Useful web3 development tools for creating projects, connecting to RPCs, checking gas, and running a local dev server.
Warning
This project is in active development and has not yet been officially released. Use at your own risk.
- project master : https://github.com/nk4dev/vx3
- update here: https://nknighta.me/vx
- vx3: https://nknighta.me/dev/vx3
this project using code generation AI tools.
- GitHub Copilot [GPT-5, Claude sonnet 4, GPT-5 mini, grok code fast]
- Google Gemini
- NotebookLM
- Connect to multiple chains (ethers v6)
- Create and manage wallets
- Local development server with simple APIs
- Deploy/compile examples (Hardhat samples included)
- Node.js 18+ (recommended; required for built-in
fetchusage) - npm (or pnpm/yarn)
npm i @nk4dev/vx or npm i -g @nk4dev/vx
vx3 create For one-off usage when published: npx vx3 <command>
- Create a new project (non-interactive):
vx3 create my-app- Create a new project (interactive prompt):
vx3 create- Initialize RPC config template:
vx3 rpc init- Start local dev server (with debug view):
vx3 serve --debug- Check gas info:
vx3 gasYou can use the SDK programmatically via the default export, while CLI features remain unchanged.
TypeScript/ESM:
import vx from "@nk4dev/vx";
const rpc = vx.getRpcUrl(); // from vx.config.json
const block = await vx.getBlockNumber(rpc);
const gas = await vx.getGasFees(rpc);CommonJS:
const vx = require("@nk4dev/vx").default;
vx.getGasFees("http://127.0.0.1:8545").then(console.log);Named exports are still available for backward compatibility:
import { vx as data, instance } from "@nk4dev/vx";
await data.getBalance("http://127.0.0.1:8545", "0x...");vx3 create <name> (or vx3 init <name>) recursively copies the contents of packages/template to the <name> folder directly under the current directory. A package.json file is also generated in the destination directory.
Template content examples:
packages/template/sample.jspackages/template/sample.solpackages/template/vmx.config.jsonpackages/template/contracts/Sample.sol
Template directory resolution searches the following candidates in order (accommodating development/distribution differences):
- When running
dist:../../packages/template - When running TS/config:
../../../packages/template - Directly under the repository:
<cwd>/packages/template
If not found, it will issue a warning and create only a minimal setup (package.json).
Scaffold Hardhat files into the current project:
vx3 setup hardhat
# then install dev dependenciesvx3 rpc init creates an RPC configuration template. The current template is an array, and the loader uses the first object.
[
{ "host": "localhost", "port": 8575, "protocol": "http" }
]In the future, we may standardize on a single object format.
vx3 serve --debug serves a TailwindCSS-powered debug dashboard at /debug:
- Shows server host and the latest block number
- Quick links:
/api,/api/block - "Usage" section with example fetch calls
Connecting to RPC: http://localhost:8545
Gas fee data:
gasPrice (wei): 20000000000
gasPrice (gwei): 20
maxFeePerGas (wei): 2532616788
maxFeePerGas (gwei): 2.532616788
maxPriorityFeePerGas (wei): 1000000000
maxPriorityFeePerGas (gwei): 1
- express(debug/local server)
- ethers.js(RPC/chain operations)
- React
- Vue.js
- Svelte
- Next.js
This repository now includes a reusable payment module that can be used both from the CLI and programmatically from your code.
What was added
src/payment/index.ts— a small helper that exportssendPayment(options).src/command/pay.ts— CLI wrapper that callssendPayment.src/index.ts— the library entry now exposes the payment namespace so you can call it from code:vx.payment.sendPayment(...)orimport { payment } from '@nk4dev/vx'.
Programmatic usage
TypeScript/ESM example:
import vx from '@nk4dev/vx';
await vx.payment.sendPayment({
rpcUrl: 'http://127.0.0.1:8545',
privateKey: process.env.PRIVATE_KEY!,
to: '0xRecipientAddressHere',
amountEth: '0.01'
});Named import:
import { payment } from '@nk4dev/vx';
await payment.sendPayment({ rpcUrl, privateKey, to, amountEth: '0.01' });CLI usage (recommended: use environment variable for private key):
#$env:PRIVATE_KEY='0x...'
vx3 pay 0xRecipientAddress 0.01 --rpc http://127.0.0.1:8545Run/Build (using Bun)
I ran the project build using the Bun runtime. Recommended steps on your machine:
# install dependencies with Bun
bun install
# compile TypeScript
bun run buildObserved build notes
- I executed
bun installandbun run buildin this repository. TypeScript was invoked viatsc. - The build surfaced TypeScript diagnostics in the workspace while compiling. Two notable issues were observed during the run:
- TypeScript could not find module declarations for
ethers(error: "Cannot find module 'ethers' or its corresponding type declarations"). If you encounter this, run:or install viabun add ethers # then bun run buildnpm installif you prefer. packages/react-template/tsconfig.jsonreferences thevite/clienttype and a deprecatedmoduleResolutionoption; this may produce an informational TypeScript diagnostic. Install the Vite types or adjust thetsconfig.jsonin that package if you plan to compile the template.
- TypeScript could not find module declarations for
Security notes
- Avoid passing secrets on the command line. Prefer environment variables (for example
PRIVATE_KEY) or an external signer. - The current
sendPaymenthelper expects a raw private key (hex). Consider extending the API to accept a Signer, hardware wallet integration, or a key management provider for production usage.
Next steps and tests
- Add an integration test that starts a local Hardhat node and runs an end-to-end payment using
payment.sendPayment. - Consider adding typed wrappers using
ethers.parseUnitsfor gas values and stronger validation.
If you'd like, I can (a) run the bun add ethers and re-run the build here and fix remaining diagnostics, (b) add the README snippet to the docs site, or (c) scaffold an automated integration test using Hardhat.
Maintainer: nk4dev
MIT License © nk4dev
This project is licensed under the MIT License, see the LICENSE.txt file for details