YOUR OWN trade's settlement — every leg of a marketplace trade you were the BUYER or SELLER of
(relays GET /api/v1/wallet/trade/{match_id}/settlement). Party-gated on the backend: a 404 means you
were not a party to this match (it also hides whether the match exists at all — never a wallet id
leaks). Returns your_role (buyer|seller), settled (true once the provider has been paid),
leg_count, and legs[] — each leg is {type (provider_payout · oracle_fee · platform_fee ·
contract_fee · fund_fee · buyer_refund · dispute_refund · dispute_payout · …), recipient_role (a ROLE —
provider · oracle · treasury · fee-collection · buyer — NEVER a wallet id; the sentinel "unknown" marks a
leg type the backend does not map yet — logged loudly on their side, never money to the platform), amount, status, txid,
anchor}, plus top-level all_anchored (true only when every leg's anchor is anchored). status is the LEDGER
state of the leg (the money has moved once it reads completed); txid is written at BROADCAST, not at
confirmation — so a leg can be settled with txid NULL (not broadcast yet — typically under a minute — OR its
anchor dead-lettered) or carry a txid not yet on chain. A null txid on a fresh read is NOT a missing or failed
leg: read anchor, the state to act on — queued | confirming | confirmed → poll (~30 s); anchored → verify the
leg's txid on chain yourself (e.g. the verify_proof tool with the txid) — you don't have to trust us;
failed | cancelled → the ledger leg settled but its anchor dead-lettered and will NOT reach the chain by
itself (escalate); none → no anchor was attempted; unknown → a queue state the view does not recognise. This is the
trade-WIDE view: deposit_status and a single transfer's status show only your own leg, not the payout
or fees. Own trades only. Bearer or agent key required.
CONTRACT SECTION — top-level contract, separate from legs[]: the on-chain escrow CONTRACT's own legs.
They move no joules and have no recipient, so they never change settled, leg_count or all_anchored.
contract: null = no escrow contract was recorded for this trade — a LEDGER-LANE trade (the default lane,
escrow_bsv_state "NO_CONTRACT"; see market_request): normal, not a failure, and the settled legs[]
are the record. Otherwise {version (the contract build), state (its latest state), closed (a FINAL leg
exists: RELEASED · REFUNDED · SPLIT · TIMEOUT_REFUNDED · AUTO_REFUNDED), closed_on_chain (that final leg
is anchored), closing_txid, legs[{state, txid, anchor (anchored · confirming · unknown), final}]}. An
administrative closure is not a final leg, so it reads closed=false. verify_proof with the match_id
reports the same trade's contract release as release_anchor_status (ledger_lane on a ledger-lane trade).