Approvals and settlement

What the taker approves, what the wallet sends, and how the trade settles on chain.

A firm quote settles on chain in one transaction from the taker wallet. Two addresses matter, and both come from the API:

AddressWhere to read itWhat you do with it
Allowance target (the spender)GET /v2/limits, assets[].sides.<buy|sell>.allowance_targetApprove token_in to it
Transaction targetFirm quote, execution.transaction.toSend the packet to it, on execution.transaction.chain_id

Today both are the Rave SettlementRouter for that chain (see Contracts). Read them from the API on every integration path anyway, and never hard-code them.

Approve before the firm quote

Do this once per (token_in, chain_id, spender) and re-check when the amount grows:

  1. Read the allowance target from /v2/limits for the entry whose token.chain_id matches your chain.
  2. Check the allowance: token_in.allowance(owner, allowance_target) on that chain. If it covers amount, skip to step 5.
  3. Approve: token_in.approve(allowance_target, amount) from the taker wallet. Approve amount, or a larger amount you are comfortable pre-approving.
  4. Wait for the approval receipt.
  5. Request a fresh firm quote, so expires and the price are current.
  6. Submit execution.transaction unchanged before expires.
# Allowance target per symbol, chain and side
curl -s "$RAVE_API/v2/limits?chain_id=56" -H "Authorization: Bearer ***" \
  | jq '.assets[] | {symbol, chain_id: .token.chain_id, buy: .sides.buy.allowance_target, sell: .sides.sell.allowance_target}'

What the wallet sends

execution.transaction is a complete packet: to, data, value and chain_id. value is usually "0"; the trade value is in data. Pass all four unchanged to the wallet or RPC.

❗️

Never edit the transaction

Do not change to, data or value, and do not send the packet on another chain. The router checks the signed terms on chain; an edited packet reverts or is refused.

How settlement works

  • The router pulls at most amount_in of token_in from the taker. Delivering more than amount_in does not revert; the surplus stays with the caller.
  • The output token is sent to recipient.
  • The router refuses to execute the same quote twice, but every new firm quote is a new trade. See Transaction safety before you retry anything.
  • A packet reverts if it is submitted after expires, if the allowance is short, or if less than amount_in arrives on an exact side. On a variable side Rave settles what arrived (see Variable Input).

Reverts are covered in Errors.


Did this page help you?