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 eth

Command 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

AliasTokenDecimalsContract Address
usdcUSDC60x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
ethETH180xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
wethWETH180x4200000000000000000000000000000000000006

You can also use any token by its contract address on Base.

Amount Formats

Dollar prefix
$1.00, $0.50
USD notation
Decimal
1.0, 0.50, 0.001
Human-readable with decimal point
Whole number
5, 100
Interpreted as whole tokens
Atomic units
500000
Large integers (>100) treated as atomic units

Examples

npx awal@latest trade $1 usdc eth
Trade $1 USDC for ETH
npx awal@latest trade 0.50 usdc eth
Trade 0.50 USDC for ETH
npx awal@latest trade 0.01 eth usdc
Trade 0.01 ETH for USDC
npx awal@latest trade $5 usdc eth --slippage 200
Trade with 2% slippage

Options

-c, --chain
Blockchain network (default: base)
-s, --slippage
Slippage tolerance in basis points (100 = 1%)
--json
Output result as JSON

Prerequisites

  • Must be authenticated (npx awal@latest status to check)
  • Wallet must have sufficient balance of the source token

Error Handling

ErrorResolution
"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