Build swap: approve + swap txs, simulated
blazar_build_swapOne call to get everything needed to swap through BlazarFeeRouter: ordered txs[] (exact approve if needed, then swap), a plain-English summary per tx, an eth_call simulation of the swap (as if the approve were mined), the quote used, guards (minAmountOut, 3-minute deadline) and warnings[]. Use this instead of blazar_quote + blazar_decode_tx + blazar_simulate_tx. Only swaps built here (through BlazarFeeRouter) earn BZB trading rewards. Returns UNSIGNED txs; nothing is sent. Polygon only (chain 137).
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": {
"tokenIn": "<tokenIn>",
"tokenOut": "<tokenOut>",
"amount": "<amount>",
"from": "<from>"
},
"name": "blazar_build_swap"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | Yes | Address that will sign and send the txs. Required: used for allowance checks, simulation and nonce. | |
| amount | Yes | Amount of tokenIn in HUMAN units, not wei: "1.5" = 1.5 POL, "250" = 250 BZB. Set amountIsBaseUnits=true to pass wei/base units instead. | |
| tokenIn | Yes | Token to sell: symbol (POL, WPOL, BZB, USDC, USDT, WETH, WBTC) or its listed 0x address (see blazar_tokens). "POL" is the native gas token; WPOL is the ERC-20. | |
| tokenOut | Yes | Token to buy: symbol (POL, WPOL, BZB, USDC, USDT, WETH, WBTC) or its listed 0x address. Choose "POL" to receive native POL (auto-unwrapped). | |
| recipient | No | Who receives the output. Defaults to `from`. | |
| slippageBps | No | Max slippage in basis points (50 = 0.5%). Default 50, max 300. | |
| deadlineSeconds | No | Seconds until the swap expires. Default 150; the fee router caps it at 180. | |
| amountIsBaseUnits | No | If true, amount is in base units (wei for 18-decimal tokens; 6 decimals for USDC). Default false. | |
| maxPriceImpactBps | No | Refuse with INSUFFICIENT_LIQUIDITY above this impact. Default 3000 (30%). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| txs | Yes | Sign and send in order. | |
| from | No | ||
| next | No | ||
| batch | No | EIP-5792 wallet_sendCalls request with the same calls (smart wallets). | |
| quote | No | ||
| action | Yes | ||
| guards | No | ||
| safety | No | ||
| chainId | No | 137 Polygon, 8453 Base, 1 Ethereum. BlazarForce builds are always 137. | |
| details | No | ||
| signing | No | ||
| summary | Yes | ||
| warnings | Yes | ||
| routeGuide | No | ||
| simulation | Yes |