Skip to content
docs

ZeroExProviderConfig

Defined in: protocol-swap2-0x/src/provider.ts:47

optional apiKey?: string | (() => string | undefined)

Defined in: protocol-swap2-0x/src/provider.ts:57

The 0x API key — server only. Best as a getter, read on every request, so the key lives where you keep secrets (server env, a vault) and never in this config object; a string is accepted too (an env value read once). It is sent only as the 0x-api-key header to baseUrl; it is never put in a URL, a refusal, an error or a quote, and an answer that came through a redirect is refused. Without a key (or with one that is not printable ASCII without spaces) the provider serves no route. Under React Native a key is refused outright (the constructor throws): use zeroExRemoteProvider in the app.


optional baseUrl?: string

Defined in: protocol-swap2-0x/src/provider.ts:59

API origin. Default ZEROEX_DEFAULT_BASE_URL. Must be https (http only for localhost), or the key would travel in clear.


optional chains?: Readonly<Record<number, ZeroExChain | null>>

Defined in: protocol-swap2-0x/src/provider.ts:61

Chain table entries merged over the defaults (EVM chain id → entry, null removes a chain).


optional defaultSlippageBps?: number

Defined in: protocol-swap2-0x/src/provider.ts:65

Slippage when the request names none, bps. Default 50.


optional enabled?: boolean

Defined in: protocol-swap2-0x/src/provider.ts:48


optional excludedSources?: readonly string[]

Defined in: protocol-swap2-0x/src/provider.ts:70

Liquidity sources 0x must not route through (its excludedSources names).


optional quoteTtlMs?: number

Defined in: protocol-swap2-0x/src/provider.ts:67

How long a quote is offered, ms. Default 120 s; never past the Permit2 deadline, and a native-coin sale’s never past ZEROEX_MAX_NATIVE_QUOTE_SECONDS.


optional rpcUrls?: Readonly<Record<number, readonly string[]>>

Defined in: protocol-swap2-0x/src/provider.ts:63

JSON-RPC endpoints per EVM chain id: the Settler registry read (needed for every executable quote) and receipts.


optional settlerMaxAgeMs?: number

Defined in: protocol-swap2-0x/src/provider.ts:72

How long a Settler registry read is reused, ms. Default 5 minutes.


optional settlerResolver?: SettlerResolver

Defined in: protocol-swap2-0x/src/provider.ts:74

Share a resolver (e.g. with zeroExRemoteProvider); built from chains / rpcUrls when absent.


optional timeoutMs?: number

Defined in: protocol-swap2-0x/src/provider.ts:68