@anywalletkit/protocol-swap2-across 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +177 -2
  3. package/dist/activity.cjs +142 -0
  4. package/dist/activity.cjs.map +1 -0
  5. package/dist/activity.d.cts +16 -0
  6. package/dist/activity.d.ts +16 -0
  7. package/dist/activity.js +10 -0
  8. package/dist/activity.js.map +1 -0
  9. package/dist/api.cjs +441 -0
  10. package/dist/api.cjs.map +1 -0
  11. package/dist/api.d.cts +207 -0
  12. package/dist/api.d.ts +207 -0
  13. package/dist/api.js +35 -0
  14. package/dist/api.js.map +1 -0
  15. package/dist/build.cjs +776 -0
  16. package/dist/build.cjs.map +1 -0
  17. package/dist/build.d.cts +93 -0
  18. package/dist/build.d.ts +93 -0
  19. package/dist/build.js +14 -0
  20. package/dist/build.js.map +1 -0
  21. package/dist/chunk-32YJEBZX.js +125 -0
  22. package/dist/chunk-32YJEBZX.js.map +1 -0
  23. package/dist/chunk-3UBRQ3ZE.js +255 -0
  24. package/dist/chunk-3UBRQ3ZE.js.map +1 -0
  25. package/dist/chunk-5BDZXOOP.js +21 -0
  26. package/dist/chunk-5BDZXOOP.js.map +1 -0
  27. package/dist/chunk-6Z4GXNLE.js +102 -0
  28. package/dist/chunk-6Z4GXNLE.js.map +1 -0
  29. package/dist/chunk-AWQT5S4V.js +101 -0
  30. package/dist/chunk-AWQT5S4V.js.map +1 -0
  31. package/dist/chunk-E5WFOPN2.js +16 -0
  32. package/dist/chunk-E5WFOPN2.js.map +1 -0
  33. package/dist/chunk-GX67FRPG.js +194 -0
  34. package/dist/chunk-GX67FRPG.js.map +1 -0
  35. package/dist/chunk-KATEONJQ.js +396 -0
  36. package/dist/chunk-KATEONJQ.js.map +1 -0
  37. package/dist/chunk-P32AW6XS.js +27 -0
  38. package/dist/chunk-P32AW6XS.js.map +1 -0
  39. package/dist/chunk-PPPZIG7S.js +265 -0
  40. package/dist/chunk-PPPZIG7S.js.map +1 -0
  41. package/dist/chunk-SJOFLM27.js +138 -0
  42. package/dist/chunk-SJOFLM27.js.map +1 -0
  43. package/dist/chunk-YGNP7KPL.js +311 -0
  44. package/dist/chunk-YGNP7KPL.js.map +1 -0
  45. package/dist/config.cjs +214 -0
  46. package/dist/config.cjs.map +1 -0
  47. package/dist/config.d.cts +119 -0
  48. package/dist/config.d.ts +119 -0
  49. package/dist/config.js +47 -0
  50. package/dist/config.js.map +1 -0
  51. package/dist/deposit.cjs +252 -0
  52. package/dist/deposit.cjs.map +1 -0
  53. package/dist/deposit.d.cts +95 -0
  54. package/dist/deposit.d.ts +95 -0
  55. package/dist/deposit.js +19 -0
  56. package/dist/deposit.js.map +1 -0
  57. package/dist/index.cjs +1789 -0
  58. package/dist/index.cjs.map +1 -0
  59. package/dist/index.d.cts +34 -0
  60. package/dist/index.d.ts +34 -0
  61. package/dist/index.js +242 -0
  62. package/dist/index.js.map +1 -0
  63. package/dist/pricing.cjs +132 -0
  64. package/dist/pricing.cjs.map +1 -0
  65. package/dist/pricing.d.cts +123 -0
  66. package/dist/pricing.d.ts +123 -0
  67. package/dist/pricing.js +42 -0
  68. package/dist/pricing.js.map +1 -0
  69. package/dist/protocol.cjs +1596 -0
  70. package/dist/protocol.cjs.map +1 -0
  71. package/dist/protocol.d.cts +20 -0
  72. package/dist/protocol.d.ts +20 -0
  73. package/dist/protocol.js +17 -0
  74. package/dist/protocol.js.map +1 -0
  75. package/dist/provider.cjs +1581 -0
  76. package/dist/provider.cjs.map +1 -0
  77. package/dist/provider.d.cts +45 -0
  78. package/dist/provider.d.ts +45 -0
  79. package/dist/provider.js +18 -0
  80. package/dist/provider.js.map +1 -0
  81. package/dist/remote.cjs +1659 -0
  82. package/dist/remote.cjs.map +1 -0
  83. package/dist/remote.d.cts +55 -0
  84. package/dist/remote.d.ts +55 -0
  85. package/dist/remote.js +17 -0
  86. package/dist/remote.js.map +1 -0
  87. package/dist/status.cjs +443 -0
  88. package/dist/status.cjs.map +1 -0
  89. package/dist/status.d.cts +109 -0
  90. package/dist/status.d.ts +109 -0
  91. package/dist/status.js +26 -0
  92. package/dist/status.js.map +1 -0
  93. package/dist/verify.cjs +690 -0
  94. package/dist/verify.cjs.map +1 -0
  95. package/dist/verify.d.cts +245 -0
  96. package/dist/verify.d.ts +245 -0
  97. package/dist/verify.js +69 -0
  98. package/dist/verify.js.map +1 -0
  99. package/module.json +32 -0
  100. package/package.json +124 -3
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/deposit.ts","../src/config.ts","../src/refusal.ts"],"sourcesContent":["/**\n * SpokePool `deposit` — built and read here, strictly.\n *\n * `deposit(bytes32 depositor, bytes32 recipient, bytes32 inputToken, bytes32 outputToken, uint256 inputAmount,\n * uint256 outputAmount, uint256 destinationChainId, bytes32 exclusiveRelayer, uint32 quoteTimestamp,\n * uint32 fillDeadline, uint32 exclusivityParameter, bytes message)`, selector 0xad5425c6 (SpokePool.sol at\n * across-protocol/contracts d652689f). Every party and token is a `bytes32`; on an EVM chain it holds a 20-byte address\n * left-padded with zeros, and `depositor` is required to be one on chain (`checkAddress`).\n *\n * The reader accepts exactly the canonical ABI encoding of that call: the selector, eleven static words with clean\n * padding, the one offset the encoding allows (0x180), the message length and the message padded to a word, and\n * nothing after it. Across's own API appends a marker to the calldata it hands out (`73c0de`, and `1dc0de` + an\n * integrator id before it); such bytes are not part of the call and are refused here — this module signs the calldata\n * it builds, which carries none.\n */\nimport {encodeFunctionData, parseAbi, type Hex} from \"viem\";\nimport {ACROSS_DEPOSIT, ACROSS_REFUSED_SELECTORS} from \"./config.js\";\nimport {AcrossRefusal} from \"./refusal.js\";\n\nexport const SPOKE_POOL_ABI = parseAbi([\n \"function deposit(bytes32 depositor, bytes32 recipient, bytes32 inputToken, bytes32 outputToken, uint256 inputAmount, uint256 outputAmount, uint256 destinationChainId, bytes32 exclusiveRelayer, uint32 quoteTimestamp, uint32 fillDeadline, uint32 exclusivityParameter, bytes message) payable\",\n]);\n\n/** The arguments of a deposit. Addresses are 20 bytes, lowercase; the zero address as `exclusiveRelayer` is \"none\". */\nexport interface AcrossDepositArgs {\n depositor: string;\n recipient: string;\n inputToken: string;\n outputToken: string;\n inputAmount: bigint;\n outputAmount: bigint;\n destinationChainId: bigint;\n exclusiveRelayer: string;\n /** Unix seconds. */\n quoteTimestamp: number;\n /** Unix seconds, on the destination chain. */\n fillDeadline: number;\n /** 0 (no exclusivity), an offset up to one year, or a unix timestamp above that. */\n exclusivityParameter: number;\n /** Lowercase hex, `0x` when empty. */\n message: Hex;\n}\n\nconst ADDRESS = /^0x[0-9a-fA-F]{40}$/;\nconst HEX = /^0x(?:[0-9a-fA-F]{2})*$/;\nconst U256_MAX = (1n << 256n) - 1n;\nconst U32_MAX = 0xffff_ffff;\n/** Static words before the message: eleven arguments and the message's offset. */\nconst HEAD_WORDS = 12;\n/** The only offset a canonical encoding gives the message: right after the head. */\nconst MESSAGE_OFFSET = HEAD_WORDS * 32;\n/** Longest message read (64 KiB): this module refuses every non-empty message anyway, this only bounds the work. */\nexport const ACROSS_MAX_MESSAGE_BYTES = 65_536;\n\n/** An address as the bytes32 a deposit carries. */\nexport function acrossBytes32(address: string): Hex {\n if (typeof address !== \"string\" || !ADDRESS.test(address)) throw new AcrossRefusal(\"request-invalid\", `${String(address)} is not an EVM address`);\n return `0x${\"0\".repeat(24)}${address.slice(2).toLowerCase()}`;\n}\n\n/** The address a bytes32 word holds, or null when its upper twelve bytes are not zero (not an EVM address). */\nexport function acrossAddressOf(word: string): string | null {\n const w = word.startsWith(\"0x\") ? word.slice(2) : word;\n if (!/^[0-9a-fA-F]{64}$/.test(w) || !/^0{24}/.test(w)) return null;\n return `0x${w.slice(24).toLowerCase()}`;\n}\n\nfunction checkArgs(a: AcrossDepositArgs): void {\n const bad = (what: string): never => { throw new AcrossRefusal(\"request-invalid\", `the deposit's ${what}`); };\n if (a === null || typeof a !== \"object\") bad(\"arguments are missing\");\n for (const [k, v] of [[\"depositor\", a.depositor], [\"recipient\", a.recipient], [\"inputToken\", a.inputToken], [\"outputToken\", a.outputToken], [\"exclusiveRelayer\", a.exclusiveRelayer]] as const) {\n if (typeof v !== \"string\" || !ADDRESS.test(v)) bad(`${k} is not an EVM address`);\n }\n for (const [k, v] of [[\"inputAmount\", a.inputAmount], [\"outputAmount\", a.outputAmount], [\"destinationChainId\", a.destinationChainId]] as const) {\n if (typeof v !== \"bigint\" || v < 0n || v > U256_MAX) bad(`${k} is not a uint256`);\n }\n for (const [k, v] of [[\"quoteTimestamp\", a.quoteTimestamp], [\"fillDeadline\", a.fillDeadline], [\"exclusivityParameter\", a.exclusivityParameter]] as const) {\n if (!Number.isInteger(v) || v < 0 || v > U32_MAX) bad(`${k} is not a uint32`);\n }\n if (typeof a.message !== \"string\" || !HEX.test(a.message) || (a.message.length - 2) / 2 > ACROSS_MAX_MESSAGE_BYTES) bad(\"message is not bytes\");\n}\n\n/** The calldata of `deposit(...)` for these arguments: lowercase hex, canonical ABI encoding, nothing appended. */\nexport function encodeAcrossDeposit(a: AcrossDepositArgs): Hex {\n checkArgs(a);\n return encodeFunctionData({\n abi: SPOKE_POOL_ABI,\n functionName: \"deposit\",\n args: [\n acrossBytes32(a.depositor), acrossBytes32(a.recipient), acrossBytes32(a.inputToken), acrossBytes32(a.outputToken),\n a.inputAmount, a.outputAmount, a.destinationChainId, acrossBytes32(a.exclusiveRelayer),\n a.quoteTimestamp, a.fillDeadline, a.exclusivityParameter, a.message.toLowerCase() as Hex,\n ],\n }).toLowerCase() as Hex;\n}\n\n/** A word's value when it fits 32 bits (its upper 28 bytes zero), else null. */\nfunction word32(word: string): number | null {\n return /^0{56}[0-9a-f]{8}$/.test(word) ? parseInt(word.slice(56), 16) : null;\n}\n\n/**\n * The arguments of a `deposit` calldata, read strictly; throws {@link AcrossRefusal} (`tx-selector`, `tx-calldata`,\n * classified `policy_refused`) for anything but the canonical encoding of that one call.\n */\nexport function decodeAcrossDeposit(data: unknown): AcrossDepositArgs {\n const malformed = (what: string): never => { throw new AcrossRefusal(\"tx-calldata\", `the deposit calldata ${what}`, \"policy_refused\"); };\n if (typeof data !== \"string\" || !HEX.test(data) || data.length < 10) malformed(\"is not hex calldata\");\n const hex = (data as string).toLowerCase();\n const selector = hex.slice(0, 10);\n if (selector !== ACROSS_DEPOSIT) {\n const name = Object.prototype.hasOwnProperty.call(ACROSS_REFUSED_SELECTORS, selector) ? ACROSS_REFUSED_SELECTORS[selector] : undefined;\n throw new AcrossRefusal(\"tx-selector\", name ? `the call is ${name} (${selector}), which this module never signs` : `the call is ${selector}, not deposit (${ACROSS_DEPOSIT})`, \"policy_refused\");\n }\n const body = hex.slice(10);\n if (body.length < (HEAD_WORDS + 1) * 64) malformed(`is ${(hex.length - 2) / 2} bytes, shorter than a deposit`);\n const word = (i: number): string => body.slice(64 * i, 64 * i + 64);\n const addr = (i: number, what: string): string => acrossAddressOf(word(i)) ?? malformed(`carries a ${what} that is not an EVM address`);\n const u32 = (i: number, what: string): number => word32(word(i)) ?? malformed(`carries a ${what} wider than 32 bits`);\n const offset = BigInt(`0x${word(11)}`);\n if (offset !== BigInt(MESSAGE_OFFSET)) malformed(`puts the message at offset ${offset}, not ${MESSAGE_OFFSET}`);\n const lengthWord = word(HEAD_WORDS);\n if (!/^0{56}/.test(lengthWord)) malformed(\"states an impossible message length\");\n const length = parseInt(lengthWord.slice(56), 16);\n if (length > ACROSS_MAX_MESSAGE_BYTES) malformed(`carries a ${length}-byte message, over ${ACROSS_MAX_MESSAGE_BYTES}`);\n const padded = Math.ceil(length / 32) * 64;\n const expected = (HEAD_WORDS + 1) * 64 + padded;\n if (body.length !== expected) {\n malformed(body.length > expected\n ? `has ${(body.length - expected) / 2} bytes after the encoded call`\n : `is ${(hex.length - 2) / 2} bytes, the encoding needs ${4 + expected / 2}`);\n }\n const tail = body.slice((HEAD_WORDS + 1) * 64);\n if (!/^0*$/.test(tail.slice(length * 2))) malformed(\"pads the message with non-zero bytes\");\n const args: AcrossDepositArgs = {\n depositor: addr(0, \"depositor\"),\n recipient: addr(1, \"recipient\"),\n inputToken: addr(2, \"input token\"),\n outputToken: addr(3, \"output token\"),\n inputAmount: BigInt(`0x${word(4)}`),\n outputAmount: BigInt(`0x${word(5)}`),\n destinationChainId: BigInt(`0x${word(6)}`),\n exclusiveRelayer: addr(7, \"exclusive relayer\"),\n quoteTimestamp: u32(8, \"quote timestamp\"),\n fillDeadline: u32(9, \"fill deadline\"),\n exclusivityParameter: u32(10, \"exclusivity parameter\"),\n message: `0x${tail.slice(0, length * 2)}`,\n };\n // Whatever the reads above let through, the bytes are the canonical encoding of what was read.\n if (encodeAcrossDeposit(args) !== hex) malformed(\"is not the canonical encoding of its arguments\");\n return args;\n}\n","// Across Protocol — the pins this module signs against. Nothing here is read from an API at run time: the Across API\n// (or an app's own proxy in front of it) is untrusted, and a deposit is signed only for a SpokePool, a chain and a\n// token written in this file.\n//\n// Sources, all read on 2026-11-15:\n// - github.com/across-protocol/contracts @ d652689f67cd9835b9c1ab0acc2f99236902e299, `broadcast/deployed-addresses.json`\n// (\"the current source of truth for deployed contract addresses\", deployments/README.md): `chains.<id>.contracts.\n// SpokePool.address` for every row below, `chains.1.contracts.HubPool.address` for the hub.\n// - On chain, Ethereum: `HubPool.crossChainContracts(chainId)` (selector 0x09474ae2) answers the same SpokePool for\n// every row (publicnode, block 26415696; eth.drpc.org one block later agreed on every row).\n// - On chain, each row over a public RPC: `eth_chainId` and the SpokePool's own `chainId()` are the row's id; the\n// EIP-1967 implementation slot is set (UUPS proxy, upgraded through the HubPool); `crossDomainAdmin()` is the\n// HubPool; `wrappedNativeToken()` is the value pinned below; `depositQuoteTimeBuffer()` = 3600,\n// `fillDeadlineBuffer()` = 21600 and `pausedDeposits()` = false. The implementation carries the `deposit` selector\n// as PUSH4 on every EVM-bytecode chain. zkSync Era runs EraVM bytecode, where that scan does not apply: there a real\n// deposit was traced instead (tx 0x21c702af…f0d96, `debug_traceTransaction` callTracer): a successful call into the\n// SpokePool with selector 0xad5425c6, 420 bytes (empty message), which emitted FundsDeposited.\n// - The contract: contracts/spoke-pools/SpokePool.sol and contracts/interfaces/V3SpokePoolInterface.sol at the same\n// commit (selectors, event, relay hash, fill statuses, the native-coin rules quoted where they are used).\n// - Tokens: Across's own route list (`GET /available-routes`) and token list (`GET /swap/tokens`), read 2026-11-14,\n// intersected with the SDK's asset catalog (`@anywalletkit/swap2-assets`) by address. A token is pinned only when\n// Across bridges it to the SAME asset on another pinned chain with the same decimals; routes Across lists between\n// different assets (USDC → USDC.e, USDC-BNB → USDC, USDT → USDC, USDG → USDC) are not served.\n//\n// Chains Across serves that are NOT pinned, and why:\n// - Scroll (534352): `pausedDeposits()` is true on chain (as on Lens, Mode and Zora, which the SDK does not carry) and\n// it is gone from Across's own chain page.\n// - BNB Chain (56): Across bridges its Binance-Peg USDC and USDT (18 decimals) only into other assets, and its ETH is an\n// ERC-20 the catalog does not list — no same-asset route is left.\n// - Lisk, Soneium, Tempo, Blast, Boba, Solana, Tron, HyperCore, Lighter: not EVM chains of the SDK's catalog.\n// SDK chains Across does not serve: Gnosis, Sonic, Berachain, Celo, Mantle, Katana, Morph, Flare, Elysium, Sei, Plume,\n// X Layer.\n\n/** What a token is across chains. A deposit only ever moves an asset to the same asset. */\nexport type AcrossAsset = \"USDC\" | \"USDT\" | \"ETH\" | \"WBTC\";\n\nexport interface AcrossToken {\n asset: AcrossAsset;\n /** ERC-20 contract on this chain, lowercase. */\n address: string;\n /** The catalog's symbol on this chain (Tether's USDT is `USDT0` where it is issued as USDT0). */\n symbol: string;\n decimals: number;\n}\n\nexport interface AcrossChain {\n caip2: string;\n chainId: number;\n /** The SDK's chain key (`@anywalletkit/swap2-assets`). */\n key: string;\n name: string;\n /** SpokePool proxy on that chain: the only contract a deposit calls and the only spender an approval names. */\n spokePool: string;\n /**\n * `wrappedNativeToken()` of that SpokePool. A deposit that sends the native coin names it as `inputToken`; a fill of\n * it is paid out as the native coin to an EOA. Null where the SpokePool reports the zero address (Arc).\n */\n wrappedNative: string | null;\n /** The chain's native coin is ether, bridged as the ETH asset. */\n nativeIsEth: boolean;\n /** ERC-20s Across bridges to the same asset on another pinned chain. ETH's ERC-20 is the wrapped native token. */\n tokens: readonly AcrossToken[];\n}\n\nconst USDC = (address: string, symbol = \"USDC\"): AcrossToken => Object.freeze({asset: \"USDC\", address, symbol, decimals: 6});\nconst USDT = (address: string, symbol = \"USDT\"): AcrossToken => Object.freeze({asset: \"USDT\", address, symbol, decimals: 6});\nconst WETH = (address: string): AcrossToken => Object.freeze({asset: \"ETH\", address, symbol: \"WETH\", decimals: 18});\nconst WBTC = (address: string): AcrossToken => Object.freeze({asset: \"WBTC\", address, symbol: \"WBTC\", decimals: 8});\n\n/** The OP-stack predeploy WETH9. */\nconst OP_WETH = \"0x4200000000000000000000000000000000000006\";\n\nfunction chain(\n chainId: number, key: string, name: string, spokePool: string, wrappedNative: string | null, nativeIsEth: boolean, tokens: AcrossToken[],\n): AcrossChain {\n return Object.freeze({caip2: `eip155:${chainId}`, chainId, key, name, spokePool, wrappedNative, nativeIsEth, tokens: Object.freeze(tokens)});\n}\n\n/** CAIP-2 → the chain as Across serves it. A null-prototype map: `ACROSS_CHAINS[\"constructor\"]` is undefined. */\nexport const ACROSS_CHAINS: Readonly<Record<string, AcrossChain>> = Object.freeze(Object.assign(Object.create(null) as Record<string, AcrossChain>, Object.fromEntries([\n chain(1, \"ethereum\", \"Ethereum\", \"0x5c7bcd6e7de5423a257d81b442095a1a6ced35c5\", \"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\", true, [\n USDC(\"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\"),\n USDT(\"0xdac17f958d2ee523a2206206994597c13d831ec7\"),\n WETH(\"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\"),\n WBTC(\"0x2260fac5e5542a773aa44fbcfedf7c193bc2c599\"),\n ]),\n chain(10, \"optimism\", \"Optimism\", \"0x6f26bf09b1c792e3228e5467807a900a503c0281\", OP_WETH, true, [\n USDC(\"0x0b2c639c533813f4aa9d7837caf62653d097ff85\"),\n USDT(\"0x94b008aa00579c1307b0ef2c499ad98a8ce58e58\"),\n WETH(OP_WETH),\n ]),\n chain(130, \"unichain\", \"Unichain\", \"0x09aea4b2242abc8bb4bb78d537a67a245a7bec64\", OP_WETH, true, [\n USDC(\"0x078d782b760474a361dda0af3839290b0ef57ad6\"),\n USDT(\"0x9151434b16b9763660705744891fa906f660ecc5\", \"USDT0\"),\n WETH(OP_WETH),\n ]),\n chain(137, \"polygon\", \"Polygon\", \"0x9295ee1d8c5b022be115a2ad3c30c72e34e7f096\", \"0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270\", false, [\n USDC(\"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359\"),\n USDT(\"0xc2132d05d31c914a87c6611c10748aeb04b58e8f\"),\n WBTC(\"0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6\"),\n ]),\n chain(143, \"monad\", \"Monad\", \"0xd2ecb3afe598b746f8123cae365a598da831a449\", \"0x3bd359c1119da7da1d913d1c4d2b7c461115433a\", false, [\n USDC(\"0x754704bc059f8c67012fed69bc8a327a5aafb603\"),\n USDT(\"0xe7cd86e13ac4309349f30b3435a9d337750fc82d\", \"USDT0\"),\n ]),\n chain(324, \"zksync\", \"zkSync Era\", \"0xe0b015e54d54fc84a6cb9b666099c46ade9335ff\", \"0x5aea5775959fbc2557cc8789bc1bf90a239d9a91\", true, [\n USDT(\"0x493257fd37edb34451f62edf8d2a0c418852ba4c\"),\n WETH(\"0x5aea5775959fbc2557cc8789bc1bf90a239d9a91\"),\n WBTC(\"0xbbeb516fb02a01611cbbe0453fe3c580d7281011\"),\n ]),\n chain(480, \"worldchain\", \"World Chain\", \"0x09aea4b2242abc8bb4bb78d537a67a245a7bec64\", OP_WETH, true, [\n USDC(\"0x79a02482a880bce3f13e09da970dc34db4cd24d1\"),\n WETH(OP_WETH),\n WBTC(\"0x03c7054bcb39f7b2e5b2c7acb37583e32d70cfa3\"),\n ]),\n chain(999, \"hyperevm\", \"HyperEVM\", \"0x35e63ea3eb0fb7a3bc543c71fb66412e1f6b0e04\", \"0x5555555555555555555555555555555555555555\", false, [\n USDC(\"0xb88339cb7199b77e23db6e890353e22632ba630f\"),\n USDT(\"0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb\", \"USDT0\"),\n ]),\n chain(4326, \"megaeth\", \"MegaETH\", \"0x3db06da8f0a24a525f314eec954fc5c6a973d40e\", OP_WETH, true, [\n USDT(\"0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb\", \"USDT0\"),\n WETH(OP_WETH),\n ]),\n chain(4663, \"robinhood\", \"Robinhood Chain\", \"0xd29c85f15df544ba632c9e25829fd29d767d7978\", \"0x0bd7d308f8e1639fab988df18a8011f41eacad73\", true, [\n WETH(\"0x0bd7d308f8e1639fab988df18a8011f41eacad73\"),\n ]),\n // Arc's gas coin is USDC; 0x3600… is its 6-decimal ERC-20 interface, which is what Across moves. The SpokePool\n // reports no wrapped native token, so no deposit or fill on Arc involves the native coin.\n chain(5042, \"arc\", \"Arc\", \"0x9b4a302a548c7e313c2b74c461db7b84d3074a84\", null, false, [\n USDC(\"0x3600000000000000000000000000000000000000\"),\n ]),\n chain(8453, \"base\", \"Base\", \"0x09aea4b2242abc8bb4bb78d537a67a245a7bec64\", OP_WETH, true, [\n USDC(\"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913\"),\n USDT(\"0xfde4c96c8593536e31f229ea8f37b2ada2699bb2\"),\n WETH(OP_WETH),\n ]),\n chain(9745, \"plasma\", \"Plasma\", \"0x50039faefebef707cfd94d6d462fe6d10b39207a\", \"0x6100e367285b01f48d07953803a2d8dca5d19873\", false, [\n USDT(\"0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb\", \"USDT0\"),\n ]),\n chain(42161, \"arbitrum\", \"Arbitrum\", \"0xe35e9842fceaca96570b734083f4a58e8f7c5f2a\", \"0x82af49447d8a07e3bd95bd0d56f35241523fbab1\", true, [\n USDC(\"0xaf88d065e77c8cc2239327c5edb3a432268e5831\"),\n USDT(\"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9\", \"USDT0\"),\n WETH(\"0x82af49447d8a07e3bd95bd0d56f35241523fbab1\"),\n WBTC(\"0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f\"),\n ]),\n chain(43114, \"avalanche\", \"Avalanche\", \"0xfe9d541c92e4e90437c7152a00244886de37a658\", \"0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7\", false, [\n USDC(\"0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e\"),\n USDT(\"0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7\"),\n ]),\n chain(57073, \"ink\", \"Ink\", \"0xef684c38f94f48775959ecf2012d7e864ffb9dd4\", OP_WETH, true, [\n USDC(\"0x2d270e6886d130d724215a266106e6832161eaed\"),\n USDT(\"0x0200c29006150606b650577bbe7b6248f58470c1\", \"USDT0\"),\n WETH(OP_WETH),\n ]),\n chain(59144, \"linea\", \"Linea\", \"0x7e63a5f1a8f0b4d0934b2f2327daed3f6bb2ee75\", \"0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f\", true, [\n USDC(\"0x176211869ca2b568f2a7d4ee941e073a821ee1ff\"),\n USDT(\"0xa219439258ca9da29e9cc4ce5596924745e12b93\"),\n WETH(\"0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f\"),\n WBTC(\"0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4\"),\n ]),\n].map((x) => [x.caip2, x]))));\n\n/** The chain for a CAIP-2 id, or undefined — own keys only. */\nexport function acrossChain(caip2: string): AcrossChain | undefined {\n return typeof caip2 === \"string\" && Object.prototype.hasOwnProperty.call(ACROSS_CHAINS, caip2) ? ACROSS_CHAINS[caip2] : undefined;\n}\n\n/** The pinned token at `address` on `chain` (any casing), or undefined. */\nexport function acrossToken(chain: AcrossChain, address: string): AcrossToken | undefined {\n if (typeof address !== \"string\") return undefined;\n const a = address.toLowerCase();\n return chain.tokens.find((t) => t.address === a);\n}\n\n/**\n * The HubPool on Ethereum: `crossChainContracts(chainId)` is the registry every pinned SpokePool was checked against.\n * Not a proxy; owned by a 3-of-5 Safe that can re-point the registry and upgrade every SpokePool — a watched fact.\n */\nexport const ACROSS_HUB_POOL = \"0xc186fa914353c44b2e33ebe05f21846f1048beda\";\n/** `crossChainContracts(uint256)` on the HubPool → `(address adapter, address spokePool)`. */\nexport const ACROSS_HUB_CROSS_CHAIN_CONTRACTS = \"0x09474ae2\";\n\n/**\n * `deposit(bytes32 depositor, bytes32 recipient, bytes32 inputToken, bytes32 outputToken, uint256 inputAmount,\n * uint256 outputAmount, uint256 destinationChainId, bytes32 exclusiveRelayer, uint32 quoteTimestamp,\n * uint32 fillDeadline, uint32 exclusivityParameter, bytes message)` payable — the only call this module builds or signs.\n */\nexport const ACROSS_DEPOSIT = \"0xad5425c6\";\n/** `depositV3(address …)`: the address-typed wrapper of `deposit`. Read in history, never built or signed. */\nexport const ACROSS_DEPOSIT_V3 = \"0x7b939232\";\n/**\n * Calls on a SpokePool that are always refused: `unsafeDeposit` (a caller-chosen deposit id that can collide),\n * `depositNow` / `depositV3Now` (the fill deadline set on chain), `speedUpDeposit` / `speedUpV3Deposit` (a depositor\n * signature that lets a relayer pay another recipient or a lower amount), and `multicall`.\n */\nexport const ACROSS_REFUSED_SELECTORS: Readonly<Record<string, string>> = Object.freeze({\n \"0x8b15788e\": \"unsafeDeposit\",\n \"0xea86bd46\": \"depositNow\",\n \"0x7aef642c\": \"depositV3Now\",\n \"0xbabb6aac\": \"speedUpDeposit\",\n \"0x577f51f8\": \"speedUpV3Deposit\",\n \"0xac9650d8\": \"multicall\",\n});\n\n/**\n * `UpdateDepositDetails(uint256 depositId,uint256 originChainId,uint256 updatedOutputAmount,bytes32 updatedRecipient,\n * bytes updatedMessage)` under the domain `ACROSS-V2` / `1.0.0`: the speed-up signature. It can move a deposit's\n * output to another recipient, so nothing carrying this type (or that domain) is ever signed through this module.\n */\nexport const ACROSS_SPEED_UP_TYPEHASH = \"0x8d1994e2bbbd77564cdca06dd819e7ee2a5efa06c80dcb59a4a7b6e39edc538f\";\nexport const ACROSS_SPEED_UP_TYPE = \"UpdateDepositDetails\";\nexport const ACROSS_SPEED_UP_DOMAIN = \"ACROSS-V2\";\n\n/**\n * `FundsDeposited(bytes32 inputToken, bytes32 outputToken, uint256 inputAmount, uint256 outputAmount,\n * uint256 indexed destinationChainId, uint256 indexed depositId, uint32 quoteTimestamp, uint32 fillDeadline,\n * uint32 exclusivityDeadline, bytes32 indexed depositor, bytes32 recipient, bytes32 exclusiveRelayer, bytes message)`.\n */\nexport const ACROSS_FUNDS_DEPOSITED = \"0x32ed1a409ef04c7b0227189c3a103dc5ac10e775a15b785dcc510201f7c25ad3\";\n/** `fillStatuses(bytes32 relayHash)` → 0 unfilled, 1 slow fill requested, 2 filled. */\nexport const ACROSS_FILL_STATUSES = \"0xc35c83fc\";\n\n/**\n * `keccak256(\"AcrossV5MessagePrefix.V1\")`: a deposit message starting with these 32 bytes is an Across V5 witness,\n * consumable only through the Gateway's V5 fill entry points (SpokePool.sol `V5_MAGIC_PREFIX`). Refused by name —\n * this module signs empty messages only.\n */\nexport const ACROSS_V5_MESSAGE_PREFIX = \"0x89ae4bc75915265a3f10e926c3894a29534f1d6362ee8959cb0e5be00f3527fd\";\n\n/** `depositQuoteTimeBuffer()` on every pinned SpokePool: a deposit's `quoteTimestamp` may be at most this old. */\nexport const ACROSS_DEPOSIT_QUOTE_TIME_BUFFER_S = 3600;\n/** `fillDeadlineBuffer()` on every pinned SpokePool: a deposit's `fillDeadline` may be at most this far ahead. */\nexport const ACROSS_FILL_DEADLINE_BUFFER_S = 21_600;\n/** SpokePool `MAX_EXCLUSIVITY_PERIOD_SECONDS`: an `exclusivityParameter` up to this is an offset, above it a timestamp. */\nexport const ACROSS_MAX_EXCLUSIVITY_PERIOD_S = 31_536_000;\n\n/** The native coin in a request (and in Across's own token lists): twenty zero bytes. */\nexport const ACROSS_NATIVE = \"0x0000000000000000000000000000000000000000\";\n\n/** Across API V5: the price source (`api.ts`), with a key from dashboard.across.to kept on a server. */\nexport const ACROSS_API = \"https://api.across.to\";\n\nconst ZERO = /^0x0{40}$/;\nconst isNativeRef = (token: string): boolean => ZERO.test(token);\n\n/** One side of a route: the token as the deposit names it, and whether the user's side of it is the native coin. */\nexport interface AcrossRouteSide {\n chain: AcrossChain;\n /** The token the deposit names: the ERC-20, or the wrapped native token when `native`. */\n token: string;\n native: boolean;\n decimals: number;\n}\n\nexport interface AcrossRoute {\n asset: AcrossAsset;\n input: AcrossRouteSide;\n output: AcrossRouteSide;\n}\n\n/** Why a pair is not served, for a refusal. */\nexport interface AcrossRouteMiss {\n code: \"chain-unsupported\" | \"token-unsupported\" | \"pair-unsupported\" | \"native-unsupported\" | \"wrapped-native-destination\";\n detail: string;\n}\n\n/**\n * The route a request names, or why it is not served. `sourceToken` / `destToken` are contracts (any casing) or the\n * zero address for the native coin. Served: two different pinned chains, the same asset on both sides, the native coin\n * only where it is ether and the SpokePool wraps it, and never the wrapped native token as a destination ERC-20 — an\n * empty-message fill of it pays an EOA the native coin, which is not what was asked for.\n */\nexport function acrossRouteOf(sourceChain: string, sourceToken: string, destChain: string, destToken: string): AcrossRoute | AcrossRouteMiss {\n const src = acrossChain(sourceChain);\n const dst = acrossChain(destChain);\n if (!src) return {code: \"chain-unsupported\", detail: `source chain ${String(sourceChain)} is not a pinned Across chain`};\n if (!dst) return {code: \"chain-unsupported\", detail: `destination chain ${String(destChain)} is not a pinned Across chain`};\n if (src === dst) return {code: \"chain-unsupported\", detail: \"source and destination are the same chain\"};\n if (typeof sourceToken !== \"string\" || typeof destToken !== \"string\") return {code: \"token-unsupported\", detail: \"the tokens are not addresses\"};\n let input: AcrossRouteSide;\n let asset: AcrossAsset;\n if (isNativeRef(sourceToken)) {\n if (!src.nativeIsEth || !src.wrappedNative) return {code: \"native-unsupported\", detail: `${src.name}'s native coin is not bridged by Across`};\n input = {chain: src, token: src.wrappedNative, native: true, decimals: 18};\n asset = \"ETH\";\n } else {\n const t = acrossToken(src, sourceToken);\n if (!t) return {code: \"token-unsupported\", detail: `${sourceToken.toLowerCase()} is not a token pinned on ${src.name}`};\n input = {chain: src, token: t.address, native: false, decimals: t.decimals};\n asset = t.asset;\n }\n let output: AcrossRouteSide;\n if (isNativeRef(destToken)) {\n if (!dst.nativeIsEth || !dst.wrappedNative) return {code: \"native-unsupported\", detail: `${dst.name}'s native coin is not bridged by Across`};\n if (asset !== \"ETH\") return {code: \"pair-unsupported\", detail: `${asset} on ${src.name} is not bridged to ${dst.name}'s native coin`};\n output = {chain: dst, token: dst.wrappedNative, native: true, decimals: 18};\n } else {\n const t = acrossToken(dst, destToken);\n if (!t) return {code: \"token-unsupported\", detail: `${destToken.toLowerCase()} is not a token pinned on ${dst.name}`};\n if (dst.wrappedNative !== null && t.address === dst.wrappedNative) {\n return {code: \"wrapped-native-destination\", detail: `a fill of ${t.symbol} on ${dst.name} pays an EOA the native coin, not ${t.symbol} — ask for the native coin`};\n }\n if (t.asset !== asset) return {code: \"pair-unsupported\", detail: `${asset} is only bridged to ${asset}, not to ${t.symbol}`};\n output = {chain: dst, token: t.address, native: false, decimals: t.decimals};\n }\n if (input.decimals !== output.decimals) return {code: \"pair-unsupported\", detail: \"the two sides have different decimals\"};\n return {asset, input, output};\n}\n\nexport const across = {\n supportsChain(chain: string): boolean {\n return acrossChain(chain) !== undefined;\n },\n /** Two different pinned EVM chains. */\n supports(from: string, to: string): boolean {\n return from !== to && acrossChain(from) !== undefined && acrossChain(to) !== undefined;\n },\n};\n","import {withReason, type Swap2RefusalReason} from \"@anywalletkit/protocol-swap2-core/errors\";\n\n/** Why a request, a deposit, a quote or an API answer was refused. One code per check; the message says what was found. */\nexport type AcrossRefusalCode =\n | \"request-invalid\"\n | \"chain-unsupported\"\n | \"token-unsupported\"\n | \"pair-unsupported\"\n | \"native-unsupported\"\n | \"wrapped-native-destination\"\n | \"route-unpriced\"\n | \"quote-unavailable\"\n | \"quote-normalized\"\n | \"tx-shape\"\n | \"tx-chain\"\n | \"tx-target\"\n | \"tx-selector\"\n | \"tx-calldata\"\n | \"tx-depositor\"\n | \"tx-recipient\"\n | \"tx-input-token\"\n | \"tx-output-token\"\n | \"tx-input-amount\"\n | \"tx-output-amount\"\n | \"tx-fee\"\n | \"tx-destination\"\n | \"tx-message\"\n | \"tx-message-v5\"\n | \"tx-exclusivity\"\n | \"tx-quote-time\"\n | \"tx-fill-deadline\"\n | \"tx-value\"\n | \"tx-approval\"\n | \"speed-up\"\n | \"quote-shape\"\n | \"quote-amounts\"\n | \"quote-expiry\"\n | \"quote-gas\"\n | \"quote-intent\"\n | \"api-error\"\n | \"api-answer\"\n | \"relayer-price\";\n\n/**\n * `code` names the check; `reason` (a `Swap2RefusalReason` from `@anywalletkit/protocol-swap2-core`) is the stable\n * classification an app switches on. It is set where the refusal is raised, so one code can carry different reasons\n * (a fill deadline too far ahead is `policy_refused`, one already too close is `quote_expired`); a malformed request\n * from the caller (a programming error) carries none.\n */\nexport class AcrossRefusal extends Error {\n readonly code: AcrossRefusalCode;\n declare readonly reason?: Swap2RefusalReason;\n constructor(code: AcrossRefusalCode, detail: string, reason?: Swap2RefusalReason) {\n super(`across: ${detail} [${code}]`);\n this.name = \"AcrossRefusal\";\n this.code = code;\n if (reason !== undefined) withReason(this, reason);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,kBAAqD;;;ACiDrD,IAAM,OAAO,CAAC,SAAiB,SAAS,WAAwB,OAAO,OAAO,EAAC,OAAO,QAAQ,SAAS,QAAQ,UAAU,EAAC,CAAC;AAC3H,IAAM,OAAO,CAAC,SAAiB,SAAS,WAAwB,OAAO,OAAO,EAAC,OAAO,QAAQ,SAAS,QAAQ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AChF;AACA,QAAM,OAAO,KAAK,OAAO,aAAa,KAAK,EAAE;AAC7C,MAAI,CAAC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC,CAAC,EAAG,WAAU,sCAAsC;AAC1F,QAAM,OAA0B;AAAA,IAC9B,WAAW,KAAK,GAAG,WAAW;AAAA,IAC9B,WAAW,KAAK,GAAG,WAAW;AAAA,IAC9B,YAAY,KAAK,GAAG,aAAa;AAAA,IACjC,aAAa,KAAK,GAAG,cAAc;AAAA,IACnC,aAAa,OAAO,KAAK,KAAK,CAAC,CAAC,EAAE;AAAA,IAClC,cAAc,OAAO,KAAK,KAAK,CAAC,CAAC,EAAE;AAAA,IACnC,oBAAoB,OAAO,KAAK,KAAK,CAAC,CAAC,EAAE;AAAA,IACzC,kBAAkB,KAAK,GAAG,mBAAmB;AAAA,IAC7C,gBAAgB,IAAI,GAAG,iBAAiB;AAAA,IACxC,cAAc,IAAI,GAAG,eAAe;AAAA,IACpC,sBAAsB,IAAI,IAAI,uBAAuB;AAAA,IACrD,SAAS,KAAK,KAAK,MAAM,GAAG,SAAS,CAAC,CAAC;AAAA,EACzC;AAEA,MAAI,oBAAoB,IAAI,MAAM,IAAK,WAAU,gDAAgD;AACjG,SAAO;AACT;","names":[]}
@@ -0,0 +1,95 @@
1
+ import { Hex } from 'viem';
2
+
3
+ /**
4
+ * SpokePool `deposit` — built and read here, strictly.
5
+ *
6
+ * `deposit(bytes32 depositor, bytes32 recipient, bytes32 inputToken, bytes32 outputToken, uint256 inputAmount,
7
+ * uint256 outputAmount, uint256 destinationChainId, bytes32 exclusiveRelayer, uint32 quoteTimestamp,
8
+ * uint32 fillDeadline, uint32 exclusivityParameter, bytes message)`, selector 0xad5425c6 (SpokePool.sol at
9
+ * across-protocol/contracts d652689f). Every party and token is a `bytes32`; on an EVM chain it holds a 20-byte address
10
+ * left-padded with zeros, and `depositor` is required to be one on chain (`checkAddress`).
11
+ *
12
+ * The reader accepts exactly the canonical ABI encoding of that call: the selector, eleven static words with clean
13
+ * padding, the one offset the encoding allows (0x180), the message length and the message padded to a word, and
14
+ * nothing after it. Across's own API appends a marker to the calldata it hands out (`73c0de`, and `1dc0de` + an
15
+ * integrator id before it); such bytes are not part of the call and are refused here — this module signs the calldata
16
+ * it builds, which carries none.
17
+ */
18
+
19
+ declare const SPOKE_POOL_ABI: readonly [{
20
+ readonly name: "deposit";
21
+ readonly type: "function";
22
+ readonly stateMutability: "payable";
23
+ readonly inputs: readonly [{
24
+ readonly type: "bytes32";
25
+ readonly name: "depositor";
26
+ }, {
27
+ readonly type: "bytes32";
28
+ readonly name: "recipient";
29
+ }, {
30
+ readonly type: "bytes32";
31
+ readonly name: "inputToken";
32
+ }, {
33
+ readonly type: "bytes32";
34
+ readonly name: "outputToken";
35
+ }, {
36
+ readonly type: "uint256";
37
+ readonly name: "inputAmount";
38
+ }, {
39
+ readonly type: "uint256";
40
+ readonly name: "outputAmount";
41
+ }, {
42
+ readonly type: "uint256";
43
+ readonly name: "destinationChainId";
44
+ }, {
45
+ readonly type: "bytes32";
46
+ readonly name: "exclusiveRelayer";
47
+ }, {
48
+ readonly type: "uint32";
49
+ readonly name: "quoteTimestamp";
50
+ }, {
51
+ readonly type: "uint32";
52
+ readonly name: "fillDeadline";
53
+ }, {
54
+ readonly type: "uint32";
55
+ readonly name: "exclusivityParameter";
56
+ }, {
57
+ readonly type: "bytes";
58
+ readonly name: "message";
59
+ }];
60
+ readonly outputs: readonly [];
61
+ }];
62
+ /** The arguments of a deposit. Addresses are 20 bytes, lowercase; the zero address as `exclusiveRelayer` is "none". */
63
+ interface AcrossDepositArgs {
64
+ depositor: string;
65
+ recipient: string;
66
+ inputToken: string;
67
+ outputToken: string;
68
+ inputAmount: bigint;
69
+ outputAmount: bigint;
70
+ destinationChainId: bigint;
71
+ exclusiveRelayer: string;
72
+ /** Unix seconds. */
73
+ quoteTimestamp: number;
74
+ /** Unix seconds, on the destination chain. */
75
+ fillDeadline: number;
76
+ /** 0 (no exclusivity), an offset up to one year, or a unix timestamp above that. */
77
+ exclusivityParameter: number;
78
+ /** Lowercase hex, `0x` when empty. */
79
+ message: Hex;
80
+ }
81
+ /** Longest message read (64 KiB): this module refuses every non-empty message anyway, this only bounds the work. */
82
+ declare const ACROSS_MAX_MESSAGE_BYTES = 65536;
83
+ /** An address as the bytes32 a deposit carries. */
84
+ declare function acrossBytes32(address: string): Hex;
85
+ /** The address a bytes32 word holds, or null when its upper twelve bytes are not zero (not an EVM address). */
86
+ declare function acrossAddressOf(word: string): string | null;
87
+ /** The calldata of `deposit(...)` for these arguments: lowercase hex, canonical ABI encoding, nothing appended. */
88
+ declare function encodeAcrossDeposit(a: AcrossDepositArgs): Hex;
89
+ /**
90
+ * The arguments of a `deposit` calldata, read strictly; throws {@link AcrossRefusal} (`tx-selector`, `tx-calldata`,
91
+ * classified `policy_refused`) for anything but the canonical encoding of that one call.
92
+ */
93
+ declare function decodeAcrossDeposit(data: unknown): AcrossDepositArgs;
94
+
95
+ export { ACROSS_MAX_MESSAGE_BYTES, type AcrossDepositArgs, SPOKE_POOL_ABI, acrossAddressOf, acrossBytes32, decodeAcrossDeposit, encodeAcrossDeposit };
@@ -0,0 +1,95 @@
1
+ import { Hex } from 'viem';
2
+
3
+ /**
4
+ * SpokePool `deposit` — built and read here, strictly.
5
+ *
6
+ * `deposit(bytes32 depositor, bytes32 recipient, bytes32 inputToken, bytes32 outputToken, uint256 inputAmount,
7
+ * uint256 outputAmount, uint256 destinationChainId, bytes32 exclusiveRelayer, uint32 quoteTimestamp,
8
+ * uint32 fillDeadline, uint32 exclusivityParameter, bytes message)`, selector 0xad5425c6 (SpokePool.sol at
9
+ * across-protocol/contracts d652689f). Every party and token is a `bytes32`; on an EVM chain it holds a 20-byte address
10
+ * left-padded with zeros, and `depositor` is required to be one on chain (`checkAddress`).
11
+ *
12
+ * The reader accepts exactly the canonical ABI encoding of that call: the selector, eleven static words with clean
13
+ * padding, the one offset the encoding allows (0x180), the message length and the message padded to a word, and
14
+ * nothing after it. Across's own API appends a marker to the calldata it hands out (`73c0de`, and `1dc0de` + an
15
+ * integrator id before it); such bytes are not part of the call and are refused here — this module signs the calldata
16
+ * it builds, which carries none.
17
+ */
18
+
19
+ declare const SPOKE_POOL_ABI: readonly [{
20
+ readonly name: "deposit";
21
+ readonly type: "function";
22
+ readonly stateMutability: "payable";
23
+ readonly inputs: readonly [{
24
+ readonly type: "bytes32";
25
+ readonly name: "depositor";
26
+ }, {
27
+ readonly type: "bytes32";
28
+ readonly name: "recipient";
29
+ }, {
30
+ readonly type: "bytes32";
31
+ readonly name: "inputToken";
32
+ }, {
33
+ readonly type: "bytes32";
34
+ readonly name: "outputToken";
35
+ }, {
36
+ readonly type: "uint256";
37
+ readonly name: "inputAmount";
38
+ }, {
39
+ readonly type: "uint256";
40
+ readonly name: "outputAmount";
41
+ }, {
42
+ readonly type: "uint256";
43
+ readonly name: "destinationChainId";
44
+ }, {
45
+ readonly type: "bytes32";
46
+ readonly name: "exclusiveRelayer";
47
+ }, {
48
+ readonly type: "uint32";
49
+ readonly name: "quoteTimestamp";
50
+ }, {
51
+ readonly type: "uint32";
52
+ readonly name: "fillDeadline";
53
+ }, {
54
+ readonly type: "uint32";
55
+ readonly name: "exclusivityParameter";
56
+ }, {
57
+ readonly type: "bytes";
58
+ readonly name: "message";
59
+ }];
60
+ readonly outputs: readonly [];
61
+ }];
62
+ /** The arguments of a deposit. Addresses are 20 bytes, lowercase; the zero address as `exclusiveRelayer` is "none". */
63
+ interface AcrossDepositArgs {
64
+ depositor: string;
65
+ recipient: string;
66
+ inputToken: string;
67
+ outputToken: string;
68
+ inputAmount: bigint;
69
+ outputAmount: bigint;
70
+ destinationChainId: bigint;
71
+ exclusiveRelayer: string;
72
+ /** Unix seconds. */
73
+ quoteTimestamp: number;
74
+ /** Unix seconds, on the destination chain. */
75
+ fillDeadline: number;
76
+ /** 0 (no exclusivity), an offset up to one year, or a unix timestamp above that. */
77
+ exclusivityParameter: number;
78
+ /** Lowercase hex, `0x` when empty. */
79
+ message: Hex;
80
+ }
81
+ /** Longest message read (64 KiB): this module refuses every non-empty message anyway, this only bounds the work. */
82
+ declare const ACROSS_MAX_MESSAGE_BYTES = 65536;
83
+ /** An address as the bytes32 a deposit carries. */
84
+ declare function acrossBytes32(address: string): Hex;
85
+ /** The address a bytes32 word holds, or null when its upper twelve bytes are not zero (not an EVM address). */
86
+ declare function acrossAddressOf(word: string): string | null;
87
+ /** The calldata of `deposit(...)` for these arguments: lowercase hex, canonical ABI encoding, nothing appended. */
88
+ declare function encodeAcrossDeposit(a: AcrossDepositArgs): Hex;
89
+ /**
90
+ * The arguments of a `deposit` calldata, read strictly; throws {@link AcrossRefusal} (`tx-selector`, `tx-calldata`,
91
+ * classified `policy_refused`) for anything but the canonical encoding of that one call.
92
+ */
93
+ declare function decodeAcrossDeposit(data: unknown): AcrossDepositArgs;
94
+
95
+ export { ACROSS_MAX_MESSAGE_BYTES, type AcrossDepositArgs, SPOKE_POOL_ABI, acrossAddressOf, acrossBytes32, decodeAcrossDeposit, encodeAcrossDeposit };
@@ -0,0 +1,19 @@
1
+ import {
2
+ ACROSS_MAX_MESSAGE_BYTES,
3
+ SPOKE_POOL_ABI,
4
+ acrossAddressOf,
5
+ acrossBytes32,
6
+ decodeAcrossDeposit,
7
+ encodeAcrossDeposit
8
+ } from "./chunk-32YJEBZX.js";
9
+ import "./chunk-GX67FRPG.js";
10
+ import "./chunk-E5WFOPN2.js";
11
+ export {
12
+ ACROSS_MAX_MESSAGE_BYTES,
13
+ SPOKE_POOL_ABI,
14
+ acrossAddressOf,
15
+ acrossBytes32,
16
+ decodeAcrossDeposit,
17
+ encodeAcrossDeposit
18
+ };
19
+ //# sourceMappingURL=deposit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}