prepare_uniswap_swap
Prepare a direct Uniswap V3 swap transaction with automatic fee tier selection. Supports exact-in and exact-out, native token swaps, and returns an unsigned tx for signing.
Instructions
Prepare a direct Uniswap V3 swap (bypasses LiFi aggregator). Use this ONLY when the user explicitly asks for Uniswap — otherwise default to prepare_swap which compares routes across venues. Same-chain only (Uniswap V3 is not a bridge). Auto-picks the best pool fee tier (100/500/3000/10000 bps) by quoting all four against QuoterV2 and choosing the one with the best price; pass feeTier to override. Supports ERC-20 <-> ERC-20, native-in (ETH -> ERC-20), and native-out (ERC-20 -> ETH). Both exact-in and exact-out. Returns an unsigned tx (with a reset+approve chain when the router needs allowance) that send_transaction can forward to Ledger Live. Single-hop only in v1 — multi-hop routes through an intermediate asset (e.g. via WETH) fall back to prepare_swap.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wallet | Yes | ||
| chain | Yes | ||
| fromToken | Yes | ||
| toToken | Yes | ||
| amount | Yes | Human-readable decimal amount, NOT raw wei/base units. Example: "1.5" for 1.5 USDC, "0.01" for 0.01 ETH. Interpreted as fromToken input by default; set `amountSide: "to"` for exact-out. The tool resolves decimals on-chain. | |
| amountSide | No | Which side of the swap `amount` refers to. "from" (default) = exact-in: spend exactly `amount` of fromToken, receive a variable output. "to" = exact-out: receive exactly `amount` of toToken, input sized to hit the target. | |
| fromTokenDecimals | No | Optional decimals hint for fromToken if on-chain lookup fails. Native is 18. | |
| toTokenDecimals | No | Optional decimals hint for toToken if on-chain lookup fails. Native is 18. | |
| slippageBps | No | Slippage tolerance in basis points (50 = 0.5%). Default 50. Hard-capped at 500 (5%); > 100 requires `acknowledgeHighSlippage: true` to prevent MEV sandwiching. | |
| acknowledgeHighSlippage | No | Opt-in flag required when slippageBps > 100. Forces explicit acknowledgement of unusually-high slippage. | |
| feeTier | No | Optional fee-tier override (100 / 500 / 3000 / 10000 bps). When omitted, QuoterV2 is queried across all four tiers and the best-pricing pool is picked. |