Commodity swap build
commodity_swap_buildBuild an UNSIGNED transaction to BUY or SELL a Citizens City commodity against APEX on the on-chain commodity AMM. side is "buy" (spend APEX) or "sell" (give commodity units). For a buy, amount is APEX; for a sell, amount is whole units. Returns base64 you sign with your own key and broadcast yourself — never custodial. Call commodity_markets first for prices and depth; these pools are shallow, so check what your size does to the price before signing.
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": {
"wallet": "<wallet>",
"commodity": "<commodity>",
"side": "<side>",
"amount": "<amount>"
},
"name": "commodity_swap_build"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| side | Yes | ||
| amount | Yes | buy: APEX to spend. sell: whole commodity units to give. | |
| wallet | Yes | Your X1 wallet public key — signer and fee payer. | |
| commodity | Yes | Commodity name, e.g. "Tomato", "Truffle", "Voidbloom". | |
| slippageBps | No | Slippage tolerance in basis points. Default 500 (5%), min 10, max 3000. |