swap
Build an unsigned swap transaction. Routes to user for signing.
Tier: Free
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sellToken | string | Yes | Token to sell — symbol or address |
buyToken | string | Yes | Token to buy — symbol or address |
sellAmount | string | Yes | Amount in human-readable units |
chainId | number | No | Chain ID (default: 1) |
slippage | number | No | Slippage tolerance % (default: 1) |
walletAddress | string | Yes | User’s wallet address |
Example
"Swap 100 USDC to ETH on Ethereum for wallet 0xd8dA..."Signing Flow
- MCP server calls signing service
/api/build/swap - Signing service fetches route from 0x (fallback: 1inch)
- Unsigned tx is queued with status
pending - User gets WebSocket notification
- User reviews and signs on their device
- Returns pending transaction ID
Notes
- Non-custodial: y0 never touches the signed transaction
- Uses 0x as primary router, 1inch as fallback
- Transaction expires after 5 minutes if not signed