Build a swap
hookr_build_swapBuilds an exact-input swap through Hookr's router as an unsigned call for the wallet to sign and send, with its least output from the quote and your slippage, a 20-minute deadline and the gas to send it with, after checking the wallet's balance and simulating the swap from the wallet. Its status is ok (send the call), needs_approval (send the approval, then build again), or refused or unknown (no calls, with the reason). Every quote states priceImpactBps, null when it did not read; at or past 15% or on a token that is not the official one for its symbol the answer is refused, and an unread impact is unknown, never ok. accept names what to pass to build it anyway.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"poolId": "<poolId>",
"side": "<side>",
"amount": "<amount>",
"wallet": "<wallet>"
},
"name": "hookr_build_swap"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | Yes | buy pays the pool's quote currency (ETH, HOOKR, …) for the token; sell pays the token for the quote currency. | |
| amount | Yes | How much the trade pays in, in the paying currency's own units as a decimal string, e.g. "0.05". | |
| poolId | Yes | The pool's 32-byte Uniswap v4 PoolId, 0x and 64 hex characters. | |
| wallet | Yes | The wallet that signs and pays. | |
| recipient | No | Where the output goes. Defaults to the wallet. | |
| acceptToken | No | The address of a look-alike token you mean to trade, one that is not the official token for its symbol. | |
| slippageBps | No | How far below the quote the output may land, in basis points (default 50). | |
| acceptImpactBps | No | The most price impact you accept, in basis points, as a second tap on the swap box. Needed at or past 1500; an impact that did not read takes 10000. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| calls | Yes | Unsigned calls, in the order to send them. | |
| payer | No | The wallet that signs and pays. | |
| quote | No | ||
| accept | No | What to pass to build this trade anyway. | |
| reason | No | Why the answer is not ok, in words an agent can act on. | |
| status | Yes | ok, needs_approval, refused or unknown. refused and unknown carry no calls. | |
| deadline | No | ||
| agentGate | No | ||
| recipient | No | Where the swap's output goes, as the calldata carries it. | |
| minimumOut | No | ||
| recipientIsPayer | No | False when the output goes to a wallet other than the one that signs; the swap's label says so too. |