Agent Token Trading
Gasless token swaps on Base via Coinbase Agentic Wallet
Quick Start
Trade tokens on Base network without paying gas fees. Your agent can swap between USDC, ETH, WETH, or any token by contract address.
npx awal@latest trade $1 usdc ethCommand Syntax
npx awal@latest trade <amount> <from> <to> [options]amount
Amount to trade (see formats below)
from
Source token: alias or contract address
to
Destination token: alias or contract address
Supported Token Aliases
| Alias | Token | Decimals | Contract Address |
|---|---|---|---|
| usdc | USDC | 6 | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| eth | ETH | 18 | 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE |
| weth | WETH | 18 | 0x4200000000000000000000000000000000000006 |
You can also use any token by its contract address on Base.
Amount Formats
Dollar prefix
$1.00, $0.50USD notation
Decimal
1.0, 0.50, 0.001Human-readable with decimal point
Whole number
5, 100Interpreted as whole tokens
Atomic units
500000Large integers (>100) treated as atomic units
Examples
npx awal@latest trade $1 usdc ethTrade $1 USDC for ETH
npx awal@latest trade 0.50 usdc ethTrade 0.50 USDC for ETH
npx awal@latest trade 0.01 eth usdcTrade 0.01 ETH for USDC
npx awal@latest trade $5 usdc eth --slippage 200Trade with 2% slippage
Options
-c, --chainBlockchain network (default: base)
-s, --slippageSlippage tolerance in basis points (100 = 1%)
--jsonOutput result as JSON
Prerequisites
- Must be authenticated (
npx awal@latest statusto check) - Wallet must have sufficient balance of the source token
Error Handling
| Error | Resolution |
|---|---|
| "Not authenticated" | Run npx awal@latest auth login <email> first |
| "Invalid token" | Use a valid alias (usdc, eth, weth) or 0x address |
| "Cannot trade a token to itself" | From and to must be different tokens |
| "TRANSFER_FROM_FAILED" | Insufficient balance or approval issue |
| "No liquidity" | Try a smaller amount or different token pair |