build_swap_offer
Builds and proves one half of a shielded token swap from your wallet, spending the token you give and creating the token you want. Returns a publishable offer file and terms.
Instructions
A swap settles two shielded tokens between two wallets without a contract: each side builds one half (it spends the coin it gives and creates the coin it wants), the two mirrored halves merge into one transaction, and a sponsor pays the fee. This builds and proves ONE half from this server's wallet: it spends give and creates want (and the change) for this wallet. Returns the offer file (offer, text starting with swapoffer1, about 25 000 characters) to publish, its id, and the terms read back from the built transaction. Anyone holding the wanted token can take the offer; the first swap that lands consumes it. The coins stay reserved until the swap lands: withdraw an offer that is not going to be used with revert_swap_offer. An offer refers to a recent chain state and expires with it, so publish it promptly. give.amount may not exceed spendable of get_swap_wallet. Proving takes about 200 s in-process, 11 to 17 s on a proof server (NIGHTGATE_PROOF_SERVER_URL). Spends no fee.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bind | No | true (default): bound, with its offer file. false: unbound, base64 only (halfB64), for a taker that builds unbound too | |
| give | Yes | ||
| want | Yes |