Flow
- Discover deposit contracts and assets through OMS registry endpoints, especially
GET /registry/vaults. - Build and sign a settlement init request.
- Submit
POST /settlement/init. - Read the approval from the
POST /settlement/initresponse. To recover it, the settler callsGET /settlement/signatures/{user_id}with its own public key and token. - The settler’s executor calls
executeAtomicSettlement(...)on the deposit contract. - Reconcile the deposit contract
Settledevent and OMS inventory/account events.
Raw init
Settlement request amounts are base-10 integer strings in 18-decimal units, without a0x prefix. Use the live OMS reference for exact current wrappers.
Populate signature with the Ed25519 signature bytes over compact inner, in the field order shown, before sending. nonce is required; settler and expires_at are always part of the signed bytes, as null when unset.
inner.nonce is the settlement nonce, required and signed. It must not be below the next settlement nonce for that (user, sub_account, chain) or collide with an in-flight lock, and the deposit contract accepts a nonce at or above settlementCounts(user, account), then sets that counter to nonce + 1. The outer nonce is deprecated; if you send it, it must equal inner.nonce. expires_at, when set, is in unix nanoseconds; the request is refused after it.
max_fee bounds the rebalancing fee the outgoing leg may reserve, as a base-10 string in 18-decimal units of asset_out; null accepts whatever the protocol reserves. It is part of the signed payload from protocol_version 3 on ("max_fee":null when unset), so an older layout cannot carry one. A request priced above its bound is rejected before any lock with code FEE_ABOVE_MAXIMUM.
tpluspy
Approval delivery
POST /settlement/init returns an approval object on success. Before retrying, fetch approvals as the named settler (the account owner if the request omitted settler).
Use the REST response or the signatures endpoint as the public integration path. For a synchronous fill, the maker acting as settler receives the approval on /sync/pending-fills.
Onchain execution
The caller must be one of the executor addresses registered for thesettler id. The deposit contract verifies expiry, settler approval, executor binding, settlement nonce, and the settlement approval signature. It sets the counter to the signed nonce plus one, transfers tokenOut to the executor, and calls:
expectedAmountIn, the deposit contract pulls that exact amount of tokenIn from the executor with transferFrom. The executor must approve the deposit contract for at least the returned tokenIn amount before or during callback execution.
executeBatchSettlements(requests, data, settler) instead. Each request pairs an order with its approval signature, the deposit contract nets the token transfers across the batch, and it calls onAtomicSettlement once per settlement with the matching data entry.