@qntx/wallet-chains 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -10
- package/dist/{account-ref-D2rW_qlI.mjs → account-ref-BFTeEyHt.mjs} +2 -2
- package/dist/{account-ref-D2rW_qlI.mjs.map → account-ref-BFTeEyHt.mjs.map} +1 -1
- package/dist/assemble-8GvNDony.mjs +405 -0
- package/dist/assemble-8GvNDony.mjs.map +1 -0
- package/dist/assemble-B3sO9Fvc.mjs +629 -0
- package/dist/assemble-B3sO9Fvc.mjs.map +1 -0
- package/dist/assemble-BdiPo0ZX.mjs +32 -0
- package/dist/assemble-BdiPo0ZX.mjs.map +1 -0
- package/dist/assets-sg2_Z3nZ.mjs +200 -0
- package/dist/assets-sg2_Z3nZ.mjs.map +1 -0
- package/dist/bitcoin-sign.d.mts +3 -0
- package/dist/bitcoin-sign.mjs +52 -18
- package/dist/bitcoin-sign.mjs.map +1 -1
- package/dist/bitcoin.d.mts +123 -7
- package/dist/bitcoin.mjs +162 -69
- package/dist/bitcoin.mjs.map +1 -1
- package/dist/evm-sign.d.mts +3 -1
- package/dist/evm-sign.mjs +25 -108
- package/dist/evm-sign.mjs.map +1 -1
- package/dist/evm.d.mts +152 -28
- package/dist/evm.mjs +2216 -753
- package/dist/evm.mjs.map +1 -1
- package/dist/families-BlgplKAJ.mjs +412 -0
- package/dist/families-BlgplKAJ.mjs.map +1 -0
- package/dist/index-CIRaHKpx.d.mts +941 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/networks.d.mts +29 -0
- package/dist/networks.mjs +245 -0
- package/dist/networks.mjs.map +1 -0
- package/dist/plan-wCnxHqRu.mjs +1311 -0
- package/dist/plan-wCnxHqRu.mjs.map +1 -0
- package/dist/solana-sign.d.mts +3 -0
- package/dist/solana-sign.mjs +23 -10
- package/dist/solana-sign.mjs.map +1 -1
- package/dist/solana.d.mts +117 -34
- package/dist/solana.mjs +796 -99
- package/dist/solana.mjs.map +1 -1
- package/dist/src-CHB_z45M.mjs +387 -0
- package/dist/src-CHB_z45M.mjs.map +1 -0
- package/dist/tasks-7AFv3PQn.mjs +86 -0
- package/dist/tasks-7AFv3PQn.mjs.map +1 -0
- package/dist/token-call-DH22g8BL.mjs +914 -0
- package/dist/token-call-DH22g8BL.mjs.map +1 -0
- package/dist/tron-sign.d.mts +10 -0
- package/dist/tron-sign.mjs +36 -0
- package/dist/tron-sign.mjs.map +1 -0
- package/dist/tron.d.mts +328 -0
- package/dist/tron.mjs +1484 -0
- package/dist/tron.mjs.map +1 -0
- package/dist/typed-data-CE9h4U0F.d.mts +51 -0
- package/dist/{typed-data-B4PJ1v8F.mjs → typed-data-DRtKULsH.mjs} +158 -10
- package/dist/typed-data-DRtKULsH.mjs.map +1 -0
- package/package.json +17 -10
- package/dist/index-DpL5hvPl.d.mts +0 -354
- package/dist/message-zf3XHwwc.mjs +0 -188
- package/dist/message-zf3XHwwc.mjs.map +0 -1
- package/dist/src-8NZeEnrW.mjs +0 -67
- package/dist/src-8NZeEnrW.mjs.map +0 -1
- package/dist/typed-data-B4PJ1v8F.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assemble-B3sO9Fvc.mjs","names":[],"sources":["../src/evm/fiat24.ts","../src/evm/envelope.ts","../src/evm/plan.ts","../src/evm/assemble.ts"],"sourcesContent":["import { keccak_256 } from \"@noble/hashes/sha3.js\";\nimport { bytesToHex, utf8ToBytes } from \"@noble/hashes/utils.js\";\nimport * as AbiFunction from \"ox/AbiFunction\";\n\nimport { ChainError } from \"../index.ts\";\nimport type {\n Fiat24Action,\n Fiat24Token,\n IntentSummary,\n AssetFlow,\n IntentWarning,\n} from \"../index.ts\";\nimport { checksumEvmAddress } from \"./address.ts\";\nimport { EVM_NATIVE_ASSET } from \"./assets.ts\";\nimport { lookupEvmToken } from \"./tokens.ts\";\nimport type { EvmTokenTable } from \"./tokens.ts\";\nimport { assertHex } from \"./transaction.ts\";\n\n/**\n * The Fiat24 contracts (SR Saphirstein AG) the decoder recognises by address — Arbitrum One only.\n * The pinned proxies come from the issuer's own list\n * (https://docs.fiat24.com/developer/integration-guide/part-1-smart-contracts.md) re-read on chain\n * at block 526439604: EIP-1967 implementation slots, symbol()/decimals() — Sourcify full matches,\n * solc 0.8.18.\n */\nexport const FIAT24_CHAIN = 42161;\n\n/** The ERC-721 \"Fiat24 Account\" — each token id is a client account. */\nexport const FIAT24_ACCOUNT = \"0x133CAEecA096cA54889db71956c7f75862Ead7A0\";\n\n/** The FX/top-up contract (Fiat24CryptoDeposit). */\nexport const FIAT24_DEPOSIT = \"0x4582f67698843Dfb6A9F195C0dDee05B0A8C973F\";\n\n/** The card-authorisation contract (Fiat24CardAuthorizationMarqeta). */\nexport const FIAT24_CARD = \"0xe2e3B88B9893e18D0867c08f9cA93f8aB5935b14\";\n\n/**\n * The deposit contract's `usdc()` — every Fiat24 top-up routes through it\n * (Fiat24CryptoDeposit.sol:66; Arbitrum One USDC).\n */\nexport const FIAT24_USDC = \"0xaf88d065e77c8cC2239327C5EDb3A432268e5831\";\n\n/**\n * The F24 utility token `mintByClient` burns at the issuer-set account price (Fiat24Account.sol:96\n * `f24.burnFrom(msg.sender, fiat24PriceList.getPrice(_tokenId))`; the deposit contract's `f24()`\n * getter returns this address on chain; Sourcify exact match —\n * https://sourcify.dev/server/v2/contract/42161/0x22043fDdF353308B4F2e7dA2e5284E4D087449e1).\n */\nconst F24_BURN: Fiat24Token = {\n asset: \"0x22043fDdF353308B4F2e7dA2e5284E4D087449e1\",\n symbol: \"F24\",\n decimals: 2,\n};\n\n/**\n * The four cash tokens, keyed by lowercase address; each carries its checksummed form. All four\n * share the one Fiat24Token.sol source and `decimals()` is the constant 2 (Fiat24Token.sol:256-258;\n * issuer list above).\n */\nexport const FIAT24_TOKENS: Readonly<\n Record<string, { readonly address: string; readonly symbol: string }>\n> = {\n \"0xbe00f3db78688d9704bcb4e0a827aea3a9cc0d62\": {\n address: \"0xbE00f3db78688d9704BCb4e0a827aea3a9Cc0D62\",\n symbol: \"USD24\",\n },\n \"0x2c5d06f591d0d8cd43ac232c2b654475a142c7da\": {\n address: \"0x2c5d06f591D0d8cd43Ac232c2B654475a142c7DA\",\n symbol: \"EUR24\",\n },\n \"0xd41f1f0cf89fd239ca4c1f8e8ada46345c86b0a4\": {\n address: \"0xd41F1f0cf89fD239ca4c1F8E8ADA46345c86b0a4\",\n symbol: \"CHF24\",\n },\n \"0x7288ac74d211735374a23707d1518dcbbc0144fd\": {\n address: \"0x7288Ac74d211735374A23707D1518DCbbc0144fd\",\n symbol: \"CNH24\",\n },\n};\n\n/* The issuer's internal accounts — the contract itself bounds them: Fiat24Account.sol:119\n `require(!_tokenId.hasFirstDigit(INTERNALDIGIT))` with INTERNALDIGIT = 9 (line 34), and\n DigitsOfUint.hasFirstDigit reads the most significant decimal digit\n (libraries/DigitsOfUint.sol). Clients can never mint those, so paying one is never a payment\n to a person. */\nconst isInternalAccount = (account: bigint): boolean => account.toString(10).startsWith(\"9\");\n\nconst TRANSFER_BY_ACCOUNT_ID = AbiFunction.from(\n \"function transferByAccountId(uint256 accountId, uint256 amount)\",\n);\nconst CLIENT_PAYOUT = AbiFunction.from(\"function clientPayout(uint256 amount, string contactId)\");\nconst CLIENT_PAYOUT_REF = AbiFunction.from(\n \"function clientPayoutRef(uint256 amount, string contactId, uint256 purposeId, string ref)\",\n);\nconst MONEY_EXCHANGE_EXACT_IN = AbiFunction.from(\n \"function moneyExchangeExactIn(address input, address output, uint256 amount)\",\n);\nconst MONEY_EXCHANGE_EXACT_OUT = AbiFunction.from(\n \"function moneyExchangeExactOut(address input, address output, uint256 amount)\",\n);\nconst DEPOSIT_TOKEN_VIA_USDC = AbiFunction.from(\n \"function depositTokenViaUsdc(address input, address output, uint256 amount)\",\n);\nconst DEPOSIT_ETH = AbiFunction.from(\"function depositETH(address output) payable\");\nconst DEPOSIT_TOKEN_VIA_ETH = AbiFunction.from(\n \"function depositTokenViaEth(address input, address output, uint256 amount)\",\n);\nconst MINT_BY_CLIENT = AbiFunction.from(\"function mintByClient(uint256 tokenId)\");\nconst MINT_BY_CLIENT_WITH_ETH = AbiFunction.from(\n \"function mintByClientWithETH(uint256 tokenId) payable\",\n);\n\n/* Plain ERC-721 movement on the account contract — generic selectors the family claims\n only at the pinned proxy, so they do not join FIAT24_FUNCTIONS. */\nconst ACCOUNT_TRANSFER_FROM = AbiFunction.from(\n \"function transferFrom(address from, address to, uint256 tokenId)\",\n);\nconst ACCOUNT_SAFE_TRANSFER = AbiFunction.from(\n \"function safeTransferFrom(address from, address to, uint256 tokenId)\",\n);\nconst ACCOUNT_SAFE_TRANSFER_DATA = AbiFunction.from(\n \"function safeTransferFrom(address from, address to, uint256 tokenId, bytes data)\",\n);\n\n/* The functions only Fiat24 contracts carry — selectors derived from the Sourcify-verified\n ABIs (https://sourcify.dev/server/v2/contract/42161/<impl> for each implementation); each is\n collision-free in the 4byte signature database\n (https://api.4byte.sourcify.dev/signature-database/v1/lookup). A selector's presence in\n calldata claims the Fiat24 family whatever the callee or chain. */\nconst FIAT24_FUNCTIONS: ReadonlyArray<AbiFunction.AbiFunction> = [\n TRANSFER_BY_ACCOUNT_ID,\n CLIENT_PAYOUT,\n CLIENT_PAYOUT_REF,\n MONEY_EXCHANGE_EXACT_IN,\n MONEY_EXCHANGE_EXACT_OUT,\n DEPOSIT_TOKEN_VIA_USDC,\n DEPOSIT_ETH,\n DEPOSIT_TOKEN_VIA_ETH,\n MINT_BY_CLIENT,\n MINT_BY_CLIENT_WITH_ETH,\n];\n\nconst FIAT24_SELECTORS: ReadonlySet<string> = new Set(\n FIAT24_FUNCTIONS.map((fn) => AbiFunction.getSelector(fn)),\n);\n\n/* ERC-20 selectors whose calls to a cash token go through the standard token path. */\nconst ERC20_SELECTORS: ReadonlySet<string> = new Set(\n [\n \"function transfer(address to, uint256 amount)\",\n \"function approve(address spender, uint256 amount)\",\n \"function increaseAllowance(address spender, uint256 amount)\",\n \"function decreaseAllowance(address spender, uint256 amount)\",\n \"function transferFrom(address from, address to, uint256 amount)\",\n ].map((signature) => AbiFunction.getSelector(signature)),\n);\n\nconst FIAT24_CONTRACTS = new Set(\n [FIAT24_ACCOUNT, FIAT24_DEPOSIT, FIAT24_CARD, ...Object.keys(FIAT24_TOKENS)].map((a) =>\n a.toLowerCase(),\n ),\n);\n\n/** `to` is one of the seven pinned Fiat24 proxies on Arbitrum One. */\nexport const isFiat24Contract = (chainId: number, to: string): boolean =>\n chainId === FIAT24_CHAIN && FIAT24_CONTRACTS.has(to.toLowerCase());\n\n/** `data` starts with a Fiat24-specific selector (any callee, any chain). */\nexport const hasFiat24Selector = (data: string): boolean =>\n FIAT24_SELECTORS.has(data.slice(0, 10).toLowerCase());\n\n/** The spender's role when it is a Fiat24 contract on Arbitrum One. */\nexport const fiat24Spender = (chainId: number, spender: string): \"card\" | \"deposit\" | undefined => {\n if (chainId !== FIAT24_CHAIN) {\n return undefined;\n }\n const address = spender.toLowerCase();\n return address === FIAT24_CARD.toLowerCase()\n ? \"card\"\n : address === FIAT24_DEPOSIT.toLowerCase()\n ? \"deposit\"\n : undefined;\n};\n\n/** Canonical-encoding decode like `tryCall` in decode.ts — undefined on any mismatch. */\nconst tryCall = (fn: AbiFunction.AbiFunction, data: string): ReadonlyArray<unknown> | undefined => {\n const selector = AbiFunction.getSelector(fn);\n if (!data.toLowerCase().startsWith(selector)) {\n return undefined;\n }\n try {\n assertHex(data, \"data\");\n const args: unknown = AbiFunction.decodeData(fn, data);\n if (!Array.isArray(args)) {\n return undefined;\n }\n const reencoded = AbiFunction.encodeData(fn, args);\n return reencoded.toLowerCase() === data.toLowerCase() ? args : undefined;\n } catch {\n return undefined;\n }\n};\n\nconst argUint = (args: ReadonlyArray<unknown>, index: number): bigint => {\n const value = args[index];\n if (typeof value !== \"bigint\") {\n throw new ChainError(\"invalid-request\", \"decoded argument is not a uint256\");\n }\n return value;\n};\n\nconst argAddress = (args: ReadonlyArray<unknown>, index: number): string => {\n const value = args[index];\n if (typeof value !== \"string\" || !/^0x[0-9a-fA-F]{40}$/.test(value)) {\n throw new ChainError(\"invalid-request\", \"decoded argument is not an address\");\n }\n return checksumEvmAddress(value);\n};\n\nconst argString = (args: ReadonlyArray<unknown>, index: number): string => {\n const value = args[index];\n if (typeof value !== \"string\") {\n throw new ChainError(\"invalid-request\", \"decoded argument is not a string\");\n }\n return value;\n};\n\n/** What a recognised Fiat24 call contributes to the intent. */\nexport type Fiat24Decode = {\n readonly summary: IntentSummary;\n readonly outflows: ReadonlyArray<AssetFlow>;\n readonly warnings: ReadonlyArray<IntentWarning>;\n readonly fiat24?: Fiat24Action;\n};\n\ntype DecodeResult = { readonly decoded: Fiat24Decode } | \"claimed\" | undefined;\ntype ValueCall = { readonly value: bigint; readonly data: string };\ntype CashToken = { readonly address: string; readonly symbol: string };\n\n/* One described function: `payable` marks the calls that must carry value (depositETH,\n mintByClientWithETH); a selector match that fails the value check is a near miss. */\ntype Fiat24Case = {\n readonly fn: AbiFunction.AbiFunction;\n readonly payable?: boolean;\n readonly run: (args: ReadonlyArray<unknown>, call: ValueCall) => Fiat24Decode | \"claimed\";\n};\n\n/* First matching selector wins; the single value guard and every \"claimed\" result end the\n decode. No match returns undefined so the caller can apply its own fallback. */\nconst runCases = (cases: ReadonlyArray<Fiat24Case>, call: ValueCall): DecodeResult => {\n for (const c of cases) {\n const args = tryCall(c.fn, call.data);\n if (args === undefined) {\n continue;\n }\n if (c.payable === true ? call.value === 0n : call.value > 0n) {\n return \"claimed\";\n }\n const decoded = c.run(args, call);\n return decoded === \"claimed\" ? \"claimed\" : { decoded };\n }\n return undefined;\n};\n\nconst tokenAmount = (token: string, amount: bigint, chainId: number, table: EvmTokenTable) => {\n const known = lookupEvmToken(table, chainId, token);\n return {\n asset: token,\n amount: amount.toString(10),\n ...(known === undefined ? {} : { symbol: known.symbol, decimals: known.decimals }),\n };\n};\n\n/** The cash-token row for an address argument, or undefined for any other token. */\nconst cashToken = (address: string) => FIAT24_TOKENS[address.toLowerCase()];\n\nconst fiat24Token = (token: CashToken) => ({\n asset: token.address,\n symbol: token.symbol,\n decimals: 2 as const,\n});\n\n/** Verified outflow of a cash-token amount; `fiat24` names the account or payee the bytes carry. */\nconst cashFlow = (\n token: CashToken,\n amount: bigint,\n chainId: number,\n table: EvmTokenTable,\n fiat24: { readonly account: string } | { readonly payee: string },\n): AssetFlow => ({\n to: token.address,\n amount: tokenAmount(token.address, amount, chainId, table),\n verified: true,\n fiat24,\n});\n\nconst ethFlow = (to: string, value: bigint): AssetFlow => ({\n to,\n amount: { asset: EVM_NATIVE_ASSET, amount: value.toString(10) },\n verified: true,\n});\n\n/** A top-up input paid to the deposit contract — verified only when the token table knows it. */\nconst topUpFlow = (\n input: string,\n amount: bigint,\n chainId: number,\n table: EvmTokenTable,\n): AssetFlow => ({\n to: FIAT24_DEPOSIT,\n amount: tokenAmount(input, amount, chainId, table),\n verified: lookupEvmToken(table, chainId, input) !== undefined,\n});\n\n/* clientPayout(Ref) pays out by bank transfer: the bytes name the payee id, Fiat24 resolves the\n receiving account off-chain — the outflow carries the id, the action the verbatim strings. */\nconst payout = (\n token: CashToken,\n args: ReadonlyArray<unknown>,\n action: (contactId: string) => Fiat24Action,\n chainId: number,\n table: EvmTokenTable,\n): Fiat24Decode => {\n const contactId = argString(args, 1);\n return {\n summary: \"payout\",\n outflows: [cashFlow(token, argUint(args, 0), chainId, table, { payee: contactId })],\n warnings: [{ kind: \"fiat24-payee-offchain\", message: \"\" }],\n fiat24: action(contactId),\n };\n};\n\n/** Both exchange sides need two different cash tokens — anything else is a near miss. */\nconst exchangePair = (args: ReadonlyArray<unknown>) => {\n const input = cashToken(argAddress(args, 0));\n const output = cashToken(argAddress(args, 1));\n return input === undefined || output === undefined || input.address === output.address\n ? undefined\n : { input, output };\n};\n\n/* The FX exchanges swap between cash tokens at the issuer-set rate: the rate is operator\n storage, so the bytes cannot bound what the call receives. */\nconst exchangeIn = (\n args: ReadonlyArray<unknown>,\n chainId: number,\n table: EvmTokenTable,\n): Fiat24Decode | \"claimed\" => {\n const pair = exchangePair(args);\n if (pair === undefined) {\n return \"claimed\";\n }\n return {\n summary: \"swap\",\n outflows: [\n {\n to: FIAT24_DEPOSIT,\n amount: tokenAmount(pair.input.address, argUint(args, 2), chainId, table),\n verified: true,\n },\n ],\n warnings: [{ kind: \"fiat24-issuer-rate\", message: \"\" }],\n fiat24: { kind: \"exchange\", side: \"exact-in\", receive: fiat24Token(pair.output) },\n };\n};\n\nconst exchangeOut = (\n args: ReadonlyArray<unknown>,\n chainId: number,\n table: EvmTokenTable,\n): Fiat24Decode | \"claimed\" => {\n const pair = exchangePair(args);\n if (pair === undefined) {\n return \"claimed\";\n }\n return {\n summary: \"swap\",\n outflows: [],\n warnings: [\n { kind: \"fiat24-issuer-rate\", message: \"\" },\n { kind: \"fiat24-exact-out-unbounded\", message: \"\" },\n ],\n fiat24: {\n kind: \"exchange\",\n side: \"exact-out\",\n pay: fiat24Token(pair.input),\n receive: tokenAmount(pair.output.address, argUint(args, 2), chainId, table),\n },\n };\n};\n\n/** A top-up's shared shape: pay in, receive a cash token at a rate the transaction cannot bound. */\nconst topUp = (\n outflows: ReadonlyArray<AssetFlow>,\n output: CashToken,\n swapsInTx: boolean,\n): Fiat24Decode => ({\n summary: \"swap\",\n outflows,\n warnings: [\n { kind: \"fiat24-issuer-rate\", message: \"\" },\n ...(swapsInTx ? [{ kind: \"fiat24-swap-quote\" as const, message: \"\" }] : []),\n ],\n fiat24: { kind: \"top-up\", receive: fiat24Token(output) },\n});\n\n/* depositTokenViaUsdc/depositTokenViaEth settle a listed or unlisted token input into a cash\n token; `swapsInTx` marks inputs that trade inside the transaction (anything but USDC). */\nconst topUpToken = (\n args: ReadonlyArray<unknown>,\n swapsInTx: (input: string) => boolean,\n chainId: number,\n table: EvmTokenTable,\n): Fiat24Decode | \"claimed\" => {\n const input = argAddress(args, 0);\n const output = cashToken(argAddress(args, 1));\n if (output === undefined) {\n return \"claimed\";\n }\n return topUp([topUpFlow(input, argUint(args, 2), chainId, table)], output, swapsInTx(input));\n};\n\n/** Minting an account permanently links the address to the identity Fiat24 verifies. */\nconst openAccount = (\n id: bigint,\n outflows: ReadonlyArray<AssetFlow>,\n burn?: Fiat24Token,\n): Fiat24Decode => ({\n summary: \"contract-call\",\n outflows,\n warnings: [\n { kind: \"fiat24-account-link\", message: \"\" },\n ...(burn === undefined ? [] : [{ kind: \"fiat24-account-burn\" as const, message: \"\" }]),\n ],\n fiat24: {\n kind: \"open-account\",\n account: id.toString(10),\n ...(burn === undefined ? {} : { burn }),\n },\n});\n\n/* Moving the account NFT moves control of the account — its balance and the identity verified\n for it. */\nconst moveAccount = (args: ReadonlyArray<unknown>): Fiat24Decode => {\n const to = argAddress(args, 1);\n const id = argUint(args, 2);\n return {\n summary: \"transfer\",\n outflows: [\n {\n to,\n amount: { asset: FIAT24_ACCOUNT, amount: \"1\", tokenId: id.toString(10) },\n verified: false,\n },\n ],\n warnings: [\n { kind: \"fiat24-account-move\", level: \"danger\", message: `#${id.toString(10)} → ${to}` },\n ],\n };\n};\n\n/* A call to a cash token: `transferByAccountId` resolves the recipient on chain at execution —\n the bytes name only the account id — and the five ERC-20 selectors fall through to the\n standard token path. Everything else is a Fiat24 call the family claims. */\nconst decodeFiat24Token = (\n token: CashToken,\n call: ValueCall,\n chainId: number,\n table: EvmTokenTable,\n): DecodeResult => {\n const hit = runCases(\n [\n {\n fn: TRANSFER_BY_ACCOUNT_ID,\n run: (args) => {\n const account = argUint(args, 0);\n return {\n summary: \"transfer\",\n outflows: [\n cashFlow(token, argUint(args, 1), chainId, table, {\n account: account.toString(10),\n }),\n ],\n warnings: isInternalAccount(account)\n ? [{ kind: \"fiat24-internal-account\", message: account.toString(10) }]\n : [],\n };\n },\n },\n {\n fn: CLIENT_PAYOUT,\n run: (args) =>\n payout(token, args, (contactId) => ({ kind: \"payout\", contactId }), chainId, table),\n },\n {\n fn: CLIENT_PAYOUT_REF,\n run: (args) =>\n payout(\n token,\n args,\n (contactId) => ({\n kind: \"payout\",\n contactId,\n purposeId: argUint(args, 2).toString(10),\n ref: argString(args, 3),\n }),\n chainId,\n table,\n ),\n },\n ],\n call,\n );\n if (hit !== undefined) {\n return hit;\n }\n const selector = call.data.slice(0, 10).toLowerCase();\n return ERC20_SELECTORS.has(selector) && call.value === 0n ? undefined : \"claimed\";\n};\n\n/* A call into the deposit/top-up contract: the FX exchanges and the three top-ups, decoded as\n above; `depositByWallet` and the rest of the wallet-provider/operator surface stay claimed. */\nconst decodeFiat24Deposit = (\n call: ValueCall,\n chainId: number,\n table: EvmTokenTable,\n): DecodeResult =>\n runCases(\n [\n { fn: MONEY_EXCHANGE_EXACT_IN, run: (args) => exchangeIn(args, chainId, table) },\n { fn: MONEY_EXCHANGE_EXACT_OUT, run: (args) => exchangeOut(args, chainId, table) },\n {\n fn: DEPOSIT_TOKEN_VIA_USDC,\n run: (args) =>\n topUpToken(\n args,\n (input) => input.toLowerCase() !== FIAT24_USDC.toLowerCase(),\n chainId,\n table,\n ),\n },\n {\n fn: DEPOSIT_ETH,\n payable: true,\n run: (args, call) => {\n const output = cashToken(argAddress(args, 0));\n return output === undefined\n ? \"claimed\"\n : topUp([ethFlow(FIAT24_DEPOSIT, call.value)], output, true);\n },\n },\n {\n fn: DEPOSIT_TOKEN_VIA_ETH,\n run: (args) => topUpToken(args, () => true, chainId, table),\n },\n ],\n call,\n ) ?? \"claimed\";\n\n/* A call into the account contract: minting opens an account whose token id is the account\n number, and moving the NFT moves control of it. `approve`/`setApprovalForAll` and the\n wallet/operator surface stay claimed. */\nconst decodeFiat24Account = (call: ValueCall): DecodeResult =>\n runCases(\n [\n /* `mintByClient` burns the account price in F24 from the caller — bounded only by the\n caller's F24 allowance; `mintByClientWithETH` buys that F24 with the ETH value, which is\n already an outflow (Fiat24Account.sol:92-96). */\n { fn: MINT_BY_CLIENT, run: (args) => openAccount(argUint(args, 0), [], F24_BURN) },\n {\n fn: MINT_BY_CLIENT_WITH_ETH,\n payable: true,\n run: (args, call) => openAccount(argUint(args, 0), [ethFlow(FIAT24_ACCOUNT, call.value)]),\n },\n { fn: ACCOUNT_SAFE_TRANSFER_DATA, run: moveAccount },\n { fn: ACCOUNT_SAFE_TRANSFER, run: moveAccount },\n { fn: ACCOUNT_TRANSFER_FROM, run: moveAccount },\n ],\n call,\n ) ?? \"claimed\";\n\n/**\n * Decodes a call to a Fiat24 contract: `{ decoded }` for the calls the rules table describes,\n * `\"claimed\"` for every other call into one of the seven pinned proxies (the Fiat24 family's\n * near-miss reason applies), `undefined` when the call is not Fiat24's — a cash token's ERC-20\n * selectors, or a callee Fiat24 does not own.\n *\n * Only `depositETH` and `mintByClientWithETH` are payable; a positive value on any other function\n * is a near miss.\n */\nexport const decodeFiat24 = (\n chainId: number,\n call: { readonly to: string | undefined; readonly value: bigint; readonly data: string },\n table: EvmTokenTable,\n): DecodeResult => {\n if (chainId !== FIAT24_CHAIN || call.to === undefined) {\n return undefined;\n }\n const to = call.to.toLowerCase();\n const token = FIAT24_TOKENS[to];\n if (token !== undefined) {\n return decodeFiat24Token(token, call, chainId, table);\n }\n if (to === FIAT24_DEPOSIT.toLowerCase()) {\n return decodeFiat24Deposit(call, chainId, table);\n }\n if (to === FIAT24_ACCOUNT.toLowerCase()) {\n return decodeFiat24Account(call);\n }\n return FIAT24_CONTRACTS.has(to) ? \"claimed\" : undefined;\n};\n\n/* The grant message the Fiat24 API verifies: \"I agree to access my profile. \" followed by the\n deadline hash (integration guide part-2-api-reference, Secured APIs). The server rebuilds the\n digest as keccak256(hash ‖ deadline) from two client-chosen header values and never parses\n `hash`, so the label the wallet hashes must not end in digits: with a `;` terminator the only\n all-digit suffix of the preimage is the deadline the user saw, and no (hash, deadline)\n re-split can move the grant to a later expiry. The label is the wallet's own convention —\n the server binds nothing inside it. */\nconst sessionLabel = (chainId: number, tokenId: string, deadline: number): string =>\n `fiat24-session-v1:${chainId}:${tokenId}:${deadline};`;\n\n/** The exact personal-message text a `evm.fiat24-session` request signs. */\nexport const fiat24SessionMessage = (\n chainId: number,\n tokenId: string,\n deadline: number,\n): string => {\n const digest = `0x${bytesToHex(keccak_256(utf8ToBytes(sessionLabel(chainId, tokenId, deadline) + deadline)))}`;\n return `I agree to access my profile. ${digest}`;\n};\n","/**\n * The unsigned EIP-2718 envelope of a normalized transaction — one construction shared by the\n * kernel's signer and by the host's round-trip check, which re-serializes it with the returned\n * signature to prove the kernel signed exactly the requested transaction.\n */\nimport { hexToBytes } from \"@noble/hashes/utils.js\";\nimport type * as Authorization from \"ox/Authorization\";\nimport type * as Hex from \"ox/Hex\";\nimport type * as Signature from \"ox/Signature\";\nimport * as TxEnvelopeEip1559 from \"ox/TxEnvelopeEip1559\";\nimport * as TxEnvelopeEip2930 from \"ox/TxEnvelopeEip2930\";\nimport * as TxEnvelopeEip7702 from \"ox/TxEnvelopeEip7702\";\nimport * as TxEnvelopeLegacy from \"ox/TxEnvelopeLegacy\";\n\nimport { ChainError } from \"../index.ts\";\nimport type { EvmAccessListEntry, EvmTransaction } from \"../index.ts\";\n\n/** Validates a string is `0x`-hex and narrows it for ox's branded type. */\nfunction assertHex(value: string, field: string): asserts value is `0x${string}` {\n if (!/^0x(?:[0-9a-fA-F]{2})*$/.test(value)) {\n throw new ChainError(\"invalid-quantity\", `${field} must be 0x-prefixed bytes`);\n }\n}\n\nconst hex = (value: string, field: string): `0x${string}` => {\n assertHex(value, field);\n return value;\n};\n\nconst accessEntry = (entry: EvmAccessListEntry) => ({\n address: hex(entry.address, \"accessList.address\"),\n storageKeys: entry.storageKeys.map((k) => hex(k, \"accessList.storageKeys\")),\n});\n\n/** The EIP-7702 authorization an `eip7702` transaction carries: the account's next-but-one nonce. */\nexport const evmAuthorization = (\n tx: Extract<EvmTransaction, { type: \"eip7702\" }>,\n): Authorization.Authorization => ({\n chainId: tx.chainId,\n address: hex(tx.authorization.address, \"authorization.address\"),\n nonce: BigInt(tx.nonce + 1),\n});\n\n/** An unsigned envelope: the digest to sign and its serialization under a signature. */\nexport type EvmEnvelope = {\n readonly payload: Hex.Hex;\n readonly serialize: (signature: Signature.Signature) => Hex.Hex;\n};\n\nconst baseEnvelope = (tx: EvmTransaction) => ({\n chainId: tx.chainId,\n to: tx.to === undefined ? undefined : hex(tx.to, \"to\"),\n data: hex(tx.data, \"data\"),\n value: BigInt(tx.value),\n nonce: BigInt(tx.nonce),\n gas: BigInt(tx.gas),\n});\n\n/**\n * The envelope of `tx`. An `eip7702` transaction embeds its signed authorization, so the caller\n * passes the signature over `evmAuthorization(tx)`.\n */\nexport const evmEnvelope = (\n tx: EvmTransaction,\n authorization?: Signature.Signature,\n): EvmEnvelope => {\n const base = baseEnvelope(tx);\n if (tx.type === \"legacy\") {\n const envelope = { ...base, type: \"legacy\" as const, gasPrice: BigInt(tx.gasPrice) };\n return {\n payload: TxEnvelopeLegacy.getSignPayload(envelope),\n serialize: (signature) => TxEnvelopeLegacy.serialize(envelope, { signature }),\n };\n }\n if (tx.type === \"eip2930\") {\n const envelope = {\n ...base,\n type: \"eip2930\" as const,\n gasPrice: BigInt(tx.gasPrice),\n accessList: tx.accessList.map(accessEntry),\n };\n return {\n payload: TxEnvelopeEip2930.getSignPayload(envelope),\n serialize: (signature) => TxEnvelopeEip2930.serialize(envelope, { signature }),\n };\n }\n if (tx.type === \"eip7702\") {\n if (authorization === undefined) {\n throw new ChainError(\"invalid-request\", \"an eip7702 envelope needs its signed authorization\");\n }\n const envelope = {\n ...base,\n type: \"eip7702\" as const,\n to: hex(tx.to, \"to\"),\n accessList: tx.accessList.map(accessEntry),\n maxFeePerGas: BigInt(tx.maxFeePerGas),\n maxPriorityFeePerGas: BigInt(tx.maxPriorityFeePerGas),\n authorizationList: [\n {\n ...evmAuthorization(tx),\n r: authorization.r,\n s: authorization.s,\n yParity: authorization.yParity,\n },\n ],\n };\n return {\n payload: TxEnvelopeEip7702.getSignPayload(envelope),\n serialize: (signature) => TxEnvelopeEip7702.serialize(envelope, { signature }),\n };\n }\n const envelope = {\n ...base,\n type: \"eip1559\" as const,\n accessList: tx.accessList.map(accessEntry),\n maxFeePerGas: BigInt(tx.maxFeePerGas),\n maxPriorityFeePerGas: BigInt(tx.maxPriorityFeePerGas),\n };\n return {\n payload: TxEnvelopeEip1559.getSignPayload(envelope),\n serialize: (signature) => TxEnvelopeEip1559.serialize(envelope, { signature }),\n };\n};\n\n/**\n * The unsigned signing preimage of `tx`: the EIP-155 / EIP-2718 serialization whose keccak256 is\n * `evmEnvelope(tx).payload`. An `eip7702` transaction has no unsigned preimage — its payload is the\n * authorization's, produced by `evmAuthorization(tx)`.\n */\nexport const evmSigningPreimage = (tx: EvmTransaction): Uint8Array => {\n const base = baseEnvelope(tx);\n if (tx.type === \"legacy\") {\n return hexToBytes(\n TxEnvelopeLegacy.serialize({\n ...base,\n type: \"legacy\" as const,\n gasPrice: BigInt(tx.gasPrice),\n }).slice(2),\n );\n }\n if (tx.type === \"eip2930\") {\n return hexToBytes(\n TxEnvelopeEip2930.serialize({\n ...base,\n type: \"eip2930\" as const,\n gasPrice: BigInt(tx.gasPrice),\n accessList: tx.accessList.map(accessEntry),\n }).slice(2),\n );\n }\n if (tx.type === \"eip7702\") {\n throw new ChainError(\"invalid-request\", \"an eip7702 transaction has no unsigned preimage\");\n }\n return hexToBytes(\n TxEnvelopeEip1559.serialize({\n ...base,\n type: \"eip1559\" as const,\n accessList: tx.accessList.map(accessEntry),\n maxFeePerGas: BigInt(tx.maxFeePerGas),\n maxPriorityFeePerGas: BigInt(tx.maxPriorityFeePerGas),\n }).slice(2),\n );\n};\n","/**\n * /evm/plan — the serialisable signing plan of a normalized request: the digests each signing\n * backend must sign, and the transaction an EIP-7702 signature later re-enters. No key material.\n */\nimport { utf8ToBytes } from \"@noble/hashes/utils.js\";\nimport * as Authorization from \"ox/Authorization\";\nimport * as Hex from \"ox/Hex\";\nimport * as PersonalMessage from \"ox/PersonalMessage\";\nimport * as TypedData from \"ox/TypedData\";\n\nimport { ChainError } from \"../index.ts\";\nimport type { EcdsaTask, EvmTransaction, SignRequest, TaskKey } from \"../index.ts\";\nimport { evmAuthorization, evmEnvelope } from \"./envelope.ts\";\nimport { fiat24SessionMessage } from \"./fiat24.ts\";\nimport { networkChainId } from \"./transaction.ts\";\nimport { parseTypedData } from \"./typed-data.ts\";\n\n/**\n * `authorization` is the 65-byte `r‖s‖v` of the stage-1 signature; it is present only on the\n * second-stage plan `assembleEvm` returns for an `eip7702` transaction.\n */\nexport type EvmSignPlan =\n | {\n readonly kind: \"evm.transaction\";\n readonly tx: EvmTransaction;\n readonly authorization?: Uint8Array;\n readonly tasks: readonly [EcdsaTask];\n }\n | {\n readonly kind: \"evm.personal-message\" | \"evm.fiat24-session\" | \"evm.typed-data\";\n readonly tasks: readonly [EcdsaTask];\n };\n\nconst ecdsa = (digest: Uint8Array, key: TaskKey): EcdsaTask => ({\n scheme: \"ecdsa-secp256k1\",\n path: key.path,\n publicKey: key.publicKey,\n digest,\n});\n\nconst personalDigest = (message: Uint8Array): Uint8Array =>\n Hex.toBytes(PersonalMessage.getSignPayload(Hex.fromBytes(message)));\n\n/**\n * The transaction plan. For `eip7702` the task covers the authorization digest; `assembleEvm` then\n * returns a stage-2 plan whose task is the envelope digest of the authorized transaction.\n */\nexport const planEvmTransaction = (tx: EvmTransaction, key: TaskKey): EvmSignPlan => ({\n kind: \"evm.transaction\",\n tx,\n tasks: [\n ecdsa(\n Hex.toBytes(\n tx.type === \"eip7702\"\n ? Authorization.getSignPayload(evmAuthorization(tx))\n : evmEnvelope(tx).payload,\n ),\n key,\n ),\n ],\n});\n\nexport const planEvmPersonalMessage = (message: Uint8Array, key: TaskKey): EvmSignPlan => ({\n kind: \"evm.personal-message\",\n tasks: [ecdsa(personalDigest(message), key)],\n});\n\nexport const planEvmTypedData = (typedData: string, key: TaskKey): EvmSignPlan => {\n const { json } = parseTypedData(typedData);\n let payload: Hex.Hex;\n try {\n payload = TypedData.getSignPayload(json);\n } catch {\n throw new ChainError(\"invalid-typed-data\", \"typedData failed to encode\");\n }\n return { kind: \"evm.typed-data\", tasks: [ecdsa(Hex.toBytes(payload), key)] };\n};\n\n/** The plan of a normalized request; the task keeps the request kind so the kernel can wrap it. */\nexport const planEvm = (\n request: Extract<\n SignRequest,\n { kind: \"evm.transaction\" | \"evm.personal-message\" | \"evm.fiat24-session\" | \"evm.typed-data\" }\n >,\n key: TaskKey,\n): EvmSignPlan => {\n if (request.kind === \"evm.transaction\") {\n return planEvmTransaction(request.tx, key);\n }\n if (request.kind === \"evm.personal-message\") {\n return planEvmPersonalMessage(request.message, key);\n }\n if (request.kind === \"evm.fiat24-session\") {\n return {\n kind: \"evm.fiat24-session\",\n tasks: [\n ecdsa(\n personalDigest(\n utf8ToBytes(\n fiat24SessionMessage(\n networkChainId(request.network),\n request.tokenId,\n request.deadline,\n ),\n ),\n ),\n key,\n ),\n ],\n };\n }\n return planEvmTypedData(request.typedData, key);\n};\n","/**\n * /evm/assemble — turn verified signature material into the wire artefact: the serialized signed\n * envelope for a transaction, the 65-byte `r‖s‖v` (v = 27 + yParity) for messages. An `eip7702`\n * transaction without its authorization returns the stage-2 plan instead.\n */\nimport * as Hex from \"ox/Hex\";\nimport * as Signature from \"ox/Signature\";\n\nimport type { Assembled } from \"../index.ts\";\nimport { acceptEcdsa, signaturesOf } from \"../tasks.ts\";\nimport { evmEnvelope } from \"./envelope.ts\";\nimport type { EvmSignPlan } from \"./plan.ts\";\n\nconst oxSignature = (accepted: {\n readonly r: bigint;\n readonly s: bigint;\n readonly yParity: 0 | 1;\n}): Signature.Signature =>\n Signature.from({\n r: Hex.fromNumber(accepted.r),\n s: Hex.fromNumber(accepted.s),\n yParity: accepted.yParity,\n });\n\nexport const assembleEvm = (\n plan: EvmSignPlan,\n signatures: ReadonlyArray<Uint8Array>,\n): Assembled<Uint8Array, EvmSignPlan> => {\n signaturesOf(plan.tasks, signatures);\n const signature = oxSignature(acceptEcdsa(plan.tasks[0], signatures[0] ?? new Uint8Array()));\n if (plan.kind !== \"evm.transaction\") {\n return { kind: \"signed\", artefact: Signature.toBytes(signature) };\n }\n if (plan.tx.type === \"eip7702\" && plan.authorization === undefined) {\n // Stage 1: the verified authorization signature enters the envelope whose digest is stage 2.\n return {\n kind: \"next\",\n plan: {\n ...plan,\n authorization: Signature.toBytes(signature),\n tasks: [\n {\n ...plan.tasks[0],\n digest: Hex.toBytes(evmEnvelope(plan.tx, signature).payload),\n },\n ],\n },\n };\n }\n const envelope = evmEnvelope(\n plan.tx,\n plan.authorization === undefined ? undefined : Signature.fromBytes(plan.authorization),\n );\n return { kind: \"signed\", artefact: Hex.toBytes(envelope.serialize(signature)) };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,eAAe;;AAG5B,MAAa,iBAAiB;;AAG9B,MAAa,iBAAiB;;AAG9B,MAAa,cAAc;;;;;;;AAc3B,MAAM,WAAwB;CAC5B,OAAO;CACP,QAAQ;CACR,UAAU;AACZ;;;;;;AAOA,MAAa,gBAET;CACF,8CAA8C;EAC5C,SAAS;EACT,QAAQ;CACV;CACA,8CAA8C;EAC5C,SAAS;EACT,QAAQ;CACV;CACA,8CAA8C;EAC5C,SAAS;EACT,QAAQ;CACV;CACA,8CAA8C;EAC5C,SAAS;EACT,QAAQ;CACV;AACF;AAOA,MAAM,qBAAqB,YAA6B,QAAQ,SAAS,EAAE,CAAC,CAAC,WAAW,GAAG;AAE3F,MAAM,yBAAyB,YAAY,KACzC,iEACF;AACA,MAAM,gBAAgB,YAAY,KAAK,yDAAyD;AAChG,MAAM,oBAAoB,YAAY,KACpC,2FACF;AACA,MAAM,0BAA0B,YAAY,KAC1C,8EACF;AACA,MAAM,2BAA2B,YAAY,KAC3C,+EACF;AACA,MAAM,yBAAyB,YAAY,KACzC,6EACF;AACA,MAAM,cAAc,YAAY,KAAK,6CAA6C;AAClF,MAAM,wBAAwB,YAAY,KACxC,4EACF;AACA,MAAM,iBAAiB,YAAY,KAAK,wCAA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AkB,KAAA,IAAY,KAAA,IAAY,UAAU,UAAU,KAAK,aAAa,CACvF;CACA,OAAO;EAAE,MAAM;EAAU,UAAU,IAAI,QAAQ,SAAS,UAAU,SAAS,CAAC;CAAE;AAChF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { t as ChainError } from "./src-CHB_z45M.mjs";
|
|
2
|
+
import { a as signaturesOf, r as acceptEd25519 } from "./tasks-7AFv3PQn.mjs";
|
|
3
|
+
// src/solana/plan.ts
|
|
4
|
+
/**
|
|
5
|
+
* /solana/plan — the serialisable signing plan of a normalized request: the compiled transaction
|
|
6
|
+
* message or the raw offchain bytes are signed as-is by Ed25519. No key material.
|
|
7
|
+
*/
|
|
8
|
+
const planSolanaMessage = (kind, message, key) => {
|
|
9
|
+
if (message.length === 0) throw new ChainError("invalid-request", "message must not be empty");
|
|
10
|
+
return {
|
|
11
|
+
kind,
|
|
12
|
+
tasks: [{
|
|
13
|
+
scheme: "ed25519",
|
|
14
|
+
path: key.path,
|
|
15
|
+
publicKey: key.publicKey,
|
|
16
|
+
message
|
|
17
|
+
}]
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/** The plan of a normalized request; the task keeps the request kind so the kernel can wrap it. */
|
|
21
|
+
const planSolana = (request, key) => planSolanaMessage(request.kind, request.message, key);
|
|
22
|
+
// src/solana/assemble.ts
|
|
23
|
+
const assembleSolana = (plan, signatures) => {
|
|
24
|
+
signaturesOf(plan.tasks, signatures);
|
|
25
|
+
return {
|
|
26
|
+
kind: "signed",
|
|
27
|
+
artefact: acceptEd25519(plan.tasks[0], signatures[0] ?? /* @__PURE__ */ new Uint8Array())
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export { planSolana as n, planSolanaMessage as r, assembleSolana as t };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=assemble-BdiPo0ZX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assemble-BdiPo0ZX.mjs","names":[],"sources":["../src/solana/plan.ts","../src/solana/assemble.ts"],"sourcesContent":["/**\n * /solana/plan — the serialisable signing plan of a normalized request: the compiled transaction\n * message or the raw offchain bytes are signed as-is by Ed25519. No key material.\n */\nimport { ChainError } from \"../index.ts\";\nimport type { Ed25519Task, SignRequest, TaskKey } from \"../index.ts\";\n\nexport type SolanaSignPlan = {\n readonly kind: \"solana.transaction\" | \"solana.message\";\n readonly tasks: readonly [Ed25519Task];\n};\n\nexport const planSolanaMessage = (\n kind: SolanaSignPlan[\"kind\"],\n message: Uint8Array,\n key: TaskKey,\n): SolanaSignPlan => {\n if (message.length === 0) {\n throw new ChainError(\"invalid-request\", \"message must not be empty\");\n }\n return {\n kind,\n tasks: [{ scheme: \"ed25519\", path: key.path, publicKey: key.publicKey, message }],\n };\n};\n\n/** The plan of a normalized request; the task keeps the request kind so the kernel can wrap it. */\nexport const planSolana = (\n request: Extract<SignRequest, { kind: \"solana.transaction\" | \"solana.message\" }>,\n key: TaskKey,\n): SolanaSignPlan => planSolanaMessage(request.kind, request.message, key);\n","/**\n * /solana/assemble — the verified 64-byte Ed25519 signature is itself the wire artefact (the host\n * attaches it to the compiled transaction). Always \"signed\".\n */\nimport type { Assembled } from \"../index.ts\";\nimport { acceptEd25519, signaturesOf } from \"../tasks.ts\";\nimport type { SolanaSignPlan } from \"./plan.ts\";\n\nexport const assembleSolana = (\n plan: SolanaSignPlan,\n signatures: ReadonlyArray<Uint8Array>,\n): Assembled<Uint8Array, SolanaSignPlan> => {\n signaturesOf(plan.tasks, signatures);\n return {\n kind: \"signed\",\n artefact: acceptEd25519(plan.tasks[0], signatures[0] ?? new Uint8Array()),\n };\n};\n"],"mappings":";;;;;;;AAYA,MAAa,qBACX,MACA,SACA,QACmB;CACnB,IAAI,QAAQ,WAAW,GACrB,MAAM,IAAI,WAAW,mBAAmB,2BAA2B;CAErE,OAAO;EACL;EACA,OAAO,CAAC;GAAE,QAAQ;GAAW,MAAM,IAAI;GAAM,WAAW,IAAI;GAAW;EAAQ,CAAC;CAClF;AACF;;AAGA,MAAa,cACX,SACA,QACmB,kBAAkB,QAAQ,MAAM,QAAQ,SAAS,GAAG;;ACtBzE,MAAa,kBACX,MACA,eAC0C;CAC1C,aAAa,KAAK,OAAO,UAAU;CACnC,OAAO;EACL,MAAM;EACN,UAAU,cAAc,KAAK,MAAM,IAAI,WAAW,sBAAM,IAAI,WAAW,CAAC;CAC1E;AACF"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// src/evm/tokens.ts
|
|
2
|
+
const USDC = Object.freeze({
|
|
3
|
+
symbol: "USDC",
|
|
4
|
+
decimals: 6,
|
|
5
|
+
name: "USD Coin"
|
|
6
|
+
});
|
|
7
|
+
const USDT = Object.freeze({
|
|
8
|
+
symbol: "USDT",
|
|
9
|
+
decimals: 6,
|
|
10
|
+
name: "Tether USD"
|
|
11
|
+
});
|
|
12
|
+
const CELO_ALIAS = Object.freeze({
|
|
13
|
+
symbol: "CELO",
|
|
14
|
+
decimals: 18,
|
|
15
|
+
name: "Celo native asset",
|
|
16
|
+
role: "native-alias"
|
|
17
|
+
});
|
|
18
|
+
const ARC_USDC_ALIAS = Object.freeze({
|
|
19
|
+
symbol: "USDC",
|
|
20
|
+
decimals: 6,
|
|
21
|
+
name: "USDC",
|
|
22
|
+
role: "native-alias"
|
|
23
|
+
});
|
|
24
|
+
const WETH = Object.freeze({
|
|
25
|
+
symbol: "WETH",
|
|
26
|
+
decimals: 18,
|
|
27
|
+
name: "Wrapped Ether",
|
|
28
|
+
role: "wrapped-native"
|
|
29
|
+
});
|
|
30
|
+
const WBNB = Object.freeze({
|
|
31
|
+
symbol: "WBNB",
|
|
32
|
+
decimals: 18,
|
|
33
|
+
name: "Wrapped BNB",
|
|
34
|
+
role: "wrapped-native"
|
|
35
|
+
});
|
|
36
|
+
/** The built-in table. */
|
|
37
|
+
const evmTokenTable = Object.freeze({
|
|
38
|
+
"1": Object.freeze({
|
|
39
|
+
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48": USDC,
|
|
40
|
+
"0xdAC17F958D2ee523a2206206994597C13D831ec7": USDT,
|
|
41
|
+
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": WETH
|
|
42
|
+
}),
|
|
43
|
+
"10": Object.freeze({
|
|
44
|
+
"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85": USDC,
|
|
45
|
+
"0x4200000000000000000000000000000000000006": WETH
|
|
46
|
+
}),
|
|
47
|
+
"25": Object.freeze({
|
|
48
|
+
"0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D": USDC,
|
|
49
|
+
"0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23": Object.freeze({
|
|
50
|
+
symbol: "WCRO",
|
|
51
|
+
decimals: 18,
|
|
52
|
+
name: "Wrapped CRO",
|
|
53
|
+
role: "wrapped-native"
|
|
54
|
+
})
|
|
55
|
+
}),
|
|
56
|
+
"56": Object.freeze({ "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c": WBNB }),
|
|
57
|
+
"130": Object.freeze({
|
|
58
|
+
"0x078D782b760474a361dDA0AF3839290b0EF57AD6": USDC,
|
|
59
|
+
"0x4200000000000000000000000000000000000006": WETH
|
|
60
|
+
}),
|
|
61
|
+
"137": Object.freeze({
|
|
62
|
+
"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359": USDC,
|
|
63
|
+
"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270": Object.freeze({
|
|
64
|
+
symbol: "WPOL",
|
|
65
|
+
decimals: 18,
|
|
66
|
+
name: "Wrapped Polygon Ecosystem Token",
|
|
67
|
+
role: "wrapped-native"
|
|
68
|
+
})
|
|
69
|
+
}),
|
|
70
|
+
"143": Object.freeze({
|
|
71
|
+
"0x754704Bc059F8C67012fEd69BC8A327a5aafb603": USDC,
|
|
72
|
+
"0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A": Object.freeze({
|
|
73
|
+
symbol: "WMON",
|
|
74
|
+
decimals: 18,
|
|
75
|
+
name: "Wrapped MON",
|
|
76
|
+
role: "wrapped-native"
|
|
77
|
+
})
|
|
78
|
+
}),
|
|
79
|
+
"146": Object.freeze({
|
|
80
|
+
"0x29219dd400f2Bf60E5a23d13Be72B486D4038894": USDC,
|
|
81
|
+
"0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38": Object.freeze({
|
|
82
|
+
symbol: "wS",
|
|
83
|
+
decimals: 18,
|
|
84
|
+
name: "Wrapped Sonic",
|
|
85
|
+
role: "wrapped-native"
|
|
86
|
+
})
|
|
87
|
+
}),
|
|
88
|
+
"196": Object.freeze({ "0xB6CEceAB302E2E4948951eE7843FC24E92933061": USDC }),
|
|
89
|
+
"204": Object.freeze({ "0x4200000000000000000000000000000000000006": WBNB }),
|
|
90
|
+
"324": Object.freeze({ "0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4": USDC }),
|
|
91
|
+
"480": Object.freeze({
|
|
92
|
+
"0x79A02482A880bCE3F13e09Da970dC34db4CD24d1": USDC,
|
|
93
|
+
"0x4200000000000000000000000000000000000006": WETH
|
|
94
|
+
}),
|
|
95
|
+
"988": Object.freeze({ "0x779Ded0c9e1022225f8E0630b35a9b54bE713736": Object.freeze({
|
|
96
|
+
symbol: "USDT0",
|
|
97
|
+
decimals: 6,
|
|
98
|
+
name: "USDT0",
|
|
99
|
+
role: "native-alias"
|
|
100
|
+
}) }),
|
|
101
|
+
"999": Object.freeze({
|
|
102
|
+
"0xb88339CB7199b77E23DB6E890353E22632Ba630f": USDC,
|
|
103
|
+
"0x5555555555555555555555555555555555555555": Object.freeze({
|
|
104
|
+
symbol: "WHYPE",
|
|
105
|
+
decimals: 18,
|
|
106
|
+
name: "Wrapped HYPE",
|
|
107
|
+
role: "wrapped-native"
|
|
108
|
+
})
|
|
109
|
+
}),
|
|
110
|
+
"1329": Object.freeze({
|
|
111
|
+
"0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392": USDC,
|
|
112
|
+
"0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7": Object.freeze({
|
|
113
|
+
symbol: "WSEI",
|
|
114
|
+
decimals: 18,
|
|
115
|
+
name: "Wrapped SEI",
|
|
116
|
+
role: "wrapped-native"
|
|
117
|
+
})
|
|
118
|
+
}),
|
|
119
|
+
"1672": Object.freeze({ "0xC879C018dB60520F4355C26eD1a6D572cdAC1815": USDC }),
|
|
120
|
+
"1868": Object.freeze({ "0x4200000000000000000000000000000000000006": WETH }),
|
|
121
|
+
"4326": Object.freeze({ "0x4200000000000000000000000000000000000006": WETH }),
|
|
122
|
+
"5042": Object.freeze({ "0x3600000000000000000000000000000000000000": ARC_USDC_ALIAS }),
|
|
123
|
+
"8217": Object.freeze({
|
|
124
|
+
"0xd077A400968890Eacc75cdc901F0356c943e4fDb": USDT,
|
|
125
|
+
"0x19Aac5f612f524B754CA7e7c41cbFa2E981A4432": Object.freeze({
|
|
126
|
+
symbol: "WKLAY",
|
|
127
|
+
decimals: 18,
|
|
128
|
+
name: "Wrapped Klay",
|
|
129
|
+
role: "wrapped-native"
|
|
130
|
+
})
|
|
131
|
+
}),
|
|
132
|
+
"8453": Object.freeze({
|
|
133
|
+
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913": USDC,
|
|
134
|
+
"0x4200000000000000000000000000000000000006": WETH
|
|
135
|
+
}),
|
|
136
|
+
"9745": Object.freeze({ "0x2d661C89D812261039AF9764eceaAee884f5F67F": USDC }),
|
|
137
|
+
"42161": Object.freeze({
|
|
138
|
+
"0xaf88d065e77c8cC2239327C5EDb3A432268e5831": USDC,
|
|
139
|
+
"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1": WETH,
|
|
140
|
+
"0xbE00f3db78688d9704BCb4e0a827aea3a9Cc0D62": Object.freeze({
|
|
141
|
+
symbol: "USD24",
|
|
142
|
+
decimals: 2,
|
|
143
|
+
name: "Fiat24 USD"
|
|
144
|
+
}),
|
|
145
|
+
"0x2c5d06f591D0d8cd43Ac232c2B654475a142c7DA": Object.freeze({
|
|
146
|
+
symbol: "EUR24",
|
|
147
|
+
decimals: 2,
|
|
148
|
+
name: "Fiat24 EUR"
|
|
149
|
+
}),
|
|
150
|
+
"0xd41F1f0cf89fD239ca4c1F8E8ADA46345c86b0a4": Object.freeze({
|
|
151
|
+
symbol: "CHF24",
|
|
152
|
+
decimals: 2,
|
|
153
|
+
name: "Fiat24 CHF"
|
|
154
|
+
}),
|
|
155
|
+
"0x7288Ac74d211735374A23707D1518DCbbc0144fd": Object.freeze({
|
|
156
|
+
symbol: "CNH24",
|
|
157
|
+
decimals: 2,
|
|
158
|
+
name: "Fiat24 CNH"
|
|
159
|
+
})
|
|
160
|
+
}),
|
|
161
|
+
"42220": Object.freeze({
|
|
162
|
+
"0xcebA9300f2b948710d2653dD7B07f33A8B32118C": USDC,
|
|
163
|
+
"0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e": USDT,
|
|
164
|
+
"0x471EcE3750Da237f93B8E339c536989b8978a438": CELO_ALIAS
|
|
165
|
+
}),
|
|
166
|
+
"43114": Object.freeze({
|
|
167
|
+
"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E": USDC,
|
|
168
|
+
"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7": USDT,
|
|
169
|
+
"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7": Object.freeze({
|
|
170
|
+
symbol: "WAVAX",
|
|
171
|
+
decimals: 18,
|
|
172
|
+
name: "Wrapped AVAX",
|
|
173
|
+
role: "wrapped-native"
|
|
174
|
+
})
|
|
175
|
+
}),
|
|
176
|
+
"57073": Object.freeze({
|
|
177
|
+
"0x2D270e6886d130D724215A266106e6832161EAEd": USDC,
|
|
178
|
+
"0x4200000000000000000000000000000000000006": WETH
|
|
179
|
+
}),
|
|
180
|
+
"59144": Object.freeze({ "0x176211869cA2b568f2A7D4EE941E073a821EE1ff": USDC }),
|
|
181
|
+
"60808": Object.freeze({ "0x4200000000000000000000000000000000000006": WETH }),
|
|
182
|
+
"80094": Object.freeze({ "0x6969696969696969696969696969696969696969": Object.freeze({
|
|
183
|
+
symbol: "WBERA",
|
|
184
|
+
decimals: 18,
|
|
185
|
+
name: "Wrapped Bera",
|
|
186
|
+
role: "wrapped-native"
|
|
187
|
+
}) }),
|
|
188
|
+
"534352": Object.freeze({ "0x5300000000000000000000000000000000000004": WETH }),
|
|
189
|
+
"747474": Object.freeze({ "0x4200000000000000000000000000000000000006": WETH }),
|
|
190
|
+
"5042002": Object.freeze({ "0x3600000000000000000000000000000000000000": ARC_USDC_ALIAS }),
|
|
191
|
+
"7777777": Object.freeze({ "0x4200000000000000000000000000000000000006": WETH }),
|
|
192
|
+
"11142220": Object.freeze({ "0x471EcE3750Da237f93B8E339c536989b8978a438": CELO_ALIAS })
|
|
193
|
+
});
|
|
194
|
+
const lookupEvmToken = (table, chainId, address) => table[String(chainId)]?.[address];
|
|
195
|
+
// src/evm/assets.ts
|
|
196
|
+
/** The native asset id in `AssetFlow` and simulated asset changes. */
|
|
197
|
+
const EVM_NATIVE_ASSET = "native";
|
|
198
|
+
export { evmTokenTable as n, lookupEvmToken as r, EVM_NATIVE_ASSET as t };
|
|
199
|
+
|
|
200
|
+
//# sourceMappingURL=assets-sg2_Z3nZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets-sg2_Z3nZ.mjs","names":[],"sources":["../src/evm/tokens.ts","../src/evm/assets.ts"],"sourcesContent":["/**\n * Built-in ERC-20 token table, keyed by `chainId` then checksummed address. An entry here makes an\n * ERC-20 `transfer` `full`-verifiable (WD-065), so every entry must come from the issuer's own\n * published list and be reviewed against it; the source is recorded per issuer below.\n */\n\nexport type EvmToken = {\n readonly symbol: string;\n readonly decimals: number;\n readonly name?: string;\n /**\n * \"native-alias\": an ERC-20 view that moves the chain's native balance — its calls are described\n * like any listed token's, but it is never counted as a separate balance nor offered by\n * discovery. \"wrapped-native\": a WETH9-style deposit/withdraw contract.\n */\n readonly role?: \"native-alias\" | \"wrapped-native\";\n};\n\nexport type EvmTokenTable = Readonly<Record<string, Readonly<Record<string, EvmToken>>>>;\n\n// Circle USDC (native issuance, 6 decimals), from\n// https://developers.circle.com/stablecoins/usdc-contract-addresses (reviewed 2026-11-20/21). BNB\n// Chain has no Circle-issued USDC (the Binance-pegged token is a different issuer), so it is\n// absent. Arc's USDC at 0x3600…0000 is the native coin's ERC-20 view — listed below as a native\n// alias rather than a Circle issuance — and Scroll on Circle's list is a different deployment.\nconst USDC: EvmToken = Object.freeze({ symbol: \"USDC\", decimals: 6, name: \"USD Coin\" });\n\n// Tether USDT (6 decimals), from https://tether.to/en/supported-protocols/ (reviewed 2026-11-20):\n// Tether lists USD₮ on Ethereum, Avalanche, Celo and Kaia among our networks; USDT0 and bridged or\n// third-party USDT on other chains are different issuers and are absent.\nconst USDT: EvmToken = Object.freeze({ symbol: \"USDT\", decimals: 6, name: \"Tether USD\" });\n\n// Native aliases — an ERC-20 front for the chain's own coin; balanceOf mirrors the native\n// balance, checked live 2026-11-21.\n// https://docs.celo.org/contracts/core-contracts (GoldToken/CeloToken).\nconst CELO_ALIAS: EvmToken = Object.freeze({\n symbol: \"CELO\",\n decimals: 18,\n name: \"Celo native asset\",\n role: \"native-alias\",\n});\n// https://docs.arc.network/arc/references/contract-addresses.\nconst ARC_USDC_ALIAS: EvmToken = Object.freeze({\n symbol: \"USDC\",\n decimals: 6,\n name: \"USDC\",\n role: \"native-alias\",\n});\n\n// Wrapped natives — WETH9-style deposit/withdraw contracts; their deposit()/withdraw(uint256)\n// calls describe as a swap between the coin and the token.\nconst WETH: EvmToken = Object.freeze({\n symbol: \"WETH\",\n decimals: 18,\n name: \"Wrapped Ether\",\n role: \"wrapped-native\",\n});\nconst WBNB: EvmToken = Object.freeze({\n symbol: \"WBNB\",\n decimals: 18,\n name: \"Wrapped BNB\",\n role: \"wrapped-native\",\n});\n\n// Rows marked \"// OP Stack\" hold the same WETH predeploy every OP Stack chain deploys —\n// https://specs.optimism.io/protocol/predeploys.html.\n\n/** The built-in table. */\nexport const evmTokenTable: EvmTokenTable = Object.freeze({\n \"1\": Object.freeze({\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\": USDC,\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\": USDT,\n // https://docs.uniswap.org/contracts/v3/reference/deployments/ethereum-deployments\n \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\": WETH,\n }),\n \"10\": Object.freeze({\n \"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85\": USDC,\n \"0x4200000000000000000000000000000000000006\": WETH, // OP Stack\n }),\n \"25\": Object.freeze({\n \"0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D\": USDC,\n // https://docs.cronos.org/for-dapp-developers/cronos-smart-contract/token-contract-addresses\n \"0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23\": Object.freeze({\n symbol: \"WCRO\",\n decimals: 18,\n name: \"Wrapped CRO\",\n role: \"wrapped-native\",\n }),\n }),\n \"56\": Object.freeze({\n // https://docs.uniswap.org/contracts/v3/reference/deployments/bnb-deployments\n \"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c\": WBNB,\n }),\n \"130\": Object.freeze({\n \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\": USDC,\n \"0x4200000000000000000000000000000000000006\": WETH, // OP Stack\n }),\n \"137\": Object.freeze({\n \"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359\": USDC,\n // https://docs.uniswap.org/contracts/v3/reference/deployments/polygon-deployments\n \"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270\": Object.freeze({\n symbol: \"WPOL\",\n decimals: 18,\n name: \"Wrapped Polygon Ecosystem Token\",\n role: \"wrapped-native\",\n }),\n }),\n \"143\": Object.freeze({\n \"0x754704Bc059F8C67012fEd69BC8A327a5aafb603\": USDC,\n // https://docs.monad.xyz/developer-essentials/network-information\n \"0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A\": Object.freeze({\n symbol: \"WMON\",\n decimals: 18,\n name: \"Wrapped MON\",\n role: \"wrapped-native\",\n }),\n }),\n \"146\": Object.freeze({\n \"0x29219dd400f2Bf60E5a23d13Be72B486D4038894\": USDC,\n // https://docs.soniclabs.com/sonic/build-on-sonic/contract-addresses\n \"0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38\": Object.freeze({\n symbol: \"wS\",\n decimals: 18,\n name: \"Wrapped Sonic\",\n role: \"wrapped-native\",\n }),\n }),\n \"196\": Object.freeze({ \"0xB6CEceAB302E2E4948951eE7843FC24E92933061\": USDC }),\n \"204\": Object.freeze({\n // https://docs.bnbchain.org/bnb-opbnb/core-concepts/opbnb-protocol-addresses/\n \"0x4200000000000000000000000000000000000006\": WBNB,\n }),\n \"324\": Object.freeze({ \"0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4\": USDC }),\n // Circle's page prints a non-EIP-55 casing; this is the checksummed form.\n \"480\": Object.freeze({\n \"0x79A02482A880bCE3F13e09Da970dC34db4CD24d1\": USDC,\n \"0x4200000000000000000000000000000000000006\": WETH, // OP Stack\n }),\n // https://docs.stable.xyz/en/explanation/usdt0-behavior — balanceOf mirrors the native balance,\n // checked live 2026-11-21.\n \"988\": Object.freeze({\n \"0x779Ded0c9e1022225f8E0630b35a9b54bE713736\": Object.freeze({\n symbol: \"USDT0\",\n decimals: 6,\n name: \"USDT0\",\n role: \"native-alias\",\n }),\n }),\n \"999\": Object.freeze({\n \"0xb88339CB7199b77E23DB6E890353E22632Ba630f\": USDC,\n // https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/wrapped-hype\n \"0x5555555555555555555555555555555555555555\": Object.freeze({\n symbol: \"WHYPE\",\n decimals: 18,\n name: \"Wrapped HYPE\",\n role: \"wrapped-native\",\n }),\n }),\n \"1329\": Object.freeze({\n \"0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392\": USDC,\n // https://docs.sei.io/evm/ecosystem-contracts\n \"0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7\": Object.freeze({\n symbol: \"WSEI\",\n decimals: 18,\n name: \"Wrapped SEI\",\n role: \"wrapped-native\",\n }),\n }),\n \"1672\": Object.freeze({ \"0xC879C018dB60520F4355C26eD1a6D572cdAC1815\": USDC }),\n \"1868\": Object.freeze({\n \"0x4200000000000000000000000000000000000006\": WETH, // OP Stack\n }),\n \"4326\": Object.freeze({\n \"0x4200000000000000000000000000000000000006\": WETH, // OP Stack\n }),\n \"5042\": Object.freeze({ \"0x3600000000000000000000000000000000000000\": ARC_USDC_ALIAS }),\n \"8217\": Object.freeze({\n \"0xd077A400968890Eacc75cdc901F0356c943e4fDb\": USDT,\n // https://docs.kaia.io/references/contract-addresses/\n \"0x19Aac5f612f524B754CA7e7c41cbFa2E981A4432\": Object.freeze({\n symbol: \"WKLAY\",\n decimals: 18,\n name: \"Wrapped Klay\",\n role: \"wrapped-native\",\n }),\n }),\n \"8453\": Object.freeze({\n \"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913\": USDC,\n \"0x4200000000000000000000000000000000000006\": WETH, // OP Stack\n }),\n \"9745\": Object.freeze({ \"0x2d661C89D812261039AF9764eceaAee884f5F67F\": USDC }),\n \"42161\": Object.freeze({\n \"0xaf88d065e77c8cC2239327C5EDb3A432268e5831\": USDC,\n // https://docs.arbitrum.io/for-devs/useful-addresses\n \"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1\": WETH,\n // Fiat24 cash tokens — issuer's own list\n // https://docs.fiat24.com/developer/integration-guide/part-1-smart-contracts.md; Sourcify\n // full match on each implementation and decimals() = 2 read on chain at block 526439604.\n \"0xbE00f3db78688d9704BCb4e0a827aea3a9Cc0D62\": Object.freeze({\n symbol: \"USD24\",\n decimals: 2,\n name: \"Fiat24 USD\",\n }),\n \"0x2c5d06f591D0d8cd43Ac232c2B654475a142c7DA\": Object.freeze({\n symbol: \"EUR24\",\n decimals: 2,\n name: \"Fiat24 EUR\",\n }),\n \"0xd41F1f0cf89fD239ca4c1F8E8ADA46345c86b0a4\": Object.freeze({\n symbol: \"CHF24\",\n decimals: 2,\n name: \"Fiat24 CHF\",\n }),\n \"0x7288Ac74d211735374A23707D1518DCbbc0144fd\": Object.freeze({\n symbol: \"CNH24\",\n decimals: 2,\n name: \"Fiat24 CNH\",\n }),\n }),\n \"42220\": Object.freeze({\n \"0xcebA9300f2b948710d2653dD7B07f33A8B32118C\": USDC,\n \"0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e\": USDT,\n \"0x471EcE3750Da237f93B8E339c536989b8978a438\": CELO_ALIAS,\n }),\n \"43114\": Object.freeze({\n \"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E\": USDC,\n \"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7\": USDT,\n // https://docs.uniswap.org/contracts/v3/reference/deployments/avax-deployments\n \"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7\": Object.freeze({\n symbol: \"WAVAX\",\n decimals: 18,\n name: \"Wrapped AVAX\",\n role: \"wrapped-native\",\n }),\n }),\n \"57073\": Object.freeze({\n \"0x2D270e6886d130D724215A266106e6832161EAEd\": USDC,\n \"0x4200000000000000000000000000000000000006\": WETH, // OP Stack\n }),\n \"59144\": Object.freeze({ \"0x176211869cA2b568f2A7D4EE941E073a821EE1ff\": USDC }),\n \"60808\": Object.freeze({\n \"0x4200000000000000000000000000000000000006\": WETH, // OP Stack\n }),\n \"80094\": Object.freeze({\n // https://docs.berachain.com/developers/deployed-contracts\n \"0x6969696969696969696969696969696969696969\": Object.freeze({\n symbol: \"WBERA\",\n decimals: 18,\n name: \"Wrapped Bera\",\n role: \"wrapped-native\",\n }),\n }),\n \"534352\": Object.freeze({\n // https://docs.scroll.io/en/developers/scroll-contracts\n \"0x5300000000000000000000000000000000000004\": WETH,\n }),\n \"747474\": Object.freeze({\n \"0x4200000000000000000000000000000000000006\": WETH, // OP Stack\n }),\n \"5042002\": Object.freeze({ \"0x3600000000000000000000000000000000000000\": ARC_USDC_ALIAS }),\n \"7777777\": Object.freeze({\n \"0x4200000000000000000000000000000000000006\": WETH, // OP Stack\n }),\n \"11142220\": Object.freeze({\n \"0x471EcE3750Da237f93B8E339c536989b8978a438\": CELO_ALIAS,\n }),\n});\n\nexport const lookupEvmToken = (\n table: EvmTokenTable,\n chainId: number,\n address: string,\n): EvmToken | undefined => table[String(chainId)]?.[address];\n","/** The native asset id in `AssetFlow` and simulated asset changes. */\nexport const EVM_NATIVE_ASSET = \"native\";\n"],"mappings":";AAyBA,MAAM,OAAiB,OAAO,OAAO;CAAE,QAAQ;CAAQ,UAAU;CAAG,MAAM;AAAW,CAAC;AAKtF,MAAM,OAAiB,OAAO,OAAO;CAAE,QAAQ;CAAQ,UAAU;CAAG,MAAM;AAAa,CAAC;AAKxF,MAAM,aAAuB,OAAO,OAAO;CACzC,QAAQ;CACR,UAAU;CACV,MAAM;CACN,MAAM;AACR,CAAC;AAED,MAAM,iBAA2B,OAAO,OAAO;CAC7C,QAAQ;CACR,UAAU;CACV,MAAM;CACN,MAAM;AACR,CAAC;AAID,MAAM,OAAiB,OAAO,OAAO;CACnC,QAAQ;CACR,UAAU;CACV,MAAM;CACN,MAAM;AACR,CAAC;AACD,MAAM,OAAiB,OAAO,OAAO;CACnC,QAAQ;CACR,UAAU;CACV,MAAM;CACN,MAAM;AACR,CAAC;;AAMD,MAAa,gBAA+B,OAAO,OAAO;CACxD,KAAK,OAAO,OAAO;EACjB,8CAA8C;EAC9C,8CAA8C;EAE9C,8CAA8C;CAChD,CAAC;CACD,MAAM,OAAO,OAAO;EAClB,8CAA8C;EAC9C,8CAA8C;CAChD,CAAC;CACD,MAAM,OAAO,OAAO;EAClB,8CAA8C;EAE9C,8CAA8C,OAAO,OAAO;GAC1D,QAAQ;GACR,UAAU;GACV,MAAM;GACN,MAAM;EACR,CAAC;CACH,CAAC;CACD,MAAM,OAAO,OAAO,EAElB,8CAA8C,KAChD,CAAC;CACD,OAAO,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ACtB,8CAA8C,KAChD,CAAC;CACD,WAAW,OAAO,OAAO,EAAE,8CAA8C,eAAe,CAAC;CACzF,WAAW,OAAO,OAAO,EACvB,8CAA8C,KAChD,CAAC;CACD,YAAY,OAAO,OAAO,EACxB,8CAA8C,WAChD,CAAC;AACH,CAAC;AAED,MAAa,kBACX,OACA,SACA,YACyB,MAAM,OAAO,OAAO,EAAE,GAAG;;;AC/QpD,MAAa,mBAAmB"}
|
package/dist/bitcoin-sign.d.mts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { L as SignTask } from "./index-CIRaHKpx.mjs";
|
|
2
|
+
/** Signs one task with a raw secp256k1 key; `auxRand` feeds only the BIP-340 nonce. */
|
|
3
|
+
export declare const signBitcoinTask: (task: SignTask, privateKey: Uint8Array, auxRand: Uint8Array) => Uint8Array;
|
|
1
4
|
export declare const signBitcoinPsbt: (psbt: Uint8Array, inputs: ReadonlyArray<{
|
|
2
5
|
index: number;
|
|
3
6
|
privateKey: Uint8Array;
|
package/dist/bitcoin-sign.mjs
CHANGED
|
@@ -1,29 +1,63 @@
|
|
|
1
|
-
import { t as ChainError } from "./src-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { t as ChainError } from "./src-CHB_z45M.mjs";
|
|
2
|
+
import { i as signLocally } from "./tasks-7AFv3PQn.mjs";
|
|
3
|
+
import { i as planBitcoinPsbt, n as assembleBitcoinPsbt, r as planBitcoinMessage, t as assembleBitcoinMessage } from "./assemble-8GvNDony.mjs";
|
|
4
|
+
import { schnorr, secp256k1 } from "@noble/curves/secp256k1.js";
|
|
5
|
+
import { bytesToNumberBE } from "@noble/curves/utils.js";
|
|
5
6
|
// src/bitcoin/sign.ts
|
|
6
7
|
/**
|
|
7
|
-
* /bitcoin/sign —
|
|
8
|
-
* (BIP-
|
|
9
|
-
*
|
|
8
|
+
* /bitcoin/sign — the only file holding private-key code for the family: the local task signer
|
|
9
|
+
* (ECDSA, and BIP-340 with the protocol.md §12.2 generic tweak, equal to btc-signer's
|
|
10
|
+
* taprootTweakPrivKey when the tweak is TapTweak(x(P))), plus the raw-key API reimplemented as
|
|
11
|
+
* `plan → signBitcoinTask → assemble`. Inputs must already be normalized: the kernel calls
|
|
12
|
+
* `normalizeBitcoin` first. No key caching.
|
|
10
13
|
*/
|
|
14
|
+
const { Fn } = secp256k1.Point;
|
|
15
|
+
const checkKey = (privateKey) => {
|
|
16
|
+
if (privateKey.length !== 32) throw new ChainError("invalid-request", "private key must be 32 bytes");
|
|
17
|
+
};
|
|
18
|
+
/** Signs one task with a raw secp256k1 key; `auxRand` feeds only the BIP-340 nonce. */
|
|
19
|
+
const signBitcoinTask = (task, privateKey, auxRand) => {
|
|
20
|
+
checkKey(privateKey);
|
|
21
|
+
if (task.scheme === "ecdsa-secp256k1") return secp256k1.sign(task.digest, privateKey, { prehash: false });
|
|
22
|
+
if (task.scheme === "bip340") {
|
|
23
|
+
const d0 = Fn.fromBytes(privateKey);
|
|
24
|
+
const internal = secp256k1.Point.BASE.multiply(d0).toAffine().y % 2n === 0n ? d0 : Fn.neg(d0);
|
|
25
|
+
const tweak = bytesToNumberBE(task.tweak);
|
|
26
|
+
if (tweak >= Fn.ORDER) throw new ChainError("invalid-request", "tweak is not a valid scalar");
|
|
27
|
+
const d = Fn.create(internal + tweak);
|
|
28
|
+
if (d === 0n) throw new ChainError("invalid-request", "tweaked key is zero");
|
|
29
|
+
return schnorr.sign(task.message, Fn.toBytes(d), auxRand);
|
|
30
|
+
}
|
|
31
|
+
throw new ChainError("unsupported", `bitcoin cannot sign ${task.scheme} tasks`);
|
|
32
|
+
};
|
|
11
33
|
const signBitcoinPsbt = (psbt, inputs, auxRand) => {
|
|
12
|
-
const
|
|
13
|
-
for (const { index, privateKey } of inputs) {
|
|
34
|
+
const entries = inputs.map(({ index, privateKey }) => {
|
|
14
35
|
if (privateKey.length !== 32) throw new ChainError("invalid-request", `input ${index}: private key must be 32 bytes`);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
36
|
+
return {
|
|
37
|
+
index,
|
|
38
|
+
privateKey,
|
|
39
|
+
key: {
|
|
40
|
+
path: [],
|
|
41
|
+
publicKey: secp256k1.getPublicKey(privateKey, true)
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
const plan = planBitcoinPsbt(psbt, entries.map(({ index, key }) => ({
|
|
46
|
+
index,
|
|
47
|
+
key
|
|
48
|
+
})));
|
|
49
|
+
return signLocally(plan, (task, i) => signBitcoinTask(task, entries[i]?.privateKey ?? /* @__PURE__ */ new Uint8Array(), auxRand(entries[i]?.index ?? 0)), assembleBitcoinPsbt);
|
|
19
50
|
};
|
|
20
51
|
/** Returns the signature string: `smp…` base64 witness for bip322-simple, compact base64 for legacy. */
|
|
21
52
|
const signBitcoinMessage = (request, privateKey, auxRand) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
53
|
+
checkKey(privateKey);
|
|
54
|
+
const key = {
|
|
55
|
+
path: [],
|
|
56
|
+
publicKey: secp256k1.getPublicKey(privateKey, true)
|
|
57
|
+
};
|
|
58
|
+
const plan = planBitcoinMessage(request, key);
|
|
59
|
+
return signLocally(plan, (task) => signBitcoinTask(task, privateKey, plan.format === "legacy" ? /* @__PURE__ */ new Uint8Array(32) : auxRand(0)), assembleBitcoinMessage);
|
|
26
60
|
};
|
|
27
|
-
export { signBitcoinMessage, signBitcoinPsbt };
|
|
61
|
+
export { signBitcoinMessage, signBitcoinPsbt, signBitcoinTask };
|
|
28
62
|
|
|
29
63
|
//# sourceMappingURL=bitcoin-sign.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitcoin-sign.mjs","names":[],"sources":["../src/bitcoin/sign.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"bitcoin-sign.mjs","names":[],"sources":["../src/bitcoin/sign.ts"],"sourcesContent":["/**\n * /bitcoin/sign — the only file holding private-key code for the family: the local task signer\n * (ECDSA, and BIP-340 with the protocol.md §12.2 generic tweak, equal to btc-signer's\n * taprootTweakPrivKey when the tweak is TapTweak(x(P))), plus the raw-key API reimplemented as\n * `plan → signBitcoinTask → assemble`. Inputs must already be normalized: the kernel calls\n * `normalizeBitcoin` first. No key caching.\n */\nimport { secp256k1, schnorr } from \"@noble/curves/secp256k1.js\";\nimport { bytesToNumberBE } from \"@noble/curves/utils.js\";\n\nimport { ChainError } from \"../index.ts\";\nimport type { SignTask, TaskKey } from \"../index.ts\";\nimport { signLocally } from \"../tasks.ts\";\nimport { assembleBitcoinMessage, assembleBitcoinPsbt } from \"./assemble.ts\";\nimport { planBitcoinMessage, planBitcoinPsbt } from \"./plan.ts\";\n\nconst { Fn } = secp256k1.Point;\n\nconst checkKey = (privateKey: Uint8Array): void => {\n if (privateKey.length !== 32) {\n throw new ChainError(\"invalid-request\", \"private key must be 32 bytes\");\n }\n};\n\n/** Signs one task with a raw secp256k1 key; `auxRand` feeds only the BIP-340 nonce. */\nexport const signBitcoinTask = (\n task: SignTask,\n privateKey: Uint8Array,\n auxRand: Uint8Array,\n): Uint8Array => {\n checkKey(privateKey);\n if (task.scheme === \"ecdsa-secp256k1\") {\n return secp256k1.sign(task.digest, privateKey, { prehash: false });\n }\n if (task.scheme === \"bip340\") {\n const d0 = Fn.fromBytes(privateKey);\n const internal = secp256k1.Point.BASE.multiply(d0).toAffine().y % 2n === 0n ? d0 : Fn.neg(d0);\n const tweak = bytesToNumberBE(task.tweak);\n if (tweak >= Fn.ORDER) {\n throw new ChainError(\"invalid-request\", \"tweak is not a valid scalar\");\n }\n const d = Fn.create(internal + tweak);\n if (d === 0n) {\n throw new ChainError(\"invalid-request\", \"tweaked key is zero\");\n }\n return schnorr.sign(task.message, Fn.toBytes(d), auxRand);\n }\n throw new ChainError(\"unsupported\", `bitcoin cannot sign ${task.scheme} tasks`);\n};\n\nexport const signBitcoinPsbt = (\n psbt: Uint8Array,\n inputs: ReadonlyArray<{ index: number; privateKey: Uint8Array }>,\n auxRand: (n: number) => Uint8Array,\n): Uint8Array => {\n const entries = inputs.map(({ index, privateKey }) => {\n if (privateKey.length !== 32) {\n throw new ChainError(\"invalid-request\", `input ${index}: private key must be 32 bytes`);\n }\n return {\n index,\n privateKey,\n key: { path: [], publicKey: secp256k1.getPublicKey(privateKey, true) } satisfies TaskKey,\n };\n });\n const plan = planBitcoinPsbt(\n psbt,\n entries.map(({ index, key }) => ({ index, key })),\n );\n return signLocally(\n plan,\n (task, i) =>\n signBitcoinTask(\n task,\n entries[i]?.privateKey ?? new Uint8Array(),\n auxRand(entries[i]?.index ?? 0),\n ),\n assembleBitcoinPsbt,\n );\n};\n\n/** Returns the signature string: `smp…` base64 witness for bip322-simple, compact base64 for legacy. */\nexport const signBitcoinMessage = (\n request: {\n network: string;\n address: string;\n message: string;\n format: \"bip322-simple\" | \"legacy\";\n },\n privateKey: Uint8Array,\n auxRand: (n: number) => Uint8Array,\n): string => {\n checkKey(privateKey);\n const key: TaskKey = { path: [], publicKey: secp256k1.getPublicKey(privateKey, true) };\n const plan = planBitcoinMessage(request, key);\n return signLocally(\n plan,\n (task) =>\n signBitcoinTask(\n task,\n privateKey,\n // The legacy path never drew auxRand before; keep the caller's random consumption\n // identical — a BIP-340 task is the only one that reads it.\n plan.format === \"legacy\" ? new Uint8Array(32) : auxRand(0),\n ),\n assembleBitcoinMessage,\n );\n};\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,EAAE,OAAO,UAAU;AAEzB,MAAM,YAAY,eAAiC;CACjD,IAAI,WAAW,WAAW,IACxB,MAAM,IAAI,WAAW,mBAAmB,8BAA8B;AAE1E;;AAGA,MAAa,mBACX,MACA,YACA,YACe;CACf,SAAS,UAAU;CACnB,IAAI,KAAK,WAAW,mBAClB,OAAO,UAAU,KAAK,KAAK,QAAQ,YAAY,EAAE,SAAS,MAAM,CAAC;CAEnE,IAAI,KAAK,WAAW,UAAU;EAC5B,MAAM,KAAK,GA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