prepare_swap
Prepare unsigned cryptocurrency swap or bridge transactions using LiFi aggregator. Routes same-chain swaps through optimal DEX paths and cross-chain swaps via bridge+DEX combinations for execution.
Instructions
Prepare an unsigned swap or bridge transaction via LiFi aggregator. Same-chain swaps use the best DEX route; cross-chain swaps use a bridge + DEX combo. The returned tx can be sent via send_transaction.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wallet | Yes | ||
| fromChain | Yes | ||
| toChain | Yes | ||
| fromToken | Yes | ||
| toToken | Yes | ||
| amount | Yes | Human-readable decimal amount of fromToken, NOT raw wei/base units. Example: "1.5" for 1.5 USDC, "0.01" for 0.01 ETH. The tool resolves decimals on-chain and converts internally. | |
| fromTokenDecimals | No | Optional decimals hint for fromToken if on-chain lookup fails (rare). Native is 18. | |
| slippageBps | No | Slippage tolerance in basis points (50 = 0.5%, 100 = 1%). Default ~50. Hard-capped at 500 (5%) — anything higher is almost always a sandwich-bait misconfiguration. If a legitimate thin-liquidity route genuinely needs >1%, also pass `acknowledgeHighSlippage: true`. | |
| acknowledgeHighSlippage | No | Opt-in flag required when slippageBps > 100 (1%). Forces the caller to state that an unusually-high slippage is intentional — the default rejects the tx to protect the user from MEV sandwich attacks. |