get_swap_quote
Get a swap quote for exchanging different tokens, same-chain or cross-chain, with ready-to-sign transaction steps for automated execution.
Instructions
Get a quote for swapping between DIFFERENT tokens, same-chain or cross-chain (e.g. ETH → USDC on Base, or ETH on Ethereum → USDC on Base).
Use when input and output tokens differ. Works same-chain and cross-chain. For same-token bridging (e.g. ETH on Ethereum → ETH on Base), use get_bridge_quote instead — it's simpler.
Returns execution steps — each step contains ready-to-sign transaction data (to, data, value, chainId, gas). An agent with wallet tooling can sign and submit these directly. Also returns a relay.link deep link as a fallback for manual execution.
Amounts must be in the token's smallest unit (wei, satoshis, lamports). Examples: 1 ETH = "1000000000000000000" (18 decimals), 1 USDC = "1000000" (6 decimals), 1 BTC = "100000000" (8 decimals), 1 SOL = "1000000000" (9 decimals). Use convert_amount or get_supported_tokens to look up decimals. Chain IDs can be numbers (8453) or names ('base', 'ethereum', 'arb', 'bitcoin', 'solana').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Amount to swap in the origin token's smallest unit. Examples: wei for ETH (18 decimals), satoshis for BTC (8 decimals), lamports for SOL (9 decimals). | |
| sender | Yes | Sender wallet address. | |
| refundTo | No | Address to send refunds to if the swap fails. Defaults to sender. | |
| recipient | No | Recipient wallet address. Defaults to sender. | |
| tradeType | No | EXACT_INPUT (default): you specify input amount, output varies. EXPECTED_OUTPUT: you specify desired output, input is calculated (allows slippage). EXACT_OUTPUT: you specify exact output required, fails if not deliverable. | EXACT_INPUT |
| includeSteps | No | Include raw transaction steps for signing. Only needed if you have wallet tooling to submit transactions directly. Omit to save tokens. | |
| originChainId | Yes | Source chain ID or name (e.g. 1, 'ethereum', 'eth'). | |
| originCurrency | Yes | Token address or symbol to swap from. Symbols like "ETH", "USDC", "USDT", "WETH" are resolved automatically. For native tokens use: EVM "0x0000000000000000000000000000000000000000", Solana "11111111111111111111111111111111", Bitcoin "bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8", Hyperliquid "0x00000000000000000000000000000000", Lighter "0". For other tokens, use the contract/mint address or look up via get_supported_tokens. | |
| useDepositAddress | No | Use deposit address flow — returns an address the user can send funds to instead of transaction calldata. No wallet signing needed. Only supports EXACT_INPUT. | |
| destinationChainId | Yes | Destination chain ID or name (e.g. 8453, 'base'). Can be the same as originChainId for same-chain swaps. | |
| destinationCurrency | Yes | Token address or symbol to swap to. Symbols like "ETH", "USDC", "USDT", "WETH" are resolved automatically. For native tokens use: EVM "0x0000000000000000000000000000000000000000", Solana "11111111111111111111111111111111", Bitcoin "bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8", Hyperliquid "0x00000000000000000000000000000000", Lighter "0". For other tokens, use the contract/mint address or look up via get_supported_tokens. |