ZEROEX_PROVIDER
constZEROEX_PROVIDER:"zeroex"="zeroex"
Defined in: protocol-swap2-0x/src/provider.ts:33
0x Swap API v2 (docs.0x.org) as a same-chain swap2 provider, Permit2 flow: /swap/permit2/price for
indicative quotes, /swap/permit2/quote for the swap that is executed.
The API needs a key on every request, so zeroExProvider with a key runs on your server only, and
zeroExRemoteProvider in the app: under React Native (Hermes or JSC) it refuses to be built with a
key at all — an app bundle keeps no secret, and React Native’s fetch follows redirects with the key
header whatever redirect says. Whichever side quotes, nothing the API returns is signed as it
is: the Settler is read from the on-chain registry, the transaction is held to the request and the
Permit2 payload is rebuilt locally (see settler.ts); the engine then signs it as EIP-712 typed
data, appends the signature and estimates the signed call before broadcast. Every call goes out
with the account’s own gas estimate (ownGasEstimate), never the quoted limit.
Every refusal carries a Swap2RefusalReason next to its unchanged text (CS-13): HTTP 429 →
rate_limited (with Retry-After), 401/403 → key_rejected, 5xx or an unreachable / malformed
API → upstream_unavailable, no liquidity → insufficient_liquidity, a pair 0x does not serve →
unsupported_pair, a transaction or payload that fails the device’s checks → vault_mismatch /
recipient_mismatch / price_check_failed / policy_refused. A malformed request is the
caller’s own error and stays unclassified, and so does the caller’s own abort.