commodity_swap_build
Build 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
| 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. |