swap
Execute a token swap on Base via 0x DEX Aggregator. AI-ENHANCED: Accepts natural language like 'swap 10 USDC for VIRTUAL'. THREE MODES: (1) PRIVY MODE (RECOMMENDED): Provide owner_wallet - uses your secure Privy custodial wallet (create one first with create_wallet tool). (2) PRIVATE KEY MODE: Provide privateKey - server signs with your key (less secure). (3) BRIDGE MODE: Provide takerAddress only - returns a URL where you sign with browser wallet. Cost: 0.10 USDC
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request | No | Natural language swap request (e.g., 'swap 10 USDC for VIRTUAL', 'buy 100 DEGEN with USDC'). AI will extract the parameters automatically. | |
| buyToken | No | Token symbol (USDC, WETH, VIRTUAL, DEGEN, cbBTC, DAI, AERO, BRETT) OR token address (0x...) | |
| sellToken | No | Token symbol (USDC, WETH, VIRTUAL, DEGEN, cbBTC, DAI, AERO, BRETT) OR token address (0x...) | |
| privateKey | No | LEGACY: Private key (0x... hex) to sign and broadcast transactions server-side. Consider using owner_wallet with Privy instead for better security. | |
| sellAmount | No | Amount to sell. Use human-readable (e.g., '1.5' for 1.5 tokens) or atomic units (e.g., '1000000' for 1 USDC). Human-readable is auto-detected. | |
| slippageBps | No | Slippage in basis points (e.g., '50' = 0.50%). Takes precedence over slippagePercentage. | |
| owner_wallet | No | RECOMMENDED: Your wallet address (0x...) that owns a Privy custodial wallet. The swap will be executed securely through your Privy wallet. Create one first using the create_wallet tool. | |
| takerAddress | No | User's wallet address (0x...). When provided WITHOUT owner_wallet or privateKey, returns a secure web bridge URL where user can sign transactions with their browser wallet. | |
| slippagePercentage | No | Slippage tolerance in percent (e.g., '0.5' for 0.5%). Default: 0.5 | 0.5 |