@@ -152,8 +152,3 @@ "use strict"; | ||
| } | ||
| const cleanMoney = money.replace(/^\$/, "").trim(); | ||
| const amount = parseFloat(cleanMoney); | ||
| if (isNaN(amount)) { | ||
| throw new Error(`Invalid money format: ${money}`); | ||
| } | ||
| return amount; | ||
| return (0, import_utils.parseMoneyString)(money); | ||
| } | ||
@@ -160,0 +155,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/exact/server/index.ts","../../../../src/exact/server/scheme.ts","../../../../src/constants.ts"],"sourcesContent":["export { ExactAvmScheme } from \"./scheme\";\n","/**\n * AVM Server Scheme for Exact Payment Protocol\n *\n * Parses prices and builds payment requirements for Algorand ASA transfers.\n */\n\nimport type {\n AssetAmount,\n Network,\n PaymentRequirements,\n Price,\n SchemeNetworkServer,\n MoneyParser,\n} from \"@x402/core/types\";\nimport { convertToTokenAmount, numberToDecimalString } from \"@x402/core/utils\";\nimport { USDC_CONFIG, USDC_DECIMALS } from \"../../constants\";\n\n/**\n * AVM server implementation for the Exact payment scheme.\n *\n * Handles price parsing and payment requirements enhancement for Algorand networks.\n */\nexport class ExactAvmScheme implements SchemeNetworkServer {\n readonly scheme = \"exact\";\n private moneyParsers: MoneyParser[] = [];\n\n /**\n * Register a custom money parser in the parser chain.\n * Multiple parsers can be registered - they will be tried in registration order.\n * Each parser receives a decimal amount (e.g., 1.50 for $1.50).\n * If a parser returns null, the next parser in the chain will be tried.\n * The default parser is always the final fallback.\n *\n * @param parser - Custom function to convert amount to AssetAmount (or null to skip)\n * @returns The server instance for chaining\n *\n * @example\n * ```typescript\n * avmServer.registerMoneyParser(async (amount, network) => {\n * // Custom conversion logic for non-USDC assets\n * if (amount > 100) {\n * return { amount: (amount * 1e6).toString(), asset: \"12345678\" };\n * }\n * return null; // Use next parser\n * });\n * ```\n */\n registerMoneyParser(parser: MoneyParser): ExactAvmScheme {\n this.moneyParsers.push(parser);\n return this;\n }\n\n /**\n * Parses a price into an asset amount.\n * If price is already an AssetAmount, returns it directly.\n * If price is Money (string | number), parses to decimal and tries custom parsers.\n * Falls back to default conversion if all custom parsers return null.\n *\n * @param price - The price to parse\n * @param network - The network to use\n * @returns Promise that resolves to the parsed asset amount\n */\n async parsePrice(price: Price, network: Network): Promise<AssetAmount> {\n // If already an AssetAmount, return it directly\n if (typeof price === \"object\" && price !== null && \"amount\" in price) {\n if (!price.asset) {\n throw new Error(`Asset ID must be specified for AssetAmount on network ${network}`);\n }\n return {\n amount: price.amount,\n asset: price.asset,\n extra: price.extra || {},\n };\n }\n\n // Parse Money to decimal number\n const amount = this.parseMoneyToDecimal(price);\n\n // Try each custom money parser in order\n for (const parser of this.moneyParsers) {\n const result = await parser(amount, network);\n if (result !== null) {\n return result;\n }\n }\n\n // All custom parsers returned null, use default conversion\n return this.defaultMoneyConversion(amount, network);\n }\n\n /**\n * Build payment requirements for this scheme/network combination\n *\n * @param paymentRequirements - The base payment requirements\n * @param supportedKind - The supported kind from facilitator (contains extra data like feePayer)\n * @param supportedKind.x402Version - The x402 version\n * @param supportedKind.scheme - The logical payment scheme\n * @param supportedKind.network - The network identifier in CAIP-2 format\n * @param supportedKind.extra - Optional extra metadata (e.g., feePayer address)\n * @param extensionKeys - Extension keys supported by the facilitator\n * @returns Payment requirements ready to be sent to clients\n */\n enhancePaymentRequirements(\n paymentRequirements: PaymentRequirements,\n supportedKind: {\n x402Version: number;\n scheme: string;\n network: Network;\n extra?: Record<string, unknown>;\n },\n extensionKeys: string[],\n ): Promise<PaymentRequirements> {\n // Mark unused parameter\n void extensionKeys;\n\n // Get USDC config for the network\n const usdcConfig = USDC_CONFIG[supportedKind.network];\n const decimals = usdcConfig?.decimals ?? USDC_DECIMALS;\n\n // Build enhanced requirements with feePayer and decimals\n const enhanced: PaymentRequirements = {\n ...paymentRequirements,\n extra: {\n ...paymentRequirements.extra,\n decimals,\n },\n };\n\n // Add feePayer from supportedKind.extra if provided\n if (supportedKind.extra?.feePayer) {\n enhanced.extra = {\n ...enhanced.extra,\n feePayer: supportedKind.extra.feePayer,\n };\n }\n\n return Promise.resolve(enhanced);\n }\n\n /**\n * Parse Money (string | number) to a decimal number.\n * Handles formats like \"$1.50\", \"1.50\", 1.50, etc.\n *\n * @param money - The money value to parse\n * @returns Decimal number\n */\n private parseMoneyToDecimal(money: string | number): number {\n if (typeof money === \"number\") {\n return money;\n }\n\n // Remove $ sign and whitespace, then parse\n const cleanMoney = money.replace(/^\\$/, \"\").trim();\n const amount = parseFloat(cleanMoney);\n\n if (isNaN(amount)) {\n throw new Error(`Invalid money format: ${money}`);\n }\n\n return amount;\n }\n\n /**\n * Default money conversion implementation.\n * Converts decimal amount to the default stablecoin (USDC) on the specified network.\n *\n * @param amount - The decimal amount (e.g., 1.50)\n * @param network - The network to use\n * @returns The parsed asset amount in USDC\n */\n private defaultMoneyConversion(amount: number, network: Network): AssetAmount {\n const assetInfo = this.getDefaultAsset(network);\n const tokenAmount = convertToTokenAmount(numberToDecimalString(amount), assetInfo.decimals);\n\n return {\n amount: tokenAmount,\n asset: assetInfo.asaId,\n };\n }\n\n /**\n * Get the default asset info for a network (USDC)\n *\n * @param network - The network to get asset info for\n * @returns The asset information including ASA ID, name, and decimals\n */\n private getDefaultAsset(network: Network): {\n asaId: string;\n name: string;\n decimals: number;\n } {\n const assetInfo = USDC_CONFIG[network];\n if (!assetInfo) {\n throw new Error(`No default asset configured for network ${network}`);\n }\n\n return assetInfo;\n }\n}\n","/**\n * Algorand Network Constants for x402 AVM Implementation\n *\n * CAIP-2 Network Identifiers use the format: algorand:<genesis-hash-base64>\n * Genesis hashes uniquely identify Algorand networks.\n */\n\n// ============================================================================\n// CAIP-2 Network Identifiers (V2)\n// ============================================================================\n\n/**\n * CAIP-2 network identifier for Algorand Mainnet\n * Format: algorand:<genesis-hash-base64>\n */\nexport const ALGORAND_MAINNET_CAIP2 = \"algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\";\n\n/**\n * CAIP-2 network identifier for Algorand Testnet\n * Format: algorand:<genesis-hash-base64>\n */\nexport const ALGORAND_TESTNET_CAIP2 = \"algorand:SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=\";\n\n/**\n * All supported CAIP-2 network identifiers\n */\nexport const CAIP2_NETWORKS = [ALGORAND_MAINNET_CAIP2, ALGORAND_TESTNET_CAIP2] as const;\n\n// ============================================================================\n// Genesis Hashes\n// ============================================================================\n\n/**\n * Algorand Mainnet genesis hash (base64 encoded)\n */\nexport const ALGORAND_MAINNET_GENESIS_HASH = \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\";\n\n/**\n * Algorand Testnet genesis hash (base64 encoded)\n */\nexport const ALGORAND_TESTNET_GENESIS_HASH = \"SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=\";\n\n// ============================================================================\n// USDC ASA (Algorand Standard Asset) Configuration\n// ============================================================================\n\n/**\n * USDC ASA ID on Algorand Mainnet\n *\n * @see https://algoexplorer.io/asset/31566704\n */\nexport const USDC_MAINNET_ASA_ID = \"31566704\";\n\n/**\n * USDC ASA ID on Algorand Testnet\n *\n * @see https://testnet.algoexplorer.io/asset/10458941\n */\nexport const USDC_TESTNET_ASA_ID = \"10458941\";\n\n/**\n * USDC decimals (same across all networks)\n */\nexport const USDC_DECIMALS = 6;\n\n/**\n * USDC configuration per network\n */\nexport const USDC_CONFIG: Record<string, { asaId: string; name: string; decimals: number }> = {\n [ALGORAND_MAINNET_CAIP2]: {\n asaId: USDC_MAINNET_ASA_ID,\n name: \"USDC\",\n decimals: USDC_DECIMALS,\n },\n [ALGORAND_TESTNET_CAIP2]: {\n asaId: USDC_TESTNET_ASA_ID,\n name: \"USDC\",\n decimals: USDC_DECIMALS,\n },\n};\n\n// ============================================================================\n// Transaction Limits\n// ============================================================================\n\n/**\n * Maximum reasonable fee per transaction in microAlgos (5000 µAlgo).\n *\n * Algorand transaction fees are calculated as:\n * fee = max(current_fee_per_byte * transaction_size_in_bytes, min_fee)\n *\n * Under normal (non-congested) conditions, current_fee_per_byte is 0,\n * so fee = min_fee = 1000 µAlgo (0.001 ALGO).\n *\n * During network congestion, fees can rise. This constant is set to 5x\n * the minimum fee (5000 µAlgo) as a reasonable upper bound per transaction.\n *\n * For fee payer transactions that cover an entire group via fee pooling,\n * use `maxReasonableGroupFee(groupSize)` which multiplies this per-txn\n * cap by the number of transactions in the group.\n */\nexport const MAX_REASONABLE_FEE_PER_TXN = 5000;\n\n/**\n * Calculates the maximum reasonable fee for a fee payer transaction\n * that covers an entire atomic group via fee pooling.\n *\n * @param groupSize - Number of transactions in the atomic group\n * @returns Maximum acceptable fee in microAlgos\n */\nexport function maxReasonableGroupFee(groupSize: number): number {\n return MAX_REASONABLE_FEE_PER_TXN * groupSize;\n}\n\n// Address validation: use isValidAddress() from @algorandfoundation/algokit-utils/common\n// Address length: use ALGORAND_ADDRESS_LENGTH from @algorandfoundation/algokit-utils/common\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcA,mBAA4D;;;ACCrD,IAAM,yBAAyB;AAM/B,IAAM,yBAAyB;AA8B/B,IAAM,sBAAsB;AAO5B,IAAM,sBAAsB;AAK5B,IAAM,gBAAgB;AAKtB,IAAM,cAAiF;AAAA,EAC5F,CAAC,sBAAsB,GAAG;AAAA,IACxB,OAAO;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,CAAC,sBAAsB,GAAG;AAAA,IACxB,OAAO;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AACF;;;ADzDO,IAAM,iBAAN,MAAoD;AAAA,EAApD;AACL,SAAS,SAAS;AAClB,SAAQ,eAA8B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBvC,oBAAoB,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A,IACT;AAGA,UAAM,aAAa,MAAM,QAAQ,OAAO,EAAE,EAAE,KAAK;AACjD,UAAM,SAAS,WAAW,UAAU;AAEpC,QAAI,MAAM,MAAM,GAAG;AACjB,YAAM,IAAI,MAAM,yBAAyB,KAAK,EAAE;AAAA,IAClD;AAEA,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUQ,uBAAuB,QAAgB,SAA+B;AAC5E,UAAM,YAAY,KAAK,gBAAgB,OAAO;AAC9C,UAAM,kBAAc,uCAAqB,oCAAsB,MAAM,GAAG,UAAU,QAAQ;AAE1F,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO,UAAU;AAAA,IACnB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,gBAAgB,SAItB;AACA,UAAM,YAAY,YAAY,OAAO;AACrC,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,2CAA2C,OAAO,EAAE;AAAA,IACtE;AAEA,WAAO;AAAA,EACT;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../../src/exact/server/index.ts","../../../../src/exact/server/scheme.ts","../../../../src/constants.ts"],"sourcesContent":["export { ExactAvmScheme } from \"./scheme\";\n","/**\n * AVM Server Scheme for Exact Payment Protocol\n *\n * Parses prices and builds payment requirements for Algorand ASA transfers.\n */\n\nimport type {\n AssetAmount,\n Network,\n PaymentRequirements,\n Price,\n SchemeNetworkServer,\n MoneyParser,\n} from \"@x402/core/types\";\nimport { convertToTokenAmount, numberToDecimalString, parseMoneyString } from \"@x402/core/utils\";\nimport { USDC_CONFIG, USDC_DECIMALS } from \"../../constants\";\n\n/**\n * AVM server implementation for the Exact payment scheme.\n *\n * Handles price parsing and payment requirements enhancement for Algorand networks.\n */\nexport class ExactAvmScheme implements SchemeNetworkServer {\n readonly scheme = \"exact\";\n private moneyParsers: MoneyParser[] = [];\n\n /**\n * Register a custom money parser in the parser chain.\n * Multiple parsers can be registered - they will be tried in registration order.\n * Each parser receives a decimal amount (e.g., 1.50 for $1.50).\n * If a parser returns null, the next parser in the chain will be tried.\n * The default parser is always the final fallback.\n *\n * @param parser - Custom function to convert amount to AssetAmount (or null to skip)\n * @returns The server instance for chaining\n *\n * @example\n * ```typescript\n * avmServer.registerMoneyParser(async (amount, network) => {\n * // Custom conversion logic for non-USDC assets\n * if (amount > 100) {\n * return { amount: (amount * 1e6).toString(), asset: \"12345678\" };\n * }\n * return null; // Use next parser\n * });\n * ```\n */\n registerMoneyParser(parser: MoneyParser): ExactAvmScheme {\n this.moneyParsers.push(parser);\n return this;\n }\n\n /**\n * Parses a price into an asset amount.\n * If price is already an AssetAmount, returns it directly.\n * If price is Money (string | number), parses to decimal and tries custom parsers.\n * Falls back to default conversion if all custom parsers return null.\n *\n * @param price - The price to parse\n * @param network - The network to use\n * @returns Promise that resolves to the parsed asset amount\n */\n async parsePrice(price: Price, network: Network): Promise<AssetAmount> {\n // If already an AssetAmount, return it directly\n if (typeof price === \"object\" && price !== null && \"amount\" in price) {\n if (!price.asset) {\n throw new Error(`Asset ID must be specified for AssetAmount on network ${network}`);\n }\n return {\n amount: price.amount,\n asset: price.asset,\n extra: price.extra || {},\n };\n }\n\n // Parse Money to decimal number\n const amount = this.parseMoneyToDecimal(price);\n\n // Try each custom money parser in order\n for (const parser of this.moneyParsers) {\n const result = await parser(amount, network);\n if (result !== null) {\n return result;\n }\n }\n\n // All custom parsers returned null, use default conversion\n return this.defaultMoneyConversion(amount, network);\n }\n\n /**\n * Build payment requirements for this scheme/network combination\n *\n * @param paymentRequirements - The base payment requirements\n * @param supportedKind - The supported kind from facilitator (contains extra data like feePayer)\n * @param supportedKind.x402Version - The x402 version\n * @param supportedKind.scheme - The logical payment scheme\n * @param supportedKind.network - The network identifier in CAIP-2 format\n * @param supportedKind.extra - Optional extra metadata (e.g., feePayer address)\n * @param extensionKeys - Extension keys supported by the facilitator\n * @returns Payment requirements ready to be sent to clients\n */\n enhancePaymentRequirements(\n paymentRequirements: PaymentRequirements,\n supportedKind: {\n x402Version: number;\n scheme: string;\n network: Network;\n extra?: Record<string, unknown>;\n },\n extensionKeys: string[],\n ): Promise<PaymentRequirements> {\n // Mark unused parameter\n void extensionKeys;\n\n // Get USDC config for the network\n const usdcConfig = USDC_CONFIG[supportedKind.network];\n const decimals = usdcConfig?.decimals ?? USDC_DECIMALS;\n\n // Build enhanced requirements with feePayer and decimals\n const enhanced: PaymentRequirements = {\n ...paymentRequirements,\n extra: {\n ...paymentRequirements.extra,\n decimals,\n },\n };\n\n // Add feePayer from supportedKind.extra if provided\n if (supportedKind.extra?.feePayer) {\n enhanced.extra = {\n ...enhanced.extra,\n feePayer: supportedKind.extra.feePayer,\n };\n }\n\n return Promise.resolve(enhanced);\n }\n\n /**\n * Parse Money (string | number) to a decimal number.\n * Handles formats like \"$1.50\", \"1.50\", 1.50, etc.\n *\n * @param money - The money value to parse\n * @returns Decimal number\n */\n private parseMoneyToDecimal(money: string | number): number {\n if (typeof money === \"number\") {\n return money;\n }\n\n return parseMoneyString(money);\n }\n\n /**\n * Default money conversion implementation.\n * Converts decimal amount to the default stablecoin (USDC) on the specified network.\n *\n * @param amount - The decimal amount (e.g., 1.50)\n * @param network - The network to use\n * @returns The parsed asset amount in USDC\n */\n private defaultMoneyConversion(amount: number, network: Network): AssetAmount {\n const assetInfo = this.getDefaultAsset(network);\n const tokenAmount = convertToTokenAmount(numberToDecimalString(amount), assetInfo.decimals);\n\n return {\n amount: tokenAmount,\n asset: assetInfo.asaId,\n };\n }\n\n /**\n * Get the default asset info for a network (USDC)\n *\n * @param network - The network to get asset info for\n * @returns The asset information including ASA ID, name, and decimals\n */\n private getDefaultAsset(network: Network): {\n asaId: string;\n name: string;\n decimals: number;\n } {\n const assetInfo = USDC_CONFIG[network];\n if (!assetInfo) {\n throw new Error(`No default asset configured for network ${network}`);\n }\n\n return assetInfo;\n }\n}\n","/**\n * Algorand Network Constants for x402 AVM Implementation\n *\n * CAIP-2 Network Identifiers use the format: algorand:<genesis-hash-base64>\n * Genesis hashes uniquely identify Algorand networks.\n */\n\n// ============================================================================\n// CAIP-2 Network Identifiers (V2)\n// ============================================================================\n\n/**\n * CAIP-2 network identifier for Algorand Mainnet\n * Format: algorand:<genesis-hash-base64>\n */\nexport const ALGORAND_MAINNET_CAIP2 = \"algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\";\n\n/**\n * CAIP-2 network identifier for Algorand Testnet\n * Format: algorand:<genesis-hash-base64>\n */\nexport const ALGORAND_TESTNET_CAIP2 = \"algorand:SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=\";\n\n/**\n * All supported CAIP-2 network identifiers\n */\nexport const CAIP2_NETWORKS = [ALGORAND_MAINNET_CAIP2, ALGORAND_TESTNET_CAIP2] as const;\n\n// ============================================================================\n// Genesis Hashes\n// ============================================================================\n\n/**\n * Algorand Mainnet genesis hash (base64 encoded)\n */\nexport const ALGORAND_MAINNET_GENESIS_HASH = \"wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=\";\n\n/**\n * Algorand Testnet genesis hash (base64 encoded)\n */\nexport const ALGORAND_TESTNET_GENESIS_HASH = \"SGO1GKSzyE7IEPItTxCByw9x8FmnrCDexi9/cOUJOiI=\";\n\n// ============================================================================\n// USDC ASA (Algorand Standard Asset) Configuration\n// ============================================================================\n\n/**\n * USDC ASA ID on Algorand Mainnet\n *\n * @see https://algoexplorer.io/asset/31566704\n */\nexport const USDC_MAINNET_ASA_ID = \"31566704\";\n\n/**\n * USDC ASA ID on Algorand Testnet\n *\n * @see https://testnet.algoexplorer.io/asset/10458941\n */\nexport const USDC_TESTNET_ASA_ID = \"10458941\";\n\n/**\n * USDC decimals (same across all networks)\n */\nexport const USDC_DECIMALS = 6;\n\n/**\n * USDC configuration per network\n */\nexport const USDC_CONFIG: Record<string, { asaId: string; name: string; decimals: number }> = {\n [ALGORAND_MAINNET_CAIP2]: {\n asaId: USDC_MAINNET_ASA_ID,\n name: \"USDC\",\n decimals: USDC_DECIMALS,\n },\n [ALGORAND_TESTNET_CAIP2]: {\n asaId: USDC_TESTNET_ASA_ID,\n name: \"USDC\",\n decimals: USDC_DECIMALS,\n },\n};\n\n// ============================================================================\n// Transaction Limits\n// ============================================================================\n\n/**\n * Maximum reasonable fee per transaction in microAlgos (5000 µAlgo).\n *\n * Algorand transaction fees are calculated as:\n * fee = max(current_fee_per_byte * transaction_size_in_bytes, min_fee)\n *\n * Under normal (non-congested) conditions, current_fee_per_byte is 0,\n * so fee = min_fee = 1000 µAlgo (0.001 ALGO).\n *\n * During network congestion, fees can rise. This constant is set to 5x\n * the minimum fee (5000 µAlgo) as a reasonable upper bound per transaction.\n *\n * For fee payer transactions that cover an entire group via fee pooling,\n * use `maxReasonableGroupFee(groupSize)` which multiplies this per-txn\n * cap by the number of transactions in the group.\n */\nexport const MAX_REASONABLE_FEE_PER_TXN = 5000;\n\n/**\n * Calculates the maximum reasonable fee for a fee payer transaction\n * that covers an entire atomic group via fee pooling.\n *\n * @param groupSize - Number of transactions in the atomic group\n * @returns Maximum acceptable fee in microAlgos\n */\nexport function maxReasonableGroupFee(groupSize: number): number {\n return MAX_REASONABLE_FEE_PER_TXN * groupSize;\n}\n\n// Address validation: use isValidAddress() from @algorandfoundation/algokit-utils/common\n// Address length: use ALGORAND_ADDRESS_LENGTH from @algorandfoundation/algokit-utils/common\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcA,mBAA8E;;;ACCvE,IAAM,yBAAyB;AAM/B,IAAM,yBAAyB;AA8B/B,IAAM,sBAAsB;AAO5B,IAAM,sBAAsB;AAK5B,IAAM,gBAAgB;AAKtB,IAAM,cAAiF;AAAA,EAC5F,CAAC,sBAAsB,GAAG;AAAA,IACxB,OAAO;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA,CAAC,sBAAsB,GAAG;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AAA,MACF;AAAA,IACF;AAGA,QAAI,cAAc,OAAO,UAAU;AACjC,eAAS,QAAQ;AAAA,QACf,GAAG,SAAS;AAAA,QACZ,UAAU,cAAc,MAAM;AAAA,MAChC;AAAA,IACF;AAEA,WAAO,QAAQ,QAAQ,QAAQ;AAAA,EACjC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASQ,oBAAoB,OAAgC;AAC1D,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO;AAAA,IACT;AAEA,eAAO,+BAAiB,KAAK;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUQ,uBAAuB,QAAgB,SAA+B;AAC5E,UAAM,YAAY,KAAK,gBAAgB,OAAO;AAC9C,UAAM,kBAAc,uCAAqB,oCAAsB,MAAM,GAAG,UAAU,QAAQ;AAE1F,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO,UAAU;AAAA,IACnB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,gBAAgB,SAItB;AACA,UAAM,YAAY,YAAY,OAAO;AACrC,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,2CAA2C,OAAO,EAAE;AAAA,IACtE;AAEA,WAAO;AAAA,EACT;AACF;","names":[]} |
@@ -7,3 +7,3 @@ import { | ||
| // src/exact/server/scheme.ts | ||
| import { convertToTokenAmount, numberToDecimalString } from "@x402/core/utils"; | ||
| import { convertToTokenAmount, numberToDecimalString, parseMoneyString } from "@x402/core/utils"; | ||
| var ExactAvmScheme = class { | ||
@@ -111,8 +111,3 @@ constructor() { | ||
| } | ||
| const cleanMoney = money.replace(/^\$/, "").trim(); | ||
| const amount = parseFloat(cleanMoney); | ||
| if (isNaN(amount)) { | ||
| throw new Error(`Invalid money format: ${money}`); | ||
| } | ||
| return amount; | ||
| return parseMoneyString(money); | ||
| } | ||
@@ -119,0 +114,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"sources":["../../../../src/exact/server/scheme.ts"],"sourcesContent":["/**\n * AVM Server Scheme for Exact Payment Protocol\n *\n * Parses prices and builds payment requirements for Algorand ASA transfers.\n */\n\nimport type {\n AssetAmount,\n Network,\n PaymentRequirements,\n Price,\n SchemeNetworkServer,\n MoneyParser,\n} from \"@x402/core/types\";\nimport { convertToTokenAmount, numberToDecimalString } from \"@x402/core/utils\";\nimport { USDC_CONFIG, USDC_DECIMALS } from \"../../constants\";\n\n/**\n * AVM server implementation for the Exact payment scheme.\n *\n * Handles price parsing and payment requirements enhancement for Algorand networks.\n */\nexport class ExactAvmScheme implements SchemeNetworkServer {\n readonly scheme = \"exact\";\n private moneyParsers: MoneyParser[] = [];\n\n /**\n * Register a custom money parser in the parser chain.\n * Multiple parsers can be registered - they will be tried in registration order.\n * Each parser receives a decimal amount (e.g., 1.50 for $1.50).\n * If a parser returns null, the next parser in the chain will be tried.\n * The default parser is always the final fallback.\n *\n * @param parser - Custom function to convert amount to AssetAmount (or null to skip)\n * @returns The server instance for chaining\n *\n * @example\n * ```typescript\n * avmServer.registerMoneyParser(async (amount, network) => {\n * // Custom conversion logic for non-USDC assets\n * if (amount > 100) {\n * return { amount: (amount * 1e6).toString(), asset: \"12345678\" };\n * }\n * return null; // Use next parser\n * });\n * ```\n */\n registerMoneyParser(parser: MoneyParser): ExactAvmScheme {\n this.moneyParsers.push(parser);\n return this;\n }\n\n /**\n * Parses a price into an asset amount.\n * If price is already an AssetAmount, returns it directly.\n * If price is Money (string | number), parses to decimal and tries custom parsers.\n * Falls back to default conversion if all custom parsers return null.\n *\n * @param price - The price to parse\n * @param network - The network to use\n * @returns Promise that resolves to the parsed asset amount\n */\n async parsePrice(price: Price, network: Network): Promise<AssetAmount> {\n // If already an AssetAmount, return it directly\n if (typeof price === \"object\" && price !== null && \"amount\" in price) {\n if (!price.asset) {\n throw new Error(`Asset ID must be specified for AssetAmount on network ${network}`);\n }\n return {\n amount: price.amount,\n asset: price.asset,\n extra: price.extra || {},\n };\n }\n\n // Parse Money to decimal number\n const amount = this.parseMoneyToDecimal(price);\n\n // Try each custom money parser in order\n for (const parser of this.moneyParsers) {\n const result = await parser(amount, network);\n if (result !== null) {\n return result;\n }\n }\n\n // All custom parsers returned null, use default conversion\n return this.defaultMoneyConversion(amount, network);\n }\n\n /**\n * Build payment requirements for this scheme/network combination\n *\n * @param paymentRequirements - The base payment requirements\n * @param supportedKind - The supported kind from facilitator (contains extra data like feePayer)\n * @param supportedKind.x402Version - The x402 version\n * @param supportedKind.scheme - The logical payment scheme\n * @param supportedKind.network - The network identifier in CAIP-2 format\n * @param supportedKind.extra - Optional extra metadata (e.g., feePayer address)\n * @param extensionKeys - Extension keys supported by the facilitator\n * @returns Payment requirements ready to be sent to clients\n */\n enhancePaymentRequirements(\n paymentRequirements: PaymentRequirements,\n supportedKind: {\n x402Version: number;\n scheme: string;\n network: Network;\n extra?: Record<string, unknown>;\n },\n extensionKeys: string[],\n ): Promise<PaymentRequirements> {\n // Mark unused parameter\n void extensionKeys;\n\n // Get USDC config for the network\n const usdcConfig = USDC_CONFIG[supportedKind.network];\n const decimals = usdcConfig?.decimals ?? USDC_DECIMALS;\n\n // Build enhanced requirements with feePayer and decimals\n const enhanced: PaymentRequirements = {\n ...paymentRequirements,\n extra: {\n ...paymentRequirements.extra,\n decimals,\n },\n };\n\n // Add feePayer from supportedKind.extra if provided\n if (supportedKind.extra?.feePayer) {\n enhanced.extra = {\n ...enhanced.extra,\n feePayer: supportedKind.extra.feePayer,\n };\n }\n\n return Promise.resolve(enhanced);\n }\n\n /**\n * Parse Money (string | number) to a decimal number.\n * Handles formats like \"$1.50\", \"1.50\", 1.50, etc.\n *\n * @param money - The money value to parse\n * @returns Decimal number\n */\n private parseMoneyToDecimal(money: string | number): number {\n if (typeof money === \"number\") {\n return money;\n }\n\n // Remove $ sign and whitespace, then parse\n const cleanMoney = money.replace(/^\\$/, \"\").trim();\n const amount = parseFloat(cleanMoney);\n\n if (isNaN(amount)) {\n throw new Error(`Invalid money format: ${money}`);\n }\n\n return amount;\n }\n\n /**\n * Default money conversion implementation.\n * Converts decimal amount to the default stablecoin (USDC) on the specified network.\n *\n * @param amount - The decimal amount (e.g., 1.50)\n * @param network - The network to use\n * @returns The parsed asset amount in USDC\n */\n private defaultMoneyConversion(amount: number, network: Network): AssetAmount {\n const assetInfo = this.getDefaultAsset(network);\n const tokenAmount = convertToTokenAmount(numberToDecimalString(amount), assetInfo.decimals);\n\n return {\n amount: tokenAmount,\n asset: assetInfo.asaId,\n };\n }\n\n /**\n * Get the default asset info for a network (USDC)\n *\n * @param network - The network to get asset info for\n * @returns The asset information including ASA ID, name, and decimals\n */\n private getDefaultAsset(network: Network): {\n asaId: string;\n name: string;\n decimals: number;\n } {\n const assetInfo = USDC_CONFIG[network];\n if (!assetInfo) {\n throw new Error(`No default asset configured for network ${network}`);\n }\n\n return assetInfo;\n }\n}\n"],"mappings":";;;;;;AAcA,SAAS,sBAAsB,6BAA6B;AAQrD,IAAM,iBAAN,MAAoD;AAAA,EAApD;AACL,SAAS,SAAS;AAClB,SAAQ,eAA8B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBvC,oBAAoB,QAAqC;AACvD,SAAK,aAAa,KAAK,MAAM;AAC7B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,WAAW,OAAc,SAAwC;AAErE,QAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,YAAY,OAAO;AACpE,UAAI,CAAC,MAAM,OAAO;AAChB,cAAM,IAAI,MAAM,yDAAyD,OAAO,EAAE;AAAA,MACpF;AACA,aAAO;AAAA,QACL,QAAQ,MAAM;AAAA,QACd,OAAO,MAAM;AAAA,QACb,OAAO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,UAAU,QAAQ;AAE1F,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO,UAAU;AAAA,IACnB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,gBAAgB,SAItB;AACA,UAAM,YAAY,YAAY,OAAO;AACrC,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,2CAA2C,OAAO,EAAE;AAAA,IACtE;AAEA,WAAO;AAAA,EACT;AACF;","names":[]} | ||
| {"version":3,"sources":["../../../../src/exact/server/scheme.ts"],"sourcesContent":["/**\n * AVM Server Scheme for Exact Payment Protocol\n *\n * Parses prices and builds payment requirements for Algorand ASA transfers.\n */\n\nimport type {\n AssetAmount,\n Network,\n PaymentRequirements,\n Price,\n SchemeNetworkServer,\n MoneyParser,\n} from \"@x402/core/types\";\nimport { convertToTokenAmount, numberToDecimalString, parseMoneyString } from \"@x402/core/utils\";\nimport { USDC_CONFIG, USDC_DECIMALS } from \"../../constants\";\n\n/**\n * AVM server implementation for the Exact payment scheme.\n *\n * Handles price parsing and payment requirements enhancement for Algorand networks.\n */\nexport class ExactAvmScheme implements SchemeNetworkServer {\n readonly scheme = \"exact\";\n private moneyParsers: MoneyParser[] = [];\n\n /**\n * Register a custom money parser in the parser chain.\n * Multiple parsers can be registered - they will be tried in registration order.\n * Each parser receives a decimal amount (e.g., 1.50 for $1.50).\n * If a parser returns null, the next parser in the chain will be tried.\n * The default parser is always the final fallback.\n *\n * @param parser - Custom function to convert amount to AssetAmount (or null to skip)\n * @returns The server instance for chaining\n *\n * @example\n * ```typescript\n * avmServer.registerMoneyParser(async (amount, network) => {\n * // Custom conversion logic for non-USDC assets\n * if (amount > 100) {\n * return { amount: (amount * 1e6).toString(), asset: \"12345678\" };\n * }\n * return null; // Use next parser\n * });\n * ```\n */\n registerMoneyParser(parser: MoneyParser): ExactAvmScheme {\n this.moneyParsers.push(parser);\n return this;\n }\n\n /**\n * Parses a price into an asset amount.\n * If price is already an AssetAmount, returns it directly.\n * If price is Money (string | number), parses to decimal and tries custom parsers.\n * Falls back to default conversion if all custom parsers return null.\n *\n * @param price - The price to parse\n * @param network - The network to use\n * @returns Promise that resolves to the parsed asset amount\n */\n async parsePrice(price: Price, network: Network): Promise<AssetAmount> {\n // If already an AssetAmount, return it directly\n if (typeof price === \"object\" && price !== null && \"amount\" in price) {\n if (!price.asset) {\n throw new Error(`Asset ID must be specified for AssetAmount on network ${network}`);\n }\n return {\n amount: price.amount,\n asset: price.asset,\n extra: price.extra || {},\n };\n }\n\n // Parse Money to decimal number\n const amount = this.parseMoneyToDecimal(price);\n\n // Try each custom money parser in order\n for (const parser of this.moneyParsers) {\n const result = await parser(amount, network);\n if (result !== null) {\n return result;\n }\n }\n\n // All custom parsers returned null, use default conversion\n return this.defaultMoneyConversion(amount, network);\n }\n\n /**\n * Build payment requirements for this scheme/network combination\n *\n * @param paymentRequirements - The base payment requirements\n * @param supportedKind - The supported kind from facilitator (contains extra data like feePayer)\n * @param supportedKind.x402Version - The x402 version\n * @param supportedKind.scheme - The logical payment scheme\n * @param supportedKind.network - The network identifier in CAIP-2 format\n * @param supportedKind.extra - Optional extra metadata (e.g., feePayer address)\n * @param extensionKeys - Extension keys supported by the facilitator\n * @returns Payment requirements ready to be sent to clients\n */\n enhancePaymentRequirements(\n paymentRequirements: PaymentRequirements,\n supportedKind: {\n x402Version: number;\n scheme: string;\n network: Network;\n extra?: Record<string, unknown>;\n },\n extensionKeys: string[],\n ): Promise<PaymentRequirements> {\n // Mark unused parameter\n void extensionKeys;\n\n // Get USDC config for the network\n const usdcConfig = USDC_CONFIG[supportedKind.network];\n const decimals = usdcConfig?.decimals ?? USDC_DECIMALS;\n\n // Build enhanced requirements with feePayer and decimals\n const enhanced: PaymentRequirements = {\n ...paymentRequirements,\n extra: {\n ...paymentRequirements.extra,\n decimals,\n },\n };\n\n // Add feePayer from supportedKind.extra if provided\n if (supportedKind.extra?.feePayer) {\n enhanced.extra = {\n ...enhanced.extra,\n feePayer: supportedKind.extra.feePayer,\n };\n }\n\n return Promise.resolve(enhanced);\n }\n\n /**\n * Parse Money (string | number) to a decimal number.\n * Handles formats like \"$1.50\", \"1.50\", 1.50, etc.\n *\n * @param money - The money value to parse\n * @returns Decimal number\n */\n private parseMoneyToDecimal(money: string | number): number {\n if (typeof money === \"number\") {\n return money;\n }\n\n return parseMoneyString(money);\n }\n\n /**\n * Default money conversion implementation.\n * Converts decimal amount to the default stablecoin (USDC) on the specified network.\n *\n * @param amount - The decimal amount (e.g., 1.50)\n * @param network - The network to use\n * @returns The parsed asset amount in USDC\n */\n private defaultMoneyConversion(amount: number, network: Network): AssetAmount {\n const assetInfo = this.getDefaultAsset(network);\n const tokenAmount = convertToTokenAmount(numberToDecimalString(amount), assetInfo.decimals);\n\n return {\n amount: tokenAmount,\n asset: assetInfo.asaId,\n };\n }\n\n /**\n * Get the default asset info for a network (USDC)\n *\n * @param network - The network to get asset info for\n * @returns The asset information including ASA ID, name, and decimals\n */\n private getDefaultAsset(network: Network): {\n asaId: string;\n name: string;\n decimals: number;\n } {\n const assetInfo = USDC_CONFIG[network];\n if (!assetInfo) {\n throw new Error(`No default asset configured for network ${network}`);\n }\n\n return assetInfo;\n }\n}\n"],"mappings":";;;;;;AAcA,SAAS,sBAAsB,uBAAuB,wBAAwB;AAQvE,IAAM,iBAAN,MAAoD;AAAA,EAApD;AACL,SAAS,SAAS;AAClB,SAAQ,eAA8B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBvC,oBAAoB,QAAqC;AACvD,SAAK,aAAa,KAAK,MAAM;AAC7B,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAM,WAAW,OAAc,SAAwC;AAErE,QAAI,OAAO,UAAU,YAAY,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,qBAAqB,sBAAsB,MAAM,GAAG,UAAU,QAAQ;AAE1F,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO,UAAU;AAAA,IACnB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQQ,gBAAgB,SAItB;AACA,UAAM,YAAY,YAAY,OAAO;AACrC,QAAI,CAAC,WAAW;AACd,YAAM,IAAI,MAAM,2CAA2C,OAAO,EAAE;AAAA,IACtE;AAEA,WAAO;AAAA,EACT;AACF;","names":[]} |
+2
-2
| { | ||
| "name": "@x402/avm", | ||
| "version": "2.14.0", | ||
| "version": "2.15.0", | ||
| "main": "./dist/cjs/index.js", | ||
@@ -37,3 +37,3 @@ "module": "./dist/esm/index.js", | ||
| "@algorandfoundation/algokit-utils": "10.0.0-alpha.46", | ||
| "@x402/core": "~2.14.0" | ||
| "@x402/core": "~2.15.0" | ||
| }, | ||
@@ -40,0 +40,0 @@ "exports": { |
385598
-0.26%3401
-0.29%+ Added
- Removed
Updated