@anywalletkit/protocol-swap2-cctp 0.5.3 → 0.5.5

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/provider.ts","../src/activity.ts","../src/config.ts"],"sourcesContent":["import type {RemotePins} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {createPublicClient, decodeFunctionData, encodeFunctionData, getAddress, http, isAddress, pad, parseAbi, zeroHash, type Hex} from \"viem\";\nimport {describeCctpActivity} from \"./activity.js\";\nimport {ccAsset} from \"@anywalletkit/swap2-assets\";\nimport {timeoutSignal} from \"@anywalletkit/protocol-swap2-core/util\";\nimport type {Asset, CrossChainProvider, IntentRef, IntentStatus, Quote, QuoteParams, UnsignedTx} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {CCTP_API, CCTP_BY_DOMAIN, CCTP_DOMAINS, FINALITY_FAST, FINALITY_STANDARD, cctp as cctpCfg, type CctpDomain} from \"./config.js\";\nimport {bigintToNumber} from \"@anywalletkit/core\";\n\n/**\n * Circle CCTP V2 — native USDC between chains by burn-and-mint, no spread, no\n * aggregator fee. TWO-PHASE: `depositForBurn` on the source burns the USDC and\n * emits the message; Circle's attestation service (Iris) signs it once the\n * source reached the requested finality; `receiveMessage(message, attestation)`\n * on the destination mints. That second transaction is the user's: the engine\n * exposes it through `buildClaim` / `claimSwap2` (status \"action-required\").\n *\n * - Fast Transfer (finality 1000, confirmed, ~seconds–minutes) costs a fee in\n * bps that Circle publishes per pair; Standard (2000, finalized, ~15 min)\n * is free. `mode: \"auto\"` takes Fast when the pair offers it and the Fast\n * allowance covers the amount, else Standard.\n * - `maxFee` sent on-chain is the published fee (plus a small buffer) and is\n * the only thing that can be deducted: the guaranteed output is\n * amount − maxFee. `preflightDeposit` re-reads Circle's published fee right\n * before the burn (the deployed TokenMessengerV2 has no on-chain\n * `getMinFeeAmount`/`minFee` — both revert on Ethereum, Base, Arbitrum,\n * 2026-10-12) and, with an RPC for the source chain, the transmitter's\n * `localDomain()` on the very contract the calldata targets.\n * - Everything is bound to Circle's documented contract addresses and the\n * native USDC of each domain; a catalog USDC that is not the native one\n * refuses the route (USDC.e cannot be burnt).\n */\n\nconst TOKEN_MESSENGER_ABI = parseAbi([\n \"function depositForBurn(uint256 amount, uint32 destinationDomain, bytes32 mintRecipient, address burnToken, bytes32 destinationCaller, uint256 maxFee, uint32 minFinalityThreshold)\",\n \"function localMessageTransmitter() view returns (address)\",\n]);\nconst MESSAGE_TRANSMITTER_ABI = parseAbi([\n \"function receiveMessage(bytes message, bytes attestation) returns (bool)\",\n \"function localDomain() view returns (uint32)\",\n \"function usedNonces(bytes32 nonce) view returns (uint256)\",\n]);\n\nconst EVM_PLACEHOLDER = \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\";\nconst DEFAULT_QUOTE_TTL_MS = 60_000;\n/** Fallback gas limit: a depositForBurn runs ~110–150k, receiveMessage ~150–200k. */\nconst GAS_DEPOSIT = \"200000\";\nconst GAS_CLAIM = \"260000\";\n\nexport type CctpMode = \"auto\" | \"fast\" | \"standard\";\n\nexport interface CctpProviderConfig {\n enabled?: boolean;\n /** Circle attestation API base (default https://iris-api.circle.com). */\n apiUrl?: string;\n /** Fast when offered and within the allowance (default), or force one path. */\n mode?: CctpMode;\n /** Extra headroom on the published Fast fee, in percent of the fee (default 10). The excess is never charged. */\n feeBufferPct?: number;\n /**\n * JSON-RPC URLs per CAIP-2 chain. Optional, but with them the provider\n * verifies the contracts before the burn and detects the mint on the\n * destination (`usedNonces`). Without the destination chain's URL the status\n * reaches \"completed\" only through the id `claimSwap2` returns for a claim the\n * account saw succeed; a bare claim hash stays \"pending\" (hash kept).\n */\n rpcUrls?: Readonly<Record<string, string>>;\n /** Local lifetime of a quote (fees are stable; default 60 s). */\n quoteTtlMs?: number;\n /** Injectable for tests. */\n fetchImpl?: typeof fetch;\n}\n\ninterface FeeRow { finalityThreshold: number; minimumFee: number }\ninterface ApiMessage {\n message?: string;\n eventNonce?: string;\n attestation?: string | null;\n status?: string;\n delayReason?: string | null;\n cctpVersion?: number;\n decodedMessage?: {\n sourceDomain?: string; destinationDomain?: string; nonce?: string; mintRecipient?: string;\n decodedMessageBody?: {amount?: string; maxFee?: string; feeExecuted?: string; expirationBlock?: string; mintRecipient?: string; burnToken?: string};\n };\n}\n\nconst isHexData = (v: unknown): v is Hex => typeof v === \"string\" && /^0x(?:[0-9a-fA-F]{2})+$/.test(v);\nconst same = (a: string | undefined, b: string) => !!a && a.toLowerCase() === b.toLowerCase();\n\n/** `amount × bps` rounded up; `bps` may be fractional (Circle publishes 1.3). */\nfunction feeFor(amount: bigint, bps: number, bufferPct: number): bigint {\n const hundredths = BigInt(Math.round(bps * 100)); // 1.3 bps → 130\n const fee = (amount * hundredths + 999_999n) / 1_000_000n;\n if (fee === 0n) return 0n;\n return fee + (fee * BigInt(Math.round(bufferPct * 100)) + 9_999n) / 10_000n;\n}\n\n/**\n * The contracts a CCTP claim may call on `chain`: its MessageTransmitter (`receiveMessage`). Pass it\n * as `claimTargets` to a remote provider stub so the app, not the server, decides (round 3, M24).\n */\nexport function cctpClaimTargets(chain: string): readonly string[] {\n const d = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, chain) ? CCTP_DOMAINS[chain] : undefined;\n return d ? [d.messageTransmitter] : [];\n}\n\nexport function cctpProvider(config: CctpProviderConfig = {}): CrossChainProvider {\n config = Object.freeze({...config});\n const api = (config.apiUrl ?? CCTP_API).replace(/\\/+$/, \"\");\n if (!/^https?:\\/\\//.test(api)) throw new Error(\"cctp: apiUrl must use http or https\");\n const mode: CctpMode = config.mode ?? \"auto\";\n if (![\"auto\", \"fast\", \"standard\"].includes(mode)) throw new Error(\"cctp: mode must be auto | fast | standard\");\n const bufferPct = config.feeBufferPct ?? 10;\n if (!Number.isFinite(bufferPct) || bufferPct < 0 || bufferPct > 100) throw new Error(\"cctp: feeBufferPct must be between 0 and 100\");\n const quoteTtlMs = config.quoteTtlMs ?? DEFAULT_QUOTE_TTL_MS;\n if (!Number.isInteger(quoteTtlMs) || quoteTtlMs <= 0 || quoteTtlMs > 300_000) throw new Error(\"cctp: quoteTtlMs must be an integer between 1 and 300000\");\n const doFetch = config.fetchImpl ?? fetch;\n const rpcUrls = Object.freeze({...(config.rpcUrls ?? {})});\n\n const client = (caip2: string) => {\n const url = rpcUrls[caip2];\n return url ? createPublicClient({transport: http(url, {fetchOptions: {}, ...(config.fetchImpl ? {fetchFn: config.fetchImpl} : {})} as never), ccipRead: false}) : null;\n };\n\n async function getJson<T>(path: string, signal?: AbortSignal): Promise<T | null> {\n const res = await doFetch(`${api}${path}`, {headers: {accept: \"application/json\"}, signal: signal ?? timeoutSignal(12_000)});\n if (res.status === 404) return null;\n if (!res.ok) throw new Error(`cctp: ${path} → ${res.status}`);\n return (await res.json()) as T;\n }\n\n /** Circle's published fee per finality threshold, in bps of the burnt amount. */\n const feeRows = (src: CctpDomain, dst: CctpDomain, signal?: AbortSignal) =>\n getJson<FeeRow[]>(`/v2/burn/USDC/fees/${src.domain}/${dst.domain}`, signal);\n\n /** The native USDC of a domain, cross-checked against the asset catalog when it knows the chain. */\n function usdcOf(dom: CctpDomain): string | null {\n const known = ccAsset(dom.caip2, \"USDC\");\n if (known && (!known.contract || !same(known.contract, dom.usdc))) return null; // catalog has a USDC that is not Circle's → refuse\n return dom.usdc;\n }\n\n function parseIntent(intentId: string): {src: CctpDomain; dst: CctpDomain; threshold: number} | null {\n const [tag, s, dd, t] = intentId.split(\":\");\n if (tag !== \"cctp\") return null;\n const src = CCTP_BY_DOMAIN[Number(s)];\n const dst = CCTP_BY_DOMAIN[Number(dd)];\n const threshold = Number(t);\n if (!src || !dst || !(threshold === FINALITY_FAST || threshold === FINALITY_STANDARD)) return null;\n return {src, dst, threshold};\n }\n\n async function fetchMessage(src: CctpDomain, sourceTxHash: string): Promise<ApiMessage | null> {\n const out = await getJson<{messages?: ApiMessage[]}>(`/v2/messages/${src.domain}?transactionHash=${encodeURIComponent(sourceTxHash)}`);\n const m = out?.messages?.find((x) => x.cctpVersion === undefined || x.cctpVersion === 2);\n return m ?? null;\n }\n\n /** The nonce's state on the destination: null without an RPC there, \"unknown\" when the configured RPC fails to answer. */\n async function minted(dst: CctpDomain, nonce: Hex): Promise<boolean | null | \"unknown\"> {\n const c = client(dst.caip2);\n if (!c) return null;\n try {\n const used = await c.readContract({address: getAddress(dst.messageTransmitter), abi: MESSAGE_TRANSMITTER_ABI, functionName: \"usedNonces\", args: [nonce]});\n return used !== 0n;\n } catch {\n return \"unknown\";\n }\n }\n\n return {\n name: \"cctp\",\n claimTargets: cctpClaimTargets,\n describeActivity: describeCctpActivity,\n enabled: () => config.enabled ?? true,\n supportsChain: (chain: string) => cctpCfg.supportsChain(chain),\n supportsChainPair: (from: string, to: string) => cctpCfg.supports(from, to),\n supportsRoute(from: Asset, to: Asset): boolean {\n const src = CCTP_DOMAINS[from.chain];\n const dst = CCTP_DOMAINS[to.chain];\n if (!src || !dst || from.chain === to.chain) return false;\n if (from.token.toUpperCase() !== \"USDC\") return false;\n // Destination is given as an address (zero = native): only the native USDC of the destination domain.\n return same(to.token, dst.usdc) || to.token.toUpperCase() === \"USDC\";\n },\n\n async getQuote(params: QuoteParams, signal?: AbortSignal): Promise<Quote | null> {\n if (params.flex) return null; // the amount is baked into the calldata\n const src = CCTP_DOMAINS[params.sourceChain];\n const dst = CCTP_DOMAINS[params.destChain];\n if (!src || !dst || src === dst) return null;\n if (params.sourceToken.toUpperCase() !== \"USDC\") return null;\n if (!(same(params.destToken, dst.usdc) || params.destToken.toUpperCase() === \"USDC\")) return null;\n const usdc = usdcOf(src);\n if (!usdc) { params.onRefusal?.(\"catalog USDC on the source chain is not Circle's native USDC\"); return null; }\n if (!/^\\d+$/.test(params.amountIn)) return null;\n const amount = BigInt(params.amountIn);\n if (amount <= 0n) return null;\n // The placeholder prices a dry quote; a live one without a recipient would mint to it (round 3, H8).\n const recipient = params.destAddress || (params.dry !== false ? EVM_PLACEHOLDER : \"\");\n if (!recipient) { params.onRefusal?.(\"a live quote needs a recipient\"); return null; }\n if (!isAddress(recipient)) { params.onRefusal?.(\"destination must be an EVM address\"); return null; }\n\n try {\n const fees = await feeRows(src, dst, signal);\n if (!fees || !Array.isArray(fees) || fees.length === 0) { params.onRefusal?.(\"Circle publishes no fee for this pair\"); return null; }\n const fast = fees.find((f) => f.finalityThreshold === FINALITY_FAST);\n const standard = fees.find((f) => f.finalityThreshold === FINALITY_STANDARD);\n let threshold: number;\n let bps: number;\n if (mode === \"standard\") {\n if (!standard) { params.onRefusal?.(\"Standard Transfer is not offered for this pair\"); return null; }\n threshold = FINALITY_STANDARD; bps = standard.minimumFee;\n } else {\n let fastOk = !!fast;\n if (fastOk) {\n const allowance = await getJson<{allowance?: number}>(\"/v2/fastBurn/USDC/allowance\", signal).catch(() => null);\n // The allowance is in whole USDC; refuse Fast when it cannot cover the burn.\n if (typeof allowance?.allowance === \"number\" && allowance.allowance * 1e6 < bigintToNumber(amount)) fastOk = false;\n }\n if (fastOk) { threshold = FINALITY_FAST; bps = fast!.minimumFee; }\n else if (mode === \"fast\") { params.onRefusal?.(fast ? \"Fast Transfer allowance is exhausted\" : \"Fast Transfer is not offered for this pair\"); return null; }\n else if (standard) { threshold = FINALITY_STANDARD; bps = standard.minimumFee; }\n else { params.onRefusal?.(\"neither Fast nor Standard is offered\"); return null; }\n }\n if (!Number.isFinite(bps) || bps < 0) return null;\n const maxFee = feeFor(amount, bps, bufferPct);\n if (maxFee >= amount) { params.onRefusal?.(\"amount is below the Fast Transfer fee\"); return null; }\n const out = amount - maxFee;\n if (params.minAmountOut !== undefined && out < BigInt(params.minAmountOut)) return null;\n\n const data = encodeFunctionData({\n abi: TOKEN_MESSENGER_ABI,\n functionName: \"depositForBurn\",\n args: [amount, dst.domain, pad(getAddress(recipient), {size: 32}), getAddress(usdc), zeroHash, maxFee, threshold],\n });\n const eta = threshold === FINALITY_FAST ? (src.domain === 0 ? 180 : 45) : (src.domain === 0 ? 1200 : 1000);\n return {\n provider: \"cctp\",\n intentId: `cctp:${src.domain}:${dst.domain}:${threshold}`,\n depositAddress: \"\",\n depositMemo: null,\n txRequest: {to: src.tokenMessenger, data, value: \"0\", chainId: src.chainId, gasLimit: GAS_DEPOSIT, approvalAddress: src.tokenMessenger},\n sourceAmount: amount.toString(),\n destAmount: out.toString(),\n minDestAmount: out.toString(),\n feeUsd: bigintToNumber(maxFee) / 1e6,\n fees: maxFee > 0n ? [{type: \"protocol\", amount: maxFee.toString(), token: usdc, included: true, description: `Circle Fast Transfer fee (${bps} bps + ${bufferPct}% buffer, unused part is not charged)`}] : [],\n etaSeconds: eta,\n reliability: 0.99,\n validUntilMs: Date.now() + quoteTtlMs,\n providerData: {\n sourceDomain: String(src.domain), destinationDomain: String(dst.domain), finalityThreshold: String(threshold),\n maxFee: maxFee.toString(), mintRecipient: getAddress(recipient), claimChain: dst.caip2, claimRequired: \"1\",\n },\n };\n } catch {\n return null;\n }\n },\n\n async buildDeposit(quote: Quote): Promise<UnsignedTx> {\n const tx = quote.txRequest;\n const parsed = parseIntent(quote.intentId);\n if (!tx || !parsed) throw new Error(\"swap2: CCTP quote has no transaction request\");\n return {\n chain: parsed.src.caip2,\n to: tx.to ?? \"\",\n value: tx.value ?? \"0\",\n ...(tx.data ? {data: tx.data} : {}),\n ...(tx.chainId !== undefined ? {chainId: tx.chainId} : {}),\n ...(tx.gasLimit ? {gasLimit: tx.gasLimit} : {}),\n ...(tx.approvalAddress ? {approvalAddress: tx.approvalAddress} : {}),\n };\n },\n\n /**\n * Fast: Circle's CURRENT fee (same source and rounding as the quote, without\n * the buffer) still fits `maxFee` — Iris would otherwise hold the burn\n * until it times out to Standard. With a source RPC: the target really is\n * CCTP for this domain.\n */\n async preflightDeposit(quote: Quote, tx: UnsignedTx): Promise<void> {\n const parsed = parseIntent(quote.intentId);\n if (!parsed) throw new Error(\"cctp: malformed intent id\");\n if (!same(tx.to, parsed.src.tokenMessenger)) throw new Error(\"cctp: deposit target is not the TokenMessengerV2 of the source domain\");\n if (parsed.threshold === FINALITY_FAST) {\n const fast = (await feeRows(parsed.src, parsed.dst))?.find((f) => f.finalityThreshold === FINALITY_FAST);\n if (!fast || !Number.isFinite(fast.minimumFee) || fast.minimumFee < 0) throw new Error(\"cctp: Circle no longer publishes a Fast Transfer fee for this pair — re-quote\");\n const minFee = feeFor(BigInt(quote.sourceAmount), fast.minimumFee, 0);\n const maxFee = BigInt(quote.providerData?.maxFee ?? \"0\");\n if (minFee > maxFee) throw new Error(`cctp: Circle's Fast Transfer fee ${minFee} (${fast.minimumFee} bps) exceeds the quoted maxFee ${maxFee} — re-quote`);\n }\n const c = client(parsed.src.caip2);\n if (!c) return;\n const transmitter = await c.readContract({address: getAddress(parsed.src.tokenMessenger), abi: TOKEN_MESSENGER_ABI, functionName: \"localMessageTransmitter\"});\n if (!same(transmitter, parsed.src.messageTransmitter)) throw new Error(\"cctp: TokenMessengerV2 does not point at the expected MessageTransmitterV2\");\n const domain = await c.readContract({address: getAddress(parsed.src.messageTransmitter), abi: MESSAGE_TRANSMITTER_ABI, functionName: \"localDomain\"});\n if (Number(domain) !== parsed.src.domain) throw new Error(`cctp: MessageTransmitterV2 reports domain ${domain}, expected ${parsed.src.domain}`);\n },\n\n async trackIntent(ref: IntentRef): Promise<IntentStatus> {\n const parsed = parseIntent(ref.intentId);\n if (!parsed) return {state: \"failed\"};\n const claim = {chain: parsed.dst.caip2, ready: false};\n if (!ref.sourceTxHash) return {state: \"pending\", claim};\n try {\n const m = await fetchMessage(parsed.src, ref.sourceTxHash);\n if (!m) return {state: \"pending\", depositReceived: false, claim};\n const nonce = m.decodedMessage?.nonce;\n if (m.status === \"complete\" && isHexData(m.attestation) && isHexData(m.message)) {\n // A message without a readable nonce cannot be checked on the destination even with an RPC there.\n const done = isHexData(nonce) && nonce.length === 66 ? await minted(parsed.dst, nonce) : client(parsed.dst.caip2) ? \"unknown\" : null;\n if (done === true) return {state: \"completed\", claim: {...claim, ready: false}, ...(ref.destTxHash ? {destTxHash: ref.destTxHash} : {})};\n if (ref.destTxHash) {\n // A claim the sending account saw included and succeed is the mint: receiveMessage reverts once the\n // nonce is used, so a successful one minted this message. Without a destination read that is completed;\n // a destination read that does not show it yet is a node behind the claim, not a claim to send again.\n if (ref.destTxConfirmed === true) {\n return done === false\n ? {state: \"pending\", depositReceived: true, destTxHash: ref.destTxHash, claim: {...claim, ready: false}}\n : {state: \"completed\", destTxHash: ref.destTxHash, claim: {...claim, ready: false}};\n }\n // A claim was sent, but nothing here can read whether it minted (no destination RPC, or one that did\n // not answer): the hash is kept and the swap stays pending — a hash alone is not a mint.\n if (done !== false) return {state: \"pending\", depositReceived: true, destTxHash: ref.destTxHash, claim: {...claim, ready: false}};\n }\n return {state: \"action-required\", depositReceived: true, claim: {...claim, ready: true}};\n }\n return {state: \"pending\", depositReceived: true, claim};\n } catch {\n return {state: \"pending\", claim};\n }\n },\n\n /** `receiveMessage(message, attestation)` on the destination once Circle attested; null while pending. */\n async buildClaim(ref: IntentRef): Promise<UnsignedTx | null> {\n const parsed = parseIntent(ref.intentId);\n if (!parsed || !ref.sourceTxHash) return null;\n const m = await fetchMessage(parsed.src, ref.sourceTxHash);\n if (!m || m.status !== \"complete\" || !isHexData(m.attestation) || !isHexData(m.message)) return null;\n // Bind the attested message to the route it claims to complete.\n if (m.decodedMessage?.destinationDomain !== undefined && Number(m.decodedMessage.destinationDomain) !== parsed.dst.domain) {\n throw new Error(\"cctp: attested message is for another destination domain\");\n }\n if (m.decodedMessage?.sourceDomain !== undefined && Number(m.decodedMessage.sourceDomain) !== parsed.src.domain) {\n throw new Error(\"cctp: attested message is for another source domain\");\n }\n // Fast messages expire at `expirationBlock` on the destination; an expired\n // one needs Circle's re-attestation before it can be received. The\n // transmitter compares it with `block.number`, which on Arbitrum-stack\n // chains is the L1 (Ethereum) height, not the L2 height eth_blockNumber\n // returns — the RPC block carries it as `l1BlockNumber` (live\n // 2026-10-16: a Base→Arbitrum claim was held as \"expired\" by L2 height).\n const exp = m.decodedMessage?.decodedMessageBody?.expirationBlock;\n const c = client(parsed.dst.caip2);\n if (c && exp && /^\\d+$/.test(exp) && BigInt(exp) > 0n) {\n const head = await c.request({method: \"eth_getBlockByNumber\", params: [\"latest\", false]})\n .then((b) => {\n const block = b as {number?: string; l1BlockNumber?: string} | null;\n const raw = block?.l1BlockNumber ?? block?.number;\n return raw ? BigInt(raw) : null;\n })\n .catch(() => null);\n if (head !== null && head >= BigInt(exp)) {\n const nonce = m.decodedMessage?.nonce ?? m.eventNonce;\n if (nonce) await doFetch(`${api}/v2/reattest/${nonce}`, {method: \"POST\", signal: timeoutSignal(12_000)}).catch(() => undefined);\n return null;\n }\n }\n return {\n chain: parsed.dst.caip2,\n to: parsed.dst.messageTransmitter,\n value: \"0\",\n data: encodeFunctionData({abi: MESSAGE_TRANSMITTER_ABI, functionName: \"receiveMessage\", args: [m.message, m.attestation]}),\n chainId: parsed.dst.chainId,\n gasLimit: GAS_CLAIM,\n };\n },\n };\n}\n\n/**\n * A remote CCTP quote's burn, decoded on the device against the app's own request (scan 2026-10-30, F3): exactly\n * `depositForBurn` on the source TokenMessengerV2 with no value, approving it; the input amount; the destination\n * chain's domain; the recipient as `mintRecipient`; the source domain's native USDC; no destination caller; a Fast\n * or Standard threshold; and a `maxFee` that leaves at least the quoted minimum and the caller's floor. The reason\n * it fails, or null. The engine then requires the build to repeat this quote's call.\n */\nexport function cctpVerifyQuote(params: QuoteParams, quote: Quote): string | null {\n const src = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, params.sourceChain) ? CCTP_DOMAINS[params.sourceChain] : undefined;\n const dst = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, params.destChain) ? CCTP_DOMAINS[params.destChain] : undefined;\n if (!src || !dst || src === dst) return \"not a CCTP route between two domains\";\n if (params.sourceToken.toUpperCase() !== \"USDC\" || !(same(params.destToken, dst.usdc) || params.destToken.toUpperCase() === \"USDC\")) return \"not USDC to USDC\";\n const tx = quote.txRequest;\n if (!tx?.data || !tx.to || tx.serializedTx !== undefined) return \"the quote carries no TokenMessenger call\";\n if (!same(tx.to, src.tokenMessenger)) return `the call targets ${tx.to}, not the TokenMessengerV2`;\n if (BigInt(tx.value ?? \"0\") !== 0n) return \"a burn attaches no value\";\n if (!tx.approvalAddress || !same(tx.approvalAddress, src.tokenMessenger)) return \"the burn approves another spender than the TokenMessengerV2\";\n if (tx.chainId !== undefined && tx.chainId !== src.chainId) return `the call is for chain ${tx.chainId}, not ${src.chainId}`;\n let args: readonly unknown[];\n try {\n const d = decodeFunctionData({abi: TOKEN_MESSENGER_ABI, data: tx.data as Hex});\n if (d.functionName !== \"depositForBurn\") return `${d.functionName} is not depositForBurn`;\n args = d.args;\n } catch {\n return \"the call is not depositForBurn\";\n }\n const [amount, domain, mintRecipient, burnToken, caller, maxFee, threshold] = args as [bigint, number, Hex, string, Hex, bigint, number];\n let amountIn: bigint, floor: bigint;\n try {\n amountIn = BigInt(params.amountIn);\n floor = BigInt(quote.minDestAmount);\n if (params.minAmountOut !== undefined && BigInt(params.minAmountOut) > floor) floor = BigInt(params.minAmountOut);\n } catch {\n return \"the request does not name amounts\";\n }\n if (amount !== amountIn || BigInt(quote.sourceAmount) !== amountIn) return `the burn moves ${amount}, not the ${amountIn} input`;\n if (domain !== dst.domain) return `the burn mints on domain ${domain}, not ${dst.name} (${dst.domain})`;\n // A dry quote without a recipient prices the placeholder the provider uses; it is never built (the engine re-quotes live).\n if (params.destAddress || params.dry === false) {\n if (!isAddress(params.destAddress)) return \"the recipient is not an EVM address\";\n if (mintRecipient.toLowerCase() !== pad(getAddress(params.destAddress), {size: 32}).toLowerCase()) return `the burn mints to ${mintRecipient}, not the recipient`;\n }\n if (!same(burnToken, src.usdc)) return `the burn spends ${burnToken}, not the source domain's USDC`;\n if (caller !== zeroHash) return \"the burn names a destination caller\";\n if (threshold !== FINALITY_FAST && threshold !== FINALITY_STANDARD) return `finality threshold ${threshold} is neither Fast nor Standard`;\n if (maxFee >= amount || amount - maxFee < floor) return `the burn's maxFee ${maxFee} leaves less than the ${floor} minimum`;\n // The server appends its intent token (`<id>~<tag>`); the id before it is what the server's provider tracks and claims.\n if ((/^([\\s\\S]+)~[0-9a-f]{32}$/.exec(quote.intentId)?.[1] ?? quote.intentId) !== `cctp:${src.domain}:${dst.domain}:${threshold}`) return \"the intent id does not name this burn\";\n if (quote.providerData?.maxFee !== undefined && quote.providerData.maxFee !== maxFee.toString()) return \"the quoted maxFee is not the burn's\";\n return null;\n}\n\n/**\n * The TokenMessenger a CCTP burn calls and approves, and the MessageTransmitter its claim calls, per\n * chain, and {@link cctpVerifyQuote} — the app's pins for `remoteProvider({name: \"cctp\", baseUrl, ...cctpPins})`\n * (scan 2026-10-27 modules, F8/F16; claims since round 3, M24; the burn's arguments since scan 2026-10-30, F3).\n */\nexport const cctpPins: RemotePins & {claimTargets(chain: string): readonly string[]} = Object.freeze({\n callTargets: (chain: string): readonly string[] => cctpMessengerFor(chain),\n spenders: (chain: string): readonly string[] => cctpMessengerFor(chain),\n claimTargets: cctpClaimTargets,\n verifyQuote: cctpVerifyQuote,\n});\nfunction cctpMessengerFor(chain: string): readonly string[] {\n const d = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, chain) ? CCTP_DOMAINS[chain] : undefined;\n return d ? [d.tokenMessenger] : [];\n}\n","/**\n * Activity recognition for Circle CCTP V2 on every domain in `config.ts`:\n * `depositForBurn` on TokenMessengerV2 is our source leg (\"Bridged USDC\"), and\n * `receiveMessage` on MessageTransmitterV2 is the claim that mints on the\n * destination (\"Received USDC via CCTP\") — whoever paid the gas, the USDC lands\n * on the `mintRecipient`. Both are `bridge`; the other leg's hash is only known\n * through the kit's journal / Circle's attestation API, so `related` stays empty.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {chainLabel, describeSwapLike, matchesCall} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {CCTP_DOMAINS} from \"./config.js\";\n\nexport const CCTP_MODULE = \"@anywalletkit/protocol-swap2-cctp\";\n\n/** depositForBurn(uint256,uint32,bytes32,address,bytes32,uint256,uint32) — TokenMessengerV2 */\nexport const CCTP_DEPOSIT_FOR_BURN = \"0x8e0250ee\";\n/** receiveMessage(bytes,bytes) — MessageTransmitterV2 */\nexport const CCTP_RECEIVE_MESSAGE = \"0x57ecfd28\";\n\nexport function describeCctpActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null {\n const domain = CCTP_DOMAINS[tx.chain];\n if (!domain) return null;\n const subtitle = `CCTP · ${chainLabel(tx.chain)}`;\n if (matchesCall(tx, [domain.tokenMessenger], [CCTP_DEPOSIT_FOR_BURN])) {\n return describeSwapLike(tx, ctx, {protocol: CCTP_MODULE, subtitle, kind: \"bridge\", title: \"Bridged USDC\"});\n }\n if (matchesCall(tx, [domain.messageTransmitter], [CCTP_RECEIVE_MESSAGE])) {\n return describeSwapLike(tx, ctx, {protocol: CCTP_MODULE, subtitle, kind: \"bridge\", title: \"Received USDC via CCTP\"});\n }\n return null;\n}\n","// Circle CCTP V2 — mainnet domains, contracts and the native USDC each domain\n// mints. Sources (read 2026-10-10, Arc + Morph 2026-10-14): developers.circle.com/cctp/evm-smart-contracts\n// (domains + TokenMessengerV2 / MessageTransmitterV2, the same addresses on\n// every EVM chain except EDGE), developers.circle.com/stablecoins/usdc-contract-addresses\n// (native USDC). Only chains whose USDC is Circle-native are listed: CCTP\n// burns native USDC, a bridged USDC.e (BSC, Gnosis) cannot ride it.\nimport {evmRef, isEvm} from \"@anywalletkit/protocol-swap2-core/util\";\n\nexport interface CctpDomain {\n caip2: string;\n chainId: number;\n domain: number;\n name: string;\n usdc: string;\n tokenMessenger: string;\n messageTransmitter: string;\n}\n\nexport const TOKEN_MESSENGER_V2 = \"0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d\";\nexport const MESSAGE_TRANSMITTER_V2 = \"0x81D40F21F12A8F0E3252Bccb954D722d4c464B64\";\n\nconst d = (chainId: number, domain: number, name: string, usdc: string): CctpDomain => ({\n caip2: `eip155:${chainId}`, chainId, domain, name, usdc, tokenMessenger: TOKEN_MESSENGER_V2, messageTransmitter: MESSAGE_TRANSMITTER_V2,\n});\n\n/** CAIP-2 → CCTP domain. */\nexport const CCTP_DOMAINS: Readonly<Record<string, CctpDomain>> = Object.freeze(Object.fromEntries([\n d(1, 0, \"Ethereum\", \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"),\n d(43114, 1, \"Avalanche\", \"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\"),\n d(10, 2, \"OP Mainnet\", \"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85\"),\n d(42161, 3, \"Arbitrum\", \"0xaf88d065e77c8cC2239327C5EDb3A432268e5831\"),\n d(8453, 6, \"Base\", \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\"),\n d(137, 7, \"Polygon PoS\", \"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359\"),\n d(130, 10, \"Unichain\", \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\"),\n d(59144, 11, \"Linea\", \"0x176211869cA2b568f2A7D4EE941E073a821EE1ff\"),\n d(146, 13, \"Sonic\", \"0x29219dd400f2Bf60E5a23d13Be72B486D4038894\"),\n d(480, 14, \"World Chain\", \"0x79A02482A880bCe3F13E09da970dC34dB4cD24D1\"),\n d(143, 15, \"Monad\", \"0x754704Bc059F8C67012fEd69BC8A327a5aafb603\"),\n d(1329, 16, \"Sei\", \"0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392\"),\n d(999, 19, \"HyperEVM\", \"0xb88339CB7199b77E23DB6E890353E22632Ba630f\"),\n d(57073, 21, \"Ink\", \"0x2D270e6886d130D724215A266106e6832161EAEd\"),\n d(98866, 22, \"Plume\", \"0x222365EF19F7947e5484218551B56bb3965Aa7aF\"),\n d(9745, 33, \"Plasma\", \"0x2d661C89D812261039AF9764eceaAee884f5F67F\"),\n d(196, 37, \"X Layer\", \"0xB6CEceAB302E2E4948951eE7843FC24E92933061\"),\n // 2026-10-14: Arc and Morph (developers.circle.com/cctp/evm-smart-contracts + usdc-contract-addresses; TokenMessengerV2 /\n // MessageTransmitterV2 have code on both chains, MessageTransmitterV2.localDomain() answers 26 / 30 and\n // TokenMessengerV2.localMessageTransmitter() points at 0x81D4…). Arc's USDC is the chain's gas token: 0x3600… is its\n // 6-decimal ERC-20 interface, which is what CCTP burns and mints.\n d(5042, 26, \"Arc\", \"0x3600000000000000000000000000000000000000\"),\n d(2818, 30, \"Morph\", \"0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B\"),\n].map((x) => [x.caip2, x])));\n\n/** CCTP domain → entry. */\nexport const CCTP_BY_DOMAIN: Readonly<Record<number, CctpDomain>> = Object.freeze(\n Object.fromEntries(Object.values(CCTP_DOMAINS).map((x) => [x.domain, x])),\n);\n\n/** Solana is CCTP domain 5 (not executed by this package yet: the engine runs calldata on EVM only). */\nexport const CCTP_SOLANA_DOMAIN = 5;\n\nexport const CCTP_API = \"https://iris-api.circle.com\";\n\n/** Finality thresholds the header carries: Fast Transfer (confirmed) vs Standard (finalized). */\nexport const FINALITY_FAST = 1000;\nexport const FINALITY_STANDARD = 2000;\n\nexport const cctp = {\n supportsChain(chain: string): boolean {\n return isEvm(chain) && !!CCTP_DOMAINS[`eip155:${evmRef(chain)}`];\n },\n supports(from: string, to: string): boolean {\n return from !== to && this.supportsChain(from) && this.supportsChain(to);\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAyI;;;ACQzI,sBAAwD;;;ACHxD,kBAA4B;AAYrB,IAAM,qBAAqB;AAC3B,IAAM,yBAAyB;AAEtC,IAAM,IAAI,CAAC,SAAiB,QAAgB,MAAc,UAA8B;AAAA,EACtF,OAAO,UAAU,OAAO;AAAA,EAAI;AAAA,EAAS;AAAA,EAAQ;AAAA,EAAM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AO;AACzI,MAAI,MAAM,cAAc,WAAW,UAAa,MAAM,aAAa,WAAW,OAAO,SAAS,EAAG,QAAO;AACxG,SAAO;AACT;AAOO,IAAM,WAA0E,OAAO,OAAO;AAAA,EACnG,aAAa,CAAC,UAAqC,iBAAiB,KAAK;AAAA,EACzE,UAAU,CAAC,UAAqC,iBAAiB,KAAK;AAAA,EACtE,cAAc;AAAA,EACd,aAAa;AACf,CAAC;AACD,SAAS,iBAAiB,OAAkC;AAC1D,QAAMA,KAAI,OAAO,UAAU,eAAe,KAAK,cAAc,KAAK,IAAI,aAAa,KAAK,IAAI;AAC5F,SAAOA,KAAI,CAACA,GAAE,cAAc,IAAI,CAAC;AACnC;","names":["import_util","d"]}
1
+ {"version":3,"sources":["../src/provider.ts","../src/activity.ts","../src/config.ts"],"sourcesContent":["import type {RemotePins} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {httpRefusal, refusal, refusalNotes, withReason, type Swap2RefusalReason} from \"@anywalletkit/protocol-swap2-core/errors\";\nimport {createPublicClient, decodeFunctionData, encodeFunctionData, getAddress, http, isAddress, pad, parseAbi, zeroHash, type Hex} from \"viem\";\nimport {describeCctpActivity} from \"./activity.js\";\nimport {ccAsset} from \"@anywalletkit/swap2-assets\";\nimport {timeoutSignal} from \"@anywalletkit/protocol-swap2-core/util\";\nimport type {Asset, CrossChainProvider, IntentRef, IntentStatus, Quote, QuoteParams, UnsignedTx} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {CCTP_API, CCTP_BY_DOMAIN, CCTP_DOMAINS, FINALITY_FAST, FINALITY_STANDARD, cctp as cctpCfg, type CctpDomain} from \"./config.js\";\nimport {bigintToNumber} from \"@anywalletkit/core\";\n\n/**\n * Circle CCTP V2 — native USDC between chains by burn-and-mint, no spread, no\n * aggregator fee. TWO-PHASE: `depositForBurn` on the source burns the USDC and\n * emits the message; Circle's attestation service (Iris) signs it once the\n * source reached the requested finality; `receiveMessage(message, attestation)`\n * on the destination mints. That second transaction is the user's: the engine\n * exposes it through `buildClaim` / `claimSwap2` (status \"action-required\").\n *\n * - Fast Transfer (finality 1000, confirmed, ~seconds–minutes) costs a fee in\n * bps that Circle publishes per pair; Standard (2000, finalized, ~15 min)\n * is free. `mode: \"auto\"` takes Fast when the pair offers it and the Fast\n * allowance covers the amount, else Standard.\n * - `maxFee` sent on-chain is the published fee (plus a small buffer) and is\n * the only thing that can be deducted: the guaranteed output is\n * amount − maxFee. `preflightDeposit` re-reads Circle's published fee right\n * before the burn (the deployed TokenMessengerV2 has no on-chain\n * `getMinFeeAmount`/`minFee` — both revert on Ethereum, Base, Arbitrum,\n * 2026-10-12) and, with an RPC for the source chain, the transmitter's\n * `localDomain()` on the very contract the calldata targets.\n * - Everything is bound to Circle's documented contract addresses and the\n * native USDC of each domain; a catalog USDC that is not the native one\n * refuses the route (USDC.e cannot be burnt).\n */\n\nconst TOKEN_MESSENGER_ABI = parseAbi([\n \"function depositForBurn(uint256 amount, uint32 destinationDomain, bytes32 mintRecipient, address burnToken, bytes32 destinationCaller, uint256 maxFee, uint32 minFinalityThreshold)\",\n \"function localMessageTransmitter() view returns (address)\",\n]);\nconst MESSAGE_TRANSMITTER_ABI = parseAbi([\n \"function receiveMessage(bytes message, bytes attestation) returns (bool)\",\n \"function localDomain() view returns (uint32)\",\n \"function usedNonces(bytes32 nonce) view returns (uint256)\",\n]);\n\nconst EVM_PLACEHOLDER = \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\";\nconst DEFAULT_QUOTE_TTL_MS = 60_000;\n/** Fallback gas limit: a depositForBurn runs ~110–150k, receiveMessage ~150–200k. */\nconst GAS_DEPOSIT = \"200000\";\nconst GAS_CLAIM = \"260000\";\n\nexport type CctpMode = \"auto\" | \"fast\" | \"standard\";\n\nexport interface CctpProviderConfig {\n enabled?: boolean;\n /** Circle attestation API base (default https://iris-api.circle.com). */\n apiUrl?: string;\n /** Fast when offered and within the allowance (default), or force one path. */\n mode?: CctpMode;\n /** Extra headroom on the published Fast fee, in percent of the fee (default 10). The excess is never charged. */\n feeBufferPct?: number;\n /**\n * JSON-RPC URLs per CAIP-2 chain. Optional, but with them the provider\n * verifies the contracts before the burn and detects the mint on the\n * destination (`usedNonces`). Without the destination chain's URL the status\n * reaches \"completed\" only through the id `claimSwap2` returns for a claim the\n * account saw succeed; a bare claim hash stays \"pending\" (hash kept).\n */\n rpcUrls?: Readonly<Record<string, string>>;\n /** Local lifetime of a quote (fees are stable; default 60 s). */\n quoteTtlMs?: number;\n /** Injectable for tests. */\n fetchImpl?: typeof fetch;\n}\n\ninterface FeeRow { finalityThreshold: number; minimumFee: number }\ninterface ApiMessage {\n message?: string;\n eventNonce?: string;\n attestation?: string | null;\n status?: string;\n delayReason?: string | null;\n cctpVersion?: number;\n decodedMessage?: {\n sourceDomain?: string; destinationDomain?: string; nonce?: string; mintRecipient?: string;\n decodedMessageBody?: {amount?: string; maxFee?: string; feeExecuted?: string; expirationBlock?: string; mintRecipient?: string; burnToken?: string};\n };\n}\n\nconst isHexData = (v: unknown): v is Hex => typeof v === \"string\" && /^0x(?:[0-9a-fA-F]{2})+$/.test(v);\n\n/**\n * Tags a failed read with what it means and hands back the same error: a network failure, our own timeout or an\n * answer that is not JSON is `upstream_unavailable`; the caller's own abort stays unclassified.\n */\nfunction unreachable<E>(error: E, signal?: AbortSignal): E {\n if (!signal?.aborted && error instanceof Error) withReason(error, \"upstream_unavailable\");\n return error;\n}\n\n/** A contract read on the caller's RPC that failed: an `eth_call` that reverted or found no code, else the node's failure. */\nfunction rpcFailure<E>(error: E): E {\n if (!(error instanceof Error)) return error;\n let reverted = false;\n for (let e: unknown = error, i = 0; e instanceof Error && i < 8; e = e.cause, i++) {\n if (e.name === \"ContractFunctionRevertedError\" || e.name === \"ContractFunctionZeroDataError\" || e.name === \"ExecutionRevertedError\") reverted = true;\n }\n return withReason(error, reverted ? \"simulation_failed\" : \"upstream_unavailable\");\n}\nconst same = (a: string | undefined, b: string) => !!a && a.toLowerCase() === b.toLowerCase();\n\n/** `amount × bps` rounded up; `bps` may be fractional (Circle publishes 1.3). */\nfunction feeFor(amount: bigint, bps: number, bufferPct: number): bigint {\n const hundredths = BigInt(Math.round(bps * 100)); // 1.3 bps → 130\n const fee = (amount * hundredths + 999_999n) / 1_000_000n;\n if (fee === 0n) return 0n;\n return fee + (fee * BigInt(Math.round(bufferPct * 100)) + 9_999n) / 10_000n;\n}\n\n/**\n * The contracts a CCTP claim may call on `chain`: its MessageTransmitter (`receiveMessage`). Pass it\n * as `claimTargets` to a remote provider stub so the app, not the server, decides (round 3, M24).\n */\nexport function cctpClaimTargets(chain: string): readonly string[] {\n const d = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, chain) ? CCTP_DOMAINS[chain] : undefined;\n return d ? [d.messageTransmitter] : [];\n}\n\nexport function cctpProvider(config: CctpProviderConfig = {}): CrossChainProvider {\n config = Object.freeze({...config});\n const api = (config.apiUrl ?? CCTP_API).replace(/\\/+$/, \"\");\n if (!/^https?:\\/\\//.test(api)) throw new Error(\"cctp: apiUrl must use http or https\");\n const mode: CctpMode = config.mode ?? \"auto\";\n if (![\"auto\", \"fast\", \"standard\"].includes(mode)) throw new Error(\"cctp: mode must be auto | fast | standard\");\n const bufferPct = config.feeBufferPct ?? 10;\n if (!Number.isFinite(bufferPct) || bufferPct < 0 || bufferPct > 100) throw new Error(\"cctp: feeBufferPct must be between 0 and 100\");\n const quoteTtlMs = config.quoteTtlMs ?? DEFAULT_QUOTE_TTL_MS;\n if (!Number.isInteger(quoteTtlMs) || quoteTtlMs <= 0 || quoteTtlMs > 300_000) throw new Error(\"cctp: quoteTtlMs must be an integer between 1 and 300000\");\n const doFetch = config.fetchImpl ?? fetch;\n const rpcUrls = Object.freeze({...(config.rpcUrls ?? {})});\n\n const client = (caip2: string) => {\n const url = rpcUrls[caip2];\n return url ? createPublicClient({transport: http(url, {fetchOptions: {}, ...(config.fetchImpl ? {fetchFn: config.fetchImpl} : {})} as never), ccipRead: false}) : null;\n };\n\n async function getJson<T>(path: string, signal?: AbortSignal): Promise<T | null> {\n let res: Response;\n try {\n res = await doFetch(`${api}${path}`, {headers: {accept: \"application/json\"}, signal: signal ?? timeoutSignal(12_000)});\n } catch (e) {\n throw unreachable(e, signal);\n }\n if (res.status === 404) return null;\n if (!res.ok) {\n // 429 (with Retry-After), 408 / 425 / 5xx; any other status stays unclassified. Circle's API takes no key, so a\n // 401 / 403 (a block in front of it) is upstream_unavailable with its status, never key_rejected.\n const byStatus = httpRefusal(res.status, res.headers?.get?.(\"retry-after\"));\n const info = byStatus?.reason === \"key_rejected\" ? {reason: \"upstream_unavailable\" as const, httpStatus: res.status} : byStatus;\n const error = new Error(`cctp: ${path} → ${res.status}`);\n throw info ? withReason(error, info) : error;\n }\n try {\n return (await res.json()) as T;\n } catch (e) {\n throw unreachable(e, signal);\n }\n }\n\n /** Circle's published fee per finality threshold, in bps of the burnt amount. */\n const feeRows = (src: CctpDomain, dst: CctpDomain, signal?: AbortSignal) =>\n getJson<FeeRow[]>(`/v2/burn/USDC/fees/${src.domain}/${dst.domain}`, signal);\n\n /** The native USDC of a domain, cross-checked against the asset catalog when it knows the chain. */\n function usdcOf(dom: CctpDomain): string | null {\n const known = ccAsset(dom.caip2, \"USDC\");\n if (known && (!known.contract || !same(known.contract, dom.usdc))) return null; // catalog has a USDC that is not Circle's → refuse\n return dom.usdc;\n }\n\n function parseIntent(intentId: string): {src: CctpDomain; dst: CctpDomain; threshold: number} | null {\n const [tag, s, dd, t] = intentId.split(\":\");\n if (tag !== \"cctp\") return null;\n const src = CCTP_BY_DOMAIN[Number(s)];\n const dst = CCTP_BY_DOMAIN[Number(dd)];\n const threshold = Number(t);\n if (!src || !dst || !(threshold === FINALITY_FAST || threshold === FINALITY_STANDARD)) return null;\n return {src, dst, threshold};\n }\n\n async function fetchMessage(src: CctpDomain, sourceTxHash: string): Promise<ApiMessage | null> {\n const out = await getJson<{messages?: ApiMessage[]}>(`/v2/messages/${src.domain}?transactionHash=${encodeURIComponent(sourceTxHash)}`);\n const m = out?.messages?.find((x) => x.cctpVersion === undefined || x.cctpVersion === 2);\n return m ?? null;\n }\n\n /** The nonce's state on the destination: null without an RPC there, \"unknown\" when the configured RPC fails to answer. */\n async function minted(dst: CctpDomain, nonce: Hex): Promise<boolean | null | \"unknown\"> {\n const c = client(dst.caip2);\n if (!c) return null;\n try {\n const used = await c.readContract({address: getAddress(dst.messageTransmitter), abi: MESSAGE_TRANSMITTER_ABI, functionName: \"usedNonces\", args: [nonce]});\n return used !== 0n;\n } catch {\n return \"unknown\";\n }\n }\n\n return {\n name: \"cctp\",\n claimTargets: cctpClaimTargets,\n describeActivity: describeCctpActivity,\n enabled: () => config.enabled ?? true,\n supportsChain: (chain: string) => cctpCfg.supportsChain(chain),\n supportsChainPair: (from: string, to: string) => cctpCfg.supports(from, to),\n supportsRoute(from: Asset, to: Asset): boolean {\n const src = CCTP_DOMAINS[from.chain];\n const dst = CCTP_DOMAINS[to.chain];\n if (!src || !dst || from.chain === to.chain) return false;\n if (from.token.toUpperCase() !== \"USDC\") return false;\n // Destination is given as an address (zero = native): only the native USDC of the destination domain.\n return same(to.token, dst.usdc) || to.token.toUpperCase() === \"USDC\";\n },\n\n async getQuote(params: QuoteParams, signal?: AbortSignal): Promise<Quote | null> {\n if (params.flex) return null; // the amount is baked into the calldata\n const src = CCTP_DOMAINS[params.sourceChain];\n const dst = CCTP_DOMAINS[params.destChain];\n if (!src || !dst || src === dst) return null;\n if (params.sourceToken.toUpperCase() !== \"USDC\") return null;\n if (!(same(params.destToken, dst.usdc) || params.destToken.toUpperCase() === \"USDC\")) return null;\n const usdc = usdcOf(src);\n if (!usdc) { params.onRefusal?.(\"catalog USDC on the source chain is not Circle's native USDC\", {reason: \"unsupported_pair\"}); return null; }\n if (!/^\\d+$/.test(params.amountIn)) return null;\n const amount = BigInt(params.amountIn);\n if (amount <= 0n) return null;\n // The placeholder prices a dry quote; a live one without a recipient would mint to it (round 3, H8).\n const recipient = params.destAddress || (params.dry !== false ? EVM_PLACEHOLDER : \"\");\n if (!recipient) { params.onRefusal?.(\"a live quote needs a recipient\", {reason: \"policy_refused\"}); return null; }\n if (!isAddress(recipient)) { params.onRefusal?.(\"destination must be an EVM address\"); return null; }\n\n try {\n const fees = await feeRows(src, dst, signal);\n if (!fees || !Array.isArray(fees) || fees.length === 0) {\n // No fee list (404) or an empty one: Circle does not serve the pair; a list of another shape is a broken answer.\n params.onRefusal?.(\"Circle publishes no fee for this pair\", {reason: !fees || Array.isArray(fees) ? \"unsupported_pair\" : \"upstream_unavailable\"});\n return null;\n }\n const fast = fees.find((f) => f.finalityThreshold === FINALITY_FAST);\n const standard = fees.find((f) => f.finalityThreshold === FINALITY_STANDARD);\n let threshold: number;\n let bps: number;\n if (mode === \"standard\") {\n if (!standard) { params.onRefusal?.(\"Standard Transfer is not offered for this pair\", {reason: \"unsupported_pair\"}); return null; }\n threshold = FINALITY_STANDARD; bps = standard.minimumFee;\n } else {\n let fastOk = !!fast;\n if (fastOk) {\n const allowance = await getJson<{allowance?: number}>(\"/v2/fastBurn/USDC/allowance\", signal).catch(() => null);\n // The allowance is in whole USDC; refuse Fast when it cannot cover the burn.\n if (typeof allowance?.allowance === \"number\" && allowance.allowance * 1e6 < bigintToNumber(amount)) fastOk = false;\n }\n if (fastOk) { threshold = FINALITY_FAST; bps = fast!.minimumFee; }\n else if (mode === \"fast\") {\n params.onRefusal?.(fast ? \"Fast Transfer allowance is exhausted\" : \"Fast Transfer is not offered for this pair\", {reason: fast ? \"insufficient_liquidity\" : \"unsupported_pair\"});\n return null;\n }\n else if (standard) { threshold = FINALITY_STANDARD; bps = standard.minimumFee; }\n else { params.onRefusal?.(\"neither Fast nor Standard is offered\", {reason: \"unsupported_pair\"}); return null; }\n }\n if (!Number.isFinite(bps) || bps < 0) return null;\n const maxFee = feeFor(amount, bps, bufferPct);\n if (maxFee >= amount) { params.onRefusal?.(\"amount is below the Fast Transfer fee\", {reason: \"amount_too_small\"}); return null; }\n const out = amount - maxFee;\n if (params.minAmountOut !== undefined && out < BigInt(params.minAmountOut)) return null;\n\n const data = encodeFunctionData({\n abi: TOKEN_MESSENGER_ABI,\n functionName: \"depositForBurn\",\n args: [amount, dst.domain, pad(getAddress(recipient), {size: 32}), getAddress(usdc), zeroHash, maxFee, threshold],\n });\n const eta = threshold === FINALITY_FAST ? (src.domain === 0 ? 180 : 45) : (src.domain === 0 ? 1200 : 1000);\n return {\n provider: \"cctp\",\n intentId: `cctp:${src.domain}:${dst.domain}:${threshold}`,\n depositAddress: \"\",\n depositMemo: null,\n txRequest: {to: src.tokenMessenger, data, value: \"0\", chainId: src.chainId, gasLimit: GAS_DEPOSIT, approvalAddress: src.tokenMessenger},\n sourceAmount: amount.toString(),\n destAmount: out.toString(),\n minDestAmount: out.toString(),\n feeUsd: bigintToNumber(maxFee) / 1e6,\n fees: maxFee > 0n ? [{type: \"protocol\", amount: maxFee.toString(), token: usdc, included: true, description: `Circle Fast Transfer fee (${bps} bps + ${bufferPct}% buffer, unused part is not charged)`}] : [],\n etaSeconds: eta,\n reliability: 0.99,\n validUntilMs: Date.now() + quoteTtlMs,\n providerData: {\n sourceDomain: String(src.domain), destinationDomain: String(dst.domain), finalityThreshold: String(threshold),\n maxFee: maxFee.toString(), mintRecipient: getAddress(recipient), claimChain: dst.caip2, claimRequired: \"1\",\n },\n };\n } catch {\n return null;\n }\n },\n\n async buildDeposit(quote: Quote): Promise<UnsignedTx> {\n const tx = quote.txRequest;\n const parsed = parseIntent(quote.intentId);\n if (!tx || !parsed) throw refusal(\"policy_refused\", \"swap2: CCTP quote has no transaction request\");\n return {\n chain: parsed.src.caip2,\n to: tx.to ?? \"\",\n value: tx.value ?? \"0\",\n ...(tx.data ? {data: tx.data} : {}),\n ...(tx.chainId !== undefined ? {chainId: tx.chainId} : {}),\n ...(tx.gasLimit ? {gasLimit: tx.gasLimit} : {}),\n ...(tx.approvalAddress ? {approvalAddress: tx.approvalAddress} : {}),\n };\n },\n\n /**\n * Fast: Circle's CURRENT fee (same source and rounding as the quote, without\n * the buffer) still fits `maxFee` — Iris would otherwise hold the burn\n * until it times out to Standard. With a source RPC: the target really is\n * CCTP for this domain.\n */\n async preflightDeposit(quote: Quote, tx: UnsignedTx): Promise<void> {\n const parsed = parseIntent(quote.intentId);\n if (!parsed) throw refusal(\"policy_refused\", \"cctp: malformed intent id\");\n if (!same(tx.to, parsed.src.tokenMessenger)) throw refusal(\"vault_mismatch\", \"cctp: deposit target is not the TokenMessengerV2 of the source domain\");\n if (parsed.threshold === FINALITY_FAST) {\n const fast = (await feeRows(parsed.src, parsed.dst))?.find((f) => f.finalityThreshold === FINALITY_FAST);\n if (!fast || !Number.isFinite(fast.minimumFee) || fast.minimumFee < 0) throw refusal(\"quote_expired\", \"cctp: Circle no longer publishes a Fast Transfer fee for this pair — re-quote\");\n const minFee = feeFor(BigInt(quote.sourceAmount), fast.minimumFee, 0);\n const maxFee = BigInt(quote.providerData?.maxFee ?? \"0\");\n if (minFee > maxFee) throw refusal(\"quote_expired\", `cctp: Circle's Fast Transfer fee ${minFee} (${fast.minimumFee} bps) exceeds the quoted maxFee ${maxFee} — re-quote`);\n }\n const c = client(parsed.src.caip2);\n if (!c) return;\n const transmitter = await c.readContract({address: getAddress(parsed.src.tokenMessenger), abi: TOKEN_MESSENGER_ABI, functionName: \"localMessageTransmitter\"})\n .catch((e: unknown) => { throw rpcFailure(e); });\n if (!same(transmitter, parsed.src.messageTransmitter)) throw refusal(\"vault_mismatch\", \"cctp: TokenMessengerV2 does not point at the expected MessageTransmitterV2\");\n const domain = await c.readContract({address: getAddress(parsed.src.messageTransmitter), abi: MESSAGE_TRANSMITTER_ABI, functionName: \"localDomain\"})\n .catch((e: unknown) => { throw rpcFailure(e); });\n if (Number(domain) !== parsed.src.domain) throw refusal(\"vault_mismatch\", `cctp: MessageTransmitterV2 reports domain ${domain}, expected ${parsed.src.domain}`);\n },\n\n async trackIntent(ref: IntentRef): Promise<IntentStatus> {\n const parsed = parseIntent(ref.intentId);\n if (!parsed) return {state: \"failed\"};\n const claim = {chain: parsed.dst.caip2, ready: false};\n if (!ref.sourceTxHash) return {state: \"pending\", claim};\n try {\n const m = await fetchMessage(parsed.src, ref.sourceTxHash);\n if (!m) return {state: \"pending\", depositReceived: false, claim};\n const nonce = m.decodedMessage?.nonce;\n if (m.status === \"complete\" && isHexData(m.attestation) && isHexData(m.message)) {\n // A message without a readable nonce cannot be checked on the destination even with an RPC there.\n const done = isHexData(nonce) && nonce.length === 66 ? await minted(parsed.dst, nonce) : client(parsed.dst.caip2) ? \"unknown\" : null;\n if (done === true) return {state: \"completed\", claim: {...claim, ready: false}, ...(ref.destTxHash ? {destTxHash: ref.destTxHash} : {})};\n if (ref.destTxHash) {\n // A claim the sending account saw included and succeed is the mint: receiveMessage reverts once the\n // nonce is used, so a successful one minted this message. Without a destination read that is completed;\n // a destination read that does not show it yet is a node behind the claim, not a claim to send again.\n if (ref.destTxConfirmed === true) {\n return done === false\n ? {state: \"pending\", depositReceived: true, destTxHash: ref.destTxHash, claim: {...claim, ready: false}}\n : {state: \"completed\", destTxHash: ref.destTxHash, claim: {...claim, ready: false}};\n }\n // A claim was sent, but nothing here can read whether it minted (no destination RPC, or one that did\n // not answer): the hash is kept and the swap stays pending — a hash alone is not a mint.\n if (done !== false) return {state: \"pending\", depositReceived: true, destTxHash: ref.destTxHash, claim: {...claim, ready: false}};\n }\n return {state: \"action-required\", depositReceived: true, claim: {...claim, ready: true}};\n }\n return {state: \"pending\", depositReceived: true, claim};\n } catch {\n return {state: \"pending\", claim};\n }\n },\n\n /** `receiveMessage(message, attestation)` on the destination once Circle attested; null while pending. */\n async buildClaim(ref: IntentRef): Promise<UnsignedTx | null> {\n const parsed = parseIntent(ref.intentId);\n if (!parsed || !ref.sourceTxHash) return null;\n const m = await fetchMessage(parsed.src, ref.sourceTxHash);\n if (!m || m.status !== \"complete\" || !isHexData(m.attestation) || !isHexData(m.message)) return null;\n // Bind the attested message to the route it claims to complete.\n if (m.decodedMessage?.destinationDomain !== undefined && Number(m.decodedMessage.destinationDomain) !== parsed.dst.domain) {\n throw refusal(\"recipient_mismatch\", \"cctp: attested message is for another destination domain\");\n }\n if (m.decodedMessage?.sourceDomain !== undefined && Number(m.decodedMessage.sourceDomain) !== parsed.src.domain) {\n throw refusal(\"policy_refused\", \"cctp: attested message is for another source domain\");\n }\n // Fast messages expire at `expirationBlock` on the destination; an expired\n // one needs Circle's re-attestation before it can be received. The\n // transmitter compares it with `block.number`, which on Arbitrum-stack\n // chains is the L1 (Ethereum) height, not the L2 height eth_blockNumber\n // returns — the RPC block carries it as `l1BlockNumber` (live\n // 2026-10-16: a Base→Arbitrum claim was held as \"expired\" by L2 height).\n const exp = m.decodedMessage?.decodedMessageBody?.expirationBlock;\n const c = client(parsed.dst.caip2);\n if (c && exp && /^\\d+$/.test(exp) && BigInt(exp) > 0n) {\n const head = await c.request({method: \"eth_getBlockByNumber\", params: [\"latest\", false]})\n .then((b) => {\n const block = b as {number?: string; l1BlockNumber?: string} | null;\n const raw = block?.l1BlockNumber ?? block?.number;\n return raw ? BigInt(raw) : null;\n })\n .catch(() => null);\n if (head !== null && head >= BigInt(exp)) {\n const nonce = m.decodedMessage?.nonce ?? m.eventNonce;\n if (nonce) await doFetch(`${api}/v2/reattest/${nonce}`, {method: \"POST\", signal: timeoutSignal(12_000)}).catch(() => undefined);\n return null;\n }\n }\n return {\n chain: parsed.dst.caip2,\n to: parsed.dst.messageTransmitter,\n value: \"0\",\n data: encodeFunctionData({abi: MESSAGE_TRANSMITTER_ABI, functionName: \"receiveMessage\", args: [m.message, m.attestation]}),\n chainId: parsed.dst.chainId,\n gasLimit: GAS_CLAIM,\n };\n },\n };\n}\n\n/** The reason behind each text {@link cctpVerifyQuote} returns (`cctpPins.reasonOf`). */\nconst notes = refusalNotes();\nconst why = (text: string, reason: Swap2RefusalReason): string => notes.note(text, reason);\n\n/**\n * A remote CCTP quote's burn, decoded on the device against the app's own request (scan 2026-10-30, F3): exactly\n * `depositForBurn` on the source TokenMessengerV2 with no value, approving it; the input amount; the destination\n * chain's domain; the recipient as `mintRecipient`; the source domain's native USDC; no destination caller; a Fast\n * or Standard threshold; and a `maxFee` that leaves at least the quoted minimum and the caller's floor. The reason\n * it fails, or null. The engine then requires the build to repeat this quote's call.\n */\nexport function cctpVerifyQuote(params: QuoteParams, quote: Quote): string | null {\n const src = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, params.sourceChain) ? CCTP_DOMAINS[params.sourceChain] : undefined;\n const dst = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, params.destChain) ? CCTP_DOMAINS[params.destChain] : undefined;\n if (!src || !dst || src === dst) return why(\"not a CCTP route between two domains\", \"unsupported_pair\");\n if (params.sourceToken.toUpperCase() !== \"USDC\" || !(same(params.destToken, dst.usdc) || params.destToken.toUpperCase() === \"USDC\")) return why(\"not USDC to USDC\", \"unsupported_pair\");\n const tx = quote.txRequest;\n if (!tx?.data || !tx.to || tx.serializedTx !== undefined) return why(\"the quote carries no TokenMessenger call\", \"policy_refused\");\n if (!same(tx.to, src.tokenMessenger)) return why(`the call targets ${tx.to}, not the TokenMessengerV2`, \"vault_mismatch\");\n if (BigInt(tx.value ?? \"0\") !== 0n) return why(\"a burn attaches no value\", \"policy_refused\");\n if (!tx.approvalAddress || !same(tx.approvalAddress, src.tokenMessenger)) return why(\"the burn approves another spender than the TokenMessengerV2\", \"vault_mismatch\");\n if (tx.chainId !== undefined && tx.chainId !== src.chainId) return why(`the call is for chain ${tx.chainId}, not ${src.chainId}`, \"policy_refused\");\n let args: readonly unknown[];\n try {\n const d = decodeFunctionData({abi: TOKEN_MESSENGER_ABI, data: tx.data as Hex});\n if (d.functionName !== \"depositForBurn\") return why(`${d.functionName} is not depositForBurn`, \"policy_refused\");\n args = d.args;\n } catch {\n return why(\"the call is not depositForBurn\", \"policy_refused\");\n }\n const [amount, domain, mintRecipient, burnToken, caller, maxFee, threshold] = args as [bigint, number, Hex, string, Hex, bigint, number];\n let amountIn: bigint, floor: bigint;\n try {\n amountIn = BigInt(params.amountIn);\n floor = BigInt(quote.minDestAmount);\n if (params.minAmountOut !== undefined && BigInt(params.minAmountOut) > floor) floor = BigInt(params.minAmountOut);\n } catch {\n return why(\"the request does not name amounts\", \"upstream_unavailable\");\n }\n if (amount !== amountIn || BigInt(quote.sourceAmount) !== amountIn) return why(`the burn moves ${amount}, not the ${amountIn} input`, \"policy_refused\");\n if (domain !== dst.domain) return why(`the burn mints on domain ${domain}, not ${dst.name} (${dst.domain})`, \"recipient_mismatch\");\n // A dry quote without a recipient prices the placeholder the provider uses; it is never built (the engine re-quotes live).\n if (params.destAddress || params.dry === false) {\n if (!isAddress(params.destAddress)) return \"the recipient is not an EVM address\";\n if (mintRecipient.toLowerCase() !== pad(getAddress(params.destAddress), {size: 32}).toLowerCase()) return why(`the burn mints to ${mintRecipient}, not the recipient`, \"recipient_mismatch\");\n }\n if (!same(burnToken, src.usdc)) return why(`the burn spends ${burnToken}, not the source domain's USDC`, \"policy_refused\");\n if (caller !== zeroHash) return why(\"the burn names a destination caller\", \"policy_refused\");\n if (threshold !== FINALITY_FAST && threshold !== FINALITY_STANDARD) return why(`finality threshold ${threshold} is neither Fast nor Standard`, \"policy_refused\");\n if (maxFee >= amount || amount - maxFee < floor) return why(`the burn's maxFee ${maxFee} leaves less than the ${floor} minimum`, \"price_check_failed\");\n // The server appends its intent token (`<id>~<tag>`); the id before it is what the server's provider tracks and claims.\n if ((/^([\\s\\S]+)~[0-9a-f]{32}$/.exec(quote.intentId)?.[1] ?? quote.intentId) !== `cctp:${src.domain}:${dst.domain}:${threshold}`) return why(\"the intent id does not name this burn\", \"policy_refused\");\n if (quote.providerData?.maxFee !== undefined && quote.providerData.maxFee !== maxFee.toString()) return why(\"the quoted maxFee is not the burn's\", \"policy_refused\");\n return null;\n}\n\n/**\n * The TokenMessenger a CCTP burn calls and approves, and the MessageTransmitter its claim calls, per\n * chain, and {@link cctpVerifyQuote} — the app's pins for `remoteProvider({name: \"cctp\", baseUrl, ...cctpPins})`\n * (scan 2026-10-27 modules, F8/F16; claims since round 3, M24; the burn's arguments since scan 2026-10-30, F3).\n * `reasonOf` classifies each text the verifier returns (`Swap2RefusalReason`), so a remote stub's refusal carries it.\n */\nexport const cctpPins: RemotePins & {claimTargets(chain: string): readonly string[]} = Object.freeze({\n callTargets: (chain: string): readonly string[] => cctpMessengerFor(chain),\n spenders: (chain: string): readonly string[] => cctpMessengerFor(chain),\n claimTargets: cctpClaimTargets,\n verifyQuote: cctpVerifyQuote,\n reasonOf: notes.reasonOf,\n});\nfunction cctpMessengerFor(chain: string): readonly string[] {\n const d = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, chain) ? CCTP_DOMAINS[chain] : undefined;\n return d ? [d.tokenMessenger] : [];\n}\n","/**\n * Activity recognition for Circle CCTP V2 on every domain in `config.ts`:\n * `depositForBurn` on TokenMessengerV2 is our source leg (\"Bridged USDC\"), and\n * `receiveMessage` on MessageTransmitterV2 is the claim that mints on the\n * destination (\"Received USDC via CCTP\") — whoever paid the gas, the USDC lands\n * on the `mintRecipient`. Both are `bridge`; the other leg's hash is only known\n * through the kit's journal / Circle's attestation API, so `related` stays empty.\n */\nimport type {ActivityItem, ChainTx, DescribeActivityContext} from \"@anywalletkit/core\";\nimport {chainLabel, describeSwapLike, matchesCall} from \"@anywalletkit/protocol-swap2-core/activity\";\nimport {CCTP_DOMAINS} from \"./config.js\";\n\nexport const CCTP_MODULE = \"@anywalletkit/protocol-swap2-cctp\";\n\n/** depositForBurn(uint256,uint32,bytes32,address,bytes32,uint256,uint32) — TokenMessengerV2 */\nexport const CCTP_DEPOSIT_FOR_BURN = \"0x8e0250ee\";\n/** receiveMessage(bytes,bytes) — MessageTransmitterV2 */\nexport const CCTP_RECEIVE_MESSAGE = \"0x57ecfd28\";\n\nexport function describeCctpActivity(tx: ChainTx, ctx: DescribeActivityContext): ActivityItem | null {\n const domain = CCTP_DOMAINS[tx.chain];\n if (!domain) return null;\n const subtitle = `CCTP · ${chainLabel(tx.chain)}`;\n if (matchesCall(tx, [domain.tokenMessenger], [CCTP_DEPOSIT_FOR_BURN])) {\n return describeSwapLike(tx, ctx, {protocol: CCTP_MODULE, subtitle, kind: \"bridge\", title: \"Bridged USDC\"});\n }\n if (matchesCall(tx, [domain.messageTransmitter], [CCTP_RECEIVE_MESSAGE])) {\n return describeSwapLike(tx, ctx, {protocol: CCTP_MODULE, subtitle, kind: \"bridge\", title: \"Received USDC via CCTP\"});\n }\n return null;\n}\n","// Circle CCTP V2 — mainnet domains, contracts and the native USDC each domain\n// mints. Sources (read 2026-10-10, Arc + Morph 2026-10-14): developers.circle.com/cctp/evm-smart-contracts\n// (domains + TokenMessengerV2 / MessageTransmitterV2, the same addresses on\n// every EVM chain except EDGE), developers.circle.com/stablecoins/usdc-contract-addresses\n// (native USDC). Only chains whose USDC is Circle-native are listed: CCTP\n// burns native USDC, a bridged USDC.e (BSC, Gnosis) cannot ride it.\nimport {evmRef, isEvm} from \"@anywalletkit/protocol-swap2-core/util\";\n\nexport interface CctpDomain {\n caip2: string;\n chainId: number;\n domain: number;\n name: string;\n usdc: string;\n tokenMessenger: string;\n messageTransmitter: string;\n}\n\nexport const TOKEN_MESSENGER_V2 = \"0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d\";\nexport const MESSAGE_TRANSMITTER_V2 = \"0x81D40F21F12A8F0E3252Bccb954D722d4c464B64\";\n\nconst d = (chainId: number, domain: number, name: string, usdc: string): CctpDomain => ({\n caip2: `eip155:${chainId}`, chainId, domain, name, usdc, tokenMessenger: TOKEN_MESSENGER_V2, messageTransmitter: MESSAGE_TRANSMITTER_V2,\n});\n\n/** CAIP-2 → CCTP domain. */\nexport const CCTP_DOMAINS: Readonly<Record<string, CctpDomain>> = Object.freeze(Object.fromEntries([\n d(1, 0, \"Ethereum\", \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\"),\n d(43114, 1, \"Avalanche\", \"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\"),\n d(10, 2, \"OP Mainnet\", \"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85\"),\n d(42161, 3, \"Arbitrum\", \"0xaf88d065e77c8cC2239327C5EDb3A432268e5831\"),\n d(8453, 6, \"Base\", \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\"),\n d(137, 7, \"Polygon PoS\", \"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359\"),\n d(130, 10, \"Unichain\", \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\"),\n d(59144, 11, \"Linea\", \"0x176211869cA2b568f2A7D4EE941E073a821EE1ff\"),\n d(146, 13, \"Sonic\", \"0x29219dd400f2Bf60E5a23d13Be72B486D4038894\"),\n d(480, 14, \"World Chain\", \"0x79A02482A880bCe3F13E09da970dC34dB4cD24D1\"),\n d(143, 15, \"Monad\", \"0x754704Bc059F8C67012fEd69BC8A327a5aafb603\"),\n d(1329, 16, \"Sei\", \"0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392\"),\n d(999, 19, \"HyperEVM\", \"0xb88339CB7199b77E23DB6E890353E22632Ba630f\"),\n d(57073, 21, \"Ink\", \"0x2D270e6886d130D724215A266106e6832161EAEd\"),\n d(98866, 22, \"Plume\", \"0x222365EF19F7947e5484218551B56bb3965Aa7aF\"),\n d(9745, 33, \"Plasma\", \"0x2d661C89D812261039AF9764eceaAee884f5F67F\"),\n d(196, 37, \"X Layer\", \"0xB6CEceAB302E2E4948951eE7843FC24E92933061\"),\n // 2026-10-14: Arc and Morph (developers.circle.com/cctp/evm-smart-contracts + usdc-contract-addresses; TokenMessengerV2 /\n // MessageTransmitterV2 have code on both chains, MessageTransmitterV2.localDomain() answers 26 / 30 and\n // TokenMessengerV2.localMessageTransmitter() points at 0x81D4…). Arc's USDC is the chain's gas token: 0x3600… is its\n // 6-decimal ERC-20 interface, which is what CCTP burns and mints.\n d(5042, 26, \"Arc\", \"0x3600000000000000000000000000000000000000\"),\n d(2818, 30, \"Morph\", \"0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B\"),\n].map((x) => [x.caip2, x])));\n\n/** CCTP domain → entry. */\nexport const CCTP_BY_DOMAIN: Readonly<Record<number, CctpDomain>> = Object.freeze(\n Object.fromEntries(Object.values(CCTP_DOMAINS).map((x) => [x.domain, x])),\n);\n\n/** Solana is CCTP domain 5 (not executed by this package yet: the engine runs calldata on EVM only). */\nexport const CCTP_SOLANA_DOMAIN = 5;\n\nexport const CCTP_API = \"https://iris-api.circle.com\";\n\n/** Finality thresholds the header carries: Fast Transfer (confirmed) vs Standard (finalized). */\nexport const FINALITY_FAST = 1000;\nexport const FINALITY_STANDARD = 2000;\n\nexport const cctp = {\n supportsChain(chain: string): boolean {\n return isEvm(chain) && !!CCTP_DOMAINS[`eip155:${evmRef(chain)}`];\n },\n supports(from: string, to: string): boolean {\n return from !== to && this.supportsChain(from) && this.supportsChain(to);\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAsF;AACtF,kBAAyI;;;ACOzI,sBAAwD;;;ACHxD,kBAA4B;AAYrB,IAAM,qBAAqB;AAC3B,IAAM,yBAAyB;AAEtC,IAAM,IAAI,CAAC,SAAiB,QAAgB,MAAc,UAA8B;AAAA,EACtF,OAAO,UAAU,OAAO;AAAA,EAAI;AAAA,EAAS;AAAA,EAAQ;AAAA,EAAM;AAAA,EAAM,gBAAgB;AAAA,EAAoB,oBAAoB;AACnH;AAGO,IAAM,eAAqD,OAAO,OAAO,OAAO,YAAY;AAAA,EACjG,EAAE,GAAG,GAAG,YAAY,4CAA4C;AAAA,EAChE,EAAE,OAAO,GAAG,aAAa,4CAA4C;AAAA,EACrE,EAAE,IAAI,GAAG,cAAc,4CAA4C;AAAA,EACnE,EAAE,OAAO,GAAG,YAAY,4CAA4C;AAAA,EACpE,EAAE,MAAM,GAAG,QAAQ,4CAA4C;AAAA,EAC/D,EAAE,KAAK,GAAG,eAAe,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AAK,2BAA2B,KAAK,MAAM,QAAQ,IAAI,CAAC,KAAK,MAAM,cAAc,QAAQ,IAAI,MAAM,IAAI,IAAI,MAAM,IAAI,SAAS,GAAI,QAAO,IAAI,yCAAyC,gBAAgB;AACtM,MAAI,MAAM,cAAc,WAAW,UAAa,MAAM,aAAa,WAAW,OAAO,SAAS,EAAG,QAAO,IAAI,uCAAuC,gBAAgB;AACnK,SAAO;AACT;AAQO,IAAM,WAA0E,OAAO,OAAO;AAAA,EACnG,aAAa,CAAC,UAAqC,iBAAiB,KAAK;AAAA,EACzE,UAAU,CAAC,UAAqC,iBAAiB,KAAK;AAAA,EACtE,cAAc;AAAA,EACd,aAAa;AAAA,EACb,UAAU,MAAM;AAClB,CAAC;AACD,SAAS,iBAAiB,OAAkC;AAC1D,QAAMA,KAAI,OAAO,UAAU,eAAe,KAAK,cAAc,KAAK,IAAI,aAAa,KAAK,IAAI;AAC5F,SAAOA,KAAI,CAACA,GAAE,cAAc,IAAI,CAAC;AACnC;","names":["import_util","d"]}
@@ -40,6 +40,7 @@ declare function cctpVerifyQuote(params: QuoteParams, quote: Quote): string | nu
40
40
  * The TokenMessenger a CCTP burn calls and approves, and the MessageTransmitter its claim calls, per
41
41
  * chain, and {@link cctpVerifyQuote} — the app's pins for `remoteProvider({name: "cctp", baseUrl, ...cctpPins})`
42
42
  * (scan 2026-10-27 modules, F8/F16; claims since round 3, M24; the burn's arguments since scan 2026-10-30, F3).
43
+ * `reasonOf` classifies each text the verifier returns (`Swap2RefusalReason`), so a remote stub's refusal carries it.
43
44
  */
44
45
  declare const cctpPins: RemotePins & {
45
46
  claimTargets(chain: string): readonly string[];
@@ -40,6 +40,7 @@ declare function cctpVerifyQuote(params: QuoteParams, quote: Quote): string | nu
40
40
  * The TokenMessenger a CCTP burn calls and approves, and the MessageTransmitter its claim calls, per
41
41
  * chain, and {@link cctpVerifyQuote} — the app's pins for `remoteProvider({name: "cctp", baseUrl, ...cctpPins})`
42
42
  * (scan 2026-10-27 modules, F8/F16; claims since round 3, M24; the burn's arguments since scan 2026-10-30, F3).
43
+ * `reasonOf` classifies each text the verifier returns (`Swap2RefusalReason`), so a remote stub's refusal carries it.
43
44
  */
44
45
  declare const cctpPins: RemotePins & {
45
46
  claimTargets(chain: string): readonly string[];
package/dist/provider.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  cctpPins,
4
4
  cctpProvider,
5
5
  cctpVerifyQuote
6
- } from "./chunk-H4W3JMYC.js";
6
+ } from "./chunk-UPA4KJKX.js";
7
7
  import "./chunk-FLAON5RO.js";
8
8
  import "./chunk-ZR5XR5RO.js";
9
9
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anywalletkit/protocol-swap2-cctp",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Circle CCTP V2 for the swap2 engine: native USDC between EVM chains by burn-and-mint (Fast Transfer or Standard), attestation via Circle's Iris API, two-phase delivery with the user's own receiveMessage claim. Bound to Circle's documented contracts and native USDC per domain.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://docs.anywallet.tech",
@@ -50,7 +50,7 @@
50
50
  ],
51
51
  "dependencies": {
52
52
  "viem": "^2.57.2",
53
- "@anywalletkit/protocol-swap2-core": "0.10.3",
53
+ "@anywalletkit/protocol-swap2-core": "0.12.0",
54
54
  "@anywalletkit/swap2-assets": "0.3.0"
55
55
  },
56
56
  "peerDependencies": {
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/node": "^22",
61
- "vitest": "^5.0.3",
61
+ "vitest": "^5.1.0",
62
62
  "@anywalletkit/conformance": "0.5.1",
63
63
  "@anywalletkit/core": "0.8.0"
64
64
  },
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/provider.ts"],"sourcesContent":["import type {RemotePins} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {createPublicClient, decodeFunctionData, encodeFunctionData, getAddress, http, isAddress, pad, parseAbi, zeroHash, type Hex} from \"viem\";\nimport {describeCctpActivity} from \"./activity.js\";\nimport {ccAsset} from \"@anywalletkit/swap2-assets\";\nimport {timeoutSignal} from \"@anywalletkit/protocol-swap2-core/util\";\nimport type {Asset, CrossChainProvider, IntentRef, IntentStatus, Quote, QuoteParams, UnsignedTx} from \"@anywalletkit/protocol-swap2-core/types\";\nimport {CCTP_API, CCTP_BY_DOMAIN, CCTP_DOMAINS, FINALITY_FAST, FINALITY_STANDARD, cctp as cctpCfg, type CctpDomain} from \"./config.js\";\nimport {bigintToNumber} from \"@anywalletkit/core\";\n\n/**\n * Circle CCTP V2 — native USDC between chains by burn-and-mint, no spread, no\n * aggregator fee. TWO-PHASE: `depositForBurn` on the source burns the USDC and\n * emits the message; Circle's attestation service (Iris) signs it once the\n * source reached the requested finality; `receiveMessage(message, attestation)`\n * on the destination mints. That second transaction is the user's: the engine\n * exposes it through `buildClaim` / `claimSwap2` (status \"action-required\").\n *\n * - Fast Transfer (finality 1000, confirmed, ~seconds–minutes) costs a fee in\n * bps that Circle publishes per pair; Standard (2000, finalized, ~15 min)\n * is free. `mode: \"auto\"` takes Fast when the pair offers it and the Fast\n * allowance covers the amount, else Standard.\n * - `maxFee` sent on-chain is the published fee (plus a small buffer) and is\n * the only thing that can be deducted: the guaranteed output is\n * amount − maxFee. `preflightDeposit` re-reads Circle's published fee right\n * before the burn (the deployed TokenMessengerV2 has no on-chain\n * `getMinFeeAmount`/`minFee` — both revert on Ethereum, Base, Arbitrum,\n * 2026-10-12) and, with an RPC for the source chain, the transmitter's\n * `localDomain()` on the very contract the calldata targets.\n * - Everything is bound to Circle's documented contract addresses and the\n * native USDC of each domain; a catalog USDC that is not the native one\n * refuses the route (USDC.e cannot be burnt).\n */\n\nconst TOKEN_MESSENGER_ABI = parseAbi([\n \"function depositForBurn(uint256 amount, uint32 destinationDomain, bytes32 mintRecipient, address burnToken, bytes32 destinationCaller, uint256 maxFee, uint32 minFinalityThreshold)\",\n \"function localMessageTransmitter() view returns (address)\",\n]);\nconst MESSAGE_TRANSMITTER_ABI = parseAbi([\n \"function receiveMessage(bytes message, bytes attestation) returns (bool)\",\n \"function localDomain() view returns (uint32)\",\n \"function usedNonces(bytes32 nonce) view returns (uint256)\",\n]);\n\nconst EVM_PLACEHOLDER = \"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\";\nconst DEFAULT_QUOTE_TTL_MS = 60_000;\n/** Fallback gas limit: a depositForBurn runs ~110–150k, receiveMessage ~150–200k. */\nconst GAS_DEPOSIT = \"200000\";\nconst GAS_CLAIM = \"260000\";\n\nexport type CctpMode = \"auto\" | \"fast\" | \"standard\";\n\nexport interface CctpProviderConfig {\n enabled?: boolean;\n /** Circle attestation API base (default https://iris-api.circle.com). */\n apiUrl?: string;\n /** Fast when offered and within the allowance (default), or force one path. */\n mode?: CctpMode;\n /** Extra headroom on the published Fast fee, in percent of the fee (default 10). The excess is never charged. */\n feeBufferPct?: number;\n /**\n * JSON-RPC URLs per CAIP-2 chain. Optional, but with them the provider\n * verifies the contracts before the burn and detects the mint on the\n * destination (`usedNonces`). Without the destination chain's URL the status\n * reaches \"completed\" only through the id `claimSwap2` returns for a claim the\n * account saw succeed; a bare claim hash stays \"pending\" (hash kept).\n */\n rpcUrls?: Readonly<Record<string, string>>;\n /** Local lifetime of a quote (fees are stable; default 60 s). */\n quoteTtlMs?: number;\n /** Injectable for tests. */\n fetchImpl?: typeof fetch;\n}\n\ninterface FeeRow { finalityThreshold: number; minimumFee: number }\ninterface ApiMessage {\n message?: string;\n eventNonce?: string;\n attestation?: string | null;\n status?: string;\n delayReason?: string | null;\n cctpVersion?: number;\n decodedMessage?: {\n sourceDomain?: string; destinationDomain?: string; nonce?: string; mintRecipient?: string;\n decodedMessageBody?: {amount?: string; maxFee?: string; feeExecuted?: string; expirationBlock?: string; mintRecipient?: string; burnToken?: string};\n };\n}\n\nconst isHexData = (v: unknown): v is Hex => typeof v === \"string\" && /^0x(?:[0-9a-fA-F]{2})+$/.test(v);\nconst same = (a: string | undefined, b: string) => !!a && a.toLowerCase() === b.toLowerCase();\n\n/** `amount × bps` rounded up; `bps` may be fractional (Circle publishes 1.3). */\nfunction feeFor(amount: bigint, bps: number, bufferPct: number): bigint {\n const hundredths = BigInt(Math.round(bps * 100)); // 1.3 bps → 130\n const fee = (amount * hundredths + 999_999n) / 1_000_000n;\n if (fee === 0n) return 0n;\n return fee + (fee * BigInt(Math.round(bufferPct * 100)) + 9_999n) / 10_000n;\n}\n\n/**\n * The contracts a CCTP claim may call on `chain`: its MessageTransmitter (`receiveMessage`). Pass it\n * as `claimTargets` to a remote provider stub so the app, not the server, decides (round 3, M24).\n */\nexport function cctpClaimTargets(chain: string): readonly string[] {\n const d = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, chain) ? CCTP_DOMAINS[chain] : undefined;\n return d ? [d.messageTransmitter] : [];\n}\n\nexport function cctpProvider(config: CctpProviderConfig = {}): CrossChainProvider {\n config = Object.freeze({...config});\n const api = (config.apiUrl ?? CCTP_API).replace(/\\/+$/, \"\");\n if (!/^https?:\\/\\//.test(api)) throw new Error(\"cctp: apiUrl must use http or https\");\n const mode: CctpMode = config.mode ?? \"auto\";\n if (![\"auto\", \"fast\", \"standard\"].includes(mode)) throw new Error(\"cctp: mode must be auto | fast | standard\");\n const bufferPct = config.feeBufferPct ?? 10;\n if (!Number.isFinite(bufferPct) || bufferPct < 0 || bufferPct > 100) throw new Error(\"cctp: feeBufferPct must be between 0 and 100\");\n const quoteTtlMs = config.quoteTtlMs ?? DEFAULT_QUOTE_TTL_MS;\n if (!Number.isInteger(quoteTtlMs) || quoteTtlMs <= 0 || quoteTtlMs > 300_000) throw new Error(\"cctp: quoteTtlMs must be an integer between 1 and 300000\");\n const doFetch = config.fetchImpl ?? fetch;\n const rpcUrls = Object.freeze({...(config.rpcUrls ?? {})});\n\n const client = (caip2: string) => {\n const url = rpcUrls[caip2];\n return url ? createPublicClient({transport: http(url, {fetchOptions: {}, ...(config.fetchImpl ? {fetchFn: config.fetchImpl} : {})} as never), ccipRead: false}) : null;\n };\n\n async function getJson<T>(path: string, signal?: AbortSignal): Promise<T | null> {\n const res = await doFetch(`${api}${path}`, {headers: {accept: \"application/json\"}, signal: signal ?? timeoutSignal(12_000)});\n if (res.status === 404) return null;\n if (!res.ok) throw new Error(`cctp: ${path} → ${res.status}`);\n return (await res.json()) as T;\n }\n\n /** Circle's published fee per finality threshold, in bps of the burnt amount. */\n const feeRows = (src: CctpDomain, dst: CctpDomain, signal?: AbortSignal) =>\n getJson<FeeRow[]>(`/v2/burn/USDC/fees/${src.domain}/${dst.domain}`, signal);\n\n /** The native USDC of a domain, cross-checked against the asset catalog when it knows the chain. */\n function usdcOf(dom: CctpDomain): string | null {\n const known = ccAsset(dom.caip2, \"USDC\");\n if (known && (!known.contract || !same(known.contract, dom.usdc))) return null; // catalog has a USDC that is not Circle's → refuse\n return dom.usdc;\n }\n\n function parseIntent(intentId: string): {src: CctpDomain; dst: CctpDomain; threshold: number} | null {\n const [tag, s, dd, t] = intentId.split(\":\");\n if (tag !== \"cctp\") return null;\n const src = CCTP_BY_DOMAIN[Number(s)];\n const dst = CCTP_BY_DOMAIN[Number(dd)];\n const threshold = Number(t);\n if (!src || !dst || !(threshold === FINALITY_FAST || threshold === FINALITY_STANDARD)) return null;\n return {src, dst, threshold};\n }\n\n async function fetchMessage(src: CctpDomain, sourceTxHash: string): Promise<ApiMessage | null> {\n const out = await getJson<{messages?: ApiMessage[]}>(`/v2/messages/${src.domain}?transactionHash=${encodeURIComponent(sourceTxHash)}`);\n const m = out?.messages?.find((x) => x.cctpVersion === undefined || x.cctpVersion === 2);\n return m ?? null;\n }\n\n /** The nonce's state on the destination: null without an RPC there, \"unknown\" when the configured RPC fails to answer. */\n async function minted(dst: CctpDomain, nonce: Hex): Promise<boolean | null | \"unknown\"> {\n const c = client(dst.caip2);\n if (!c) return null;\n try {\n const used = await c.readContract({address: getAddress(dst.messageTransmitter), abi: MESSAGE_TRANSMITTER_ABI, functionName: \"usedNonces\", args: [nonce]});\n return used !== 0n;\n } catch {\n return \"unknown\";\n }\n }\n\n return {\n name: \"cctp\",\n claimTargets: cctpClaimTargets,\n describeActivity: describeCctpActivity,\n enabled: () => config.enabled ?? true,\n supportsChain: (chain: string) => cctpCfg.supportsChain(chain),\n supportsChainPair: (from: string, to: string) => cctpCfg.supports(from, to),\n supportsRoute(from: Asset, to: Asset): boolean {\n const src = CCTP_DOMAINS[from.chain];\n const dst = CCTP_DOMAINS[to.chain];\n if (!src || !dst || from.chain === to.chain) return false;\n if (from.token.toUpperCase() !== \"USDC\") return false;\n // Destination is given as an address (zero = native): only the native USDC of the destination domain.\n return same(to.token, dst.usdc) || to.token.toUpperCase() === \"USDC\";\n },\n\n async getQuote(params: QuoteParams, signal?: AbortSignal): Promise<Quote | null> {\n if (params.flex) return null; // the amount is baked into the calldata\n const src = CCTP_DOMAINS[params.sourceChain];\n const dst = CCTP_DOMAINS[params.destChain];\n if (!src || !dst || src === dst) return null;\n if (params.sourceToken.toUpperCase() !== \"USDC\") return null;\n if (!(same(params.destToken, dst.usdc) || params.destToken.toUpperCase() === \"USDC\")) return null;\n const usdc = usdcOf(src);\n if (!usdc) { params.onRefusal?.(\"catalog USDC on the source chain is not Circle's native USDC\"); return null; }\n if (!/^\\d+$/.test(params.amountIn)) return null;\n const amount = BigInt(params.amountIn);\n if (amount <= 0n) return null;\n // The placeholder prices a dry quote; a live one without a recipient would mint to it (round 3, H8).\n const recipient = params.destAddress || (params.dry !== false ? EVM_PLACEHOLDER : \"\");\n if (!recipient) { params.onRefusal?.(\"a live quote needs a recipient\"); return null; }\n if (!isAddress(recipient)) { params.onRefusal?.(\"destination must be an EVM address\"); return null; }\n\n try {\n const fees = await feeRows(src, dst, signal);\n if (!fees || !Array.isArray(fees) || fees.length === 0) { params.onRefusal?.(\"Circle publishes no fee for this pair\"); return null; }\n const fast = fees.find((f) => f.finalityThreshold === FINALITY_FAST);\n const standard = fees.find((f) => f.finalityThreshold === FINALITY_STANDARD);\n let threshold: number;\n let bps: number;\n if (mode === \"standard\") {\n if (!standard) { params.onRefusal?.(\"Standard Transfer is not offered for this pair\"); return null; }\n threshold = FINALITY_STANDARD; bps = standard.minimumFee;\n } else {\n let fastOk = !!fast;\n if (fastOk) {\n const allowance = await getJson<{allowance?: number}>(\"/v2/fastBurn/USDC/allowance\", signal).catch(() => null);\n // The allowance is in whole USDC; refuse Fast when it cannot cover the burn.\n if (typeof allowance?.allowance === \"number\" && allowance.allowance * 1e6 < bigintToNumber(amount)) fastOk = false;\n }\n if (fastOk) { threshold = FINALITY_FAST; bps = fast!.minimumFee; }\n else if (mode === \"fast\") { params.onRefusal?.(fast ? \"Fast Transfer allowance is exhausted\" : \"Fast Transfer is not offered for this pair\"); return null; }\n else if (standard) { threshold = FINALITY_STANDARD; bps = standard.minimumFee; }\n else { params.onRefusal?.(\"neither Fast nor Standard is offered\"); return null; }\n }\n if (!Number.isFinite(bps) || bps < 0) return null;\n const maxFee = feeFor(amount, bps, bufferPct);\n if (maxFee >= amount) { params.onRefusal?.(\"amount is below the Fast Transfer fee\"); return null; }\n const out = amount - maxFee;\n if (params.minAmountOut !== undefined && out < BigInt(params.minAmountOut)) return null;\n\n const data = encodeFunctionData({\n abi: TOKEN_MESSENGER_ABI,\n functionName: \"depositForBurn\",\n args: [amount, dst.domain, pad(getAddress(recipient), {size: 32}), getAddress(usdc), zeroHash, maxFee, threshold],\n });\n const eta = threshold === FINALITY_FAST ? (src.domain === 0 ? 180 : 45) : (src.domain === 0 ? 1200 : 1000);\n return {\n provider: \"cctp\",\n intentId: `cctp:${src.domain}:${dst.domain}:${threshold}`,\n depositAddress: \"\",\n depositMemo: null,\n txRequest: {to: src.tokenMessenger, data, value: \"0\", chainId: src.chainId, gasLimit: GAS_DEPOSIT, approvalAddress: src.tokenMessenger},\n sourceAmount: amount.toString(),\n destAmount: out.toString(),\n minDestAmount: out.toString(),\n feeUsd: bigintToNumber(maxFee) / 1e6,\n fees: maxFee > 0n ? [{type: \"protocol\", amount: maxFee.toString(), token: usdc, included: true, description: `Circle Fast Transfer fee (${bps} bps + ${bufferPct}% buffer, unused part is not charged)`}] : [],\n etaSeconds: eta,\n reliability: 0.99,\n validUntilMs: Date.now() + quoteTtlMs,\n providerData: {\n sourceDomain: String(src.domain), destinationDomain: String(dst.domain), finalityThreshold: String(threshold),\n maxFee: maxFee.toString(), mintRecipient: getAddress(recipient), claimChain: dst.caip2, claimRequired: \"1\",\n },\n };\n } catch {\n return null;\n }\n },\n\n async buildDeposit(quote: Quote): Promise<UnsignedTx> {\n const tx = quote.txRequest;\n const parsed = parseIntent(quote.intentId);\n if (!tx || !parsed) throw new Error(\"swap2: CCTP quote has no transaction request\");\n return {\n chain: parsed.src.caip2,\n to: tx.to ?? \"\",\n value: tx.value ?? \"0\",\n ...(tx.data ? {data: tx.data} : {}),\n ...(tx.chainId !== undefined ? {chainId: tx.chainId} : {}),\n ...(tx.gasLimit ? {gasLimit: tx.gasLimit} : {}),\n ...(tx.approvalAddress ? {approvalAddress: tx.approvalAddress} : {}),\n };\n },\n\n /**\n * Fast: Circle's CURRENT fee (same source and rounding as the quote, without\n * the buffer) still fits `maxFee` — Iris would otherwise hold the burn\n * until it times out to Standard. With a source RPC: the target really is\n * CCTP for this domain.\n */\n async preflightDeposit(quote: Quote, tx: UnsignedTx): Promise<void> {\n const parsed = parseIntent(quote.intentId);\n if (!parsed) throw new Error(\"cctp: malformed intent id\");\n if (!same(tx.to, parsed.src.tokenMessenger)) throw new Error(\"cctp: deposit target is not the TokenMessengerV2 of the source domain\");\n if (parsed.threshold === FINALITY_FAST) {\n const fast = (await feeRows(parsed.src, parsed.dst))?.find((f) => f.finalityThreshold === FINALITY_FAST);\n if (!fast || !Number.isFinite(fast.minimumFee) || fast.minimumFee < 0) throw new Error(\"cctp: Circle no longer publishes a Fast Transfer fee for this pair — re-quote\");\n const minFee = feeFor(BigInt(quote.sourceAmount), fast.minimumFee, 0);\n const maxFee = BigInt(quote.providerData?.maxFee ?? \"0\");\n if (minFee > maxFee) throw new Error(`cctp: Circle's Fast Transfer fee ${minFee} (${fast.minimumFee} bps) exceeds the quoted maxFee ${maxFee} — re-quote`);\n }\n const c = client(parsed.src.caip2);\n if (!c) return;\n const transmitter = await c.readContract({address: getAddress(parsed.src.tokenMessenger), abi: TOKEN_MESSENGER_ABI, functionName: \"localMessageTransmitter\"});\n if (!same(transmitter, parsed.src.messageTransmitter)) throw new Error(\"cctp: TokenMessengerV2 does not point at the expected MessageTransmitterV2\");\n const domain = await c.readContract({address: getAddress(parsed.src.messageTransmitter), abi: MESSAGE_TRANSMITTER_ABI, functionName: \"localDomain\"});\n if (Number(domain) !== parsed.src.domain) throw new Error(`cctp: MessageTransmitterV2 reports domain ${domain}, expected ${parsed.src.domain}`);\n },\n\n async trackIntent(ref: IntentRef): Promise<IntentStatus> {\n const parsed = parseIntent(ref.intentId);\n if (!parsed) return {state: \"failed\"};\n const claim = {chain: parsed.dst.caip2, ready: false};\n if (!ref.sourceTxHash) return {state: \"pending\", claim};\n try {\n const m = await fetchMessage(parsed.src, ref.sourceTxHash);\n if (!m) return {state: \"pending\", depositReceived: false, claim};\n const nonce = m.decodedMessage?.nonce;\n if (m.status === \"complete\" && isHexData(m.attestation) && isHexData(m.message)) {\n // A message without a readable nonce cannot be checked on the destination even with an RPC there.\n const done = isHexData(nonce) && nonce.length === 66 ? await minted(parsed.dst, nonce) : client(parsed.dst.caip2) ? \"unknown\" : null;\n if (done === true) return {state: \"completed\", claim: {...claim, ready: false}, ...(ref.destTxHash ? {destTxHash: ref.destTxHash} : {})};\n if (ref.destTxHash) {\n // A claim the sending account saw included and succeed is the mint: receiveMessage reverts once the\n // nonce is used, so a successful one minted this message. Without a destination read that is completed;\n // a destination read that does not show it yet is a node behind the claim, not a claim to send again.\n if (ref.destTxConfirmed === true) {\n return done === false\n ? {state: \"pending\", depositReceived: true, destTxHash: ref.destTxHash, claim: {...claim, ready: false}}\n : {state: \"completed\", destTxHash: ref.destTxHash, claim: {...claim, ready: false}};\n }\n // A claim was sent, but nothing here can read whether it minted (no destination RPC, or one that did\n // not answer): the hash is kept and the swap stays pending — a hash alone is not a mint.\n if (done !== false) return {state: \"pending\", depositReceived: true, destTxHash: ref.destTxHash, claim: {...claim, ready: false}};\n }\n return {state: \"action-required\", depositReceived: true, claim: {...claim, ready: true}};\n }\n return {state: \"pending\", depositReceived: true, claim};\n } catch {\n return {state: \"pending\", claim};\n }\n },\n\n /** `receiveMessage(message, attestation)` on the destination once Circle attested; null while pending. */\n async buildClaim(ref: IntentRef): Promise<UnsignedTx | null> {\n const parsed = parseIntent(ref.intentId);\n if (!parsed || !ref.sourceTxHash) return null;\n const m = await fetchMessage(parsed.src, ref.sourceTxHash);\n if (!m || m.status !== \"complete\" || !isHexData(m.attestation) || !isHexData(m.message)) return null;\n // Bind the attested message to the route it claims to complete.\n if (m.decodedMessage?.destinationDomain !== undefined && Number(m.decodedMessage.destinationDomain) !== parsed.dst.domain) {\n throw new Error(\"cctp: attested message is for another destination domain\");\n }\n if (m.decodedMessage?.sourceDomain !== undefined && Number(m.decodedMessage.sourceDomain) !== parsed.src.domain) {\n throw new Error(\"cctp: attested message is for another source domain\");\n }\n // Fast messages expire at `expirationBlock` on the destination; an expired\n // one needs Circle's re-attestation before it can be received. The\n // transmitter compares it with `block.number`, which on Arbitrum-stack\n // chains is the L1 (Ethereum) height, not the L2 height eth_blockNumber\n // returns — the RPC block carries it as `l1BlockNumber` (live\n // 2026-10-16: a Base→Arbitrum claim was held as \"expired\" by L2 height).\n const exp = m.decodedMessage?.decodedMessageBody?.expirationBlock;\n const c = client(parsed.dst.caip2);\n if (c && exp && /^\\d+$/.test(exp) && BigInt(exp) > 0n) {\n const head = await c.request({method: \"eth_getBlockByNumber\", params: [\"latest\", false]})\n .then((b) => {\n const block = b as {number?: string; l1BlockNumber?: string} | null;\n const raw = block?.l1BlockNumber ?? block?.number;\n return raw ? BigInt(raw) : null;\n })\n .catch(() => null);\n if (head !== null && head >= BigInt(exp)) {\n const nonce = m.decodedMessage?.nonce ?? m.eventNonce;\n if (nonce) await doFetch(`${api}/v2/reattest/${nonce}`, {method: \"POST\", signal: timeoutSignal(12_000)}).catch(() => undefined);\n return null;\n }\n }\n return {\n chain: parsed.dst.caip2,\n to: parsed.dst.messageTransmitter,\n value: \"0\",\n data: encodeFunctionData({abi: MESSAGE_TRANSMITTER_ABI, functionName: \"receiveMessage\", args: [m.message, m.attestation]}),\n chainId: parsed.dst.chainId,\n gasLimit: GAS_CLAIM,\n };\n },\n };\n}\n\n/**\n * A remote CCTP quote's burn, decoded on the device against the app's own request (scan 2026-10-30, F3): exactly\n * `depositForBurn` on the source TokenMessengerV2 with no value, approving it; the input amount; the destination\n * chain's domain; the recipient as `mintRecipient`; the source domain's native USDC; no destination caller; a Fast\n * or Standard threshold; and a `maxFee` that leaves at least the quoted minimum and the caller's floor. The reason\n * it fails, or null. The engine then requires the build to repeat this quote's call.\n */\nexport function cctpVerifyQuote(params: QuoteParams, quote: Quote): string | null {\n const src = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, params.sourceChain) ? CCTP_DOMAINS[params.sourceChain] : undefined;\n const dst = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, params.destChain) ? CCTP_DOMAINS[params.destChain] : undefined;\n if (!src || !dst || src === dst) return \"not a CCTP route between two domains\";\n if (params.sourceToken.toUpperCase() !== \"USDC\" || !(same(params.destToken, dst.usdc) || params.destToken.toUpperCase() === \"USDC\")) return \"not USDC to USDC\";\n const tx = quote.txRequest;\n if (!tx?.data || !tx.to || tx.serializedTx !== undefined) return \"the quote carries no TokenMessenger call\";\n if (!same(tx.to, src.tokenMessenger)) return `the call targets ${tx.to}, not the TokenMessengerV2`;\n if (BigInt(tx.value ?? \"0\") !== 0n) return \"a burn attaches no value\";\n if (!tx.approvalAddress || !same(tx.approvalAddress, src.tokenMessenger)) return \"the burn approves another spender than the TokenMessengerV2\";\n if (tx.chainId !== undefined && tx.chainId !== src.chainId) return `the call is for chain ${tx.chainId}, not ${src.chainId}`;\n let args: readonly unknown[];\n try {\n const d = decodeFunctionData({abi: TOKEN_MESSENGER_ABI, data: tx.data as Hex});\n if (d.functionName !== \"depositForBurn\") return `${d.functionName} is not depositForBurn`;\n args = d.args;\n } catch {\n return \"the call is not depositForBurn\";\n }\n const [amount, domain, mintRecipient, burnToken, caller, maxFee, threshold] = args as [bigint, number, Hex, string, Hex, bigint, number];\n let amountIn: bigint, floor: bigint;\n try {\n amountIn = BigInt(params.amountIn);\n floor = BigInt(quote.minDestAmount);\n if (params.minAmountOut !== undefined && BigInt(params.minAmountOut) > floor) floor = BigInt(params.minAmountOut);\n } catch {\n return \"the request does not name amounts\";\n }\n if (amount !== amountIn || BigInt(quote.sourceAmount) !== amountIn) return `the burn moves ${amount}, not the ${amountIn} input`;\n if (domain !== dst.domain) return `the burn mints on domain ${domain}, not ${dst.name} (${dst.domain})`;\n // A dry quote without a recipient prices the placeholder the provider uses; it is never built (the engine re-quotes live).\n if (params.destAddress || params.dry === false) {\n if (!isAddress(params.destAddress)) return \"the recipient is not an EVM address\";\n if (mintRecipient.toLowerCase() !== pad(getAddress(params.destAddress), {size: 32}).toLowerCase()) return `the burn mints to ${mintRecipient}, not the recipient`;\n }\n if (!same(burnToken, src.usdc)) return `the burn spends ${burnToken}, not the source domain's USDC`;\n if (caller !== zeroHash) return \"the burn names a destination caller\";\n if (threshold !== FINALITY_FAST && threshold !== FINALITY_STANDARD) return `finality threshold ${threshold} is neither Fast nor Standard`;\n if (maxFee >= amount || amount - maxFee < floor) return `the burn's maxFee ${maxFee} leaves less than the ${floor} minimum`;\n // The server appends its intent token (`<id>~<tag>`); the id before it is what the server's provider tracks and claims.\n if ((/^([\\s\\S]+)~[0-9a-f]{32}$/.exec(quote.intentId)?.[1] ?? quote.intentId) !== `cctp:${src.domain}:${dst.domain}:${threshold}`) return \"the intent id does not name this burn\";\n if (quote.providerData?.maxFee !== undefined && quote.providerData.maxFee !== maxFee.toString()) return \"the quoted maxFee is not the burn's\";\n return null;\n}\n\n/**\n * The TokenMessenger a CCTP burn calls and approves, and the MessageTransmitter its claim calls, per\n * chain, and {@link cctpVerifyQuote} — the app's pins for `remoteProvider({name: \"cctp\", baseUrl, ...cctpPins})`\n * (scan 2026-10-27 modules, F8/F16; claims since round 3, M24; the burn's arguments since scan 2026-10-30, F3).\n */\nexport const cctpPins: RemotePins & {claimTargets(chain: string): readonly string[]} = Object.freeze({\n callTargets: (chain: string): readonly string[] => cctpMessengerFor(chain),\n spenders: (chain: string): readonly string[] => cctpMessengerFor(chain),\n claimTargets: cctpClaimTargets,\n verifyQuote: cctpVerifyQuote,\n});\nfunction cctpMessengerFor(chain: string): readonly string[] {\n const d = Object.prototype.hasOwnProperty.call(CCTP_DOMAINS, chain) ? CCTP_DOMAINS[chain] : undefined;\n return d ? [d.tokenMessenger] : [];\n}\n"],"mappings":";;;;;;;;;;;;;AACA,SAAQ,oBAAoB,oBAAoB,oBAAoB,YAAY,MAAM,WAAW,KAAK,UAAU,gBAAyB;AAEzI,SAAQ,eAAc;AACtB,SAAQ,qBAAoB;AAG5B,SAAQ,sBAAqB;AA0B7B,IAAM,sBAAsB,SAAS;AAAA,EACnC;AAAA,EACA;AACF,CAAC;AACD,IAAM,0BAA0B,SAAS;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,IAAM,kBAAkB;AACxB,IAAM,uBAAuB;AAE7B,IAAM,cAAc;AACpB,IAAM,YAAY;AAwClB,IAAM,YAAY,CAAC,MAAyB,OAAO,MAAM,YAAY,0BAA0B,KAAK,CAAC;AACrG,IAAM,OAAO,CAAC,GAAuB,MAAc,CAAC,CAAC,KAAK,EAAE,YAAY,MAAM,EAAE,YAAY;AAG5F,SAAS,OAAO,QAAgB,KAAa,WAA2B;AACtE,QAAM,aAAa,OAAO,KAAK,MAAM,MAAM,GAAG,CAAC;AAC/C,QAAM,OAAO,SAAS,aAAa,WAAY;AAC/C,MAAI,QAAQ,GAAI,QAAO;AACv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