Plan a token-to-token swap
qmax_swap_quotePlans swapping one token for another as two linked trades: sell 'from' for QU (leg 1), then buy 'to' with the QU (leg 2), each routed across QX and QSwap by the best route. Read-only: nothing is signed.
Returns both quotes, 'upfrontQu' (QU the wallet must hold before leg 1 for its flat fees), 'expectedOutQty' (what the swap should return) and 'minOutQty' (guaranteed by the limits only if neither price moves past the slippage limit), plus warnings. Leg 2 can only be sized exactly after leg 1 settles, from the wallet's real balance, so a swap is never one atomic transaction: if leg 1 completes and leg 2 cannot proceed you are left holding QU. Both tokens must trade on QX or QSwap; QU itself is not a swap leg (qmax_get_quote prices a plain purchase or sale for QU).
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": {
"from": "<from>",
"to": "<to>",
"qty": "<qty>"
},
"name": "qmax_swap_quote"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Token to buy | |
| qty | Yes | How many units of 'from' to sell | |
| from | Yes | Token to sell | |
| compare | No | Also plan the same swap forced onto each single market (QX or QSwap per leg) and say what QMax's route is worth against them (bestDeal). Slower. | |
| slippage_bps | No | Slippage tolerance in basis points (100 = 1%), applied to the limits of both legs |