commodity_swap_build
may change things: you confirm before it runsBuild 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.
Input schema
{
"type": "object",
"properties": {
"wallet": {
"type": "string",
"description": "Your X1 wallet public key — signer and fee payer."
},
"commodity": {
"type": "string",
"description": "Commodity name, e.g. \"Tomato\", \"Truffle\", \"Voidbloom\"."
},
"side": {
"type": "string",
"enum": [
"buy",
"sell"
]
},
"amount": {
"type": "number",
"description": "buy: APEX to spend. sell: whole commodity units to give."
},
"slippageBps": {
"type": "number",
"description": "Slippage tolerance in basis points. Default 500 (5%), min 10, max 3000."
}
},
"required": [
"wallet",
"commodity",
"side",
"amount"
]
}