haiku_get_quote
Get a quote for token swaps or portfolio rebalances, returning expected outputs, fees, gas estimates, and required approvals. Includes EIP-712 signing payloads for Permit2 or bridge signatures when needed.
Instructions
Get a quote for a token swap or portfolio rebalance. Returns expected outputs, fees, gas estimates, and any required approvals. When signatures are required (Permit2 or bridge), EIP-712 signing payloads are included in the response. Two execution paths after getting a quote: • Path A — Self-contained (WALLET_PRIVATE_KEY set): call haiku_execute with quoteId, sourceChainId, permit2SigningPayload + bridgeSigningPayload (if present in this response), and approvals. Haiku signs and broadcasts automatically — returns tx hash. • Path B — External wallet (wallet MCP, broadcast: false required): (1) broadcast any approvals {to, data} via wallet MCP first; (2) call haiku_prepare_signatures with quoteId if signatures are needed → sign via wallet MCP; (3) call haiku_execute with quoteId, sourceChainId, signatures, and broadcast: false → returns { transaction: { to, data, value, chainId } } → broadcast transaction via wallet MCP.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| inputPositions | Yes | Map of token IID to amount. IID format: "<chain-slug>:<token-address>". Supported chain slugs: arb=Arbitrum(42161), base=Base(8453), eth=Ethereum(1), poly=Polygon(137), opt=Optimism(10), bsc=BNB Chain(56), avax=Avalanche(43114), gnosis=Gnosis(100), sonic=Sonic(146), worldchain=World Chain(480), scroll=Scroll(534352), lisk=Lisk(1135), sei=Sei(1329), bera=Berachain(80094), bob=BOB(60808), hype=Hyperliquid(999), katana=Katana(747474), monad=Monad(143), plasma=Plasma(9745), uni=Unichain(130), ape=ApeChain(33139), megaeth=MegaETH(4326). Example: { "arb:0x82aF49447D8a07e3bd95BD0d56f35241523fBab1": "1.5" } | |
| targetWeights | Yes | Map of output token IID to weight (sum to 1). Example: { "arb:0xaf88...": 0.5, "arb:0xFd08...": 0.5 } | |
| slippage | No | Max slippage as decimal (e.g., 0.003 for 0.3%). Default: 0.003 | |
| receiver | No | Receiving wallet address. Required when WALLET_PRIVATE_KEY is not set — must be provided explicitly. When WALLET_PRIVATE_KEY is set, auto-derived from it if omitted. |