take_swap_offer
Take a shielded token swap offer by building the mirrored half and optionally submitting both halves to a sponsor; verify agreed terms to reject mismatches.
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 takes an offer: it reads the offer's terms from the transaction, refuses when they differ from expect, builds and proves the mirror half from this server's wallet (it spends what the offer wants and creates what the offer gives). With submit: true the two halves go to the sponsor at once and the tool waits until the swap landed ({ status, txHash, transactionHash, result.swap, id, terms }). Without it the answer carries both halves for sponsor_swap. ALWAYS pass expect with the terms you agreed to: an offer is text from someone else. With offerId the board entry is read first and the call refuses, before proving, when it is not open or carries another offer than offer. A sponsor that refuses the swap leaves the proven half held under halfId: send it again with sponsor_swap({ halfId, offerId? }) or release its coins with revert_swap_offer. If the offer was taken by somebody else first, the job fails: revert_swap_offer.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| offer | Yes | The offer to take: offer file text (swapoffer1...) or base64 of the serialized, proven transaction | |
| expect | No | The terms you agreed to, from the MAKER's side: what the offer gives and what it wants | |
| submit | No | true: hand both halves to the sponsor at once and answer with the job | |
| offerId | No | The board entry the offer came from (list_swap_offers), so the fill is recorded against it | |
| takerSecret | No | For a directed offer (directed: true on the board): the secret its poster handed you; the sponsor refuses the swap without it | |
| idempotencyKey | No | Dedupes retries of the same submission |