Skip to content
docs

checkZeroExTransaction

checkZeroExTransaction(tx, expected): ZeroExCheckedTransaction

Defined in: protocol-swap2-0x/src/settler.ts:465

Hold a 0x transaction to the request, or throw ZeroExTransactionError. Checked:

  1. to is one of the registry’s Settlers, and a deployment inside the chain’s pinned window (previousLiveNonce … newestLiveNonce + ZEROEX_SETTLER_NONCE_MARGIN); chainId, when present, is the swap’s chain.
  2. value is the input for a native-coin sale and zero for a token sale; a sale that sends value goes only to the chain’s newestLiveNonce or previousLiveNonce deployment — Settlers that were live when the table was pinned — never into the margin; a gas limit, when given, is at most the chain’s cap (zeroExMaxGasLimit: its own maxGasLimit, else ZEROEX_MAX_GAS_LIMIT).
  3. The method is execute, and its slippage tuple names the expected recipient, the requested buy token and exactly the expected minimum (never zero).
  4. Token sale: the allowance target is canonical Permit2; the Permit2 payload passes the core reader (Permit2 domain on this chain, the sell token, exactly the input, this very Settler as spender) and is rebuilt locally, with a deadline at most ZEROEX_MAX_PERMIT_SECONDS away; the first action is a known Permit2-spending action carrying that same token, amount, nonce and deadline, and its signature slot points at the end of the data, where the signature is appended.
  5. Native-coin sale: no allowance target, no Permit2 payload, and the first action is NATIVE_CHECK — the only place Settler would spend a Permit2 signature holds none.

Not checked: the actions after the first (the route), the first action’s own recipient (where Permit2 sends the input: the Settler or a pool) and zidAndAffiliate. Settler’s slippage check bounds what they can do.

ZeroExTransaction

ZeroExExpectation

ZeroExCheckedTransaction