haiku_execute
Execute a DeFi swap or bridge by broadcasting the transaction or returning an unsigned tx for external signing. Use after haiku_get_quote to complete the trade with signatures and approvals.
Instructions
Execute a quote. Call haiku_get_quote first, then choose a path: • Path A — Self-contained (WALLET_PRIVATE_KEY set): pass quoteId, sourceChainId, permit2SigningPayload + bridgeSigningPayload (if present in the quote), and approvals. Haiku signs Permit2/bridge internally, sends any approvals on-chain, and broadcasts. Returns tx hash. • Path B — External wallet (no WALLET_PRIVATE_KEY): broadcast: false is required. First broadcast any approvals from the quote via your wallet MCP (each is a {to, data} transaction). Then call haiku_prepare_signatures if signatures are needed → sign via wallet MCP → call haiku_execute with quoteId, sourceChainId, the signatures, and broadcast: false. Returns { transaction: { to, data, value, chainId } } — broadcast transaction via your wallet MCP. Always pass sourceChainId from the quote response.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| quoteId | Yes | Quote ID from haiku_get_quote | |
| permit2SigningPayload | No | permit2SigningPayload from haiku_get_quote (for self-contained signing) | |
| bridgeSigningPayload | No | bridgeSigningPayload from haiku_get_quote (cross-chain only, for self-contained signing) | |
| permit2Signature | No | Pre-signed Permit2 signature (external wallet mode) | |
| userSignature | No | Pre-signed bridge intent signature (external wallet mode) | |
| approvals | No | approvals from haiku_get_quote. Self-contained mode only: haiku broadcasts these on-chain before the swap. In external wallet mode (broadcast: false), do not pass these — broadcast each approval {to, data} via your wallet MCP before calling haiku_execute. | |
| sourceChainId | No | Chain ID of the source token (from haiku_get_quote). Recommended — if omitted, the server will attempt to recover it from the signing payloads or session cache, but passing it explicitly is safer. | |
| broadcast | No | If true (default), broadcasts tx. If false, returns unsigned tx. |