@radzor/token-swap
Swap ERC-20 tokens via Uniswap-style DEX routers using raw JSON-RPC. Supports quoting, executing swaps, and balance queries on EVM chains.
Web3 & Blockchainv0.1.0typescriptpythonServerswapdexuniswaperc20defiweb3tokenby Radzor
Install
View source on GitHub →$npx radzor@latest add token-swap
⚠ Constraints: Requires a funded private key with sufficient ETH for gas and token allowance for the router. Always call getQuote before executeSwap to check price impact. slippageBps applies automatically during executeSwap.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
| rpcUrl* | string | — | JSON-RPC endpoint URL.ETH_RPC_URL |
| routerAddress* | string | — | DEX router contract address (e.g. Uniswap V2 Router02). |
| privateKey* | string | — | Private key for signing swap transactions.ETH_PRIVATE_KEY |
| chainId | number | 1 | Chain ID for transaction signing. |
| slippageBps | number | 50 | Maximum slippage in basis points (default 50 = 0.5%). |