@anywalletkit/protocol-swap2-0x 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/{chunk-SAI3RXOP.js → chunk-ABT2WYBK.js} +2 -2
- package/dist/{chunk-VPQZVV5O.js → chunk-KYVRMBZG.js} +2 -2
- package/dist/{chunk-PLQSYP6W.js → chunk-S2RUUV3X.js} +8 -1
- package/dist/chunk-S2RUUV3X.js.map +1 -0
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -3
- package/dist/protocol.cjs +6 -0
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.js +2 -2
- package/dist/provider.cjs +7 -0
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.cts +8 -1
- package/dist/provider.d.ts +8 -1
- package/dist/provider.js +3 -1
- package/dist/remote.cjs.map +1 -1
- package/dist/remote.js +2 -2
- package/package.json +4 -4
- package/dist/chunk-PLQSYP6W.js.map +0 -1
- /package/dist/{chunk-SAI3RXOP.js.map → chunk-ABT2WYBK.js.map} +0 -0
- /package/dist/{chunk-VPQZVV5O.js.map → chunk-KYVRMBZG.js.map} +0 -0
package/dist/remote.js
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
zeroExRemoteProvider,
|
|
6
6
|
zeroExVerifyBuild,
|
|
7
7
|
zeroExVerifyQuote
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-ABT2WYBK.js";
|
|
9
|
+
import "./chunk-S2RUUV3X.js";
|
|
10
10
|
import "./chunk-V4HUFBY2.js";
|
|
11
11
|
import "./chunk-YHRPT6BS.js";
|
|
12
12
|
import "./chunk-AMZ5DXN2.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anywalletkit/protocol-swap2-0x",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "0x Swap API v2 same-chain swaps for Any Wallet Kit: Permit2 quotes on Ethereum, Base, Arbitrum, Optimism, Polygon, Avalanche, BNB Smart Chain and Monad, settled through the 0x Settler read from the on-chain registry, with the Permit2 payload rebuilt and the transaction checked against the request before signing.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://docs.anywallet.tech",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
],
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"viem": "^2.57.2",
|
|
68
|
-
"@anywalletkit/protocol-swap2-core": "0.
|
|
68
|
+
"@anywalletkit/protocol-swap2-core": "0.18.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@anywalletkit/core": "0.9.0"
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@types/node": "^22",
|
|
75
75
|
"vitest": "^5.1.0",
|
|
76
|
-
"@anywalletkit/core": "0.9.0",
|
|
77
76
|
"@anywalletkit/conformance": "0.6.1",
|
|
78
|
-
"@anywalletkit/
|
|
77
|
+
"@anywalletkit/core": "0.9.0",
|
|
78
|
+
"@anywalletkit/protocol-swap2-router": "0.9.0",
|
|
79
79
|
"@anywalletkit/wallet-evm": "0.8.1"
|
|
80
80
|
},
|
|
81
81
|
"keywords": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/provider.ts"],"sourcesContent":["import {getAddress, hashTypedData} from \"viem\";\nimport {bigintToNumber} from \"@anywalletkit/core\";\nimport {httpRefusal, refusal, refusalOf, type Swap2RefusalInfo, type Swap2RefusalReason} from \"@anywalletkit/protocol-swap2-core/errors\";\nimport {anySignal, permit2TransferJson, readPermit2Transfer, sourceAssetOf, timeoutSignal, type Permit2Transfer} from \"@anywalletkit/protocol-swap2-core/util\";\nimport {slippageFloor} from \"@anywalletkit/protocol-swap2-core/validate\";\nimport type {Asset, CrossChainProvider, IntentRef, IntentStatus, Quote, QuoteParams, UnsignedTx} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {describeZeroExActivity} from \"./activity.js\";\nimport {ZEROEX_NATIVE, ZEROEX_PERMIT2, zeroExChain, zeroExChainId, zeroExChains, type ZeroExChain} from \"./chains.js\";\nimport {rpcRequest, rpcUrlsFor, type RpcUrls} from \"./rpc.js\";\nimport {ZEROEX_MAX_NATIVE_QUOTE_SECONDS, ZEROEX_NATIVE_QUOTE_SKEW_SECONDS, checkZeroExGasLimit, checkZeroExTransaction, createSettlerResolver, isZeroExNative, type SettlerResolver, type ZeroExExpectation} from \"./settler.js\";\n\n/**\n * 0x Swap API v2 (docs.0x.org) as a same-chain swap2 provider, Permit2 flow: `/swap/permit2/price` for\n * indicative quotes, `/swap/permit2/quote` for the swap that is executed.\n *\n * The API needs a key on every request, so `zeroExProvider` with a key runs on your server only, and\n * `zeroExRemoteProvider` in the app: under React Native (Hermes or JSC) it refuses to be built with a\n * key at all — an app bundle keeps no secret, and React Native's fetch follows redirects with the key\n * header whatever `redirect` says. Whichever side quotes, nothing the API returns is signed as it\n * is: the Settler is read from the on-chain registry, the transaction is held to the request and the\n * Permit2 payload is rebuilt locally (see `settler.ts`); the engine then signs it as EIP-712 typed\n * data, appends the signature and estimates the signed call before broadcast. Every call goes out\n * with the account's own gas estimate (`ownGasEstimate`), never the quoted limit.\n *\n * Every refusal carries a `Swap2RefusalReason` next to its unchanged text (CS-13): HTTP 429 →\n * `rate_limited` (with Retry-After), 401/403 → `key_rejected`, 5xx or an unreachable / malformed\n * API → `upstream_unavailable`, no liquidity → `insufficient_liquidity`, a pair 0x does not serve →\n * `unsupported_pair`, a transaction or payload that fails the device's checks → `vault_mismatch` /\n * `recipient_mismatch` / `price_check_failed` / `policy_refused`. A malformed request is the\n * caller's own error and stays unclassified, and so does the caller's own abort.\n */\n\nexport const ZEROEX_PROVIDER = \"zeroex\";\nexport const ZEROEX_DEFAULT_BASE_URL = \"https://api.0x.org\";\nconst DEFAULT_SLIPPAGE_BPS = 50;\n/**\n * A firm 0x quote is priced at one block; the Settler enforces the minimum, the engine re-checks this TTL before broadcast.\n * Two minutes so a mainnet approval (Ethereum: often past 45 s) still lands inside the quote; a token sale's TTL is cut to\n * the Permit2 deadline (quote + 300 s) − 20 s, a native sale's to 90 s.\n */\nconst DEFAULT_TTL_MS = 120_000;\nconst DEFAULT_TIMEOUT_MS = 10_000;\n/** The Permit2 deadline must outlive the quote by this much, so a signature is never made seconds before it lapses. */\nconst DEADLINE_MARGIN_MS = 20_000;\nconst MAX_RESPONSE_CHARS = 600_000;\n\nexport interface ZeroExProviderConfig {\n enabled?: boolean | undefined;\n /**\n * The 0x API key — server only. Best as a getter, read on every request, so the key lives where you keep secrets\n * (server env, a vault) and never in this config object; a string is accepted too (an env value read once). It is\n * 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\n * answer that came through a redirect is refused. Without a key (or with one that is not printable ASCII without\n * spaces) the provider serves no route. Under React Native a key is refused outright (the constructor throws): use\n * `zeroExRemoteProvider` in the app.\n */\n apiKey?: string | (() => string | undefined) | undefined;\n /** API origin. Default {@link ZEROEX_DEFAULT_BASE_URL}. Must be https (http only for localhost), or the key would travel in clear. */\n baseUrl?: string | undefined;\n /** Chain table entries merged over the defaults (EVM chain id → entry, `null` removes a chain). */\n chains?: Readonly<Record<number, ZeroExChain | null>> | undefined;\n /** JSON-RPC endpoints per EVM chain id: the Settler registry read (needed for every executable quote) and receipts. */\n rpcUrls?: RpcUrls | undefined;\n /** Slippage when the request names none, bps. Default 50. */\n defaultSlippageBps?: number | undefined;\n /** How long a quote is offered, ms. Default 120 s; never past the Permit2 deadline, and a native-coin sale's never past {@link ZEROEX_MAX_NATIVE_QUOTE_SECONDS}. */\n quoteTtlMs?: number | undefined;\n timeoutMs?: number | undefined;\n /** Liquidity sources 0x must not route through (its `excludedSources` names). */\n excludedSources?: readonly string[] | undefined;\n /** How long a Settler registry read is reused, ms. Default 5 minutes. */\n settlerMaxAgeMs?: number | undefined;\n /** Share a resolver (e.g. with `zeroExRemoteProvider`); built from `chains` / `rpcUrls` when absent. */\n settlerResolver?: SettlerResolver | undefined;\n}\n\n/** 0x error names (`{name, message, data}` bodies) as the refusal a wallet shows, and its reason. Anything else is reported by HTTP status. */\nconst API_ERRORS: Readonly<Record<string, readonly [string, Swap2RefusalReason]>> = Object.freeze({\n INPUT_INVALID: [\"0x rejected the request as invalid\", \"no_route\"],\n SWAP_VALIDATION_FAILED: [\"0x could not validate this swap\", \"no_route\"],\n TOKEN_NOT_SUPPORTED: [\"0x does not support one of these tokens\", \"unsupported_pair\"],\n RECIPIENT_NOT_SUPPORTED: [\"0x does not support a separate recipient for this swap\", \"unsupported_pair\"],\n USER_NOT_AUTHORIZED: [\"0x does not serve this account\", \"unsupported_pair\"],\n TAKER_NOT_AUTHORIZED_FOR_TRADE: [\"0x does not serve this account\", \"unsupported_pair\"],\n RECIPIENT_NOT_AUTHORIZED_FOR_TRADE: [\"0x does not serve this recipient\", \"unsupported_pair\"],\n BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE: [\"0x does not serve the token being bought\", \"unsupported_pair\"],\n SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE: [\"0x does not serve the token being sold\", \"unsupported_pair\"],\n XSTOCKS_NOT_AUTHORIZED: [\"0x does not serve this token for this account\", \"unsupported_pair\"],\n INSUFFICIENT_ASSET_LIQUIDITY: [\"0x has too little liquidity for this pair and amount\", \"insufficient_liquidity\"],\n INTERNAL_SERVER_ERROR: [\"0x had an internal error\", \"upstream_unavailable\"],\n UNCATEGORIZED: [\"0x could not quote this swap\", \"no_route\"],\n});\n\nconst ADDRESS = /^0x[0-9a-fA-F]{40}$/;\nconst plain = (v: unknown): v is Record<string, unknown> => !!v && typeof v === \"object\" && !Array.isArray(v);\nconst own = (o: Record<string, unknown>, key: string): unknown => (Object.prototype.hasOwnProperty.call(o, key) ? o[key] : undefined);\nconst uint = (v: unknown): bigint | null => (typeof v === \"string\" && /^[0-9]{1,78}$/.test(v) ? BigInt(v) : null);\nconst same = (a: string, b: string): boolean => a.length === b.length && a.toLowerCase() === b.toLowerCase();\nconst sameAmount = (a: string, b: string): boolean => /^[0-9]{1,78}$/.test(a) && /^[0-9]{1,78}$/.test(b) && BigInt(a) === BigInt(b);\nconst isAddress = (v: unknown): v is string => typeof v === \"string\" && ADDRESS.test(v);\n/** How a fee token is named in a quote: `native` for the chain's coin, the checksummed address otherwise. */\nconst feeToken = (token: string): string => (isZeroExNative(token) ? \"native\" : getAddress(token));\n\n/** The key for one request: printable ASCII without spaces, or nothing. A throwing getter is \"no key\". */\nfunction readKey(source: ZeroExProviderConfig[\"apiKey\"]): string | undefined {\n let key: unknown = source;\n if (typeof source === \"function\") {\n try {\n key = source();\n } catch {\n return undefined;\n }\n }\n return typeof key === \"string\" && /^[\\x21-\\x7e]{1,200}$/.test(key) ? key : undefined;\n}\n\n/**\n * React Native (Hermes or JSC): an app bundle keeps no secret, and its fetch (OkHttp / NSURLSession) follows redirects\n * — carrying the key header along — whatever `redirect` says.\n */\nfunction onReactNative(): boolean {\n const g = globalThis as {HermesInternal?: unknown; navigator?: {product?: unknown}};\n return g.HermesInternal !== undefined || g.navigator?.product === \"ReactNative\";\n}\n\n/** `scheme://host[:port]` of a URL, lowercase; \"\" when it has none. No URL class: React Native's lacks `origin`. */\nconst originOf = (url: string): string => (/^[a-z][a-z0-9+.-]*:\\/\\/[^/?#]*/i.exec(url)?.[0] ?? \"\").toLowerCase();\n\n/** The API origin, refused unless https (or http on this machine): the key rides on every request to it. */\nfunction apiOrigin(baseUrl: string | undefined): string {\n const url = (baseUrl ?? ZEROEX_DEFAULT_BASE_URL).trim().replace(/\\/+$/, \"\");\n if (/^https:\\/\\/[^\\s/?#@]+(?:\\/[^\\s?#]*)?$/i.test(url)) return url;\n if (/^http:\\/\\/(?:localhost|127\\.0\\.0\\.1)(?::[0-9]{1,5})?(?:\\/[^\\s?#]*)?$/i.test(url)) return url;\n throw new Error(\"zeroex: baseUrl must be an https:// origin (http only for localhost) — the API key is sent to it\");\n}\n\ntype Fee = NonNullable<Quote[\"fees\"]>[number];\n\n/**\n * The fees of a 0x answer as quote fee entries, or the reason they cannot be read. Strict on purpose: a quote whose\n * fees do not parse is refused, never shown as free.\n *\n * - `zeroExFee` (0x's on-chain fee, taken out of the trade; `buyAmount` is already net of it) → `protocol`, included.\n * - `integratorFee` / `integratorFees` — this module asks for none, so anything above zero is refused.\n * - `gasFee` (only gasless trades carry one) → `network`, included.\n * - `totalNetworkFee` (wei the taker pays for gas; `gas × gasPrice` when 0x leaves it null) → `network`, not included.\n */\n/** The one fee refusal that is a policy (an integrator fee nobody asked for); every other one is a quote that cannot be read. */\nconst UNASKED_INTEGRATOR_FEE = \"the quote carries an integrator fee this wallet did not ask for\";\n\nexport function zeroExFees(response: Record<string, unknown>, gas: {gas: unknown; gasPrice: unknown}): {fees: Fee[]; networkFeeKnown: boolean} | string {\n const fees = own(response, \"fees\");\n if (!plain(fees)) return \"the quote's fees are missing\";\n if (!Object.prototype.hasOwnProperty.call(fees, \"zeroExFee\")) return \"the quote does not say what 0x charges\";\n const out: Fee[] = [];\n const amountAndToken = (v: unknown): {amount: bigint; token: string} | null => {\n if (!plain(v)) return null;\n const amount = uint(own(v, \"amount\"));\n const token = own(v, \"token\");\n return amount !== null && isAddress(token) ? {amount, token} : null;\n };\n\n const zeroEx = own(fees, \"zeroExFee\");\n if (zeroEx !== null) {\n const fee = amountAndToken(zeroEx);\n if (!fee) return \"the 0x fee cannot be read\";\n if (fee.amount > 0n) out.push({type: \"protocol\", amount: fee.amount.toString(), token: feeToken(fee.token), included: true, description: \"0x fee (taken on-chain, already out of the quoted amount)\"});\n }\n\n const integrator = own(fees, \"integratorFee\");\n if (integrator !== null && integrator !== undefined) {\n const fee = amountAndToken(integrator);\n if (!fee) return \"the integrator fee cannot be read\";\n if (fee.amount > 0n) return UNASKED_INTEGRATOR_FEE;\n }\n const integrators = own(fees, \"integratorFees\");\n if (integrators !== null && integrators !== undefined) {\n if (!Array.isArray(integrators) || integrators.length > 16) return \"the integrator fees cannot be read\";\n for (const entry of integrators) {\n const fee = amountAndToken(entry);\n if (!fee) return \"the integrator fees cannot be read\";\n if (fee.amount > 0n) return UNASKED_INTEGRATOR_FEE;\n }\n }\n\n const gasFee = own(fees, \"gasFee\");\n if (gasFee !== null && gasFee !== undefined) {\n const fee = amountAndToken(gasFee);\n if (!fee) return \"the gas fee cannot be read\";\n if (fee.amount > 0n) out.push({type: \"network\", amount: fee.amount.toString(), token: feeToken(fee.token), included: true, description: \"Gas charged by 0x inside the trade\"});\n }\n\n const total = own(response, \"totalNetworkFee\");\n let network: bigint | null = null;\n if (total !== null && total !== undefined) {\n network = uint(total);\n if (network === null) return \"the network fee cannot be read\";\n } else if (gas.gas !== null && gas.gas !== undefined && gas.gasPrice !== null && gas.gasPrice !== undefined) {\n const units = uint(gas.gas);\n const price = uint(gas.gasPrice);\n if (units === null || price === null) return \"the gas estimate cannot be read\";\n network = units * price;\n }\n if (network !== null) out.push({type: \"network\", amount: network.toString(), token: \"native\", included: false, description: \"Estimated network fee (gas × gas price, as 0x reports it)\"});\n return {fees: out, networkFeeKnown: network !== null};\n}\n\n/** A tax in bps from `tokenMetadata`: a number or a decimal string; null when the API does not know it. */\nfunction taxBps(v: unknown): number | null | undefined {\n if (v === null || v === undefined) return null;\n if (typeof v === \"number\" && Number.isFinite(v) && v >= 0) return v;\n if (typeof v === \"string\" && /^[0-9]{1,6}$/.test(v)) return Number(v);\n return undefined;\n}\n\nlet sequence = 0;\n\n/** What {@link zeroExProvider} returns: a swap2 provider, plus the Settler resolver it reads through (for signing policies, `zeroExKnownSpenders`). */\nexport type ZeroExProvider = CrossChainProvider & {readonly ownGasEstimate: true; readonly settlerResolver: SettlerResolver};\n\nexport function zeroExProvider(config: ZeroExProviderConfig): ZeroExProvider {\n if (config.apiKey !== undefined && onReactNative()) {\n throw new Error(\"zeroex: the 0x API key belongs on a server — in a React Native app it would ship in the bundle, and React Native's fetch follows redirects with the key attached. Run zeroExProvider({apiKey}) on your backend (createSwap2Handler) and zeroExRemoteProvider({baseUrl, rpcUrls}) in the app.\");\n }\n const baseUrl = apiOrigin(config.baseUrl);\n const apiOriginOnly = originOf(baseUrl);\n const chains = zeroExChains(config.chains);\n const slippageDefault = config.defaultSlippageBps ?? DEFAULT_SLIPPAGE_BPS;\n const ttl = config.quoteTtlMs ?? DEFAULT_TTL_MS;\n const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const excluded = (config.excludedSources ?? []).filter((s) => typeof s === \"string\" && /^[A-Za-z0-9_.\\- ]{1,60}$/.test(s));\n const resolver = config.settlerResolver ?? createSettlerResolver({chains, rpcUrls: config.rpcUrls, maxAgeMs: config.settlerMaxAgeMs});\n\n /** The chain id when the chain is in the table and a key is there to ask with. */\n const chainIdOf = (caip2: string): number | null => {\n const id = zeroExChainId(caip2);\n return zeroExChain(chains, id) && readKey(config.apiKey) !== undefined ? id : null;\n };\n const chainOfIntent = (intentId: string): number => {\n const id = Number(intentId.split(\":\")[1]);\n return zeroExChain(chains, id) ? id : NaN;\n };\n\n return {\n name: ZEROEX_PROVIDER,\n describeActivity: (tx, ctx) => describeZeroExActivity(tx, ctx, chains),\n supportsSameChain: true,\n // The quoted gas limit is the API's word: a native sale (like a Permit2 call) goes out with the account's own estimate.\n ownGasEstimate: true,\n settlerResolver: resolver,\n enabled: () => config.enabled ?? true,\n supportsChain: (caip2: string) => chainIdOf(caip2) !== null,\n supportsChainPair: (from: string, to: string) => from === to && chainIdOf(from) !== null,\n supportsRoute: (from: Asset, to: Asset) => from.chain === to.chain && chainIdOf(from.chain) !== null,\n\n async getQuote(params: QuoteParams, signal?: AbortSignal): Promise<Quote | null> {\n const refuse = (why: string, info?: Swap2RefusalReason | Swap2RefusalInfo): null => {\n params.onRefusal?.(`zeroex: ${why}`, typeof info === \"string\" ? {reason: info} : info);\n return null;\n };\n /** A refusal raised by the checks (settler.ts, the core reader): its text without the prefix, and its reason. */\n const refuseError = (e: unknown, prefix: RegExp, fallback: string): null =>\n refuse(e instanceof Error ? e.message.replace(prefix, \"\") : fallback, refusalOf(e) ?? \"policy_refused\");\n if (params.flex) return refuse(\"amount-flexible deposits are not supported\", \"unsupported_pair\");\n if (params.sourceChain !== params.destChain) return refuse(\"same-chain swaps only\", \"unsupported_pair\");\n const chainId = zeroExChainId(params.sourceChain);\n const chain = zeroExChain(chains, chainId);\n if (!chain) return refuse(`0x is not configured for ${String(params.sourceChain).slice(0, 40)}`, \"unsupported_pair\");\n const key = readKey(config.apiKey);\n if (key === undefined) return refuse(\"no 0x API key is configured\", \"key_rejected\");\n\n const src = sourceAssetOf(params);\n if (!src) return refuse(`unknown source token ${String(params.sourceToken).slice(0, 60)}`, \"unsupported_pair\");\n if (src.contract && !ADDRESS.test(src.contract)) return refuse(\"source token must be an EVM address\");\n const sellToken = src.contract ? getAddress(src.contract) : ZEROEX_NATIVE;\n if (typeof params.destToken !== \"string\" || !ADDRESS.test(params.destToken)) return refuse(\"destination token must be an EVM address\");\n const buyToken = isZeroExNative(params.destToken) ? ZEROEX_NATIVE : getAddress(params.destToken);\n const nativeSell = sellToken === ZEROEX_NATIVE;\n const nativeBuy = buyToken === ZEROEX_NATIVE;\n if (same(sellToken, buyToken)) return refuse(\"same token in and out\", \"unsupported_pair\");\n if (chain.wrappedNative && ((nativeSell && same(buyToken, chain.wrappedNative)) || (nativeBuy && same(sellToken, chain.wrappedNative)))) {\n return refuse(\"wrapping and unwrapping are not 0x swaps\", \"unsupported_pair\");\n }\n let amountIn: bigint;\n try {\n amountIn = BigInt(params.amountIn);\n } catch {\n return refuse(\"amount is not an integer\");\n }\n if (amountIn <= 0n) return refuse(\"amount must be positive\");\n const bps = params.slippageBps ?? slippageDefault;\n if (!Number.isInteger(bps) || bps < 0 || bps >= 10_000) return refuse(\"invalid slippage\");\n let floor: bigint | null = null;\n if (params.minAmountOut !== undefined) {\n floor = uint(params.minAmountOut);\n if (floor === null) return refuse(\"minimum output is not an integer\");\n }\n\n const dry = params.dry !== false;\n let taker: string | undefined;\n let recipient: string | undefined;\n if (dry) {\n // An indicative price needs no account; with one, 0x can also report the balance and allowance it sees.\n const known = isAddress(params.refundAddress) ? params.refundAddress : isAddress(params.destAddress) ? params.destAddress : undefined;\n taker = known ? getAddress(known) : undefined;\n } else {\n if (!isAddress(params.destAddress)) return refuse(\"recipient must be an EVM address\", \"recipient_mismatch\");\n recipient = getAddress(params.destAddress);\n taker = getAddress(isAddress(params.refundAddress) ? params.refundAddress : params.destAddress);\n }\n\n // The Settler comes from the chain before anything is asked of the API: no registry answer, no executable quote.\n let settlers: readonly string[] = [];\n if (!dry) {\n try {\n settlers = await resolver.resolve(chainId);\n } catch (e) {\n return refuseError(e, /^zeroex: /, \"the 0x Settler cannot be resolved\");\n }\n }\n\n const query: [string, string][] = [\n [\"chainId\", String(chainId)],\n [\"sellToken\", sellToken],\n [\"buyToken\", buyToken],\n [\"sellAmount\", amountIn.toString()],\n [\"slippageBps\", String(bps)],\n ];\n if (taker) query.push([\"taker\", taker]);\n if (recipient && taker && !same(recipient, taker)) query.push([\"recipient\", recipient]);\n if (excluded.length) query.push([\"excludedSources\", excluded.join(\",\")]);\n const url = `${baseUrl}/swap/permit2/${dry ? \"price\" : \"quote\"}?${query.map(([k, v]) => `${k}=${encodeURIComponent(v)}`).join(\"&\")}`;\n\n let status: number;\n let text: string;\n let retryAfter: string | null = null;\n try {\n const timeout = timeoutSignal(timeoutMs);\n // The key rides in a header: a redirect (a misconfigured baseUrl, a compromised edge) must not carry it on.\n const res = await fetch(url, {method: \"GET\", redirect: \"error\", headers: {accept: \"application/json\", \"0x-api-key\": key, \"0x-version\": \"v2\"}, signal: signal ? anySignal([signal, timeout]) : timeout});\n // A fetch that ignores `redirect: \"error\"` (React Native's does): an answer that came through a redirect, or\n // from another origin than the configured one, is not used.\n if (res.redirected === true || (typeof res.url === \"string\" && res.url !== \"\" && originOf(res.url) !== apiOriginOnly)) {\n return refuse(\"the API answer came through a redirect or from another origin — refused (the key must not follow one)\", \"policy_refused\");\n }\n status = res.status;\n retryAfter = res.headers?.get?.(\"retry-after\") ?? null;\n text = await res.text();\n } catch (e) {\n // The caller's own abort is not the venue failing.\n return refuse(`API unreachable (${e instanceof Error ? e.name.slice(0, 40) : \"error\"})`, signal?.aborted ? undefined : \"upstream_unavailable\");\n }\n if (text.length > MAX_RESPONSE_CHARS) return refuse(\"the API answer is larger than any quote\", \"upstream_unavailable\");\n let body: unknown;\n try {\n body = JSON.parse(text);\n } catch {\n body = undefined;\n }\n if (status < 200 || status >= 300) {\n const byStatus = httpRefusal(status, retryAfter);\n const name = plain(body) ? own(body, \"name\") : undefined;\n if (typeof name === \"string\" && Object.prototype.hasOwnProperty.call(API_ERRORS, name)) {\n const [why, reason] = API_ERRORS[name]!;\n // A 429 stays a rate limit (with its wait) whatever the body names; an upstream failure keeps its status.\n return refuse(`${why} (${name})`, byStatus?.reason === \"rate_limited\" ? byStatus : reason === \"upstream_unavailable\" || reason === \"key_rejected\" ? {reason, httpStatus: status} : reason);\n }\n if (status === 401 || status === 403) return refuse(`API key rejected (HTTP ${status})`, byStatus);\n if (status === 429) return refuse(\"rate limited (HTTP 429)\", byStatus);\n // Any other status: a JSON refusal is a quote 0x does not have; anything else is an answer of another shape.\n return refuse(`API answered HTTP ${status}`, byStatus ?? (plain(body) ? \"no_route\" : {reason: \"upstream_unavailable\", httpStatus: status}));\n }\n if (!plain(body)) return refuse(\"malformed API response\", \"upstream_unavailable\");\n const r = body;\n\n if (own(r, \"liquidityAvailable\") === false) return refuse(\"no liquidity for this pair and amount\", \"insufficient_liquidity\");\n if (own(r, \"liquidityAvailable\") !== true) return refuse(\"malformed API response (liquidity)\", \"upstream_unavailable\");\n const mode = own(r, \"mode\");\n if (mode !== undefined && mode !== \"exact-in\") return refuse(\"the API answered a quote that is not exact-input\", \"policy_refused\");\n const echoedSell = own(r, \"sellToken\");\n const echoedBuy = own(r, \"buyToken\");\n if (!isAddress(echoedSell) || !same(echoedSell, sellToken) || !isAddress(echoedBuy) || !same(echoedBuy, buyToken)) return refuse(\"the API quoted other tokens than the ones asked for\", \"policy_refused\");\n const quotedIn = uint(own(r, \"sellAmount\"));\n const buyAmount = uint(own(r, \"buyAmount\"));\n const minBuyAmount = uint(own(r, \"minBuyAmount\"));\n if (quotedIn === null || buyAmount === null || minBuyAmount === null) return refuse(\"malformed quote amounts\", \"upstream_unavailable\");\n if (quotedIn !== amountIn) return refuse(`quoted ${quotedIn}, not the requested ${amountIn}`, \"policy_refused\");\n if (minBuyAmount <= 0n || minBuyAmount > buyAmount) return refuse(\"the quoted minimum is not between zero and the quoted output\", \"price_check_failed\");\n if (minBuyAmount < slippageFloor(buyAmount, bps)) return refuse(`the quoted minimum ${minBuyAmount} is below the requested slippage (${bps} bps of ${buyAmount})`, \"price_check_failed\");\n if (floor !== null && minBuyAmount < floor) return refuse(`floor breach (min=${minBuyAmount} < floor=${floor})`, \"price_check_failed\");\n\n // A buy token that taxes transfers arrives short of the minimum Settler measured: refused rather than promised.\n // Only what 0x reports can be judged: a tax it does not flag (null / absent counts as none) is not caught here.\n const metadata = own(r, \"tokenMetadata\");\n const buyMeta = plain(metadata) ? own(metadata, \"buyToken\") : undefined;\n if (buyMeta !== undefined && buyMeta !== null) {\n if (!plain(buyMeta)) return refuse(\"malformed API response (token metadata)\", \"upstream_unavailable\");\n for (const field of [\"buyTaxBps\", \"transferTaxBps\"]) {\n const tax = taxBps(own(buyMeta, field));\n if (tax === undefined) return refuse(\"malformed API response (token tax)\", \"upstream_unavailable\");\n if (tax !== null && tax > 0) return refuse(\"the token being bought taxes transfers — the amount received cannot be guaranteed\", \"unsupported_pair\");\n }\n }\n\n const transaction = own(r, \"transaction\");\n if (!dry && !plain(transaction)) return refuse(\"the quote carries no transaction\", \"upstream_unavailable\");\n const tx = plain(transaction) ? transaction : undefined;\n const parsedFees = zeroExFees(r, tx ? {gas: own(tx, \"gas\"), gasPrice: own(tx, \"gasPrice\")} : {gas: own(r, \"gas\"), gasPrice: own(r, \"gasPrice\")});\n if (typeof parsedFees === \"string\") return refuse(parsedFees, parsedFees === UNASKED_INTEGRATOR_FEE ? \"policy_refused\" : \"upstream_unavailable\");\n\n // What 0x says about the account: informative only (the engine checks balance and allowance itself).\n const flags: string[] = [];\n const issues = own(r, \"issues\");\n if (plain(issues)) {\n if (own(issues, \"balance\")) flags.push(\"balance\");\n if (own(issues, \"simulationIncomplete\") === true) flags.push(\"simulationIncomplete\");\n const allowance = own(issues, \"allowance\");\n if (plain(allowance)) {\n const spender = own(allowance, \"spender\");\n if (!isAddress(spender) || !same(spender, ZEROEX_PERMIT2)) return refuse(\"the API asks for an allowance to something other than canonical Permit2\", \"vault_mismatch\");\n flags.push(\"allowance\");\n }\n // A source name 0x does not know is silently not excluded: a misspelt exclusion must not pass as applied.\n const invalid = own(issues, \"invalidSourcesPassed\");\n if (Array.isArray(invalid) && invalid.length) {\n const names = invalid.filter((n): n is string => typeof n === \"string\" && /^[A-Za-z0-9_.\\- ]{1,60}$/.test(n)).slice(0, 3);\n return refuse(`0x does not know the excluded source${invalid.length > 1 ? \"s\" : \"\"} ${names.length ? names.join(\", \") : \"it was given\"}${invalid.length > names.length ? \" and more\" : \"\"} — they would not be excluded`, \"policy_refused\");\n }\n }\n // 0x names canonical Permit2 as the allowance target of every answer, native sales included (where nothing is\n // approved: the transaction below carries no allowance target then). Anything else is refused.\n const allowanceTarget = own(r, \"allowanceTarget\");\n if (allowanceTarget !== null && allowanceTarget !== undefined) {\n const permit2Target = isAddress(allowanceTarget) && same(allowanceTarget, ZEROEX_PERMIT2);\n if (nativeSell && !permit2Target) return refuse(\"the API asks for a token allowance on a native-coin sale\", \"policy_refused\");\n if (!permit2Target) return refuse(\"the API asks for an allowance to something other than canonical Permit2\", \"vault_mismatch\");\n }\n const zidRaw = own(r, \"zid\");\n const zid = typeof zidRaw === \"string\" && /^0x[0-9a-fA-F]{1,64}$/.test(zidRaw) ? zidRaw : undefined;\n\n const now = Date.now();\n let validUntilMs = now + ttl;\n let txRequest: Quote[\"txRequest\"];\n let settler: string | undefined;\n if (!dry && tx && recipient) {\n const to = own(tx, \"to\");\n const data = own(tx, \"data\");\n const value = uint(own(tx, \"value\"));\n if (!isAddress(to) || typeof data !== \"string\" || value === null) return refuse(\"malformed quote transaction\", \"upstream_unavailable\");\n\n let permit2Transfer: string | undefined;\n let permit2: Permit2Transfer | undefined;\n const permit = own(r, \"permit2\");\n if (nativeSell) {\n if (permit !== null && permit !== undefined) return refuse(\"the API asks for a Permit2 signature on a native-coin sale\", \"policy_refused\");\n // A native sale signs nothing that would lapse: its quote is bounded here, inside the app verifier's bound by the clock-skew allowance.\n validUntilMs = Math.min(validUntilMs, now + (ZEROEX_MAX_NATIVE_QUOTE_SECONDS - ZEROEX_NATIVE_QUOTE_SKEW_SECONDS) * 1000);\n } else {\n const eip712 = plain(permit) ? own(permit, \"eip712\") : undefined;\n if (!plain(permit) || !plain(eip712)) return refuse(\"the quote carries no Permit2 payload to sign\", \"policy_refused\");\n try {\n // Only these four members are read; the reader holds them to this swap and the payload is rebuilt from that.\n permit2 = readPermit2Transfer(JSON.stringify({domain: own(eip712, \"domain\"), types: own(eip712, \"types\"), primaryType: own(eip712, \"primaryType\"), message: own(eip712, \"message\")}), {\n chainId,\n token: sellToken,\n amount: amountIn,\n spender: to,\n nowMs: now,\n });\n } catch (e) {\n return refuseError(e, /^swap2: /, \"the Permit2 payload is refused\");\n }\n // 0x states the digest it expects signed; the locally rebuilt payload must hash to it.\n const hash = own(permit, \"hash\");\n if (hash !== null && hash !== undefined) {\n const local = hashTypedData({\n domain: permit2.domain,\n types: {PermitTransferFrom: permit2.types.PermitTransferFrom, TokenPermissions: permit2.types.TokenPermissions},\n primaryType: permit2.primaryType,\n message: permit2.message,\n } as unknown as Parameters<typeof hashTypedData>[0]);\n if (typeof hash !== \"string\" || !same(hash, local)) return refuse(\"the Permit2 payload does not hash to what the API says is being signed\", \"policy_refused\");\n }\n permit2Transfer = permit2TransferJson(permit2);\n // The quote lapses before the signature it asks for does (the reader bounds the deadline to the next hour).\n const lapse = permit2.deadline * 1000n - BigInt(DEADLINE_MARGIN_MS);\n if (lapse <= BigInt(now)) return refuse(\"the Permit2 deadline is too close to sign against\", \"quote_expired\");\n if (lapse < BigInt(validUntilMs)) validUntilMs = bigintToNumber(lapse);\n }\n\n const gas = uint(own(tx, \"gas\"));\n // 0x's own limit for the call, with room for the appended signature and a moved route.\n const gasLimit = gas !== null && gas > 0n ? ((gas * 12n) / 10n + 20_000n).toString() : undefined;\n const candidate = {\n to,\n data,\n value: value.toString(),\n chainId,\n ...(gasLimit !== undefined ? {gasLimit} : {}),\n ...(nativeSell ? {} : {approvalAddress: ZEROEX_PERMIT2}),\n ...(permit2Transfer !== undefined ? {permit2Transfer} : {}),\n };\n const expectation = (set: readonly string[]): ZeroExExpectation => ({chainId, chain, settlers: set, sellToken, buyToken, sellAmount: amountIn, recipient: recipient!, minBuyAmount, nowMs: now});\n try {\n try {\n checkZeroExTransaction(candidate, expectation(settlers));\n } catch (first) {\n // 0x may already quote a Settler deployed after the cached registry read: read again, once.\n if (settlers.some((s) => same(s, to))) throw first;\n settlers = await resolver.resolve(chainId, {fresh: true});\n checkZeroExTransaction(candidate, expectation(settlers));\n }\n } catch (e) {\n return refuseError(e, /^zeroex: /, \"the transaction is refused\");\n }\n settler = getAddress(to);\n txRequest = {\n to: settler,\n data,\n value: value.toString(),\n chainId,\n ...(gasLimit !== undefined ? {gasLimit} : {}),\n ...(nativeSell ? {} : {approvalAddress: getAddress(ZEROEX_PERMIT2)}),\n ...(permit2Transfer !== undefined ? {permit2Transfer} : {}),\n };\n }\n\n const sources = zeroExSources(own(r, \"route\"));\n return {\n provider: ZEROEX_PROVIDER,\n intentId: `zeroex:${chainId}:${now.toString(36)}${(sequence = (sequence + 1) % 1_000_000).toString(36)}`,\n depositAddress: \"\",\n depositMemo: null,\n ...(txRequest ? {txRequest} : {}),\n sourceAmount: amountIn.toString(),\n destAmount: buyAmount.toString(),\n minDestAmount: minBuyAmount.toString(),\n feeUsd: 0,\n fees: parsedFees.fees,\n etaSeconds: 15,\n reliability: 0.96,\n validUntilMs,\n providerData: {\n minOut: minBuyAmount.toString(),\n slippageBps: String(bps),\n ...(taker ? {sender: taker} : {}),\n ...(settler ? {settler} : {}),\n ...(zid ? {zid} : {}),\n ...(sources ? {sources} : {}),\n ...(parsedFees.networkFeeKnown ? {} : {networkFee: \"unknown\"}),\n ...(flags.length ? {issues: flags.join(\",\")} : {}),\n },\n };\n },\n\n /**\n * Before the engine signs: the transaction must be the quoted one, and its target must still be a Settler in the\n * registry now ({@link zeroExPreflightDeposit}). The call itself cannot be simulated yet: it needs the Permit2\n * signature, which the engine makes next and then estimates as signed.\n */\n preflightDeposit: (quote: Quote, tx: UnsignedTx): Promise<void> => zeroExPreflightDeposit(quote, tx, {chains, resolver}),\n\n async buildDeposit(quote: Quote): Promise<UnsignedTx> {\n const tx = quote.txRequest;\n if (!tx?.to || !tx.data) throw refusal(\"policy_refused\", \"zeroex: not a live quote — it carries no transaction\");\n return {\n chain: \"\",\n to: tx.to,\n value: tx.value ?? \"0\",\n data: tx.data,\n ...(tx.chainId !== undefined ? {chainId: tx.chainId} : {}),\n ...(tx.gasLimit ? {gasLimit: tx.gasLimit} : {}),\n ...(tx.approvalAddress ? {approvalAddress: tx.approvalAddress} : {}),\n ...(tx.permit2Transfer !== undefined ? {permit2Transfer: tx.permit2Transfer} : {}),\n };\n },\n\n async trackIntent(ref: IntentRef): Promise<IntentStatus> {\n if (!ref.sourceTxHash || !/^0x[0-9a-fA-F]{64}$/.test(ref.sourceTxHash)) return {state: \"pending\"};\n const chainId = chainOfIntent(ref.intentId);\n if (Number.isNaN(chainId) || !rpcUrlsFor(config.rpcUrls, chainId).length) return {state: \"pending\"};\n const answer = await rpcRequest(config.rpcUrls, chainId, \"eth_getTransactionReceipt\", [ref.sourceTxHash]);\n if (!answer || \"error\" in answer || !plain(answer.result)) return {state: \"pending\"};\n const status = own(answer.result, \"status\");\n if (status === \"0x1\") return {state: \"completed\", destTxHash: ref.sourceTxHash};\n return status === \"0x0\" ? {state: \"failed\"} : {state: \"pending\"};\n },\n };\n}\n\n/**\n * The device's last check before the engine signs a 0x swap, run by the `preflightDeposit` of both providers (in remote\n * mode before the backend's own preflight is asked): the transaction must be the quoted one, its gas limit (when it\n * carries one) within the chain's cap, and its target must still be a Settler the registry names now — a fresh read\n * through `resolver` (the device's own RPC), so a Settler paused, replaced or removed since the quote (on the review\n * screen, during an approval) is refused here, with nothing signed or sent.\n */\nexport async function zeroExPreflightDeposit(quote: Quote, tx: UnsignedTx, ctx: {chains: Readonly<Record<number, ZeroExChain>>; resolver: SettlerResolver}): Promise<void> {\n const quoted = quote.txRequest;\n if (\n !quoted?.to || !quoted.data || typeof tx.to !== \"string\" || typeof tx.data !== \"string\" ||\n !same(tx.to, quoted.to) || !same(tx.data, quoted.data) || !sameAmount(tx.value || \"0\", quoted.value ?? \"0\") ||\n tx.permit2Transfer !== quoted.permit2Transfer\n ) {\n throw refusal(\"policy_refused\", \"zeroex: the transaction is not the quoted swap. Nothing was sent; refresh the quote.\");\n }\n const chainId = typeof quote.intentId === \"string\" ? Number(quote.intentId.split(\":\")[1]) : NaN;\n const chain = zeroExChain(ctx.chains, chainId);\n if (!chain) throw refusal(\"policy_refused\", \"zeroex: the quote names no chain this provider serves. Nothing was sent.\");\n checkZeroExGasLimit(tx.gasLimit, chain, chainId);\n const settlers = await ctx.resolver.resolve(chainId, {fresh: true});\n if (!settlers.some((s) => same(s, quoted.to!))) {\n throw refusal(\"vault_mismatch\", \"zeroex: the quoted 0x Settler is no longer in the on-chain registry. Nothing was sent; refresh the quote.\");\n }\n}\n\n/** The liquidity sources of `route.fills`, at most six short names, for display. */\nfunction zeroExSources(route: unknown): string | undefined {\n const fills = plain(route) ? own(route, \"fills\") : undefined;\n if (!Array.isArray(fills)) return undefined;\n const names: string[] = [];\n for (const fill of fills.slice(0, 64)) {\n const source = plain(fill) ? own(fill, \"source\") : undefined;\n if (typeof source !== \"string\" || !/^[A-Za-z0-9_.\\- ]{1,40}$/.test(source)) continue;\n if (!names.includes(source)) names.push(source);\n if (names.length === 6) break;\n }\n return names.length ? names.join(\",\") : undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQ,YAAY,qBAAoB;AACxC,SAAQ,sBAAqB;AAC7B,SAAQ,aAAa,SAAS,iBAAgE;AAC9F,SAAQ,WAAW,qBAAqB,qBAAqB,eAAe,qBAA0C;AACtH,SAAQ,qBAAoB;AA4BrB,IAAM,kBAAkB;AACxB,IAAM,0BAA0B;AACvC,IAAM,uBAAuB;AAM7B,IAAM,iBAAiB;AACvB,IAAM,qBAAqB;AAE3B,IAAM,qBAAqB;AAC3B,IAAM,qBAAqB;AAiC3B,IAAM,aAA8E,OAAO,OAAO;AAAA,EAChG,eAAe,CAAC,sCAAsC,UAAU;AAAA,EAChE,wBAAwB,CAAC,mCAAmC,UAAU;AAAA,EACtE,qBAAqB,CAAC,2CAA2C,kBAAkB;AAAA,EACnF,yBAAyB,CAAC,0DAA0D,kBAAkB;AAAA,EACtG,qBAAqB,CAAC,kCAAkC,kBAAkB;AAAA,EAC1E,gCAAgC,CAAC,kCAAkC,kBAAkB;AAAA,EACrF,oCAAoC,CAAC,oCAAoC,kBAAkB;AAAA,EAC3F,oCAAoC,CAAC,4CAA4C,kBAAkB;AAAA,EACnG,qCAAqC,CAAC,0CAA0C,kBAAkB;AAAA,EAClG,wBAAwB,CAAC,iDAAiD,kBAAkB;AAAA,EAC5F,8BAA8B,CAAC,wDAAwD,wBAAwB;AAAA,EAC/G,uBAAuB,CAAC,4BAA4B,sBAAsB;AAAA,EAC1E,eAAe,CAAC,gCAAgC,UAAU;AAC5D,CAAC;AAED,IAAM,UAAU;AAChB,IAAM,Q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