@anywalletkit/protocol-swap2-wrap 0.4.8 → 0.5.1
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 +56 -0
- package/dist/activity.cjs +29 -0
- package/dist/activity.cjs.map +1 -1
- package/dist/activity.js +1 -1
- package/dist/{chunk-GC6XODOS.js → chunk-GSASQDDV.js} +44 -2
- package/dist/chunk-GSASQDDV.js.map +1 -0
- package/dist/{chunk-U57U5J7R.js → chunk-V4CJ7NRY.js} +2 -2
- package/dist/index.cjs +43 -1
- 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 +8 -2
- package/dist/protocol.cjs +40 -1
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.js +2 -2
- package/dist/provider.cjs +43 -1
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.cts +24 -1
- package/dist/provider.d.ts +24 -1
- package/dist/provider.js +7 -1
- package/package.json +6 -6
- package/dist/chunk-GC6XODOS.js.map +0 -1
- /package/dist/{chunk-U57U5J7R.js.map → chunk-V4CJ7NRY.js.map} +0 -0
package/dist/provider.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/provider.ts","../src/activity.ts"],"sourcesContent":["import type {RemotePins} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {decodeFunctionData, decodeFunctionResult, encodeFunctionData, getAddress, parseAbi, type Hex} from \"viem\";\nimport {describeWrapActivity} from \"./activity.js\";\nimport {ccAsset} from \"@anywalletkit/swap2-assets\";\nimport {evmRef, isEvm, timeoutSignal} from \"@anywalletkit/protocol-swap2-core/util\";\nimport {httpRefusal, refusal, refusalNotes, refusalOf, withReason, type Swap2RefusalInfo, type Swap2RefusalReason} from \"@anywalletkit/protocol-swap2-core/errors\";\nimport type {Asset, CrossChainProvider, IntentRef, IntentStatus, Quote, QuoteParams, UnsignedTx} from \"@anywalletkit/protocol-swap2-core/types\";\n\n/**\n * The chain's canonical wrapped native token (WETH9-style `deposit()` /\n * `withdraw(uint256)`). Every entry was checked on-chain 2026-10-12: symbol,\n * 18 decimals, non-zero supply, and `deposit()` succeeding for a funded sender.\n * The provider re-checks symbol + decimals once per chain before quoting.\n */\nexport const WRAPPED_NATIVE: Readonly<Record<number, {address: `0x${string}`; symbol: string}>> = Object.freeze({\n 1: {address: \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\", symbol: \"WETH\"},\n 10: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 56: {address: \"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c\", symbol: \"WBNB\"},\n 100: {address: \"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d\", symbol: \"WXDAI\"},\n 130: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 137: {address: \"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270\", symbol: \"WPOL\"},\n 143: {address: \"0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A\", symbol: \"WMON\"},\n 999: {address: \"0x5555555555555555555555555555555555555555\", symbol: \"WHYPE\"},\n 324: {address: \"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91\", symbol: \"WETH\"},\n 4326: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 9745: {address: \"0x6100E367285b01F48D07953803A2d8dCA5D19873\", symbol: \"WXPL\"},\n 146: {address: \"0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38\", symbol: \"wS\"},\n 59144: {address: \"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f\", symbol: \"WETH\"},\n 8453: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 42161: {address: \"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1\", symbol: \"WETH\"},\n 43114: {address: \"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7\", symbol: \"WAVAX\"},\n 80094: {address: \"0x6969696969696969696969696969696969696969\", symbol: \"WBERA\"},\n 534352: {address: \"0x5300000000000000000000000000000000000004\", symbol: \"WETH\"},\n // 2026-10-13: World Chain, Sei, Ink, Plume, X Layer — verified on-chain (symbol, decimals, supply, deposit()).\n 480: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 1329: {address: \"0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7\", symbol: \"WSEI\"},\n 57073: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 98866: {address: \"0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1\", symbol: \"WPLUME\"},\n 196: {address: \"0xe538905cf8410324e03A5A23C1c177a474D59b2b\", symbol: \"WOKB\"},\n // 2026-10-14: Mantle, Katana, Morph, Flare — symbol, 18 decimals, supply, deposit()/withdraw() selectors in the\n // bytecode and eth_estimateGas of deposit() with value from a funded sender, all checked on-chain. Katana's WETH9 is\n // Vault Bridge's vbETH (the on-chain symbol the verify step compares against; the catalog shows it as WETH).\n // Arc has no wrapper by design: its native USDC already exposes an ERC-20 interface (docs.arc.network).\n 5000: {address: \"0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8\", symbol: \"WMNT\"},\n 747474: {address: \"0xEE7D8BCFb72bC1880D0Cf19822eB0A2e6577aB62\", symbol: \"vbETH\"},\n 2818: {address: \"0x5300000000000000000000000000000000000011\", symbol: \"WETH\"},\n 14: {address: \"0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d\", symbol: \"WFLR\"},\n // 2026-11-10: Elysium (Kinetiq, Arbitrum Orbit on HyperEVM). WHYPE is the chain's aeWETH behind a transparent proxy\n // (implementation 0xf098…0542): symbol \"WHYPE\", 18 decimals, native balance == totalSupply() (read 2026-11-10),\n // deposit() / withdraw(uint256) in the implementation's bytecode, eth_estimateGas of deposit() with value from a\n // funded sender and of withdraw(1e15) from a holder both pass, withdraw from an empty account reverts \"burn amount\n // exceeds balance\". It emits Transfer mint / burn, not WETH9's Deposit / Withdrawal — activity reads the call.\n 99901: {address: \"0xbA876237B0F021A6c6D852d6c26E107997cC5E81\", symbol: \"WHYPE\"},\n});\n\nconst WETH_ABI = parseAbi([\n \"function deposit() payable\",\n \"function withdraw(uint256 wad)\",\n \"function symbol() view returns (string)\",\n \"function decimals() view returns (uint8)\",\n]);\n/** deposit/withdraw on WETH9 cost ~30-45k; a generous cap, the account still estimates. */\nconst GAS_LIMIT = \"90000\";\n\nexport interface WrapProviderConfig {\n enabled?: boolean;\n /** JSON-RPC endpoints per EVM chain id (on-chain token check + receipt tracking). */\n rpcUrls: Readonly<Record<number, readonly string[]>>;\n /** Override the wrapped tokens (tests, new chains). Still verified on-chain before use. */\n wrapped?: Readonly<Record<number, {address: `0x${string}`; symbol: string}>>;\n}\n\n/**\n * Native ↔ wrapped native as a swap2 venue: `deposit()` with value to wrap,\n * `withdraw(amount)` to unwrap. 1:1, no pool, no slippage, no approval. WETH9\n * credits and pays `msg.sender`, so the recipient must be the sender — a wrap\n * \"to someone else\" is refused rather than silently paid to the wrong place.\n */\nexport function wrapProvider(config: WrapProviderConfig): CrossChainProvider {\n const wrapped = config.wrapped ?? WRAPPED_NATIVE;\n const verified = new Map<number, Promise<void>>();\n\n const chainIdOf = (caip2: string): number | null => {\n if (!isEvm(caip2)) return null;\n const id = evmRef(caip2);\n return wrapped[id] && config.rpcUrls[id]?.length ? id : null;\n };\n\n async function rpc(chainId: number, method: string, params: unknown[]): Promise<unknown> {\n let lastErr: unknown;\n for (const url of config.rpcUrls[chainId] ?? []) {\n try {\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\"content-type\": \"application/json\"},\n body: JSON.stringify({jsonrpc: \"2.0\", id: 1, method, params}),\n signal: timeoutSignal(10_000),\n });\n // 429 rate_limited (Retry-After), 401 / 403 key_rejected, anything else the node failing.\n if (!res.ok) throw withReason(new Error(`HTTP ${res.status}`), httpRefusal(res.status, res.headers?.get?.(\"retry-after\")) ?? {reason: \"upstream_unavailable\", httpStatus: res.status});\n const body = (await res.json()) as {result?: unknown; error?: {code?: number; message?: string}};\n // A node's throttling answer (-32005 \"limit exceeded\", or a 429 code in the body): rate_limited; any other RPC error: upstream_unavailable.\n if (body.error) throw refusal(body.error.code === -32005 || body.error.code === 429 ? \"rate_limited\" : \"upstream_unavailable\", body.error.message ?? \"rpc error\");\n return body.result ?? null;\n } catch (e) {\n lastErr = e;\n }\n }\n // The last endpoint's classification (its HTTP status); a network failure, a timeout or malformed JSON: upstream_unavailable.\n throw withReason(new Error(`wrap: no RPC answered on chain ${chainId} (${lastErr instanceof Error ? lastErr.message : String(lastErr)})`), refusalOf(lastErr) ?? {reason: \"upstream_unavailable\"});\n }\n\n function verify(chainId: number): Promise<void> {\n let p = verified.get(chainId);\n if (!p) {\n const w = wrapped[chainId]!;\n p = (async () => {\n const read = async (fn: \"symbol\" | \"decimals\") =>\n decodeFunctionResult({abi: WETH_ABI, functionName: fn, data: (await rpc(chainId, \"eth_call\", [{to: w.address, data: encodeFunctionData({abi: WETH_ABI, functionName: fn})}, \"latest\"])) as Hex});\n const [symbol, decimals] = await Promise.all([read(\"symbol\"), read(\"decimals\")]);\n if (symbol !== w.symbol || Number(decimals) !== 18) throw refusal(\"vault_mismatch\", `wrap: ${w.address} on chain ${chainId} is not ${w.symbol} — refusing`);\n })();\n p.catch(() => verified.delete(chainId));\n verified.set(chainId, p);\n }\n return p;\n }\n\n return {\n name: \"wrap\",\n describeActivity: (tx, ctx) => describeWrapActivity(tx, ctx, wrapped),\n supportsSameChain: true,\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): boolean {\n return from.chain === to.chain && chainIdOf(from.chain) !== null;\n },\n\n async getQuote(params: QuoteParams): Promise<Quote | null> {\n // The reason goes to onRefusal next to the text; an unclassified refusal (a developer's bad argument) has none.\n const refuse = (why: string, reason?: Swap2RefusalReason | Swap2RefusalInfo): null => {\n const info = typeof reason === \"string\" ? {reason} : reason;\n if (info) params.onRefusal?.(`wrap: ${why}`, info);\n else params.onRefusal?.(`wrap: ${why}`);\n return null;\n };\n if (params.flex) return refuse(\"amount-flexible deposits are not supported\", \"unsupported_pair\");\n if (params.sourceChain !== params.destChain) return refuse(\"same-chain only\", \"unsupported_pair\");\n const chainId = chainIdOf(params.sourceChain);\n if (chainId === null) return refuse(`no wrapped native token or RPC for ${params.sourceChain}`, \"unsupported_pair\");\n const w = wrapped[chainId]!;\n const src = ccAsset(params.sourceChain, params.sourceToken);\n if (!src) return refuse(`unknown source token ${params.sourceToken}`, \"unsupported_pair\");\n const nativeIn = !src.contract;\n const srcIsWrapped = !!src.contract && /^0x[0-9a-fA-F]{40}$/.test(src.contract) && getAddress(src.contract) === getAddress(w.address);\n const nativeOut = /^0x0+$/.test(params.destToken);\n const destIsWrapped = /^0x[0-9a-fA-F]{40}$/.test(params.destToken) && !nativeOut && getAddress(params.destToken) === getAddress(w.address);\n const wrap = nativeIn && destIsWrapped;\n const unwrap = srcIsWrapped && nativeOut;\n if (!wrap && !unwrap) return refuse(`only ${w.symbol.slice(1)} ↔ ${w.symbol}`, \"unsupported_pair\");\n // WETH9 credits / pays msg.sender: the recipient can only be the sender.\n if (params.refundAddress && /^0x[0-9a-fA-F]{40}$/.test(params.refundAddress) && getAddress(params.refundAddress) !== getAddress(params.destAddress)) {\n return refuse(\"wrapping pays the sender's own address — send the result separately\", \"recipient_mismatch\");\n }\n let amount: bigint;\n try {\n amount = BigInt(params.amountIn);\n } catch {\n return refuse(\"amount is not an integer\");\n }\n if (amount <= 0n) return refuse(\"amount must be positive\", \"amount_too_small\");\n if (params.minAmountOut !== undefined && amount < BigInt(params.minAmountOut)) return refuse(`floor breach (min=${amount} < floor=${params.minAmountOut})`, \"price_check_failed\");\n try {\n await verify(chainId);\n } catch (e) {\n // vault_mismatch for a contract that is not the pinned wrapper; the RPC's own failure; an undecodable answer: upstream_unavailable.\n return refuse(e instanceof Error ? e.message.replace(/^wrap: /, \"\") : String(e), refusalOf(e) ?? \"upstream_unavailable\");\n }\n const data = wrap ? encodeFunctionData({abi: WETH_ABI, functionName: \"deposit\"}) : encodeFunctionData({abi: WETH_ABI, functionName: \"withdraw\", args: [amount]});\n return {\n provider: \"wrap\",\n intentId: `wrap:${chainId}`,\n depositAddress: \"\",\n depositMemo: null,\n txRequest: {to: w.address, data, value: wrap ? amount.toString() : \"0\", chainId, gasLimit: GAS_LIMIT},\n sourceAmount: amount.toString(),\n destAmount: amount.toString(),\n minDestAmount: amount.toString(),\n feeUsd: 0,\n etaSeconds: 15,\n reliability: 0.995,\n validUntilMs: Date.now() + 5 * 60_000,\n providerData: {action: wrap ? \"wrap\" : \"unwrap\", token: w.address},\n };\n },\n\n async buildDeposit(quote: Quote): Promise<UnsignedTx> {\n const tx = quote.txRequest;\n if (!tx?.to || !tx.data) throw refusal(\"policy_refused\", \"swap2: wrap quote has no transaction request\");\n return {chain: \"\", to: tx.to, value: tx.value ?? \"0\", data: tx.data, ...(tx.chainId !== undefined ? {chainId: tx.chainId} : {}), ...(tx.gasLimit ? {gasLimit: tx.gasLimit} : {})};\n },\n\n async trackIntent(ref: IntentRef): Promise<IntentStatus> {\n if (!ref.sourceTxHash) return {state: \"pending\"};\n const chainId = Number(ref.intentId.split(\":\")[1]);\n if (!wrapped[chainId] || !config.rpcUrls[chainId]?.length) return {state: \"pending\"};\n try {\n const receipt = (await rpc(chainId, \"eth_getTransactionReceipt\", [ref.sourceTxHash])) as {status?: string} | null;\n if (!receipt) return {state: \"pending\"};\n return receipt.status === \"0x1\" ? {state: \"completed\", destTxHash: ref.sourceTxHash} : {state: \"failed\"};\n } catch {\n return {state: \"pending\"};\n }\n },\n };\n}\n\n/**\n * The reason behind each text {@link wrapVerifyQuote} returns, read back by `wrapPins.reasonOf` so a remote stub's\n * refusal carries it: a pair or route this venue does not serve (`unsupported_pair`), a recipient other than the\n * sender (`recipient_mismatch`), another contract or an approval (`vault_mismatch`), amounts that are not integers\n * (`upstream_unavailable`), any other call, chain, amount or value (`policy_refused`).\n */\nconst notes = refusalNotes();\nconst note = notes.note;\n\n/**\n * `read(value)` over a field of the backend's quote. What it throws (an amount that is not an integer, a target that is\n * not an address) is thrown as before; its text is noted (`upstream_unavailable`: an answer of another shape), so the\n * stub's \"fails this app's own check\" carries the reason.\n */\nfunction shaped<A, R>(read: (value: A) => R, value: A): R {\n try {\n return read(value);\n } catch (e) {\n if (e instanceof Error) note(e.message, \"upstream_unavailable\");\n throw e;\n }\n}\n\nfunction wrappedFor(chain: string): {address: `0x${string}`; symbol: string} | undefined {\n const id = /^eip155:[0-9]+$/.test(chain) ? Number(chain.slice(7)) : NaN;\n return Object.prototype.hasOwnProperty.call(WRAPPED_NATIVE, id) ? WRAPPED_NATIVE[id] : undefined;\n}\n\n/**\n * A remote wrap / unwrap quote, decoded on the device against the app's own request (scan 2026-10-30, F3): native →\n * wrapped is exactly `deposit()` with the input as value; wrapped → native is exactly `withdraw(input)` with no value;\n * on the chain's wrapped native, no approval, and (as WETH9 pays `msg.sender`) a recipient that is the sender. The\n * reason it fails, or null.\n */\nexport function wrapVerifyQuote(params: QuoteParams, quote: Quote): string | null {\n const w = wrappedFor(params.sourceChain);\n if (!w || params.destChain !== params.sourceChain) return note(\"not a same-chain wrap on a pinned wrapped native\", \"unsupported_pair\");\n const src = ccAsset(params.sourceChain, params.sourceToken);\n if (!src) return note(`unknown source token ${params.sourceToken}`, \"unsupported_pair\");\n const nativeIn = !src.contract;\n const srcIsWrapped = !!src.contract && /^0x[0-9a-fA-F]{40}$/.test(src.contract) && getAddress(src.contract) === getAddress(w.address);\n const nativeOut = /^0x0+$/.test(params.destToken);\n const destIsWrapped = /^0x[0-9a-fA-F]{40}$/.test(params.destToken) && !nativeOut && getAddress(params.destToken) === getAddress(w.address);\n const wrap = nativeIn && destIsWrapped;\n if (!wrap && !(srcIsWrapped && nativeOut)) return note(`only ${w.symbol.slice(1)} ↔ ${w.symbol}`, \"unsupported_pair\");\n if (params.refundAddress && /^0x[0-9a-fA-F]{40}$/.test(params.refundAddress) && (!/^0x[0-9a-fA-F]{40}$/.test(params.destAddress) || getAddress(params.refundAddress) !== getAddress(params.destAddress))) {\n return note(\"wrapping pays the sender's own address\", \"recipient_mismatch\");\n }\n const tx = quote.txRequest;\n if (!tx?.data || !tx.to || tx.serializedTx !== undefined) return note(\"the quote carries no wrapped-native call\", \"policy_refused\");\n if (shaped(getAddress, tx.to) !== getAddress(w.address)) return note(`the call targets ${tx.to}, not ${w.symbol}`, \"vault_mismatch\");\n if (tx.approvalAddress !== undefined) return note(\"a wrap approves nothing\", \"vault_mismatch\");\n if (tx.chainId !== undefined && `eip155:${tx.chainId}` !== params.sourceChain) return note(`the call is for chain ${tx.chainId}`, \"policy_refused\");\n let amount: bigint, value: bigint;\n try {\n amount = BigInt(params.amountIn);\n value = BigInt(tx.value ?? \"0\");\n } catch {\n return note(\"the request does not name amounts\", \"upstream_unavailable\");\n }\n if (shaped(BigInt, quote.sourceAmount) !== amount) return note(`the quote moves ${quote.sourceAmount}, not the ${amount} input`, \"policy_refused\");\n let call: {functionName: string; args?: readonly unknown[]};\n try {\n call = decodeFunctionData({abi: WETH_ABI, data: tx.data as Hex});\n } catch {\n return note(\"the call is neither deposit() nor withdraw(amount)\", \"policy_refused\");\n }\n if (wrap) {\n if (call.functionName !== \"deposit\" || tx.data.length !== 10) return note(`${call.functionName} is not deposit()`, \"policy_refused\");\n if (value !== amount) return note(`deposit() attaches ${value}, not the ${amount} input`, \"policy_refused\");\n } else {\n if (call.functionName !== \"withdraw\") return note(`${call.functionName} is not withdraw(amount)`, \"policy_refused\");\n if (call.args?.[0] !== amount) return note(`withdraw(${String(call.args?.[0])}) is not the ${amount} input`, \"policy_refused\");\n if (value !== 0n) return note(\"withdraw attaches no value\", \"policy_refused\");\n }\n return null;\n}\n\n/**\n * The wrapped-native contract a wrap / unwrap calls on a chain (no spender: neither approves), and\n * {@link wrapVerifyQuote} — the app's pins for `remoteProvider({name: \"wrap\", baseUrl, ...wrapPins})` (scan\n * 2026-10-27 modules, F8/F16; the call itself since scan 2026-10-30, F3).\n */\nexport const wrapPins: RemotePins = Object.freeze({\n callTargets: (chain: string): readonly string[] => {\n const w = wrappedFor(chain);\n return w ? [w.address] : [];\n },\n spenders: (): readonly string[] => [],\n verifyQuote: wrapVerifyQuote,\n reasonOf: notes.reasonOf,\n});\n","/**\n * Activity recognition for the Wrap module: WETH9 `deposit()` → `wrap`\n * (\"Wrapped ETH\"), `withdraw(uint256)` → `unwrap` (\"Unwrapped WETH\"), on the\n * wrapper the table (or the caller's override) names for the chain.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {assetLabel, describeSwapLike, matchesCall, ownerAssets} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {evmRef, isEvm} from \"@anywalletkit/protocol-swap2-core/util\";\nimport {WRAPPED_NATIVE} from \"./provider.js\";\n\nexport const WRAP_MODULE = \"@anywalletkit/protocol-swap2-wrap\";\n\n/** deposit() */\nexport const WETH_DEPOSIT = \"0xd0e30db0\";\n/** withdraw(uint256 wad) */\nexport const WETH_WITHDRAW = \"0x2e1a7d4d\";\n\nexport function describeWrapActivity(\n tx: ChainTx,\n ctx: DescribeActivityContext,\n wrapped: Readonly<Record<number, {address: `0x${string}`; symbol: string}>> = WRAPPED_NATIVE,\n): ActivityItem | null {\n if (!isEvm(tx.chain)) return null;\n const w = wrapped[evmRef(tx.chain)];\n if (!w) return null;\n const isDeposit = matchesCall(tx, [w.address], [WETH_DEPOSIT]);\n const isWithdraw = !isDeposit && matchesCall(tx, [w.address], [WETH_WITHDRAW]);\n if (!isDeposit && !isWithdraw) return null;\n const {assetsIn, assetsOut} = ownerAssets(tx, ctx);\n const native = [...assetsIn, ...assetsOut].find((a) => a.token === null);\n const nativeLabel = native ? assetLabel(tx, native) : w.symbol.replace(/^[Ww]/, \"\");\n return describeS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AgB;AAC7H,QAAI,UAAU,GAAI,QAAO,KAAK,8BAA8B,gBAAgB;AAAA,EAC9E;AACA,SAAO;AACT;AAOO,IAAM,WAAuB,OAAO,OAAO;AAAA,EAChD,aAAa,CAAC,UAAqC;AACjD,UAAM,IAAI,WAAW,KAAK;AAC1B,WAAO,IAAI,CAAC,EAAE,OAAO,IAAI,CAAC;AAAA,EAC5B;AAAA,EACA,UAAU,MAAyB,CAAC;AAAA,EACpC,aAAa;AAAA,EACb,UAAU,MAAM;AAClB,CAAC;","names":["import_util"]}
|
|
1
|
+
{"version":3,"sources":["../src/provider.ts","../src/activity.ts"],"sourcesContent":["import type {RemotePins} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {decodeFunctionData, decodeFunctionResult, encodeFunctionData, getAddress, parseAbi, type Hex} from \"viem\";\nimport {describeWrapActivity} from \"./activity.js\";\nimport {ccAsset} from \"@anywalletkit/swap2-assets\";\nimport {evmRef, isEvm, timeoutSignal} from \"@anywalletkit/protocol-swap2-core/util\";\nimport {httpRefusal, refusal, refusalNotes, refusalOf, withReason, type Swap2RefusalInfo, type Swap2RefusalReason} from \"@anywalletkit/protocol-swap2-core/errors\";\nimport type {Asset, CrossChainProvider, IntentRef, IntentStatus, Quote, QuoteParams, UnsignedTx} from \"@anywalletkit/protocol-swap2-core/types\";\n\n/**\n * The chain's canonical wrapped native token (WETH9-style `deposit()` /\n * `withdraw(uint256)`). Every entry was checked on-chain 2026-10-12: symbol,\n * 18 decimals, non-zero supply, and `deposit()` succeeding for a funded sender.\n * The provider re-checks symbol + decimals once per chain before quoting.\n */\nexport const WRAPPED_NATIVE: Readonly<Record<number, {address: `0x${string}`; symbol: string}>> = Object.freeze({\n 1: {address: \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\", symbol: \"WETH\"},\n 10: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 56: {address: \"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c\", symbol: \"WBNB\"},\n 100: {address: \"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d\", symbol: \"WXDAI\"},\n 130: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 137: {address: \"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270\", symbol: \"WPOL\"},\n 143: {address: \"0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A\", symbol: \"WMON\"},\n 999: {address: \"0x5555555555555555555555555555555555555555\", symbol: \"WHYPE\"},\n 324: {address: \"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91\", symbol: \"WETH\"},\n 4326: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 9745: {address: \"0x6100E367285b01F48D07953803A2d8dCA5D19873\", symbol: \"WXPL\"},\n 146: {address: \"0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38\", symbol: \"wS\"},\n 59144: {address: \"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f\", symbol: \"WETH\"},\n 8453: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 42161: {address: \"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1\", symbol: \"WETH\"},\n 43114: {address: \"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7\", symbol: \"WAVAX\"},\n 80094: {address: \"0x6969696969696969696969696969696969696969\", symbol: \"WBERA\"},\n 534352: {address: \"0x5300000000000000000000000000000000000004\", symbol: \"WETH\"},\n // 2026-10-13: World Chain, Sei, Ink, Plume, X Layer — verified on-chain (symbol, decimals, supply, deposit()).\n 480: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 1329: {address: \"0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7\", symbol: \"WSEI\"},\n 57073: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 98866: {address: \"0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1\", symbol: \"WPLUME\"},\n 196: {address: \"0xe538905cf8410324e03A5A23C1c177a474D59b2b\", symbol: \"WOKB\"},\n // 2026-10-14: Mantle, Katana, Morph, Flare — symbol, 18 decimals, supply, deposit()/withdraw() selectors in the\n // bytecode and eth_estimateGas of deposit() with value from a funded sender, all checked on-chain. Katana's WETH9 is\n // Vault Bridge's vbETH (the on-chain symbol the verify step compares against; the catalog shows it as WETH).\n // Arc has no wrapper by design: its native USDC already exposes an ERC-20 interface (docs.arc.network).\n 5000: {address: \"0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8\", symbol: \"WMNT\"},\n 747474: {address: \"0xEE7D8BCFb72bC1880D0Cf19822eB0A2e6577aB62\", symbol: \"vbETH\"},\n 2818: {address: \"0x5300000000000000000000000000000000000011\", symbol: \"WETH\"},\n 14: {address: \"0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d\", symbol: \"WFLR\"},\n // 2026-11-10: Elysium (Kinetiq, Arbitrum Orbit on HyperEVM). WHYPE is the chain's aeWETH behind a transparent proxy\n // (implementation 0xf098…0542): symbol \"WHYPE\", 18 decimals, native balance == totalSupply() (read 2026-11-10),\n // deposit() / withdraw(uint256) in the implementation's bytecode, eth_estimateGas of deposit() with value from a\n // funded sender and of withdraw(1e15) from a holder both pass, withdraw from an empty account reverts \"burn amount\n // exceeds balance\". It emits Transfer mint / burn, not WETH9's Deposit / Withdrawal — activity reads the call.\n 99901: {address: \"0xbA876237B0F021A6c6D852d6c26E107997cC5E81\", symbol: \"WHYPE\"},\n});\n\nconst WETH_ABI = parseAbi([\n \"function deposit() payable\",\n \"function withdraw(uint256 wad)\",\n \"function symbol() view returns (string)\",\n \"function decimals() view returns (uint8)\",\n]);\n/**\n * The gas limit a wrap / unwrap is sent with: deposit() / withdraw() cost 27–67k on most chains' wrappers\n * ({@link WRAP_GAS}), so 90 000, unless {@link WRAP_GAS_LIMIT} names the chain.\n */\nconst GAS_LIMIT = \"90000\";\n\n/**\n * Chains where a wrap or an unwrap needs more than 90 000 gas — `eth_estimateGas` on 2026-11-28\n * (`fixtures/gas/limits-2026-11-28.json`): a deposit() into an empty balance from a fresh address, a withdraw() of\n * part of a real holder's balance. Each limit leaves at least half again over the dearer figure; the gas a\n * transaction does not use is not charged on these chains.\n */\nexport const WRAP_GAS_LIMIT: Readonly<Record<number, string>> = Object.freeze({\n // Flare's WNat keeps vote-power checkpoints: deposit 202 512, withdraw 175 850–187 782.\n 14: \"350000\",\n // zkSync prices pubdata in L2 gas, so the figure moves with L1 gas: deposit 186 454, withdraw 191 900–192 037.\n 324: \"500000\",\n // Sei charges 72 000 for a new storage slot: deposit into an empty balance 97 833.\n 1329: \"150000\",\n // MegaETH's storage gas: deposit into an empty balance 98 470 (a receipt: 94 632), withdraw 82 123–87 055.\n 4326: \"200000\",\n});\n\n/** The gas limit a wrap / unwrap on `chainId` is sent with. */\nexport function wrapGasLimit(chainId: number): string {\n return Object.prototype.hasOwnProperty.call(WRAP_GAS_LIMIT, chainId) ? WRAP_GAS_LIMIT[chainId]! : GAS_LIMIT;\n}\n\n/**\n * Gas a wrap (`deposit()`) and an unwrap (`withdraw(amount)`) use on each chain's pinned wrapper in\n * {@link WRAPPED_NATIVE} — the quote's `gasEstimate`, source `\"model\"`. Measured 2026-11-28 (README, \"Gas estimate\"):\n * `eth_simulateV1` of the exact call this module builds, checked against receipts of public wrap / unwrap\n * transactions on the same chain; Sei, HyperEVM and Scroll from receipts alone (their nodes have no `eth_simulateV1`).\n * Each figure is the dearer of the two cases the call can hit: a wrap into an empty wrapped balance (topping up a\n * held balance uses 17 100 less; 17 940 on Polygon), an unwrap of part of the balance (clearing it earns a storage\n * refund: 4 788 less; 3 948 on Polygon). A chain or a direction without an entry was not measured to that standard —\n * its quote carries no estimate.\n */\nexport const WRAP_GAS: Readonly<Record<number, Readonly<{wrap?: string; unwrap?: string}>>> = Object.freeze({\n 1: Object.freeze({wrap: \"45038\", unwrap: \"35192\"}),\n 10: Object.freeze({wrap: \"44866\", unwrap: \"35116\"}),\n 56: Object.freeze({wrap: \"45038\", unwrap: \"35192\"}),\n 130: Object.freeze({wrap: \"44932\", unwrap: \"35211\"}),\n 137: Object.freeze({wrap: \"48401\", unwrap: \"37747\"}),\n 196: Object.freeze({wrap: \"49054\", unwrap: \"39241\"}),\n 480: Object.freeze({wrap: \"44866\", unwrap: \"35116\"}),\n 999: Object.freeze({wrap: \"44866\", unwrap: \"35140\"}),\n 1329: Object.freeze({unwrap: \"35140\"}),\n 5000: Object.freeze({wrap: \"51977\", unwrap: \"42329\"}),\n 8453: Object.freeze({wrap: \"44866\", unwrap: \"35116\"}),\n 9745: Object.freeze({wrap: \"45041\", unwrap: \"35227\"}),\n 42161: Object.freeze({wrap: \"57975\", unwrap: \"48177\"}),\n 57073: Object.freeze({wrap: \"44932\", unwrap: \"35211\"}),\n 59144: Object.freeze({wrap: \"45038\", unwrap: \"35192\"}),\n 534352: Object.freeze({unwrap: \"42062\"}),\n 747474: Object.freeze({wrap: \"66336\", unwrap: \"55851\"}),\n});\n\n/** {@link WRAP_GAS} for a call on `address`: only the pinned wrapper was measured, so another contract gets none. */\nfunction measuredGas(chainId: number, address: string, wrap: boolean): string | undefined {\n if (!Object.prototype.hasOwnProperty.call(WRAPPED_NATIVE, chainId) || !Object.prototype.hasOwnProperty.call(WRAP_GAS, chainId)) return undefined;\n if (getAddress(WRAPPED_NATIVE[chainId]!.address) !== getAddress(address)) return undefined;\n return WRAP_GAS[chainId]![wrap ? \"wrap\" : \"unwrap\"];\n}\n\nexport interface WrapProviderConfig {\n enabled?: boolean;\n /** JSON-RPC endpoints per EVM chain id (on-chain token check + receipt tracking). */\n rpcUrls: Readonly<Record<number, readonly string[]>>;\n /** Override the wrapped tokens (tests, new chains). Still verified on-chain before use. */\n wrapped?: Readonly<Record<number, {address: `0x${string}`; symbol: string}>>;\n}\n\n/**\n * Native ↔ wrapped native as a swap2 venue: `deposit()` with value to wrap,\n * `withdraw(amount)` to unwrap. 1:1, no pool, no slippage, no approval. WETH9\n * credits and pays `msg.sender`, so the recipient must be the sender — a wrap\n * \"to someone else\" is refused rather than silently paid to the wrong place.\n */\nexport function wrapProvider(config: WrapProviderConfig): CrossChainProvider {\n const wrapped = config.wrapped ?? WRAPPED_NATIVE;\n const verified = new Map<number, Promise<void>>();\n\n const chainIdOf = (caip2: string): number | null => {\n if (!isEvm(caip2)) return null;\n const id = evmRef(caip2);\n return wrapped[id] && config.rpcUrls[id]?.length ? id : null;\n };\n\n async function rpc(chainId: number, method: string, params: unknown[]): Promise<unknown> {\n let lastErr: unknown;\n for (const url of config.rpcUrls[chainId] ?? []) {\n try {\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\"content-type\": \"application/json\"},\n body: JSON.stringify({jsonrpc: \"2.0\", id: 1, method, params}),\n signal: timeoutSignal(10_000),\n });\n // 429 rate_limited (Retry-After), 401 / 403 key_rejected, anything else the node failing.\n if (!res.ok) throw withReason(new Error(`HTTP ${res.status}`), httpRefusal(res.status, res.headers?.get?.(\"retry-after\")) ?? {reason: \"upstream_unavailable\", httpStatus: res.status});\n const body = (await res.json()) as {result?: unknown; error?: {code?: number; message?: string}};\n // A node's throttling answer (-32005 \"limit exceeded\", or a 429 code in the body): rate_limited; any other RPC error: upstream_unavailable.\n if (body.error) throw refusal(body.error.code === -32005 || body.error.code === 429 ? \"rate_limited\" : \"upstream_unavailable\", body.error.message ?? \"rpc error\");\n return body.result ?? null;\n } catch (e) {\n lastErr = e;\n }\n }\n // The last endpoint's classification (its HTTP status); a network failure, a timeout or malformed JSON: upstream_unavailable.\n throw withReason(new Error(`wrap: no RPC answered on chain ${chainId} (${lastErr instanceof Error ? lastErr.message : String(lastErr)})`), refusalOf(lastErr) ?? {reason: \"upstream_unavailable\"});\n }\n\n function verify(chainId: number): Promise<void> {\n let p = verified.get(chainId);\n if (!p) {\n const w = wrapped[chainId]!;\n p = (async () => {\n const read = async (fn: \"symbol\" | \"decimals\") =>\n decodeFunctionResult({abi: WETH_ABI, functionName: fn, data: (await rpc(chainId, \"eth_call\", [{to: w.address, data: encodeFunctionData({abi: WETH_ABI, functionName: fn})}, \"latest\"])) as Hex});\n const [symbol, decimals] = await Promise.all([read(\"symbol\"), read(\"decimals\")]);\n if (symbol !== w.symbol || Number(decimals) !== 18) throw refusal(\"vault_mismatch\", `wrap: ${w.address} on chain ${chainId} is not ${w.symbol} — refusing`);\n })();\n p.catch(() => verified.delete(chainId));\n verified.set(chainId, p);\n }\n return p;\n }\n\n return {\n name: \"wrap\",\n describeActivity: (tx, ctx) => describeWrapActivity(tx, ctx, wrapped),\n supportsSameChain: true,\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): boolean {\n return from.chain === to.chain && chainIdOf(from.chain) !== null;\n },\n\n async getQuote(params: QuoteParams): Promise<Quote | null> {\n // The reason goes to onRefusal next to the text; an unclassified refusal (a developer's bad argument) has none.\n const refuse = (why: string, reason?: Swap2RefusalReason | Swap2RefusalInfo): null => {\n const info = typeof reason === \"string\" ? {reason} : reason;\n if (info) params.onRefusal?.(`wrap: ${why}`, info);\n else params.onRefusal?.(`wrap: ${why}`);\n return null;\n };\n if (params.flex) return refuse(\"amount-flexible deposits are not supported\", \"unsupported_pair\");\n if (params.sourceChain !== params.destChain) return refuse(\"same-chain only\", \"unsupported_pair\");\n const chainId = chainIdOf(params.sourceChain);\n if (chainId === null) return refuse(`no wrapped native token or RPC for ${params.sourceChain}`, \"unsupported_pair\");\n const w = wrapped[chainId]!;\n const src = ccAsset(params.sourceChain, params.sourceToken);\n if (!src) return refuse(`unknown source token ${params.sourceToken}`, \"unsupported_pair\");\n const nativeIn = !src.contract;\n const srcIsWrapped = !!src.contract && /^0x[0-9a-fA-F]{40}$/.test(src.contract) && getAddress(src.contract) === getAddress(w.address);\n const nativeOut = /^0x0+$/.test(params.destToken);\n const destIsWrapped = /^0x[0-9a-fA-F]{40}$/.test(params.destToken) && !nativeOut && getAddress(params.destToken) === getAddress(w.address);\n const wrap = nativeIn && destIsWrapped;\n const unwrap = srcIsWrapped && nativeOut;\n if (!wrap && !unwrap) return refuse(`only ${w.symbol.slice(1)} ↔ ${w.symbol}`, \"unsupported_pair\");\n // WETH9 credits / pays msg.sender: the recipient can only be the sender.\n if (params.refundAddress && /^0x[0-9a-fA-F]{40}$/.test(params.refundAddress) && getAddress(params.refundAddress) !== getAddress(params.destAddress)) {\n return refuse(\"wrapping pays the sender's own address — send the result separately\", \"recipient_mismatch\");\n }\n let amount: bigint;\n try {\n amount = BigInt(params.amountIn);\n } catch {\n return refuse(\"amount is not an integer\");\n }\n if (amount <= 0n) return refuse(\"amount must be positive\", \"amount_too_small\");\n if (params.minAmountOut !== undefined && amount < BigInt(params.minAmountOut)) return refuse(`floor breach (min=${amount} < floor=${params.minAmountOut})`, \"price_check_failed\");\n try {\n await verify(chainId);\n } catch (e) {\n // vault_mismatch for a contract that is not the pinned wrapper; the RPC's own failure; an undecodable answer: upstream_unavailable.\n return refuse(e instanceof Error ? e.message.replace(/^wrap: /, \"\") : String(e), refusalOf(e) ?? \"upstream_unavailable\");\n }\n const data = wrap ? encodeFunctionData({abi: WETH_ABI, functionName: \"deposit\"}) : encodeFunctionData({abi: WETH_ABI, functionName: \"withdraw\", args: [amount]});\n const gasEstimate = measuredGas(chainId, w.address, wrap);\n return {\n provider: \"wrap\",\n intentId: `wrap:${chainId}`,\n depositAddress: \"\",\n depositMemo: null,\n txRequest: {to: w.address, data, value: wrap ? amount.toString() : \"0\", chainId, gasLimit: wrapGasLimit(chainId)},\n sourceAmount: amount.toString(),\n destAmount: amount.toString(),\n minDestAmount: amount.toString(),\n feeUsd: 0,\n ...(gasEstimate !== undefined ? {gasEstimate, gasEstimateSource: \"model\" as const} : {}),\n etaSeconds: 15,\n reliability: 0.995,\n validUntilMs: Date.now() + 5 * 60_000,\n providerData: {action: wrap ? \"wrap\" : \"unwrap\", token: w.address},\n };\n },\n\n async buildDeposit(quote: Quote): Promise<UnsignedTx> {\n const tx = quote.txRequest;\n if (!tx?.to || !tx.data) throw refusal(\"policy_refused\", \"swap2: wrap quote has no transaction request\");\n return {chain: \"\", to: tx.to, value: tx.value ?? \"0\", data: tx.data, ...(tx.chainId !== undefined ? {chainId: tx.chainId} : {}), ...(tx.gasLimit ? {gasLimit: tx.gasLimit} : {})};\n },\n\n async trackIntent(ref: IntentRef): Promise<IntentStatus> {\n if (!ref.sourceTxHash) return {state: \"pending\"};\n const chainId = Number(ref.intentId.split(\":\")[1]);\n if (!wrapped[chainId] || !config.rpcUrls[chainId]?.length) return {state: \"pending\"};\n try {\n const receipt = (await rpc(chainId, \"eth_getTransactionReceipt\", [ref.sourceTxHash])) as {status?: string} | null;\n if (!receipt) return {state: \"pending\"};\n return receipt.status === \"0x1\" ? {state: \"completed\", destTxHash: ref.sourceTxHash} : {state: \"failed\"};\n } catch {\n return {state: \"pending\"};\n }\n },\n };\n}\n\n/**\n * The reason behind each text {@link wrapVerifyQuote} returns, read back by `wrapPins.reasonOf` so a remote stub's\n * refusal carries it: a pair or route this venue does not serve (`unsupported_pair`), a recipient other than the\n * sender (`recipient_mismatch`), another contract or an approval (`vault_mismatch`), amounts that are not integers\n * (`upstream_unavailable`), any other call, chain, amount or value (`policy_refused`).\n */\nconst notes = refusalNotes();\nconst note = notes.note;\n\n/**\n * `read(value)` over a field of the backend's quote. What it throws (an amount that is not an integer, a target that is\n * not an address) is thrown as before; its text is noted (`upstream_unavailable`: an answer of another shape), so the\n * stub's \"fails this app's own check\" carries the reason.\n */\nfunction shaped<A, R>(read: (value: A) => R, value: A): R {\n try {\n return read(value);\n } catch (e) {\n if (e instanceof Error) note(e.message, \"upstream_unavailable\");\n throw e;\n }\n}\n\nfunction wrappedFor(chain: string): {address: `0x${string}`; symbol: string} | undefined {\n const id = /^eip155:[0-9]+$/.test(chain) ? Number(chain.slice(7)) : NaN;\n return Object.prototype.hasOwnProperty.call(WRAPPED_NATIVE, id) ? WRAPPED_NATIVE[id] : undefined;\n}\n\n/**\n * A remote wrap / unwrap quote, decoded on the device against the app's own request (scan 2026-10-30, F3): native →\n * wrapped is exactly `deposit()` with the input as value; wrapped → native is exactly `withdraw(input)` with no value;\n * on the chain's wrapped native, no approval, and (as WETH9 pays `msg.sender`) a recipient that is the sender. The\n * reason it fails, or null.\n */\nexport function wrapVerifyQuote(params: QuoteParams, quote: Quote): string | null {\n const w = wrappedFor(params.sourceChain);\n if (!w || params.destChain !== params.sourceChain) return note(\"not a same-chain wrap on a pinned wrapped native\", \"unsupported_pair\");\n const src = ccAsset(params.sourceChain, params.sourceToken);\n if (!src) return note(`unknown source token ${params.sourceToken}`, \"unsupported_pair\");\n const nativeIn = !src.contract;\n const srcIsWrapped = !!src.contract && /^0x[0-9a-fA-F]{40}$/.test(src.contract) && getAddress(src.contract) === getAddress(w.address);\n const nativeOut = /^0x0+$/.test(params.destToken);\n const destIsWrapped = /^0x[0-9a-fA-F]{40}$/.test(params.destToken) && !nativeOut && getAddress(params.destToken) === getAddress(w.address);\n const wrap = nativeIn && destIsWrapped;\n if (!wrap && !(srcIsWrapped && nativeOut)) return note(`only ${w.symbol.slice(1)} ↔ ${w.symbol}`, \"unsupported_pair\");\n if (params.refundAddress && /^0x[0-9a-fA-F]{40}$/.test(params.refundAddress) && (!/^0x[0-9a-fA-F]{40}$/.test(params.destAddress) || getAddress(params.refundAddress) !== getAddress(params.destAddress))) {\n return note(\"wrapping pays the sender's own address\", \"recipient_mismatch\");\n }\n const tx = quote.txRequest;\n if (!tx?.data || !tx.to || tx.serializedTx !== undefined) return note(\"the quote carries no wrapped-native call\", \"policy_refused\");\n if (shaped(getAddress, tx.to) !== getAddress(w.address)) return note(`the call targets ${tx.to}, not ${w.symbol}`, \"vault_mismatch\");\n if (tx.approvalAddress !== undefined) return note(\"a wrap approves nothing\", \"vault_mismatch\");\n if (tx.chainId !== undefined && `eip155:${tx.chainId}` !== params.sourceChain) return note(`the call is for chain ${tx.chainId}`, \"policy_refused\");\n let amount: bigint, value: bigint;\n try {\n amount = BigInt(params.amountIn);\n value = BigInt(tx.value ?? \"0\");\n } catch {\n return note(\"the request does not name amounts\", \"upstream_unavailable\");\n }\n if (shaped(BigInt, quote.sourceAmount) !== amount) return note(`the quote moves ${quote.sourceAmount}, not the ${amount} input`, \"policy_refused\");\n let call: {functionName: string; args?: readonly unknown[]};\n try {\n call = decodeFunctionData({abi: WETH_ABI, data: tx.data as Hex});\n } catch {\n return note(\"the call is neither deposit() nor withdraw(amount)\", \"policy_refused\");\n }\n if (wrap) {\n if (call.functionName !== \"deposit\" || tx.data.length !== 10) return note(`${call.functionName} is not deposit()`, \"policy_refused\");\n if (value !== amount) return note(`deposit() attaches ${value}, not the ${amount} input`, \"policy_refused\");\n } else {\n if (call.functionName !== \"withdraw\") return note(`${call.functionName} is not withdraw(amount)`, \"policy_refused\");\n if (call.args?.[0] !== amount) return note(`withdraw(${String(call.args?.[0])}) is not the ${amount} input`, \"policy_refused\");\n if (value !== 0n) return note(\"withdraw attaches no value\", \"policy_refused\");\n }\n return null;\n}\n\n/**\n * The wrapped-native contract a wrap / unwrap calls on a chain (no spender: neither approves), and\n * {@link wrapVerifyQuote} — the app's pins for `remoteProvider({name: \"wrap\", baseUrl, ...wrapPins})` (scan\n * 2026-10-27 modules, F8/F16; the call itself since scan 2026-10-30, F3).\n */\nexport const wrapPins: RemotePins = Object.freeze({\n callTargets: (chain: string): readonly string[] => {\n const w = wrappedFor(chain);\n return w ? [w.address] : [];\n },\n spenders: (): readonly string[] => [],\n verifyQuote: wrapVerifyQuote,\n reasonOf: notes.reasonOf,\n});\n","/**\n * Activity recognition for the Wrap module: WETH9 `deposit()` → `wrap`\n * (\"Wrapped ETH\"), `withdraw(uint256)` → `unwrap` (\"Unwrapped WETH\"), on the\n * wrapper the table (or the caller's override) names for the chain.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {assetLabel, describeSwapLike, matchesCall, ownerAssets} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {evmRef, isEvm} from \"@anywalletkit/protocol-swap2-core/util\";\nimport {WRAPPED_NATIVE} from \"./provider.js\";\n\nexport const WRAP_MODULE = \"@anywalletkit/protocol-swap2-wrap\";\n\n/** deposit() */\nexport const WETH_DEPOSIT = \"0xd0e30db0\";\n/** withdraw(uint256 wad) */\nexport const WETH_WITHDRAW = \"0x2e1a7d4d\";\n\nexport function describeWrapActivity(\n tx: ChainTx,\n ctx: DescribeActivityContext,\n wrapped: Readonly<Record<number, {address: `0x${string}`; symbol: string}>> = WRAPPED_NATIVE,\n): ActivityItem | null {\n if (!isEvm(tx.chain)) return null;\n const w = wrapped[evmRef(tx.chain)];\n if (!w) return null;\n const isDeposit = matchesCall(tx, [w.address], [WETH_DEPOSIT]);\n const isWithdraw = !isDeposit && matchesCall(tx, [w.address], [WETH_WITHDRAW]);\n if (!isDeposit && !isWithdraw) return null;\n const {assetsIn, assetsOut} = ownerAssets(tx, ctx);\n const native = [...assetsIn, ...assetsOut].find((a) => a.token === null);\n const nativeLabel = native ? assetLabel(tx, native) : w.symbol.replace(/^[Ww]/, \"\");\n return describeSwapLike(tx, ctx, {\n protocol: WRAP_MODULE,\n subtitle: w.symbol,\n kind: isDeposit ? \"wrap\" : \"unwrap\",\n title: isDeposit ? `Wrapped ${nativeLabel}` : `Unwrapped ${w.symbol}`,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAA2G;;;ACK3G,sBAAqE;AACrE,kBAA4B;AAGrB,IAAM,cAAc;AAGpB,IAAM,eAAe;AAErB,IAAM,gBAAgB;AAEtB,SAAS,qBACd,IACA,KACA,UAA8E,gBACzD;AACrB,MAAI,KAAC,mBAAM,GAAG,KAAK,EAAG,QAAO;AAC7B,QAAM,IAAI,YAAQ,oBAAO,GAAG,KAAK,CAAC;AAClC,MAAI,CAAC,EAAG,QAAO;AACf,QAA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M,OAAQ,QAAO,KAAK,YAAY,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,gBAAgB,MAAM,UAAU,gBAAgB;AAC7H,QAAI,UAAU,GAAI,QAAO,KAAK,8BAA8B,gBAAgB;AAAA,EAC9E;AACA,SAAO;AACT;AAOO,IAAM,WAAuB,OAAO,OAAO;AAAA,EAChD,aAAa,CAAC,UAAqC;AACjD,UAAM,IAAI,WAAW,KAAK;AAC1B,WAAO,IAAI,CAAC,EAAE,OAAO,IAAI,CAAC;AAAA,EAC5B;AAAA,EACA,UAAU,MAAyB,CAAC;AAAA,EACpC,aAAa;AAAA,EACb,UAAU,MAAM;AAClB,CAAC;","names":["import_util"]}
|
package/dist/provider.d.cts
CHANGED
|
@@ -10,6 +10,29 @@ declare const WRAPPED_NATIVE: Readonly<Record<number, {
|
|
|
10
10
|
address: `0x${string}`;
|
|
11
11
|
symbol: string;
|
|
12
12
|
}>>;
|
|
13
|
+
/**
|
|
14
|
+
* Chains where a wrap or an unwrap needs more than 90 000 gas — `eth_estimateGas` on 2026-11-28
|
|
15
|
+
* (`fixtures/gas/limits-2026-11-28.json`): a deposit() into an empty balance from a fresh address, a withdraw() of
|
|
16
|
+
* part of a real holder's balance. Each limit leaves at least half again over the dearer figure; the gas a
|
|
17
|
+
* transaction does not use is not charged on these chains.
|
|
18
|
+
*/
|
|
19
|
+
declare const WRAP_GAS_LIMIT: Readonly<Record<number, string>>;
|
|
20
|
+
/** The gas limit a wrap / unwrap on `chainId` is sent with. */
|
|
21
|
+
declare function wrapGasLimit(chainId: number): string;
|
|
22
|
+
/**
|
|
23
|
+
* Gas a wrap (`deposit()`) and an unwrap (`withdraw(amount)`) use on each chain's pinned wrapper in
|
|
24
|
+
* {@link WRAPPED_NATIVE} — the quote's `gasEstimate`, source `"model"`. Measured 2026-11-28 (README, "Gas estimate"):
|
|
25
|
+
* `eth_simulateV1` of the exact call this module builds, checked against receipts of public wrap / unwrap
|
|
26
|
+
* transactions on the same chain; Sei, HyperEVM and Scroll from receipts alone (their nodes have no `eth_simulateV1`).
|
|
27
|
+
* Each figure is the dearer of the two cases the call can hit: a wrap into an empty wrapped balance (topping up a
|
|
28
|
+
* held balance uses 17 100 less; 17 940 on Polygon), an unwrap of part of the balance (clearing it earns a storage
|
|
29
|
+
* refund: 4 788 less; 3 948 on Polygon). A chain or a direction without an entry was not measured to that standard —
|
|
30
|
+
* its quote carries no estimate.
|
|
31
|
+
*/
|
|
32
|
+
declare const WRAP_GAS: Readonly<Record<number, Readonly<{
|
|
33
|
+
wrap?: string;
|
|
34
|
+
unwrap?: string;
|
|
35
|
+
}>>>;
|
|
13
36
|
interface WrapProviderConfig {
|
|
14
37
|
enabled?: boolean;
|
|
15
38
|
/** JSON-RPC endpoints per EVM chain id (on-chain token check + receipt tracking). */
|
|
@@ -41,4 +64,4 @@ declare function wrapVerifyQuote(params: QuoteParams, quote: Quote): string | nu
|
|
|
41
64
|
*/
|
|
42
65
|
declare const wrapPins: RemotePins;
|
|
43
66
|
|
|
44
|
-
export { WRAPPED_NATIVE, type WrapProviderConfig, wrapPins, wrapProvider, wrapVerifyQuote };
|
|
67
|
+
export { WRAPPED_NATIVE, WRAP_GAS, WRAP_GAS_LIMIT, type WrapProviderConfig, wrapGasLimit, wrapPins, wrapProvider, wrapVerifyQuote };
|
package/dist/provider.d.ts
CHANGED
|
@@ -10,6 +10,29 @@ declare const WRAPPED_NATIVE: Readonly<Record<number, {
|
|
|
10
10
|
address: `0x${string}`;
|
|
11
11
|
symbol: string;
|
|
12
12
|
}>>;
|
|
13
|
+
/**
|
|
14
|
+
* Chains where a wrap or an unwrap needs more than 90 000 gas — `eth_estimateGas` on 2026-11-28
|
|
15
|
+
* (`fixtures/gas/limits-2026-11-28.json`): a deposit() into an empty balance from a fresh address, a withdraw() of
|
|
16
|
+
* part of a real holder's balance. Each limit leaves at least half again over the dearer figure; the gas a
|
|
17
|
+
* transaction does not use is not charged on these chains.
|
|
18
|
+
*/
|
|
19
|
+
declare const WRAP_GAS_LIMIT: Readonly<Record<number, string>>;
|
|
20
|
+
/** The gas limit a wrap / unwrap on `chainId` is sent with. */
|
|
21
|
+
declare function wrapGasLimit(chainId: number): string;
|
|
22
|
+
/**
|
|
23
|
+
* Gas a wrap (`deposit()`) and an unwrap (`withdraw(amount)`) use on each chain's pinned wrapper in
|
|
24
|
+
* {@link WRAPPED_NATIVE} — the quote's `gasEstimate`, source `"model"`. Measured 2026-11-28 (README, "Gas estimate"):
|
|
25
|
+
* `eth_simulateV1` of the exact call this module builds, checked against receipts of public wrap / unwrap
|
|
26
|
+
* transactions on the same chain; Sei, HyperEVM and Scroll from receipts alone (their nodes have no `eth_simulateV1`).
|
|
27
|
+
* Each figure is the dearer of the two cases the call can hit: a wrap into an empty wrapped balance (topping up a
|
|
28
|
+
* held balance uses 17 100 less; 17 940 on Polygon), an unwrap of part of the balance (clearing it earns a storage
|
|
29
|
+
* refund: 4 788 less; 3 948 on Polygon). A chain or a direction without an entry was not measured to that standard —
|
|
30
|
+
* its quote carries no estimate.
|
|
31
|
+
*/
|
|
32
|
+
declare const WRAP_GAS: Readonly<Record<number, Readonly<{
|
|
33
|
+
wrap?: string;
|
|
34
|
+
unwrap?: string;
|
|
35
|
+
}>>>;
|
|
13
36
|
interface WrapProviderConfig {
|
|
14
37
|
enabled?: boolean;
|
|
15
38
|
/** JSON-RPC endpoints per EVM chain id (on-chain token check + receipt tracking). */
|
|
@@ -41,4 +64,4 @@ declare function wrapVerifyQuote(params: QuoteParams, quote: Quote): string | nu
|
|
|
41
64
|
*/
|
|
42
65
|
declare const wrapPins: RemotePins;
|
|
43
66
|
|
|
44
|
-
export { WRAPPED_NATIVE, type WrapProviderConfig, wrapPins, wrapProvider, wrapVerifyQuote };
|
|
67
|
+
export { WRAPPED_NATIVE, WRAP_GAS, WRAP_GAS_LIMIT, type WrapProviderConfig, wrapGasLimit, wrapPins, wrapProvider, wrapVerifyQuote };
|
package/dist/provider.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WRAPPED_NATIVE,
|
|
3
|
+
WRAP_GAS,
|
|
4
|
+
WRAP_GAS_LIMIT,
|
|
5
|
+
wrapGasLimit,
|
|
3
6
|
wrapPins,
|
|
4
7
|
wrapProvider,
|
|
5
8
|
wrapVerifyQuote
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-GSASQDDV.js";
|
|
7
10
|
export {
|
|
8
11
|
WRAPPED_NATIVE,
|
|
12
|
+
WRAP_GAS,
|
|
13
|
+
WRAP_GAS_LIMIT,
|
|
14
|
+
wrapGasLimit,
|
|
9
15
|
wrapPins,
|
|
10
16
|
wrapProvider,
|
|
11
17
|
wrapVerifyQuote
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anywalletkit/protocol-swap2-wrap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Wrap and unwrap the native coin (ETH↔WETH, BNB↔WBNB, POL↔WPOL…) on 13 EVM chains as a swap2 venue: 1:1, no pool, wrapped tokens verified on-chain.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://docs.anywallet.tech",
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"viem": "^2.57.2",
|
|
48
|
-
"@anywalletkit/swap2-
|
|
49
|
-
"@anywalletkit/
|
|
48
|
+
"@anywalletkit/protocol-swap2-core": "0.19.0",
|
|
49
|
+
"@anywalletkit/swap2-assets": "0.3.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@anywalletkit/core": "0.
|
|
52
|
+
"@anywalletkit/core": "0.10.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/node": "^22",
|
|
56
56
|
"vitest": "^5.1.0",
|
|
57
|
-
"@anywalletkit/conformance": "0.
|
|
58
|
-
"@anywalletkit/core": "0.
|
|
57
|
+
"@anywalletkit/conformance": "0.7.0",
|
|
58
|
+
"@anywalletkit/core": "0.10.0"
|
|
59
59
|
},
|
|
60
60
|
"keywords": [
|
|
61
61
|
"wrap",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/activity.ts","../src/provider.ts"],"sourcesContent":["/**\n * Activity recognition for the Wrap module: WETH9 `deposit()` → `wrap`\n * (\"Wrapped ETH\"), `withdraw(uint256)` → `unwrap` (\"Unwrapped WETH\"), on the\n * wrapper the table (or the caller's override) names for the chain.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {assetLabel, describeSwapLike, matchesCall, ownerAssets} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {evmRef, isEvm} from \"@anywalletkit/protocol-swap2-core/util\";\nimport {WRAPPED_NATIVE} from \"./provider.js\";\n\nexport const WRAP_MODULE = \"@anywalletkit/protocol-swap2-wrap\";\n\n/** deposit() */\nexport const WETH_DEPOSIT = \"0xd0e30db0\";\n/** withdraw(uint256 wad) */\nexport const WETH_WITHDRAW = \"0x2e1a7d4d\";\n\nexport function describeWrapActivity(\n tx: ChainTx,\n ctx: DescribeActivityContext,\n wrapped: Readonly<Record<number, {address: `0x${string}`; symbol: string}>> = WRAPPED_NATIVE,\n): ActivityItem | null {\n if (!isEvm(tx.chain)) return null;\n const w = wrapped[evmRef(tx.chain)];\n if (!w) return null;\n const isDeposit = matchesCall(tx, [w.address], [WETH_DEPOSIT]);\n const isWithdraw = !isDeposit && matchesCall(tx, [w.address], [WETH_WITHDRAW]);\n if (!isDeposit && !isWithdraw) return null;\n const {assetsIn, assetsOut} = ownerAssets(tx, ctx);\n const native = [...assetsIn, ...assetsOut].find((a) => a.token === null);\n const nativeLabel = native ? assetLabel(tx, native) : w.symbol.replace(/^[Ww]/, \"\");\n return describeSwapLike(tx, ctx, {\n protocol: WRAP_MODULE,\n subtitle: w.symbol,\n kind: isDeposit ? \"wrap\" : \"unwrap\",\n title: isDeposit ? `Wrapped ${nativeLabel}` : `Unwrapped ${w.symbol}`,\n });\n}\n","import type {RemotePins} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {decodeFunctionData, decodeFunctionResult, encodeFunctionData, getAddress, parseAbi, type Hex} from \"viem\";\nimport {describeWrapActivity} from \"./activity.js\";\nimport {ccAsset} from \"@anywalletkit/swap2-assets\";\nimport {evmRef, isEvm, timeoutSignal} from \"@anywalletkit/protocol-swap2-core/util\";\nimport {httpRefusal, refusal, refusalNotes, refusalOf, withReason, type Swap2RefusalInfo, type Swap2RefusalReason} from \"@anywalletkit/protocol-swap2-core/errors\";\nimport type {Asset, CrossChainProvider, IntentRef, IntentStatus, Quote, QuoteParams, UnsignedTx} from \"@anywalletkit/protocol-swap2-core/types\";\n\n/**\n * The chain's canonical wrapped native token (WETH9-style `deposit()` /\n * `withdraw(uint256)`). Every entry was checked on-chain 2026-10-12: symbol,\n * 18 decimals, non-zero supply, and `deposit()` succeeding for a funded sender.\n * The provider re-checks symbol + decimals once per chain before quoting.\n */\nexport const WRAPPED_NATIVE: Readonly<Record<number, {address: `0x${string}`; symbol: string}>> = Object.freeze({\n 1: {address: \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\", symbol: \"WETH\"},\n 10: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 56: {address: \"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c\", symbol: \"WBNB\"},\n 100: {address: \"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d\", symbol: \"WXDAI\"},\n 130: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 137: {address: \"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270\", symbol: \"WPOL\"},\n 143: {address: \"0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A\", symbol: \"WMON\"},\n 999: {address: \"0x5555555555555555555555555555555555555555\", symbol: \"WHYPE\"},\n 324: {address: \"0x5AEa5775959fBC2557Cc8789bC1bf90A239D9a91\", symbol: \"WETH\"},\n 4326: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 9745: {address: \"0x6100E367285b01F48D07953803A2d8dCA5D19873\", symbol: \"WXPL\"},\n 146: {address: \"0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38\", symbol: \"wS\"},\n 59144: {address: \"0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f\", symbol: \"WETH\"},\n 8453: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 42161: {address: \"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1\", symbol: \"WETH\"},\n 43114: {address: \"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7\", symbol: \"WAVAX\"},\n 80094: {address: \"0x6969696969696969696969696969696969696969\", symbol: \"WBERA\"},\n 534352: {address: \"0x5300000000000000000000000000000000000004\", symbol: \"WETH\"},\n // 2026-10-13: World Chain, Sei, Ink, Plume, X Layer — verified on-chain (symbol, decimals, supply, deposit()).\n 480: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 1329: {address: \"0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7\", symbol: \"WSEI\"},\n 57073: {address: \"0x4200000000000000000000000000000000000006\", symbol: \"WETH\"},\n 98866: {address: \"0xEa237441c92CAe6FC17Caaf9a7acB3f953be4bd1\", symbol: \"WPLUME\"},\n 196: {address: \"0xe538905cf8410324e03A5A23C1c177a474D59b2b\", symbol: \"WOKB\"},\n // 2026-10-14: Mantle, Katana, Morph, Flare — symbol, 18 decimals, supply, deposit()/withdraw() selectors in the\n // bytecode and eth_estimateGas of deposit() with value from a funded sender, all checked on-chain. Katana's WETH9 is\n // Vault Bridge's vbETH (the on-chain symbol the verify step compares against; the catalog shows it as WETH).\n // Arc has no wrapper by design: its native USDC already exposes an ERC-20 interface (docs.arc.network).\n 5000: {address: \"0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8\", symbol: \"WMNT\"},\n 747474: {address: \"0xEE7D8BCFb72bC1880D0Cf19822eB0A2e6577aB62\", symbol: \"vbETH\"},\n 2818: {address: \"0x5300000000000000000000000000000000000011\", symbol: \"WETH\"},\n 14: {address: \"0x1D80c49BbBCd1C0911346656B529DF9E5c2F783d\", symbol: \"WFLR\"},\n // 2026-11-10: Elysium (Kinetiq, Arbitrum Orbit on HyperEVM). WHYPE is the chain's aeWETH behind a transparent proxy\n // (implementation 0xf098…0542): symbol \"WHYPE\", 18 decimals, native balance == totalSupply() (read 2026-11-10),\n // deposit() / withdraw(uint256) in the implementation's bytecode, eth_estimateGas of deposit() with value from a\n // funded sender and of withdraw(1e15) from a holder both pass, withdraw from an empty account reverts \"burn amount\n // exceeds balance\". It emits Transfer mint / burn, not WETH9's Deposit / Withdrawal — activity reads the call.\n 99901: {address: \"0xbA876237B0F021A6c6D852d6c26E107997cC5E81\", symbol: \"WHYPE\"},\n});\n\nconst WETH_ABI = parseAbi([\n \"function deposit() payable\",\n \"function withdraw(uint256 wad)\",\n \"function symbol() view returns (string)\",\n \"function decimals() view returns (uint8)\",\n]);\n/** deposit/withdraw on WETH9 cost ~30-45k; a generous cap, the account still estimates. */\nconst GAS_LIMIT = \"90000\";\n\nexport interface WrapProviderConfig {\n enabled?: boolean;\n /** JSON-RPC endpoints per EVM chain id (on-chain token check + receipt tracking). */\n rpcUrls: Readonly<Record<number, readonly string[]>>;\n /** Override the wrapped tokens (tests, new chains). Still verified on-chain before use. */\n wrapped?: Readonly<Record<number, {address: `0x${string}`; symbol: string}>>;\n}\n\n/**\n * Native ↔ wrapped native as a swap2 venue: `deposit()` with value to wrap,\n * `withdraw(amount)` to unwrap. 1:1, no pool, no slippage, no approval. WETH9\n * credits and pays `msg.sender`, so the recipient must be the sender — a wrap\n * \"to someone else\" is refused rather than silently paid to the wrong place.\n */\nexport function wrapProvider(config: WrapProviderConfig): CrossChainProvider {\n const wrapped = config.wrapped ?? WRAPPED_NATIVE;\n const verified = new Map<number, Promise<void>>();\n\n const chainIdOf = (caip2: string): number | null => {\n if (!isEvm(caip2)) return null;\n const id = evmRef(caip2);\n return wrapped[id] && config.rpcUrls[id]?.length ? id : null;\n };\n\n async function rpc(chainId: number, method: string, params: unknown[]): Promise<unknown> {\n let lastErr: unknown;\n for (const url of config.rpcUrls[chainId] ?? []) {\n try {\n const res = await fetch(url, {\n method: \"POST\",\n headers: {\"content-type\": \"application/json\"},\n body: JSON.stringify({jsonrpc: \"2.0\", id: 1, method, params}),\n signal: timeoutSignal(10_000),\n });\n // 429 rate_limited (Retry-After), 401 / 403 key_rejected, anything else the node failing.\n if (!res.ok) throw withReason(new Error(`HTTP ${res.status}`), httpRefusal(res.status, res.headers?.get?.(\"retry-after\")) ?? {reason: \"upstream_unavailable\", httpStatus: res.status});\n const body = (await res.json()) as {result?: unknown; error?: {code?: number; message?: string}};\n // A node's throttling answer (-32005 \"limit exceeded\", or a 429 code in the body): rate_limited; any other RPC error: upstream_unavailable.\n if (body.error) throw refusal(body.error.code === -32005 || body.error.code === 429 ? \"rate_limited\" : \"upstream_unavailable\", body.error.message ?? \"rpc error\");\n return body.result ?? null;\n } catch (e) {\n lastErr = e;\n }\n }\n // The last endpoint's classification (its HTTP status); a network failure, a timeout or malformed JSON: upstream_unavailable.\n throw withReason(new Error(`wrap: no RPC answered on chain ${chainId} (${lastErr instanceof Error ? lastErr.message : String(lastErr)})`), refusalOf(lastErr) ?? {reason: \"upstream_unavailable\"});\n }\n\n function verify(chainId: number): Promise<void> {\n let p = verified.get(chainId);\n if (!p) {\n const w = wrapped[chainId]!;\n p = (async () => {\n const read = async (fn: \"symbol\" | \"decimals\") =>\n decodeFunctionResult({abi: WETH_ABI, functionName: fn, data: (await rpc(chainId, \"eth_call\", [{to: w.address, data: encodeFunctionData({abi: WETH_ABI, functionName: fn})}, \"latest\"])) as Hex});\n const [symbol, decimals] = await Promise.all([read(\"symbol\"), read(\"decimals\")]);\n if (symbol !== w.symbol || Number(decimals) !== 18) throw refusal(\"vault_mismatch\", `wrap: ${w.address} on chain ${chainId} is not ${w.symbol} — refusing`);\n })();\n p.catch(() => verified.delete(chainId));\n verified.set(chainId, p);\n }\n return p;\n }\n\n return {\n name: \"wrap\",\n describeActivity: (tx, ctx) => describeWrapActivity(tx, ctx, wrapped),\n supportsSameChain: true,\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): boolean {\n return from.chain === to.chain && chainIdOf(from.chain) !== null;\n },\n\n async getQuote(params: QuoteParams): Promise<Quote | null> {\n // The reason goes to onRefusal next to the text; an unclassified refusal (a developer's bad argument) has none.\n const refuse = (why: string, reason?: Swap2RefusalReason | Swap2RefusalInfo): null => {\n const info = typeof reason === \"string\" ? {reason} : reason;\n if (info) params.onRefusal?.(`wrap: ${why}`, info);\n else params.onRefusal?.(`wrap: ${why}`);\n return null;\n };\n if (params.flex) return refuse(\"amount-flexible deposits are not supported\", \"unsupported_pair\");\n if (params.sourceChain !== params.destChain) return refuse(\"same-chain only\", \"unsupported_pair\");\n const chainId = chainIdOf(params.sourceChain);\n if (chainId === null) return refuse(`no wrapped native token or RPC for ${params.sourceChain}`, \"unsupported_pair\");\n const w = wrapped[chainId]!;\n const src = ccAsset(params.sourceChain, params.sourceToken);\n if (!src) return refuse(`unknown source token ${params.sourceToken}`, \"unsupported_pair\");\n const nativeIn = !src.contract;\n const srcIsWrapped = !!src.contract && /^0x[0-9a-fA-F]{40}$/.test(src.contract) && getAddress(src.contract) === getAddress(w.address);\n const nativeOut = /^0x0+$/.test(params.destToken);\n const destIsWrapped = /^0x[0-9a-fA-F]{40}$/.test(params.destToken) && !nativeOut && getAddress(params.destToken) === getAddress(w.address);\n const wrap = nativeIn && destIsWrapped;\n const unwrap = srcIsWrapped && nativeOut;\n if (!wrap && !unwrap) return refuse(`only ${w.symbol.slice(1)} ↔ ${w.symbol}`, \"unsupported_pair\");\n // WETH9 credits / pays msg.sender: the recipient can only be the sender.\n if (params.refundAddress && /^0x[0-9a-fA-F]{40}$/.test(params.refundAddress) && getAddress(params.refundAddress) !== getAddress(params.destAddress)) {\n return refuse(\"wrapping pays the sender's own address — send the result separately\", \"recipient_mismatch\");\n }\n let amount: bigint;\n try {\n amount = BigInt(params.amountIn);\n } catch {\n return refuse(\"amount is not an integer\");\n }\n if (amount <= 0n) return refuse(\"amount must be positive\", \"amount_too_small\");\n if (params.minAmountOut !== undefined && amount < BigInt(params.minAmountOut)) return refuse(`floor breach (min=${amount} < floor=${params.minAmountOut})`, \"price_check_failed\");\n try {\n await verify(chainId);\n } catch (e) {\n // vault_mismatch for a contract that is not the pinned wrapper; the RPC's own failure; an undecodable answer: upstream_unavailable.\n return refuse(e instanceof Error ? e.message.replace(/^wrap: /, \"\") : String(e), refusalOf(e) ?? \"upstream_unavailable\");\n }\n const data = wrap ? encodeFunctionData({abi: WETH_ABI, functionName: \"deposit\"}) : encodeFunctionData({abi: WETH_ABI, functionName: \"withdraw\", args: [amount]});\n return {\n provider: \"wrap\",\n intentId: `wrap:${chainId}`,\n depositAddress: \"\",\n depositMemo: null,\n txRequest: {to: w.address, data, value: wrap ? amount.toString() : \"0\", chainId, gasLimit: GAS_LIMIT},\n sourceAmount: amount.toString(),\n destAmount: amount.toString(),\n minDestAmount: amount.toString(),\n feeUsd: 0,\n etaSeconds: 15,\n reliability: 0.995,\n validUntilMs: Date.now() + 5 * 60_000,\n providerData: {action: wrap ? \"wrap\" : \"unwrap\", token: w.address},\n };\n },\n\n async buildDeposit(quote: Quote): Promise<UnsignedTx> {\n const tx = quote.txRequest;\n if (!tx?.to || !tx.data) throw refusal(\"policy_refused\", \"swap2: wrap quote has no transaction request\");\n return {chain: \"\", to: tx.to, value: tx.value ?? \"0\", data: tx.data, ...(tx.chainId !== undefined ? {chainId: tx.chainId} : {}), ...(tx.gasLimit ? {gasLimit: tx.gasLimit} : {})};\n },\n\n async trackIntent(ref: IntentRef): Promise<IntentStatus> {\n if (!ref.sourceTxHash) return {state: \"pending\"};\n const chainId = Number(ref.intentId.split(\":\")[1]);\n if (!wrapped[chainId] || !config.rpcUrls[chainId]?.length) return {state: \"pending\"};\n try {\n const receipt = (await rpc(chainId, \"eth_getTransactionReceipt\", [ref.sourceTxHash])) as {status?: string} | null;\n if (!receipt) return {state: \"pending\"};\n return receipt.status === \"0x1\" ? {state: \"completed\", destTxHash: ref.sourceTxHash} : {state: \"failed\"};\n } catch {\n return {state: \"pending\"};\n }\n },\n };\n}\n\n/**\n * The reason behind each text {@link wrapVerifyQuote} returns, read back by `wrapPins.reasonOf` so a remote stub's\n * refusal carries it: a pair or route this venue does not serve (`unsupported_pair`), a recipient other than the\n * sender (`recipient_mismatch`), another contract or an approval (`vault_mismatch`), amounts that are not integers\n * (`upstream_unavailable`), any other call, chain, amount or value (`policy_refused`).\n */\nconst notes = refusalNotes();\nconst note = notes.note;\n\n/**\n * `read(value)` over a field of the backend's quote. What it throws (an amount that is not an integer, a target that is\n * not an address) is thrown as before; its text is noted (`upstream_unavailable`: an answer of another shape), so the\n * stub's \"fails this app's own check\" carries the reason.\n */\nfunction shaped<A, R>(read: (value: A) => R, value: A): R {\n try {\n return read(value);\n } catch (e) {\n if (e instanceof Error) note(e.message, \"upstream_unavailable\");\n throw e;\n }\n}\n\nfunction wrappedFor(chain: string): {address: `0x${string}`; symbol: string} | undefined {\n const id = /^eip155:[0-9]+$/.test(chain) ? Number(chain.slice(7)) : NaN;\n return Object.prototype.hasOwnProperty.call(WRAPPED_NATIVE, id) ? WRAPPED_NATIVE[id] : undefined;\n}\n\n/**\n * A remote wrap / unwrap quote, decoded on the device against the app's own request (scan 2026-10-30, F3): native →\n * wrapped is exactly `deposit()` with the input as value; wrapped → native is exactly `withdraw(input)` with no value;\n * on the chain's wrapped native, no approval, and (as WETH9 pays `msg.sender`) a recipient that is the sender. The\n * reason it fails, or null.\n */\nexport function wrapVerifyQuote(params: QuoteParams, quote: Quote): string | null {\n const w = wrappedFor(params.sourceChain);\n if (!w || params.destChain !== params.sourceChain) return note(\"not a same-chain wrap on a pinned wrapped native\", \"unsupported_pair\");\n const src = ccAsset(params.sourceChain, params.sourceToken);\n if (!src) return note(`unknown source token ${params.sourceToken}`, \"unsupported_pair\");\n const nativeIn = !src.contract;\n const srcIsWrapped = !!src.contract && /^0x[0-9a-fA-F]{40}$/.test(src.contract) && getAddress(src.contract) === getAddress(w.address);\n const nativeOut = /^0x0+$/.test(params.destToken);\n const destIsWrapped = /^0x[0-9a-fA-F]{40}$/.test(params.destToken) && !nativeOut && getAddress(params.destToken) === getAddress(w.address);\n const wrap = nativeIn && destIsWrapped;\n if (!wrap && !(srcIsWrapped && nativeOut)) return note(`only ${w.symbol.slice(1)} ↔ ${w.symbol}`, \"unsupported_pair\");\n if (params.refundAddress && /^0x[0-9a-fA-F]{40}$/.test(params.refundAddress) && (!/^0x[0-9a-fA-F]{40}$/.test(params.destAddress) || getAddress(params.refundAddress) !== getAddress(params.destAddress))) {\n return note(\"wrapping pays the sender's own address\", \"recipient_mismatch\");\n }\n const tx = quote.txRequest;\n if (!tx?.data || !tx.to || tx.serializedTx !== undefined) return note(\"the quote carries no wrapped-native call\", \"policy_refused\");\n if (shaped(getAddress, tx.to) !== getAddress(w.address)) return note(`the call targets ${tx.to}, not ${w.symbol}`, \"vault_mismatch\");\n if (tx.approvalAddress !== undefined) return note(\"a wrap approves nothing\", \"vault_mismatch\");\n if (tx.chainId !== undefined && `eip155:${tx.chainId}` !== params.sourceChain) return note(`the call is for chain ${tx.chainId}`, \"policy_refused\");\n let amount: bigint, value: bigint;\n try {\n amount = BigInt(params.amountIn);\n value = BigInt(tx.value ?? \"0\");\n } catch {\n return note(\"the request does not name amounts\", \"upstream_unavailable\");\n }\n if (shaped(BigInt, quote.sourceAmount) !== amount) return note(`the quote moves ${quote.sourceAmount}, not the ${amount} input`, \"policy_refused\");\n let call: {functionName: string; args?: readonly unknown[]};\n try {\n call = decodeFunctionData({abi: WETH_ABI, data: tx.data as Hex});\n } catch {\n return note(\"the call is neither deposit() nor withdraw(amount)\", \"policy_refused\");\n }\n if (wrap) {\n if (call.functionName !== \"deposit\" || tx.data.length !== 10) return note(`${call.functionName} is not deposit()`, \"policy_refused\");\n if (value !== amount) return note(`deposit() attaches ${value}, not the ${amount} input`, \"policy_refused\");\n } else {\n if (call.functionName !== \"withdraw\") return note(`${call.functionName} is not withdraw(amount)`, \"policy_refused\");\n if (call.args?.[0] !== amount) return note(`withdraw(${String(call.args?.[0])}) is not the ${amount} input`, \"policy_refused\");\n if (value !== 0n) return note(\"withdraw attaches no value\", \"policy_refused\");\n }\n return null;\n}\n\n/**\n * The wrapped-native contract a wrap / unwrap calls on a chain (no spender: neither approves), and\n * {@link wrapVerifyQuote} — the app's pins for `remoteProvider({name: \"wrap\", baseUrl, ...wrapPins})` (scan\n * 2026-10-27 modules, F8/F16; the call itself since scan 2026-10-30, F3).\n */\nexport const wrapPins: RemotePins = Object.freeze({\n callTargets: (chain: string): readonly string[] => {\n const w = wrappedFor(chain);\n return w ? [w.address] : [];\n },\n spenders: (): readonly string[] => [],\n verifyQuote: wrapVerifyQuote,\n reasonOf: notes.reasonOf,\n});\n"],"mappings":";AAMA,SAAQ,YAAY,kBAAkB,aAAa,mBAAkB;AACrE,SAAQ,UAAAA,SAAQ,SAAAC,cAAY;;;ACN5B,SAAQ,oBAAoB,sBAAsB,oBAAoB,YAAY,gBAAyB;AAE3G,SAAQ,eAAc;AACtB,SAAQ,QAAQ,OAAO,qBAAoB;AAC3C,SAAQ,aAAa,SAAS,cAAc,WAAW,kBAAiE;AASjH,IAAM,iBAAqF,OAAO,OAAO;AAAA,EAC9G,GAAG,EAAC,SAAS,8CAA8C,QAAQ,OAAM;AAAA,EACzE,IAAI,EAAC,SAAS,8CAA8C,QAAQ,OAAM;AAAA,EAC1E,IAAI,EAAC,SAAS,8CAA8C,QAAQ,OAAM;AAAA,EA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