@zkp2p/sdk 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{Zkp2pClient-w5Pzlea6.d.mts → Zkp2pClient-tpqzO2dc.d.mts} +4 -0
  2. package/dist/{Zkp2pClient-w5Pzlea6.d.ts → Zkp2pClient-tpqzO2dc.d.ts} +4 -0
  3. package/dist/{chunk-J34QNX2H.mjs → chunk-GNGQRV2U.mjs} +2 -2
  4. package/dist/{chunk-J34QNX2H.mjs.map → chunk-GNGQRV2U.mjs.map} +1 -1
  5. package/dist/{chunk-LZJL5J5X.mjs → chunk-IXZY7BSF.mjs} +3 -3
  6. package/dist/{chunk-LZJL5J5X.mjs.map → chunk-IXZY7BSF.mjs.map} +1 -1
  7. package/dist/{chunk-NRU6Z6WS.mjs → chunk-PLKVLZVI.mjs} +4 -4
  8. package/dist/{chunk-NRU6Z6WS.mjs.map → chunk-PLKVLZVI.mjs.map} +1 -1
  9. package/dist/{chunk-MWFONYDJ.mjs → chunk-RMWIECY7.mjs} +3 -3
  10. package/dist/{chunk-MWFONYDJ.mjs.map → chunk-RMWIECY7.mjs.map} +1 -1
  11. package/dist/{constants-S277YHME.mjs → constants-UPXDEQFF.mjs} +4 -4
  12. package/dist/{constants-S277YHME.mjs.map → constants-UPXDEQFF.mjs.map} +1 -1
  13. package/dist/{currency-NTRIKAOH.mjs → currency-V2V6PKXO.mjs} +4 -4
  14. package/dist/{currency-NTRIKAOH.mjs.map → currency-V2V6PKXO.mjs.map} +1 -1
  15. package/dist/index.cjs +21 -9
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.mjs +24 -17
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/paymentResolution-AZUVXTLV.mjs +5 -0
  22. package/dist/{paymentResolution-WNXTUSNH.mjs.map → paymentResolution-AZUVXTLV.mjs.map} +1 -1
  23. package/dist/protocolViewerParsers-ZHJDHXTL.mjs +7 -0
  24. package/dist/{protocolViewerParsers-FCIK2ZTT.mjs.map → protocolViewerParsers-ZHJDHXTL.mjs.map} +1 -1
  25. package/dist/react.d.mts +1 -1
  26. package/dist/react.d.ts +1 -1
  27. package/package.json +15 -15
  28. package/dist/paymentResolution-WNXTUSNH.mjs +0 -5
  29. package/dist/protocolViewerParsers-FCIK2ZTT.mjs +0 -7
@@ -360,6 +360,7 @@ interface DepositEntity {
360
360
  escrowAddress: string;
361
361
  depositId: string;
362
362
  depositor: string;
363
+ delegate?: string | null;
363
364
  token: string;
364
365
  remainingDeposits: string;
365
366
  intentAmountMin: string;
@@ -445,6 +446,9 @@ type OrderDirection = 'asc' | 'desc';
445
446
  type DepositFilter = Partial<{
446
447
  status: 'ACTIVE' | 'CLOSED';
447
448
  depositor: string;
449
+ delegate: string;
450
+ /** True to only include deposits with a non-zero delegate, false for zero delegate. */
451
+ delegateIsSet: boolean;
448
452
  chainId: number;
449
453
  escrowAddress: string;
450
454
  escrowAddresses: string[];
@@ -360,6 +360,7 @@ interface DepositEntity {
360
360
  escrowAddress: string;
361
361
  depositId: string;
362
362
  depositor: string;
363
+ delegate?: string | null;
363
364
  token: string;
364
365
  remainingDeposits: string;
365
366
  intentAmountMin: string;
@@ -445,6 +446,9 @@ type OrderDirection = 'asc' | 'desc';
445
446
  type DepositFilter = Partial<{
446
447
  status: 'ACTIVE' | 'CLOSED';
447
448
  depositor: string;
449
+ delegate: string;
450
+ /** True to only include deposits with a non-zero delegate, false for zero delegate. */
451
+ delegateIsSet: boolean;
448
452
  chainId: number;
449
453
  escrowAddress: string;
450
454
  escrowAddresses: string[];
@@ -192,5 +192,5 @@ BigInt(2e9);
192
192
  usdcUnits(0.1);
193
193
 
194
194
  export { currencyKeccak256 };
195
- //# sourceMappingURL=chunk-J34QNX2H.mjs.map
196
- //# sourceMappingURL=chunk-J34QNX2H.mjs.map
195
+ //# sourceMappingURL=chunk-GNGQRV2U.mjs.map
196
+ //# sourceMappingURL=chunk-GNGQRV2U.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/canonicalize@2.1.0/node_modules/canonicalize/lib/canonicalize.js","../../core/src/utils/units.ts","../../core/src/utils/keccak.ts","../../core/src/types/currency.ts","../../core/src/platforms/types.ts","../../core/src/utils/paymentMethodHashes.ts","../../core/src/utils/gas.ts","../../core/src/constants/index.ts"],"names":["exports","values","viemKeccak256"],"mappings":";;;;;AAAA,IAAA,oBAAA,GAAA,UAAA,CAAA;AAAA,EAAA,2FAAA,CAAAA,SAAA,EAAA,MAAA,EAAA;AAIA,IAAA,MAAA,CAAO,OAAA,GAAU,SAAS,SAAA,CAAW,MAAA,EAAQ;AAC3C,MAAA,IAAI,OAAO,MAAA,KAAW,QAAA,IAAY,KAAA,CAAM,MAAM,CAAA,EAAG;AAC/C,QAAA,MAAM,IAAI,MAAM,oBAAoB,CAAA;AAAA,MACtC;AAEA,MAAA,IAAI,OAAO,MAAA,KAAW,QAAA,IAAY,CAAC,QAAA,CAAS,MAAM,CAAA,EAAG;AACnD,QAAA,MAAM,IAAI,MAAM,yBAAyB,CAAA;AAAA,MAC3C;AAEA,MAAA,IAAI,MAAA,KAAW,IAAA,IAAQ,OAAO,MAAA,KAAW,QAAA,EAAU;AACjD,QAAA,OAAO,IAAA,CAAK,UAAU,MAAM,CAAA;AAAA,MAC9B;AAEA,MAAA,IAAI,MAAA,CAAO,kBAAkB,QAAA,EAAU;AACrC,QAAA,OAAO,SAAA,CAAU,MAAA,CAAO,MAAA,EAAQ,CAAA;AAAA,MAClC;AAEA,MAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,EAAG;AACzB,QAAA,MAAMC,UAAS,MAAA,CAAO,MAAA,CAAO,CAAC,CAAA,EAAG,IAAI,EAAA,KAAO;AAC1C,UAAA,MAAM,KAAA,GAAQ,EAAA,KAAO,CAAA,GAAI,EAAA,GAAK,GAAA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K,CAE5B;AAEjB;AC/UO,IAAM,eAAA,GAAkB;EAC7B,KAAA,EAAO,OAAA;EACP,OAAA,EAAS,SAAA;EACT,KAAA,EAAO,OAAA;EACP,OAAA,EAAS,SAAA;EACT,IAAA,EAAM,MAAA;EACN,YAAA,EAAc,aAAA;EACd,KAAA,EAAO,OAAA;EACP,MAAA,EAAQ,QAAA;EACR,KAAA,EAAO,OAAA;EACP,GAAA,EAAK,KAAA;EACL,MAAA,EAAQ;AACV,CAAA;AAEgC,CAAC,GAAG,MAAA,CAAO,MAAA,CAAO,eAAe,CAAC,CAAA;ACf3D,IAAM,mBAAA,GAAsB;EACjC,KAAA,EAAO,oEAAA;EACP,OAAA,EAAS,oEAAA;EACT,OAAA,EAAS,oEAAA;EACT,KAAA,EAAO,oEAAA;EACP,IAAA,EAAM,oEAAA;EACN,WAAA,EAAa,oEAAA;EACb,YAAA,EAAc,oEAAA;EACd,aAAA,EAAe,oEAAA;EACf,YAAA,EAAc,oEAAA;EACd,MAAA,EAAQ,oEAAA;EACR,KAAA,EAAO,oEAAA;EACP,GAAA,EAAK,oEAAA;EACL,MAAA,EAAQ;AACV,CAAA;AAI+D,MAAA,CAAO,OAAA,CAAQ,mBAAmB,CAAA,CAAE,MAAA;AACjG,EAAA,CAAC,GAAA,EAAK,CAAC,IAAA,EAAM,IAAI,CAAA,KAAM;AACrB,IAAA,GAAA,CAAI,IAAA,CAAK,WAAA,EAAa,CAAA,GAAI,IAAA;AAC1B,IAAA,OAAO,GAAA;AACT,EAAA,CAAA;EACA;AACF;ACToC,OAAO,GAAU;AAKrB,OAAO,GAAU;AACtB,OAAO,GAAU;ACuJN,SAAA,CAAU,GAAG,CAAA","file":"chunk-J34QNX2H.mjs","sourcesContent":["/* jshint esversion: 6 */\n/* jslint node: true */\n'use strict';\n\nmodule.exports = function serialize (object) {\n if (typeof object === 'number' && isNaN(object)) {\n throw new Error('NaN is not allowed');\n }\n\n if (typeof object === 'number' && !isFinite(object)) {\n throw new Error('Infinity is not allowed');\n }\n\n if (object === null || typeof object !== 'object') {\n return JSON.stringify(object);\n }\n\n if (object.toJSON instanceof Function) {\n return serialize(object.toJSON());\n }\n\n if (Array.isArray(object)) {\n const values = object.reduce((t, cv, ci) => {\n const comma = ci === 0 ? '' : ',';\n const value = cv === undefined || typeof cv === 'symbol' ? null : cv;\n return `${t}${comma}${serialize(value)}`;\n }, '');\n return `[${values}]`;\n }\n\n const values = Object.keys(object).sort().reduce((t, cv) => {\n if (object[cv] === undefined ||\n typeof object[cv] === 'symbol') {\n return t;\n }\n const comma = t.length === 0 ? '' : ',';\n return `${t}${comma}${serialize(cv)}:${serialize(object[cv])}`;\n }, '');\n return `{${values}}`;\n};\n","import { parseEther, parseUnits, formatEther, formatUnits } from \"viem\";\n\n\nexport const etherUnits = (amount: number | string | bigint): bigint => {\n return parseEther(amount.toString());\n};\n\nexport const usdcUnits = (amount: number | string | bigint): bigint => {\n return parseUnits(amount.toString(), 6);\n};\n\nexport const tokenUnits = (amount: number | string | bigint, decimals: number): bigint => {\n return parseUnits(amount.toString(), decimals);\n};\n\nexport const etherUnitsToReadable = (amount: bigint | string, decimalsToDisplay: number = 2): string => {\n return Number(Number(formatEther(BigInt(amount))).toFixed(decimalsToDisplay)).toString();\n};\n\nexport const tokenUnitsToReadable = (amount: bigint | string, decimals: number, decimalsToDisplay: number = 2): string => {\n const formatted = Number(formatUnits(BigInt(amount), decimals));\n const multiplier = Math.pow(10, decimalsToDisplay);\n return (Math.floor(formatted * multiplier) / multiplier).toFixed(decimalsToDisplay);\n};\n\nexport const tokenUnitsToReadableWithMaxDecimals = (amount: bigint | string, decimals: number, maxDecimalsToDisplay: number = 2): string => {\n const formatted = Number(formatUnits(BigInt(amount), decimals));\n\n if (formatted === 0) return '0';\n\n // For small numbers (less than 0.001), show at least 3 non-zero places\n if (formatted < 0.001) {\n // Handle scientific notation (e.g., 7.7327284e-11)\n const formattedStr = formatted.toString();\n\n // Check if the number is in scientific notation\n if (formattedStr.includes('e-')) {\n const parts = formattedStr.split('e-');\n const base = parseFloat(parts[0]);\n const exponent = parseInt(parts[1], 10);\n\n // Convert from scientific notation to decimal format\n let decimalStr = '0.';\n // Add leading zeros based on the exponent\n for (let i = 1; i < exponent; i++) {\n decimalStr += '0';\n }\n\n // Add the significant digits (only 3 non-zero places)\n const baseDigits = base.toString().replace('.', '');\n let nonZeroCount = 0;\n let result = '';\n\n for (let i = 0; i < baseDigits.length; i++) {\n result += baseDigits[i];\n if (baseDigits[i] !== '0') {\n nonZeroCount++;\n if (nonZeroCount === 3) break;\n }\n }\n\n return decimalStr + result;\n } else {\n // For regular small decimals, find leading zeros and show 3 significant digits\n const decimalStr = formattedStr.split('.')[1] || '';\n let leadingZeros = 0;\n for (let i = 0; i < decimalStr.length; i++) {\n if (decimalStr[i] !== '0') break;\n leadingZeros++;\n }\n\n // Show at least 3 significant digits\n return formatted.toFixed(leadingZeros + 3);\n }\n }\n\n // For larger numbers, use the specified maxDecimalsToDisplay\n const fixedValue = formatted.toFixed(maxDecimalsToDisplay);\n // Remove trailing zeros and decimal point if needed\n return fixedValue.replace(/\\.?0+$/, '');\n};\n\n\nexport const relayTokenAmountToReadable = (amountFormatted: string | undefined) => {\n if (!amountFormatted) return '0';\n\n const num = Number(amountFormatted);\n if (num === 0) return '0';\n\n // For small numbers (less than 0.001), show at least 3 non-zero places\n if (num < 0.001) {\n // Find the first non-zero digit after decimal\n const decimalStr = num.toString().split('.')[1] || '';\n let leadingZeros = 0;\n for (let i = 0; i < decimalStr.length; i++) {\n if (decimalStr[i] !== '0') break;\n leadingZeros++;\n }\n // Show at least 3 significant digits\n return num.toFixed(leadingZeros + 3);\n }\n\n // For larger numbers, show 3 decimal places\n return num.toFixed(3);\n};","import { keccak256 as viemKeccak256, encodePacked, sha256 as viemSha256 } from \"viem\";\n\nexport const keccak256 = (inputString: string): string => {\n return viemKeccak256(encodePacked([\"string\"], [inputString]));\n};\n\nexport const currencyKeccak256 = (inputString: string): string => {\n const bytes = new TextEncoder().encode(inputString);\n return viemKeccak256(bytes);\n};\n\nexport const sha256 = (inputString: string): string => {\n return viemSha256(encodePacked([\"string\"], [inputString]));\n};\n\n/**\n * Hashes the payee details the same way the ZKP2P Escrow contract does.\n * The contract does: keccak256(abi.encodePacked(payeeDetails))\n *\n * @param payeeDetails The payee details string to hash (e.g., \"0xab797bc4...\")\n * @returns The hashed value that will appear in contract events\n *\n * @example\n * Input: \"0xab797bc4330de21c4fa9d3d96bc4fcb6a8f20a0c18fd5ae3475e097f393f41b8\"\n * Output: \"0x06b222a351506718f57874ed8fc5ea5cb8ecc77293b249529c682d8dd9ac1925\"\n */\nexport const hashPayeeDetails = (payeeDetails: string): string => {\n return keccak256(payeeDetails);\n};\n","import { currencyKeccak256 } from '../utils/keccak';\n\n\nexport const Currency = {\n AED: \"AED\",\n ARS: \"ARS\",\n AUD: \"AUD\",\n CAD: \"CAD\",\n CHF: \"CHF\",\n CNY: \"CNY\",\n CZK: \"CZK\",\n DKK: \"DKK\",\n EUR: \"EUR\",\n GBP: \"GBP\",\n HKD: \"HKD\",\n HUF: \"HUF\",\n IDR: \"IDR\",\n ILS: \"ILS\",\n INR: \"INR\",\n JPY: \"JPY\",\n KES: \"KES\",\n NOK: \"NOK\",\n MXN: \"MXN\",\n MYR: \"MYR\",\n NZD: \"NZD\",\n PHP: \"PHP\",\n PLN: \"PLN\",\n RON: \"RON\",\n SAR: \"SAR\",\n SEK: \"SEK\",\n SGD: \"SGD\",\n THB: \"THB\",\n TRY: \"TRY\",\n UGX: \"UGX\",\n USD: \"USD\",\n VND: \"VND\",\n ZAR: \"ZAR\",\n};\n\nexport type CurrencyType = typeof Currency[keyof typeof Currency];\n\nfunction getCurrencies(): string[] {\n return Object.values(Currency);\n}\n\nexport function getCurrencyInfoFromHash(currencyCodeHash: string): CurrencyData | null {\n return Object.values(currencyInfo).find(\n (currency) => currency.currencyCodeHash === currencyCodeHash\n ) ?? null;\n}\n\nexport function getCurrencyInfoFromCountryCode(countryCode: string): CurrencyData | null {\n return Object.values(currencyInfo).find(\n (currency) => currency.countryCode === countryCode\n ) ?? null;\n}\n\nexport function isSupportedCurrency(currencyCode: string): boolean {\n return Object.values(currencyInfo).some(\n (currency) => currency.currencyCode === currencyCode\n );\n}\n\nexport const currencies = getCurrencies();\n\ninterface CurrencyData {\n currency: CurrencyType;\n currencyCode: string;\n currencyName: string;\n currencySymbol: string;\n currencyCodeHash: string;\n countryCode: string;\n}\n\nexport const currencyInfo: Record<CurrencyType, CurrencyData> = {\n [Currency.AED]: {\n currency: Currency.AED,\n currencyCode: \"AED\",\n currencyName: \"United Arab Emirates Dirham\",\n currencyCodeHash: currencyKeccak256(\"AED\"),\n currencySymbol: \"د.إ\",\n countryCode: \"ae\",\n },\n [Currency.ARS]: {\n currency: Currency.ARS,\n currencyCode: \"ARS\",\n currencyName: \"Argentine Peso\",\n currencyCodeHash: currencyKeccak256(\"ARS\"),\n currencySymbol: \"$\",\n countryCode: \"ar\"\n },\n [Currency.AUD]: {\n currency: Currency.AUD,\n currencyCode: \"AUD\",\n currencyName: \"Australian Dollar\",\n currencyCodeHash: currencyKeccak256(\"AUD\"),\n currencySymbol: \"A$\",\n countryCode: \"au\",\n },\n [Currency.CAD]: {\n currency: Currency.CAD,\n currencyCode: \"CAD\",\n currencyName: \"Canadian Dollar\",\n currencyCodeHash: currencyKeccak256(\"CAD\"),\n currencySymbol: \"C$\",\n countryCode: \"ca\",\n },\n [Currency.CHF]: {\n currency: Currency.CHF,\n currencyCode: \"CHF\",\n currencyName: \"Swiss Franc\",\n currencyCodeHash: currencyKeccak256(\"CHF\"),\n currencySymbol: \"Fr\",\n countryCode: \"ch\",\n },\n [Currency.CNY]: {\n currency: Currency.CNY,\n currencyCode: \"CNY\",\n currencyName: \"Chinese Yuan\",\n currencyCodeHash: currencyKeccak256(\"CNY\"),\n currencySymbol: \"¥\",\n countryCode: \"cn\",\n },\n [Currency.CZK]: {\n currency: Currency.CZK,\n currencyCode: \"CZK\",\n currencyName: \"Czech Koruna\",\n currencyCodeHash: currencyKeccak256(\"CZK\"),\n currencySymbol: \"Kč\",\n countryCode: \"cz\",\n },\n [Currency.DKK]: {\n currency: Currency.DKK,\n currencyCode: \"DKK\",\n currencyName: \"Danish Krone\",\n currencyCodeHash: currencyKeccak256(\"DKK\"),\n currencySymbol: \"kr\",\n countryCode: \"dk\",\n },\n [Currency.EUR]: {\n currency: Currency.EUR,\n currencyCode: \"EUR\",\n currencyName: \"Euro\",\n currencyCodeHash: currencyKeccak256(\"EUR\"),\n currencySymbol: \"€\",\n countryCode: \"eu\",\n },\n [Currency.GBP]: {\n currency: Currency.GBP,\n currencyCode: \"GBP\",\n currencyName: \"British Pound\",\n currencyCodeHash: currencyKeccak256(\"GBP\"),\n currencySymbol: \"£\",\n countryCode: \"gb\",\n },\n [Currency.HKD]: {\n currency: Currency.HKD,\n currencyCode: \"HKD\",\n currencyName: \"Hong Kong Dollar\",\n currencyCodeHash: currencyKeccak256(\"HKD\"),\n currencySymbol: \"HK$\",\n countryCode: \"hk\",\n },\n [Currency.HUF]: {\n currency: Currency.HUF,\n currencyCode: \"HUF\",\n currencyName: \"Hungarian Forint\",\n currencyCodeHash: currencyKeccak256(\"HUF\"),\n currencySymbol: \"Ft\",\n countryCode: \"hu\",\n },\n [Currency.IDR]: {\n currency: Currency.IDR,\n currencyCode: \"IDR\",\n currencyName: \"Indonesian Rupiah\",\n currencyCodeHash: currencyKeccak256(\"IDR\"),\n currencySymbol: \"Rp\",\n countryCode: \"id\",\n },\n [Currency.INR]: {\n currency: Currency.INR,\n currencyCode: \"INR\",\n currencyName: \"Indian Rupee\",\n currencyCodeHash: currencyKeccak256(\"INR\"),\n currencySymbol: \"₹\",\n countryCode: \"in\",\n },\n [Currency.ILS]: {\n currency: Currency.ILS,\n currencyCode: \"ILS\",\n currencyName: \"Israeli New Shekel\",\n currencyCodeHash: currencyKeccak256(\"ILS\"),\n currencySymbol: \"₪\",\n countryCode: \"il\",\n },\n [Currency.JPY]: {\n currency: Currency.JPY,\n currencyCode: \"JPY\",\n currencyName: \"Japanese Yen\",\n currencyCodeHash: currencyKeccak256(\"JPY\"),\n currencySymbol: \"¥\",\n countryCode: \"jp\",\n },\n [Currency.KES]: {\n currency: Currency.KES,\n currencyCode: \"KES\",\n currencyName: \"Kenyan Shilling\",\n currencyCodeHash: currencyKeccak256(\"KES\"),\n currencySymbol: \"KSh\",\n countryCode: \"ke\",\n },\n [Currency.MXN]: {\n currency: Currency.MXN,\n currencyCode: \"MXN\",\n currencyName: \"Mexican Peso\",\n currencyCodeHash: currencyKeccak256(\"MXN\"),\n currencySymbol: \"$\",\n countryCode: \"mx\",\n },\n [Currency.MYR]: {\n currency: Currency.MYR,\n currencyCode: \"MYR\",\n currencyName: \"Malaysian Ringgit\",\n currencyCodeHash: currencyKeccak256(\"MYR\"),\n currencySymbol: \"RM\",\n countryCode: \"my\",\n },\n [Currency.NOK]: {\n currency: Currency.NOK,\n currencyCode: \"NOK\",\n currencyName: \"Norwegian Krone\",\n currencyCodeHash: currencyKeccak256(\"NOK\"),\n currencySymbol: \"kr\",\n countryCode: \"no\",\n },\n [Currency.NZD]: {\n currency: Currency.NZD,\n currencyCode: \"NZD\",\n currencyName: \"New Zealand Dollar\",\n currencyCodeHash: currencyKeccak256(\"NZD\"),\n currencySymbol: \"NZ$\",\n countryCode: \"nz\",\n },\n [Currency.PHP]: {\n currency: Currency.PHP,\n currencyCode: \"PHP\",\n currencyName: \"Philippine Peso\",\n currencyCodeHash: currencyKeccak256(\"PHP\"),\n currencySymbol: \"₱\",\n countryCode: \"ph\",\n },\n [Currency.PLN]: {\n currency: Currency.PLN,\n currencyCode: \"PLN\",\n currencyName: \"Polish Złoty\",\n currencyCodeHash: currencyKeccak256(\"PLN\"),\n currencySymbol: \"zł\",\n countryCode: \"pl\",\n },\n [Currency.RON]: {\n currency: Currency.RON,\n currencyCode: \"RON\",\n currencyName: \"Romanian Leu\",\n currencyCodeHash: currencyKeccak256(\"RON\"),\n currencySymbol: \"lei\",\n countryCode: \"ro\",\n },\n [Currency.SAR]: {\n currency: Currency.SAR,\n currencyCode: \"SAR\",\n currencyName: \"Saudi Riyal\",\n currencyCodeHash: currencyKeccak256(\"SAR\"),\n currencySymbol: \"﷼\",\n countryCode: \"sa\",\n },\n [Currency.SEK]: {\n currency: Currency.SEK,\n currencyCode: \"SEK\",\n currencyName: \"Swedish Krona\",\n currencyCodeHash: currencyKeccak256(\"SEK\"),\n currencySymbol: \"kr\",\n countryCode: \"se\",\n },\n [Currency.SGD]: {\n currency: Currency.SGD,\n currencyCode: \"SGD\",\n currencyName: \"Singapore Dollar\",\n currencyCodeHash: currencyKeccak256(\"SGD\"),\n currencySymbol: \"S$\",\n countryCode: \"sg\",\n },\n [Currency.THB]: {\n currency: Currency.THB,\n currencyCode: \"THB\",\n currencyName: \"Thai Baht\",\n currencyCodeHash: currencyKeccak256(\"THB\"),\n currencySymbol: \"฿\",\n countryCode: \"th\",\n },\n [Currency.TRY]: {\n currency: Currency.TRY,\n currencyCode: \"TRY\",\n currencyName: \"Turkish Lira\",\n currencyCodeHash: currencyKeccak256(\"TRY\"),\n currencySymbol: \"₺\",\n countryCode: \"tr\",\n },\n [Currency.UGX]: {\n currency: Currency.UGX,\n currencyCode: \"UGX\",\n currencyName: \"Ugandan Shilling\",\n currencyCodeHash: currencyKeccak256(\"UGX\"),\n currencySymbol: \"USh\",\n countryCode: \"ug\",\n },\n [Currency.USD]: {\n currency: Currency.USD,\n currencyCode: \"USD\",\n currencyName: \"United States Dollar\",\n currencyCodeHash: currencyKeccak256(\"USD\"),\n currencySymbol: \"$\",\n countryCode: \"us\",\n },\n [Currency.VND]: {\n currency: Currency.VND,\n currencyCode: \"VND\",\n currencyName: \"Vietnamese Dong\",\n currencyCodeHash: currencyKeccak256(\"VND\"),\n currencySymbol: \"₫\",\n countryCode: \"vn\",\n },\n [Currency.ZAR]: {\n currency: Currency.ZAR,\n currencyCode: \"ZAR\",\n currencyName: \"South African Rand\",\n currencyCodeHash: currencyKeccak256(\"ZAR\"),\n currencySymbol: \"R\",\n countryCode: \"za\",\n },\n};\n\n// Utility helpers to safely resolve currency values at runtime\nexport function resolveCurrency(currencyCode?: string | null): CurrencyType {\n const code = (currencyCode || '').toUpperCase();\n return isSupportedCurrency(code) ? (code as CurrencyType) : Currency.USD;\n}\n\n// Note: intentionally not exporting a \"safeCurrencyInfo\" wrapper to\n// keep the public surface area minimal; use resolveCurrency + currencyInfo instead.\n","import { CurrencyType } from '../types/currency';\nimport { ExtensionRequestMetadata } from '../types/browserExtension';\n\n// Platforms that can be used to send payments\nexport const PaymentPlatform = {\n VENMO: \"venmo\",\n CASHAPP: \"cashapp\",\n CHIME: \"chime\",\n REVOLUT: \"revolut\",\n WISE: \"wise\",\n MERCADO_PAGO: \"mercadopago\",\n ZELLE: \"zelle\",\n PAYPAL: \"paypal\",\n MONZO: \"monzo\",\n N26: \"n26\",\n ALIPAY: \"alipay\",\n};\n\nexport const paymentPlatforms = [...Object.values(PaymentPlatform)];\nexport type PaymentPlatformType = typeof PaymentPlatform[keyof typeof PaymentPlatform];\n\n\n// Payment platform enums and interfaces\nexport enum PaymentPlatformDefaultPaymentMode {\n QR_CODE = \"QR_CODE\",\n WEB_PAYMENT = \"WEB_PAYMENT\",\n}\n\nexport interface ParsedPaymentDetails {\n amount: string;\n parsedAmount: boolean; // whether the amount was successfully parsed\n date: string;\n parsedDate: boolean; // whether the date was successfully parsed\n recipientId: string;\n parsedRecipientId: boolean; // whether the recipientId was successfully parsed\n currency: string;\n parsedCurrency: boolean; // whether the currency was successfully parsed\n}\n\nexport interface ProofExtractedParameters {\n amount: string;\n recipient: string;\n currency: string;\n paymentPlatform: string;\n date: string;\n paymentId: string;\n intentHash: string;\n providerHash: string;\n}\n\n\nexport interface SendPaymentConfig {\n paymentMethodName?: string;\n paymentMethodIcon?: string;\n defaultPaymentMode: PaymentPlatformDefaultPaymentMode;\n useCustomQRCode?: boolean;\n payeeDetailPrefix?: string;\n troubleScanningQRCodeLink: (\n recipientId: string,\n sendCurrency?: CurrencyType,\n amountFiatToSend?: string\n ) => string;\n getFormattedSendLink: (\n recipientId: string,\n sendCurrency?: CurrencyType,\n amountFiatToSend?: string\n ) => string;\n supportsSendingPaymentOnWeb: boolean;\n showTroubleScanningQRCodeLink: boolean;\n sendPaymentWarning?: (sendCurrency: CurrencyType, amountFiatToSend: string) => string;\n sendPaymentInfo?: (sendCurrency: CurrencyType, amountFiatToSend: string) => string;\n // Optional structured guidance for clearer bullets and emphasis\n sendPaymentDos?: (sendCurrency: CurrencyType, amountFiatToSend: string) => Array<{ text: string; emphasize?: string[] }>;\n sendPaymentDonts?: (sendCurrency: CurrencyType, amountFiatToSend: string) => Array<{ text: string; emphasize?: string[] }>;\n}\n\nexport interface PaymentVerificationConfig {\n authLink: string;\n actionType: string;\n actionPlatform: string;\n numPaymentsFetched: number;\n minExtensionVersion: string;\n supportsAppclip: boolean;\n parseExtractedParameters: (parameters: string) => ProofExtractedParameters;\n parseMetadata: (metadata: ExtensionRequestMetadata) => ParsedPaymentDetails;\n reverseTransactionHistoryOrder?: boolean;\n getSubjectText: (metadata: ExtensionRequestMetadata) => string;\n totalProofs: number;\n}\n\n\nexport interface PlatformDepositConfig {\n depositRequiresApproval: boolean;\n payeeDetailInputPlaceholder: string;\n payeeDetailInputHelperText: string;\n payeeDetailValidationFailureMessage: string;\n getDepositData: (payeeDetails: string, telegramUsername?: string) => { [key: string]: string };\n getPayeeDetail: (data: { [key: string]: string }) => string;\n}\n\nexport interface PaymentPlatformConfig {\n platformId: PaymentPlatformType;\n platformLogo?: string;\n platformName: string;\n platformCurrencies: CurrencyType[];\n minFiatAmount: string\n localeTimeString: string;\n platformIcon?: string;\n platformColor?: string; // Platform's brand color for fallback logo background\n // Optional client-side caps for better pre-validation UX\n maxUsdcPerIntent?: string; // e.g., '5000' means 5000 USDC cap\n\n // One deposit config per platform\n depositConfig: PlatformDepositConfig;\n\n hasMultiplePaymentMethods: boolean;\n // Multiple payment methods per platform\n paymentMethods: Array<{\n sendConfig: SendPaymentConfig,\n verifyConfig: PaymentVerificationConfig\n }>\n}\n","import { PaymentPlatform, PaymentPlatformType } from '../platforms';\n\n// Optional convenience mapping from method name -> hash (for reference)\nexport const METHOD_NAME_TO_HASH = {\n venmo: '0x90262a3db0edd0be2369c6b28f9e8511ec0bac7136cefbada0880602f87e7268',\n revolut: '0x617f88ab82b5c1b014c539f7e75121427f0bb50a4c58b187a238531e7d58605d',\n cashapp: '0x10940ee67cfb3c6c064569ec92c0ee934cd7afa18dd2ca2d6a2254fcb009c17d',\n chime: '0x5908bb0c9b87763ac6171d4104847667e7f02b4c47b574fe890c1f439ed128bb',\n wise: '0x554a007c2217df766b977723b276671aee5ebb4adaea0edb6433c88b3e61dac5',\n mercadopago: '0xa5418819c024239299ea32e09defae8ec412c03e58f5c75f1b2fe84c857f5483',\n 'zelle-citi': '0x817260692b75e93c7fbc51c71637d4075a975e221e1ebc1abeddfabd731fd90d',\n 'zelle-chase': '0x6aa1d1401e79ad0549dced8b1b96fb72c41cd02b32a7d9ea1fed54ba9e17152e',\n 'zelle-bofa': '0x4bc42b322a3ad413b91b2fde30549ca70d6ee900eded1681de91aaf32ffd7ab5',\n paypal: '0x3ccc3d4d5e769b1f82dc4988485551dc0cd3c7a3926d7d8a4dde91507199490f',\n monzo: '0x62c7ed738ad3e7618111348af32691b5767777fbaf46a2d8943237625552645c',\n n26: '0xd9ff4fd6b39a3e3dd43c41d05662a5547de4a878bc97a65bcb352ade493cdc6b',\n alipay: '0xcac9daea62d7b89d75ac73af4ee14dcf25721012ae82b568c2ea5c808eaa04ff',\n} as const;\n\ntype MethodName = keyof typeof METHOD_NAME_TO_HASH;\n\nexport const HASH_TO_METHOD_NAME: Record<string, MethodName> = Object.entries(METHOD_NAME_TO_HASH).reduce(\n (acc, [name, hash]) => {\n acc[hash.toLowerCase()] = name as MethodName;\n return acc;\n },\n {} as Record<string, MethodName>\n);\n\n// Legacy V2 method hash for Zelle (ASCII 'zelle' padded to 32 bytes)\n// Some historical deposits may use this selector. Map it to Zelle.\nconst LEGACY_ZELLE_V2_HASH = '0x7a656c6c650000000000000000000000000000000000000000000000000000'.toLowerCase();\n\nfunction methodNameToPlatform(method: MethodName): PaymentPlatformType | undefined {\n switch (method) {\n case 'venmo':\n return PaymentPlatform.VENMO;\n case 'revolut':\n return PaymentPlatform.REVOLUT;\n case 'cashapp':\n return PaymentPlatform.CASHAPP;\n case 'chime':\n return PaymentPlatform.CHIME;\n case 'wise':\n return PaymentPlatform.WISE;\n case 'mercadopago':\n return PaymentPlatform.MERCADO_PAGO;\n case 'paypal':\n return PaymentPlatform.PAYPAL;\n case 'monzo':\n return PaymentPlatform.MONZO;\n case 'n26':\n return PaymentPlatform.N26;\n case 'alipay':\n return PaymentPlatform.ALIPAY;\n case 'zelle-citi':\n case 'zelle-chase':\n case 'zelle-bofa':\n return PaymentPlatform.ZELLE;\n default:\n return undefined;\n }\n}\n\n/**\n * Resolve a platform id from a payment method hash.\n * Returns undefined when the hash is unknown.\n */\nexport function resolvePlatformFromMethodHash(hash?: string | null): PaymentPlatformType | undefined {\n if (!hash) return undefined;\n const normalized = hash.toLowerCase();\n\n // Handle legacy V2 Zelle deposits that use the ASCII 'zelle' 32-byte selector\n if (normalized === LEGACY_ZELLE_V2_HASH) {\n return PaymentPlatform.ZELLE;\n }\n\n const method = HASH_TO_METHOD_NAME[normalized];\n if (!method) return undefined;\n return methodNameToPlatform(method);\n}\n\n\nconst METHOD_VARIANT_LABEL_MAP: Record<string, string> = {\n 'zelle-chase': 'Chase',\n 'zelle-bofa': 'Bank of America',\n 'zelle-citi': 'Citi',\n};\n\nexport function getMethodVariantLabel(methodName?: string | null): string | null {\n if (!methodName) return null;\n const normalized = methodName.toLowerCase();\n const mapped = METHOD_VARIANT_LABEL_MAP[normalized];\n if (mapped) return mapped;\n if (normalized.includes('-')) {\n return normalized\n .split('-')\n .map(segment => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join(' ');\n }\n return null;\n}\n\nexport function getMethodVariantLabelFromHash(hash?: string | null): string | null {\n if (!hash) return null;\n const method = HASH_TO_METHOD_NAME[hash.toLowerCase()];\n if (!method) return null;\n return getMethodVariantLabel(method);\n}\n","import type { PublicClient } from 'viem';\n\nexport interface GasPricing {\n priority: bigint;\n max: bigint;\n baseFee: bigint;\n isCongested: boolean;\n}\n\nexport interface GasEstimationParams {\n estimated: bigint;\n baseFee: bigint;\n isCongested: boolean;\n}\n\n/**\n * Congestion threshold - base fee above this level triggers higher gas fees\n */\nexport const CONGESTION_THRESHOLD = BigInt(5000000000); // 5 gwei\n\n/**\n * Minimum gas fees required for account abstraction bundlers\n */\nexport const MIN_PRIORITY_FEE = BigInt(1000000000); // 1 gwei\nexport const MIN_MAX_FEE = BigInt(2000000000); // 2 gwei\n\n/**\n * Get dynamic gas pricing based on current network conditions\n * Applies congestion multiplier when base fee > 5 gwei\n */\nexport async function getDynamicGasPricing(publicClient: PublicClient | null): Promise<GasPricing> {\n try {\n if (!publicClient) {\n console.warn('[Gas] Public client not available, using fallback gas prices');\n return {\n priority: BigInt(2000000000), // 2 gwei fallback\n max: BigInt(4000000000), // 4 gwei fallback\n baseFee: BigInt(1000000000), // 1 gwei fallback\n isCongested: false\n };\n }\n\n // Get current base fee from latest block\n const block = await publicClient.getBlock({ blockTag: 'latest' });\n const baseFee = block.baseFeePerGas || BigInt(1000000000); // 1 gwei fallback\n \n // Check if network is congested\n const isCongested = baseFee > CONGESTION_THRESHOLD;\n \n // Apply congestion multiplier when network is congested\n const congestionMultiplier = isCongested ? 2n : 1n;\n \n // Calculate priority and max fees with congestion adjustment\n const priorityFee = (baseFee * congestionMultiplier) / 10n; // 10% of adjusted base fee\n const maxFee = (baseFee * congestionMultiplier * 12n) / 10n; // 120% of adjusted base fee\n \n // Ensure minimum values for account abstraction bundlers\n const finalPriorityFee = priorityFee > MIN_PRIORITY_FEE ? priorityFee : MIN_PRIORITY_FEE;\n const finalMaxFee = maxFee > MIN_MAX_FEE ? maxFee : MIN_MAX_FEE;\n\n return {\n priority: finalPriorityFee,\n max: finalMaxFee,\n baseFee,\n isCongested\n };\n } catch (error) {\n console.error('[Gas] Failed to fetch dynamic gas price:', error);\n // Return conservative fallback values\n return {\n priority: BigInt(2000000000), // 2 gwei\n max: BigInt(4000000000), // 4 gwei\n baseFee: BigInt(1000000000), // 1 gwei\n isCongested: false\n };\n }\n}\n\n/**\n * Calculate gas estimation with adaptive buffer based on network conditions\n * Uses 30% buffer during congestion, 20% during normal conditions\n */\nexport function calculateGasWithBuffer(params: GasEstimationParams): bigint {\n const { estimated, isCongested } = params;\n \n // Apply 30% buffer during congestion, 20% during normal conditions\n const bufferMultiplier = isCongested ? 130n : 120n;\n const gasWithBuffer = (estimated * bufferMultiplier) / 100n;\n \n return gasWithBuffer;\n}\n\n/**\n * Get network conditions for gas optimization decisions\n */\nexport async function getNetworkConditions(publicClient: PublicClient | null): Promise<{\n baseFee: bigint;\n isCongested: boolean;\n recommendedBuffer: number;\n}> {\n try {\n if (!publicClient) {\n return {\n baseFee: BigInt(1000000000),\n isCongested: false,\n recommendedBuffer: 20\n };\n }\n\n const block = await publicClient.getBlock({ blockTag: 'latest' });\n const baseFee = block.baseFeePerGas || BigInt(1000000000);\n const isCongested = baseFee > CONGESTION_THRESHOLD;\n \n return {\n baseFee,\n isCongested,\n recommendedBuffer: isCongested ? 30 : 20\n };\n } catch (error) {\n console.error('[Gas] Failed to get network conditions:', error);\n return {\n baseFee: BigInt(1000000000),\n isCongested: false,\n recommendedBuffer: 25 // Conservative fallback\n };\n }\n}","import { usdcUnits } from \"../utils/units\";\n\n// Re-export time constants\nexport * from \"./time\";\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt\nexport const ZERO = 0n;\nexport const SECONDS_IN_DAY = 86400n;\n\n// =============================================================================\n// QUERY & POLLING CONFIGURATION\n// =============================================================================\n// Centralized configuration for all data fetching, polling intervals, and cache times.\n// Rule: staleTime should be slightly LESS than polling interval to prevent unnecessary\n// refetches on remount/focus while still allowing polling to work correctly.\n// =============================================================================\n\n// --- Base Network Timing ---\n// Base has 2 second block times - this affects how quickly on-chain data propagates\nexport const BASE_BLOCK_TIME_MS = 2000;\n// Delay after transaction to allow RPC nodes to sync (block time + propagation margin)\nexport const RPC_PROPAGATION_DELAY_MS = 2000;\n\n// --- RPC Direct Reads (ProtocolViewer) ---\n// Used for instant on-chain data after transactions\nexport const RPC_STALE_TIME_MS = 3000; // Block time + 1s margin\nexport const RPC_GC_TIME_MS = 30000; // Keep in cache for quick re-access\n\n// --- Intent Polling (Active Swap Flow) ---\n// Fast polling for responsive UX during active order, pauses when tab hidden\nexport const INTENT_POLLING_INTERVAL_MS = 3000;\nexport const INTENT_STALE_TIME_MS = 2500; // < polling interval to prevent double-fetch on remount\n\n// --- Balance Polling ---\n// Background refresh for wallet balances, not critical path\nexport const BALANCE_POLLING_INTERVAL_MS = 30000;\nexport const BALANCE_STALE_TIME_MS = 25000; // < polling interval\n\n// --- Deposit List Polling ---\n// Slower polling for deposit management pages\nexport const DEPOSIT_REFETCH_INTERVAL = 300000; // 5 minutes\nexport const DEPOSIT_STALE_TIME_MS = 290000; // 4:50 - slightly less than polling\n\n// --- Liquidity Table Polling ---\n// Medium-frequency polling for orderbook/liquidity views\nexport const LIQUIDITY_POLLING_INTERVAL_MS = 60000; // 1 minute\nexport const LIQUIDITY_STALE_TIME_MS = 55000; // 55s - slightly less than polling\n\n// --- Backend API Queries ---\n// Longer stale times since RPC provides real-time data for critical flows\nexport const BACKEND_DEPOSITS_STALE_TIME_MS = 30000;\nexport const BACKEND_DEPOSITS_GC_TIME_MS = 120000; // 2 minutes\nexport const BACKEND_INTENTS_STALE_TIME_MS = 30000;\nexport const BACKEND_INTENTS_GC_TIME_MS = 60000; // 1 minute\nexport const BACKEND_DEPOSIT_ORDERS_STALE_TIME_MS = 30000;\nexport const BACKEND_DEPOSIT_ORDERS_GC_TIME_MS = 120000;\n\n// --- Proof Polling (Order Completion Flow) ---\n// Fast polling while waiting for proof generation\nexport const PROOF_POLL_INTERVAL_MS = 3000;\n\n// --- ENS Resolution ---\n// Long cache time since ENS names rarely change\nexport const ENS_STALE_TIME_MS = 900000; // 15 minutes\nexport const ENS_GC_TIME_MS = 1800000; // 30 minutes\n\n// --- Past Deposits (No Polling) ---\n// Historical data that only updates on explicit invalidation\nexport const PAST_DEPOSITS_STALE_TIME_MS = Infinity;\nexport const PAST_DEPOSITS_GC_TIME_MS = 60000;\n\n// =============================================================================\n// END QUERY & POLLING CONFIGURATION\n// =============================================================================\n\n// =============================================================================\n// SESSION STORAGE KEYS\n// =============================================================================\n// Namespaced keys for cross-component communication via sessionStorage.\n// These enable data-aware UI updates (e.g., skeleton clearing after deposits).\n//\n// Usage pattern:\n// 1. Component A sets a key before navigation/action\n// 2. Component B reads and clears the key on mount/update\n// 3. Component B uses the value to determine UI behavior\n//\n// All keys are namespaced with 'zkp2p:' to avoid collisions with other storage.\n// =============================================================================\n\n/**\n * Signals that the deposit list needs refreshing with skeleton loading.\n * Set by DepositDetailsView when closing a deposit before navigating back.\n * Cleared by Deposits/index.tsx after initiating refresh.\n */\nexport const DEPOSIT_REFRESH_PENDING_KEY = 'zkp2p:deposit:refreshPending';\n\n/**\n * Stores the deposit ID that was just closed.\n * Used for data-aware skeleton clearing - skeleton clears when this ID\n * is no longer present in the deposit list.\n * Set by DepositDetailsView, cleared by Deposits/index.tsx.\n */\nexport const DEPOSIT_CLOSED_ID_KEY = 'zkp2p:deposit:closedId';\n\n/**\n * Stores the expected deposit count after creating a new deposit.\n * Used for data-aware skeleton clearing - skeleton clears when the\n * actual count matches or exceeds the expected count.\n * Set by NewDeposit flow, cleared by Deposits/index.tsx.\n */\nexport const DEPOSIT_EXPECTED_COUNT_KEY = 'zkp2p:deposit:expectedCount';\n\n// =============================================================================\n// END SESSION STORAGE KEYS\n// =============================================================================\n\n// =============================================================================\n// UI TIMING CONSTANTS\n// =============================================================================\n// Constants for skeleton loading states, animations, and visual feedback timing.\n// These ensure consistent UX across the application.\n// =============================================================================\n\n/**\n * Minimum time to show skeleton loading state for visual feedback.\n * Prevents jarring flash if data loads very quickly.\n */\nexport const MIN_REFRESH_SKELETON_MS = 1500;\n\n/**\n * Maximum time to show skeleton loading state before giving up.\n * Safety timeout if data change detection fails.\n */\nexport const MAX_REFRESH_SKELETON_MS = 6000;\n\n// =============================================================================\n// END UI TIMING CONSTANTS\n// =============================================================================\n\n// Chain IDs\nconst BASE_MAINNET_CHAIN_ID = 8453;\nexport const BASE_SEPOLIA_CHAIN_ID = 84532;\nexport const SOLANA_CHAIN_ID = 792703809;\nexport const TRON_CHAIN_ID = 728126428;\nexport const HYPEREVM_CHAIN_ID = 999;\nexport const HYPERLIQUID_CHAIN_ID = 1337;\nexport const PLASMA_CHAIN_ID = 9745;\nexport const BITCOIN_CHAIN_ID = 8253038;\nexport const SUI_CHAIN_ID = 103665049;\nexport const TAIKO_CHAIN_ID = 167000;\n\n// Hyperliquid uses a special USDC token with different decimals\nexport const HYPERLIQUID_USDC_ADDRESS = \"0x00000000000000000000000000000000\";\n\n// Bitcoin uses a special address format for BTC\nexport const BITCOIN_BTC_ADDRESS = \"bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8\";\n\n// Both STAGING and PRODUCTION use Base mainnet\nexport const BASE_CHAIN_ID = BASE_MAINNET_CHAIN_ID;\n\n// USDC addresses\nconst BASE_MAINNET_USDC_ADDRESS = \"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913\";\nexport const BASE_USDC_ADDRESS = BASE_MAINNET_USDC_ADDRESS;\n\n// Excluded origin chains for Relay deposit-address flow (keep in sync with provider checks)\nexport const RELAY_DEPOSIT_ORIGIN_EXCLUDED_CHAIN_IDS: number[] = [\n BASE_MAINNET_CHAIN_ID, // Base mainnet\n BASE_SEPOLIA_CHAIN_ID, // Base Sepolia\n 43114, // Avalanche\n 1301, // Unichain\n 80084, // Berachain (testnet)\n 1088, // Metis\n 21000000, // Corn\n];\n\nexport const MINIMUM_DEPOSIT_AMOUNT = usdcUnits(0.1);\n\n// Order limit constants\nexport const MIN_ORDER_FLOOR = 5; // Minimum allowed order amount in USDC\nexport const MIN_ORDER_CAP = 50; // Maximum value for minimum order amount in USDC\nexport const MAX_ORDER_ADVISORY_THRESHOLD = 3000; // Advisory threshold for high per-order amounts in USDC\nexport const MIN_ORDER_DEPOSIT_THRESHOLD = 5; // Deposits below this amount are not subject to formula enforcement\nexport const DEFAULT_MAX_ORDER_CAP = 3000; // Default per-order cap applied when auto-filling max\n\n// Dust filtering threshold - hide liquidity entries below this USD value\nexport const DUST_THRESHOLD_USD = 5;\n\n// Extreme spread filtering threshold - hide orders with spread above this percentage\nexport const EXTREME_SPREAD_THRESHOLD_PERCENT = 100; // +100% spread\n\n// Success-rate and order-threshold configuration\nexport const MIN_ORDERS_FOR_SUCCESS_METRIC = 10; // minimum finalized intents before surfacing stats\nexport const LOW_SUCCESS_RATE_FILTER_PERCENT = 20; // Deposits below this hidden by default\nexport const LOW_SUCCESS_RATE_WARNING_PERCENT = 50; // Warn users below this completion rate\nexport const EXTREMELY_LOW_SUCCESS_RATE_PERCENT = 10; // Stronger warning badge threshold\n\n// Intent expiration fallback when indexer expiryTime unavailable.\n// On-chain: Production = 6 hours, Staging = 1 hour.\n// This is only used as a fallback; prefer expiryTime from indexer which reads the real on-chain value.\n// Note: In production, use the 6-hour default. Consuming apps can override this based on their environment.\nexport const INTENT_EXPIRATION_PERIOD_IN_SECONDS = 3600 * 6; // 6 hours (production default)\nexport const INTENT_EXPIRATION_PERIOD_STAGING_IN_SECONDS = 3600; // 1 hour (staging)\n\nexport const PRECISION = 1000000000000000000n; // 18\n\nexport const QUOTE_DEFAULT_ADDRESS = \"0x18Cc6F90512C6D95ACA0d57F98C727D61873c06a\";\nexport const QUOTE_DEFAULT_BTC_ADDRESS = \"34FzWazeBFL1mWF8tn36635hPsnJEzTrMR\"; // Default Bitcoin address for quotes\nexport const QUOTE_DEFAULT_SOL_ADDRESS = \"8pHKRNF3u8tndkUJ4euAddNWM9EAMWbUiK5GVmtaGY5U\";\nexport const QUOTE_DEFAULT_TRON_ADDRESS = \"TT2T17KZhoDu47i2E4FWxfG79zdkEWkU9N\"; // justin's tron address\nexport const QUOTE_DEFAULT_SUI_ADDRESS = \"0x2dad0710678565a0045073af0327a945e93c9c3bff31169ee689739558ed8b6b\";\n \n\n// the numeric form of the payload1 passed into the primitive\n// corresponds to the openssh signature produced by the following command:\n// echo \"E PLURIBUS UNUM; DO NOT SHARE\" | ssh-keygen -Y sign -n double-blind.xyz -f ~/.ssh/id_rsa | pbcopy\n \n\nexport const CLIENT_VERSION = \"3.0.0\";\n\n// circom constants from main.circom / https://zkrepl.dev/?gist=30d21c7a7285b1b14f608325f172417b\n// template RSAGroupSigVerify(n, k, levels) {\n// component main { public [ modulus ] } = RSAVerify(121, 17);\n// component main { public [ root, payload1 ] } = RSAGroupSigVerify(121, 17, 30);\n \n\n// Misc smart contract values\n \nexport const ZERO_ADDRESS = \"0x0000000000000000000000000000000000000000\";\n// Default intent guardian for V3 deposits\nexport const DEFAULT_INTENT_GUARDIAN_ADDRESS = \"0xe29a5BD4D0CEbA6C125A0361E7D20ab4eA275C2f\";\nexport const CALLER_ACCOUNT = \"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266\";\nexport const DEFAULT_NETWORK = \"base\";\n\n// Relay bridge app fee configuration\nexport const RELAY_APP_FEE_RECIPIENT = \"0x0bC26FF515411396DD588Abd6Ef6846E04470227\";\nexport const RELAY_APP_FEE_BPS = \"50\"; // 50 basis points = 0.5%\n\n// Cross-chain destination token addresses eligible for zero app fees when bridging from Base\nexport const RELAY_ZERO_FEE_TOKEN_ADDRESSES: Record<number, string[]> = {\n 1: [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\", // USDC\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\", // USDT\n ],\n 10: [\n \"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85\", // USDC\n \"0x01bFf41798a0bcF287b996046cA68B395dbc1071\", // USDT\n ],\n 137: [\"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359\"], // Polygon PoS (USDC)\n 42161: [\n \"0xaf88d065e77c8cC2239327C5EDb3A432268e5831\", // USDC\n \"0xfd086BC7CD5C481DCC9C85ebe478A1C0b69FCbb9\", // USDT\n ],\n 43114: [\"0x9702230A8Ea53601F5cD2dc00fDBC13D4dF4A8c7\"], // Avalanche (USDT)\n 480: [\"0x79A02482A880bCe3F13E09da970dC34dB4cD24D1\"], // World Chain (USDC)\n [HYPEREVM_CHAIN_ID]: [\n \"0xb88339CB7199b77E23DB6E890353E22632Ba630f\", // USDC\n \"0xb8cE59fC3717AdA4C02EAdf9682A9e934F625ebb\", // USDT\n ],\n [PLASMA_CHAIN_ID]: [\n \"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb\", // USDT0\n ],\n 1301: [\n \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\", // USDC\n \"0x9151434b16b9763660705744891Fa906f660EcC5\", // USDT\n ],\n 1329: [\n \"0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392\", // USDC\n \"0x9151434b16b9763660705744891Fa906f660EcC5\", // USDT\n ],\n [HYPERLIQUID_CHAIN_ID]: [HYPERLIQUID_USDC_ADDRESS, \"0x25faEdc3F054130DBB4e4203AcA63567\"],\n 146: [\"0x29219dd400f2Bf60E5a23d13Be72B486D4038894\"], // Sonic (USDC)\n [SOLANA_CHAIN_ID]: [\n \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\", // USDC\n \"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB\", // USDT\n ],\n [TRON_CHAIN_ID]: [\"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t\"],\n 80084: [\"0x779dED0C9E1022225F8E0630B35a9B54Be713736\"], // Berachain (USDT)\n};\n\n// Proving key paths\n \n"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/canonicalize@2.1.0/node_modules/canonicalize/lib/canonicalize.js","../../core/src/utils/units.ts","../../core/src/utils/keccak.ts","../../core/src/types/currency.ts","../../core/src/platforms/types.ts","../../core/src/utils/paymentMethodHashes.ts","../../core/src/utils/gas.ts","../../core/src/constants/index.ts"],"names":["exports","values","viemKeccak256"],"mappings":";;;;;AAAA,IAAA,oBAAA,GAAA,UAAA,CAAA;AAAA,EAAA,2FAAA,CAAAA,SAAA,EAAA,MAAA,EAAA;AAIA,IAAA,MAAA,CAAO,OAAA,GAAU,SAAS,SAAA,CAAW,MAAA,EAAQ;AAC3C,MAAA,IAAI,OAAO,MAAA,KAAW,QAAA,IAAY,KAAA,CAAM,MAAM,CAAA,EAAG;AAC/C,QAAA,MAAM,IAAI,MAAM,oBAAoB,CAAA;AAAA,MACtC;AAEA,MAAA,IAAI,OAAO,MAAA,KAAW,QAAA,IAAY,CAAC,QAAA,CAAS,MAAM,CAAA,EAAG;AACnD,QAAA,MAAM,IAAI,MAAM,yBAAyB,CAAA;AAAA,MAC3C;AAEA,MAAA,IAAI,MAAA,KAAW,IAAA,IAAQ,OAAO,MAAA,KAAW,QAAA,EAAU;AACjD,QAAA,OAAO,IAAA,CAAK,UAAU,MAAM,CAAA;AAAA,MAC9B;AAEA,MAAA,IAAI,MAAA,CAAO,kBAAkB,QAAA,EAAU;AACrC,QAAA,OAAO,SAAA,CAAU,MAAA,CAAO,MAAA,EAAQ,CAAA;AAAA,MAClC;AAEA,MAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,EAAG;AACzB,QAAA,MAAMC,UAAS,MAAA,CAAO,MAAA,CAAO,CAAC,CAAA,EAAG,IAAI,EAAA,KAAO;AAC1C,UAAA,MAAM,KAAA,GAAQ,EAAA,KAAO,CAAA,GAAI,EAAA,GAAK,GAAA;AAC9B,UAAA,MAAM,QAAQ,EAAA,KAAO,MAAA,IAAa,OAAO,EAAA,KAAO,WAAW,IAAA,G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S,SAAA;EACT,KAAA,EAAO,OAAA;EACP,OAAA,EAAS,SAAA;EACT,IAAA,EAAM,MAAA;EACN,YAAA,EAAc,aAAA;EACd,KAAA,EAAO,OAAA;EACP,MAAA,EAAQ,QAAA;EACR,KAAA,EAAO,OAAA;EACP,GAAA,EAAK,KAAA;EACL,MAAA,EAAQ;AACV,CAAA;AAEgC,CAAC,GAAG,MAAA,CAAO,MAAA,CAAO,eAAe,CAAC,CAAA;ACf3D,IAAM,mBAAA,GAAsB;EACjC,KAAA,EAAO,oEAAA;EACP,OAAA,EAAS,oEAAA;EACT,OAAA,EAAS,oEAAA;EACT,KAAA,EAAO,oEAAA;EACP,IAAA,EAAM,oEAAA;EACN,WAAA,EAAa,oEAAA;EACb,YAAA,EAAc,oEAAA;EACd,aAAA,EAAe,oEAAA;EACf,YAAA,EAAc,oEAAA;EACd,MAAA,EAAQ,oEAAA;EACR,KAAA,EAAO,oEAAA;EACP,GAAA,EAAK,oEAAA;EACL,MAAA,EAAQ;AACV,CAAA;AAI+D,MAAA,CAAO,OAAA,CAAQ,mBAAmB,CAAA,CAAE,MAAA;AACjG,EAAA,CAAC,GAAA,EAAK,CAAC,IAAA,EAAM,IAAI,CAAA,KAAM;AACrB,IAAA,GAAA,CAAI,IAAA,CAAK,WAAA,EAAa,CAAA,GAAI,IAAA;AAC1B,IAAA,OAAO,GAAA;AACT,EAAA,CAAA;EACA;AACF;ACToC,OAAO,GAAU;AAKrB,OAAO,GAAU;AACtB,OAAO,GAAU;ACuJN,SAAA,CAAU,GAAG,CAAA","file":"chunk-GNGQRV2U.mjs","sourcesContent":["/* jshint esversion: 6 */\n/* jslint node: true */\n'use strict';\n\nmodule.exports = function serialize (object) {\n if (typeof object === 'number' && isNaN(object)) {\n throw new Error('NaN is not allowed');\n }\n\n if (typeof object === 'number' && !isFinite(object)) {\n throw new Error('Infinity is not allowed');\n }\n\n if (object === null || typeof object !== 'object') {\n return JSON.stringify(object);\n }\n\n if (object.toJSON instanceof Function) {\n return serialize(object.toJSON());\n }\n\n if (Array.isArray(object)) {\n const values = object.reduce((t, cv, ci) => {\n const comma = ci === 0 ? '' : ',';\n const value = cv === undefined || typeof cv === 'symbol' ? null : cv;\n return `${t}${comma}${serialize(value)}`;\n }, '');\n return `[${values}]`;\n }\n\n const values = Object.keys(object).sort().reduce((t, cv) => {\n if (object[cv] === undefined ||\n typeof object[cv] === 'symbol') {\n return t;\n }\n const comma = t.length === 0 ? '' : ',';\n return `${t}${comma}${serialize(cv)}:${serialize(object[cv])}`;\n }, '');\n return `{${values}}`;\n};\n","import { parseEther, parseUnits, formatEther, formatUnits } from \"viem\";\n\n\nexport const etherUnits = (amount: number | string | bigint): bigint => {\n return parseEther(amount.toString());\n};\n\nexport const usdcUnits = (amount: number | string | bigint): bigint => {\n return parseUnits(amount.toString(), 6);\n};\n\nexport const tokenUnits = (amount: number | string | bigint, decimals: number): bigint => {\n return parseUnits(amount.toString(), decimals);\n};\n\nexport const etherUnitsToReadable = (amount: bigint | string, decimalsToDisplay: number = 2): string => {\n return Number(Number(formatEther(BigInt(amount))).toFixed(decimalsToDisplay)).toString();\n};\n\nexport const tokenUnitsToReadable = (amount: bigint | string, decimals: number, decimalsToDisplay: number = 2): string => {\n const formatted = Number(formatUnits(BigInt(amount), decimals));\n const multiplier = Math.pow(10, decimalsToDisplay);\n return (Math.floor(formatted * multiplier) / multiplier).toFixed(decimalsToDisplay);\n};\n\nexport const tokenUnitsToReadableWithMaxDecimals = (amount: bigint | string, decimals: number, maxDecimalsToDisplay: number = 2): string => {\n const formatted = Number(formatUnits(BigInt(amount), decimals));\n\n if (formatted === 0) return '0';\n\n // For small numbers (less than 0.001), show at least 3 non-zero places\n if (formatted < 0.001) {\n // Handle scientific notation (e.g., 7.7327284e-11)\n const formattedStr = formatted.toString();\n\n // Check if the number is in scientific notation\n if (formattedStr.includes('e-')) {\n const parts = formattedStr.split('e-');\n const base = parseFloat(parts[0]);\n const exponent = parseInt(parts[1], 10);\n\n // Convert from scientific notation to decimal format\n let decimalStr = '0.';\n // Add leading zeros based on the exponent\n for (let i = 1; i < exponent; i++) {\n decimalStr += '0';\n }\n\n // Add the significant digits (only 3 non-zero places)\n const baseDigits = base.toString().replace('.', '');\n let nonZeroCount = 0;\n let result = '';\n\n for (let i = 0; i < baseDigits.length; i++) {\n result += baseDigits[i];\n if (baseDigits[i] !== '0') {\n nonZeroCount++;\n if (nonZeroCount === 3) break;\n }\n }\n\n return decimalStr + result;\n } else {\n // For regular small decimals, find leading zeros and show 3 significant digits\n const decimalStr = formattedStr.split('.')[1] || '';\n let leadingZeros = 0;\n for (let i = 0; i < decimalStr.length; i++) {\n if (decimalStr[i] !== '0') break;\n leadingZeros++;\n }\n\n // Show at least 3 significant digits\n return formatted.toFixed(leadingZeros + 3);\n }\n }\n\n // For larger numbers, use the specified maxDecimalsToDisplay\n const fixedValue = formatted.toFixed(maxDecimalsToDisplay);\n // Remove trailing zeros and decimal point if needed\n return fixedValue.replace(/\\.?0+$/, '');\n};\n\n\nexport const relayTokenAmountToReadable = (amountFormatted: string | undefined) => {\n if (!amountFormatted) return '0';\n\n const num = Number(amountFormatted);\n if (num === 0) return '0';\n\n // For small numbers (less than 0.001), show at least 3 non-zero places\n if (num < 0.001) {\n // Find the first non-zero digit after decimal\n const decimalStr = num.toString().split('.')[1] || '';\n let leadingZeros = 0;\n for (let i = 0; i < decimalStr.length; i++) {\n if (decimalStr[i] !== '0') break;\n leadingZeros++;\n }\n // Show at least 3 significant digits\n return num.toFixed(leadingZeros + 3);\n }\n\n // For larger numbers, show 3 decimal places\n return num.toFixed(3);\n};","import { keccak256 as viemKeccak256, encodePacked, sha256 as viemSha256 } from \"viem\";\n\nexport const keccak256 = (inputString: string): string => {\n return viemKeccak256(encodePacked([\"string\"], [inputString]));\n};\n\nexport const currencyKeccak256 = (inputString: string): string => {\n const bytes = new TextEncoder().encode(inputString);\n return viemKeccak256(bytes);\n};\n\nexport const sha256 = (inputString: string): string => {\n return viemSha256(encodePacked([\"string\"], [inputString]));\n};\n\n/**\n * Hashes the payee details the same way the ZKP2P Escrow contract does.\n * The contract does: keccak256(abi.encodePacked(payeeDetails))\n *\n * @param payeeDetails The payee details string to hash (e.g., \"0xab797bc4...\")\n * @returns The hashed value that will appear in contract events\n *\n * @example\n * Input: \"0xab797bc4330de21c4fa9d3d96bc4fcb6a8f20a0c18fd5ae3475e097f393f41b8\"\n * Output: \"0x06b222a351506718f57874ed8fc5ea5cb8ecc77293b249529c682d8dd9ac1925\"\n */\nexport const hashPayeeDetails = (payeeDetails: string): string => {\n return keccak256(payeeDetails);\n};\n","import { currencyKeccak256 } from '../utils/keccak';\n\n\nexport const Currency = {\n AED: \"AED\",\n ARS: \"ARS\",\n AUD: \"AUD\",\n CAD: \"CAD\",\n CHF: \"CHF\",\n CNY: \"CNY\",\n CZK: \"CZK\",\n DKK: \"DKK\",\n EUR: \"EUR\",\n GBP: \"GBP\",\n HKD: \"HKD\",\n HUF: \"HUF\",\n IDR: \"IDR\",\n ILS: \"ILS\",\n INR: \"INR\",\n JPY: \"JPY\",\n KES: \"KES\",\n NOK: \"NOK\",\n MXN: \"MXN\",\n MYR: \"MYR\",\n NZD: \"NZD\",\n PHP: \"PHP\",\n PLN: \"PLN\",\n RON: \"RON\",\n SAR: \"SAR\",\n SEK: \"SEK\",\n SGD: \"SGD\",\n THB: \"THB\",\n TRY: \"TRY\",\n UGX: \"UGX\",\n USD: \"USD\",\n VND: \"VND\",\n ZAR: \"ZAR\",\n};\n\nexport type CurrencyType = typeof Currency[keyof typeof Currency];\n\nfunction getCurrencies(): string[] {\n return Object.values(Currency);\n}\n\nexport function getCurrencyInfoFromHash(currencyCodeHash: string): CurrencyData | null {\n return Object.values(currencyInfo).find(\n (currency) => currency.currencyCodeHash === currencyCodeHash\n ) ?? null;\n}\n\nexport function getCurrencyInfoFromCountryCode(countryCode: string): CurrencyData | null {\n return Object.values(currencyInfo).find(\n (currency) => currency.countryCode === countryCode\n ) ?? null;\n}\n\nexport function isSupportedCurrency(currencyCode: string): boolean {\n return Object.values(currencyInfo).some(\n (currency) => currency.currencyCode === currencyCode\n );\n}\n\nexport const currencies = getCurrencies();\n\ninterface CurrencyData {\n currency: CurrencyType;\n currencyCode: string;\n currencyName: string;\n currencySymbol: string;\n currencyCodeHash: string;\n countryCode: string;\n}\n\nexport const currencyInfo: Record<CurrencyType, CurrencyData> = {\n [Currency.AED]: {\n currency: Currency.AED,\n currencyCode: \"AED\",\n currencyName: \"United Arab Emirates Dirham\",\n currencyCodeHash: currencyKeccak256(\"AED\"),\n currencySymbol: \"د.إ\",\n countryCode: \"ae\",\n },\n [Currency.ARS]: {\n currency: Currency.ARS,\n currencyCode: \"ARS\",\n currencyName: \"Argentine Peso\",\n currencyCodeHash: currencyKeccak256(\"ARS\"),\n currencySymbol: \"$\",\n countryCode: \"ar\"\n },\n [Currency.AUD]: {\n currency: Currency.AUD,\n currencyCode: \"AUD\",\n currencyName: \"Australian Dollar\",\n currencyCodeHash: currencyKeccak256(\"AUD\"),\n currencySymbol: \"A$\",\n countryCode: \"au\",\n },\n [Currency.CAD]: {\n currency: Currency.CAD,\n currencyCode: \"CAD\",\n currencyName: \"Canadian Dollar\",\n currencyCodeHash: currencyKeccak256(\"CAD\"),\n currencySymbol: \"C$\",\n countryCode: \"ca\",\n },\n [Currency.CHF]: {\n currency: Currency.CHF,\n currencyCode: \"CHF\",\n currencyName: \"Swiss Franc\",\n currencyCodeHash: currencyKeccak256(\"CHF\"),\n currencySymbol: \"Fr\",\n countryCode: \"ch\",\n },\n [Currency.CNY]: {\n currency: Currency.CNY,\n currencyCode: \"CNY\",\n currencyName: \"Chinese Yuan\",\n currencyCodeHash: currencyKeccak256(\"CNY\"),\n currencySymbol: \"¥\",\n countryCode: \"cn\",\n },\n [Currency.CZK]: {\n currency: Currency.CZK,\n currencyCode: \"CZK\",\n currencyName: \"Czech Koruna\",\n currencyCodeHash: currencyKeccak256(\"CZK\"),\n currencySymbol: \"Kč\",\n countryCode: \"cz\",\n },\n [Currency.DKK]: {\n currency: Currency.DKK,\n currencyCode: \"DKK\",\n currencyName: \"Danish Krone\",\n currencyCodeHash: currencyKeccak256(\"DKK\"),\n currencySymbol: \"kr\",\n countryCode: \"dk\",\n },\n [Currency.EUR]: {\n currency: Currency.EUR,\n currencyCode: \"EUR\",\n currencyName: \"Euro\",\n currencyCodeHash: currencyKeccak256(\"EUR\"),\n currencySymbol: \"€\",\n countryCode: \"eu\",\n },\n [Currency.GBP]: {\n currency: Currency.GBP,\n currencyCode: \"GBP\",\n currencyName: \"British Pound\",\n currencyCodeHash: currencyKeccak256(\"GBP\"),\n currencySymbol: \"£\",\n countryCode: \"gb\",\n },\n [Currency.HKD]: {\n currency: Currency.HKD,\n currencyCode: \"HKD\",\n currencyName: \"Hong Kong Dollar\",\n currencyCodeHash: currencyKeccak256(\"HKD\"),\n currencySymbol: \"HK$\",\n countryCode: \"hk\",\n },\n [Currency.HUF]: {\n currency: Currency.HUF,\n currencyCode: \"HUF\",\n currencyName: \"Hungarian Forint\",\n currencyCodeHash: currencyKeccak256(\"HUF\"),\n currencySymbol: \"Ft\",\n countryCode: \"hu\",\n },\n [Currency.IDR]: {\n currency: Currency.IDR,\n currencyCode: \"IDR\",\n currencyName: \"Indonesian Rupiah\",\n currencyCodeHash: currencyKeccak256(\"IDR\"),\n currencySymbol: \"Rp\",\n countryCode: \"id\",\n },\n [Currency.INR]: {\n currency: Currency.INR,\n currencyCode: \"INR\",\n currencyName: \"Indian Rupee\",\n currencyCodeHash: currencyKeccak256(\"INR\"),\n currencySymbol: \"₹\",\n countryCode: \"in\",\n },\n [Currency.ILS]: {\n currency: Currency.ILS,\n currencyCode: \"ILS\",\n currencyName: \"Israeli New Shekel\",\n currencyCodeHash: currencyKeccak256(\"ILS\"),\n currencySymbol: \"₪\",\n countryCode: \"il\",\n },\n [Currency.JPY]: {\n currency: Currency.JPY,\n currencyCode: \"JPY\",\n currencyName: \"Japanese Yen\",\n currencyCodeHash: currencyKeccak256(\"JPY\"),\n currencySymbol: \"¥\",\n countryCode: \"jp\",\n },\n [Currency.KES]: {\n currency: Currency.KES,\n currencyCode: \"KES\",\n currencyName: \"Kenyan Shilling\",\n currencyCodeHash: currencyKeccak256(\"KES\"),\n currencySymbol: \"KSh\",\n countryCode: \"ke\",\n },\n [Currency.MXN]: {\n currency: Currency.MXN,\n currencyCode: \"MXN\",\n currencyName: \"Mexican Peso\",\n currencyCodeHash: currencyKeccak256(\"MXN\"),\n currencySymbol: \"$\",\n countryCode: \"mx\",\n },\n [Currency.MYR]: {\n currency: Currency.MYR,\n currencyCode: \"MYR\",\n currencyName: \"Malaysian Ringgit\",\n currencyCodeHash: currencyKeccak256(\"MYR\"),\n currencySymbol: \"RM\",\n countryCode: \"my\",\n },\n [Currency.NOK]: {\n currency: Currency.NOK,\n currencyCode: \"NOK\",\n currencyName: \"Norwegian Krone\",\n currencyCodeHash: currencyKeccak256(\"NOK\"),\n currencySymbol: \"kr\",\n countryCode: \"no\",\n },\n [Currency.NZD]: {\n currency: Currency.NZD,\n currencyCode: \"NZD\",\n currencyName: \"New Zealand Dollar\",\n currencyCodeHash: currencyKeccak256(\"NZD\"),\n currencySymbol: \"NZ$\",\n countryCode: \"nz\",\n },\n [Currency.PHP]: {\n currency: Currency.PHP,\n currencyCode: \"PHP\",\n currencyName: \"Philippine Peso\",\n currencyCodeHash: currencyKeccak256(\"PHP\"),\n currencySymbol: \"₱\",\n countryCode: \"ph\",\n },\n [Currency.PLN]: {\n currency: Currency.PLN,\n currencyCode: \"PLN\",\n currencyName: \"Polish Złoty\",\n currencyCodeHash: currencyKeccak256(\"PLN\"),\n currencySymbol: \"zł\",\n countryCode: \"pl\",\n },\n [Currency.RON]: {\n currency: Currency.RON,\n currencyCode: \"RON\",\n currencyName: \"Romanian Leu\",\n currencyCodeHash: currencyKeccak256(\"RON\"),\n currencySymbol: \"lei\",\n countryCode: \"ro\",\n },\n [Currency.SAR]: {\n currency: Currency.SAR,\n currencyCode: \"SAR\",\n currencyName: \"Saudi Riyal\",\n currencyCodeHash: currencyKeccak256(\"SAR\"),\n currencySymbol: \"﷼\",\n countryCode: \"sa\",\n },\n [Currency.SEK]: {\n currency: Currency.SEK,\n currencyCode: \"SEK\",\n currencyName: \"Swedish Krona\",\n currencyCodeHash: currencyKeccak256(\"SEK\"),\n currencySymbol: \"kr\",\n countryCode: \"se\",\n },\n [Currency.SGD]: {\n currency: Currency.SGD,\n currencyCode: \"SGD\",\n currencyName: \"Singapore Dollar\",\n currencyCodeHash: currencyKeccak256(\"SGD\"),\n currencySymbol: \"S$\",\n countryCode: \"sg\",\n },\n [Currency.THB]: {\n currency: Currency.THB,\n currencyCode: \"THB\",\n currencyName: \"Thai Baht\",\n currencyCodeHash: currencyKeccak256(\"THB\"),\n currencySymbol: \"฿\",\n countryCode: \"th\",\n },\n [Currency.TRY]: {\n currency: Currency.TRY,\n currencyCode: \"TRY\",\n currencyName: \"Turkish Lira\",\n currencyCodeHash: currencyKeccak256(\"TRY\"),\n currencySymbol: \"₺\",\n countryCode: \"tr\",\n },\n [Currency.UGX]: {\n currency: Currency.UGX,\n currencyCode: \"UGX\",\n currencyName: \"Ugandan Shilling\",\n currencyCodeHash: currencyKeccak256(\"UGX\"),\n currencySymbol: \"USh\",\n countryCode: \"ug\",\n },\n [Currency.USD]: {\n currency: Currency.USD,\n currencyCode: \"USD\",\n currencyName: \"United States Dollar\",\n currencyCodeHash: currencyKeccak256(\"USD\"),\n currencySymbol: \"$\",\n countryCode: \"us\",\n },\n [Currency.VND]: {\n currency: Currency.VND,\n currencyCode: \"VND\",\n currencyName: \"Vietnamese Dong\",\n currencyCodeHash: currencyKeccak256(\"VND\"),\n currencySymbol: \"₫\",\n countryCode: \"vn\",\n },\n [Currency.ZAR]: {\n currency: Currency.ZAR,\n currencyCode: \"ZAR\",\n currencyName: \"South African Rand\",\n currencyCodeHash: currencyKeccak256(\"ZAR\"),\n currencySymbol: \"R\",\n countryCode: \"za\",\n },\n};\n\n// Utility helpers to safely resolve currency values at runtime\nexport function resolveCurrency(currencyCode?: string | null): CurrencyType {\n const code = (currencyCode || '').toUpperCase();\n return isSupportedCurrency(code) ? (code as CurrencyType) : Currency.USD;\n}\n\n// Note: intentionally not exporting a \"safeCurrencyInfo\" wrapper to\n// keep the public surface area minimal; use resolveCurrency + currencyInfo instead.\n","import { CurrencyType } from '../types/currency';\nimport { ExtensionRequestMetadata } from '../types/browserExtension';\n\n// Platforms that can be used to send payments\nexport const PaymentPlatform = {\n VENMO: \"venmo\",\n CASHAPP: \"cashapp\",\n CHIME: \"chime\",\n REVOLUT: \"revolut\",\n WISE: \"wise\",\n MERCADO_PAGO: \"mercadopago\",\n ZELLE: \"zelle\",\n PAYPAL: \"paypal\",\n MONZO: \"monzo\",\n N26: \"n26\",\n ALIPAY: \"alipay\",\n};\n\nexport const paymentPlatforms = [...Object.values(PaymentPlatform)];\nexport type PaymentPlatformType = typeof PaymentPlatform[keyof typeof PaymentPlatform];\n\n\n// Payment platform enums and interfaces\nexport enum PaymentPlatformDefaultPaymentMode {\n QR_CODE = \"QR_CODE\",\n WEB_PAYMENT = \"WEB_PAYMENT\",\n}\n\nexport interface ParsedPaymentDetails {\n amount: string;\n parsedAmount: boolean; // whether the amount was successfully parsed\n date: string;\n parsedDate: boolean; // whether the date was successfully parsed\n recipientId: string;\n parsedRecipientId: boolean; // whether the recipientId was successfully parsed\n currency: string;\n parsedCurrency: boolean; // whether the currency was successfully parsed\n}\n\nexport interface ProofExtractedParameters {\n amount: string;\n recipient: string;\n currency: string;\n paymentPlatform: string;\n date: string;\n paymentId: string;\n intentHash: string;\n providerHash: string;\n}\n\n\nexport interface SendPaymentConfig {\n paymentMethodName?: string;\n paymentMethodIcon?: string;\n defaultPaymentMode: PaymentPlatformDefaultPaymentMode;\n useCustomQRCode?: boolean;\n payeeDetailPrefix?: string;\n troubleScanningQRCodeLink: (\n recipientId: string,\n sendCurrency?: CurrencyType,\n amountFiatToSend?: string\n ) => string;\n getFormattedSendLink: (\n recipientId: string,\n sendCurrency?: CurrencyType,\n amountFiatToSend?: string\n ) => string;\n supportsSendingPaymentOnWeb: boolean;\n showTroubleScanningQRCodeLink: boolean;\n sendPaymentWarning?: (sendCurrency: CurrencyType, amountFiatToSend: string) => string;\n sendPaymentInfo?: (sendCurrency: CurrencyType, amountFiatToSend: string) => string;\n // Optional structured guidance for clearer bullets and emphasis\n sendPaymentDos?: (sendCurrency: CurrencyType, amountFiatToSend: string) => Array<{ text: string; emphasize?: string[] }>;\n sendPaymentDonts?: (sendCurrency: CurrencyType, amountFiatToSend: string) => Array<{ text: string; emphasize?: string[] }>;\n}\n\nexport interface PaymentVerificationConfig {\n authLink: string;\n actionType: string;\n actionPlatform: string;\n numPaymentsFetched: number;\n minExtensionVersion: string;\n supportsAppclip: boolean;\n parseExtractedParameters: (parameters: string) => ProofExtractedParameters;\n parseMetadata: (metadata: ExtensionRequestMetadata) => ParsedPaymentDetails;\n reverseTransactionHistoryOrder?: boolean;\n getSubjectText: (metadata: ExtensionRequestMetadata) => string;\n totalProofs: number;\n}\n\n\nexport interface PlatformDepositConfig {\n depositRequiresApproval: boolean;\n payeeDetailInputPlaceholder: string;\n payeeDetailInputHelperText: string;\n payeeDetailValidationFailureMessage: string;\n getDepositData: (payeeDetails: string, telegramUsername?: string) => { [key: string]: string };\n getPayeeDetail: (data: { [key: string]: string }) => string;\n}\n\nexport interface PaymentPlatformConfig {\n platformId: PaymentPlatformType;\n platformLogo?: string;\n platformName: string;\n platformCurrencies: CurrencyType[];\n minFiatAmount: string\n localeTimeString: string;\n platformIcon?: string;\n platformColor?: string; // Platform's brand color for fallback logo background\n // Optional client-side caps for better pre-validation UX\n maxUsdcPerIntent?: string; // e.g., '5000' means 5000 USDC cap\n\n // One deposit config per platform\n depositConfig: PlatformDepositConfig;\n\n hasMultiplePaymentMethods: boolean;\n // Multiple payment methods per platform\n paymentMethods: Array<{\n sendConfig: SendPaymentConfig,\n verifyConfig: PaymentVerificationConfig\n }>\n}\n","import { PaymentPlatform, PaymentPlatformType } from '../platforms';\n\n// Optional convenience mapping from method name -> hash (for reference)\nexport const METHOD_NAME_TO_HASH = {\n venmo: '0x90262a3db0edd0be2369c6b28f9e8511ec0bac7136cefbada0880602f87e7268',\n revolut: '0x617f88ab82b5c1b014c539f7e75121427f0bb50a4c58b187a238531e7d58605d',\n cashapp: '0x10940ee67cfb3c6c064569ec92c0ee934cd7afa18dd2ca2d6a2254fcb009c17d',\n chime: '0x5908bb0c9b87763ac6171d4104847667e7f02b4c47b574fe890c1f439ed128bb',\n wise: '0x554a007c2217df766b977723b276671aee5ebb4adaea0edb6433c88b3e61dac5',\n mercadopago: '0xa5418819c024239299ea32e09defae8ec412c03e58f5c75f1b2fe84c857f5483',\n 'zelle-citi': '0x817260692b75e93c7fbc51c71637d4075a975e221e1ebc1abeddfabd731fd90d',\n 'zelle-chase': '0x6aa1d1401e79ad0549dced8b1b96fb72c41cd02b32a7d9ea1fed54ba9e17152e',\n 'zelle-bofa': '0x4bc42b322a3ad413b91b2fde30549ca70d6ee900eded1681de91aaf32ffd7ab5',\n paypal: '0x3ccc3d4d5e769b1f82dc4988485551dc0cd3c7a3926d7d8a4dde91507199490f',\n monzo: '0x62c7ed738ad3e7618111348af32691b5767777fbaf46a2d8943237625552645c',\n n26: '0xd9ff4fd6b39a3e3dd43c41d05662a5547de4a878bc97a65bcb352ade493cdc6b',\n alipay: '0xcac9daea62d7b89d75ac73af4ee14dcf25721012ae82b568c2ea5c808eaa04ff',\n} as const;\n\ntype MethodName = keyof typeof METHOD_NAME_TO_HASH;\n\nexport const HASH_TO_METHOD_NAME: Record<string, MethodName> = Object.entries(METHOD_NAME_TO_HASH).reduce(\n (acc, [name, hash]) => {\n acc[hash.toLowerCase()] = name as MethodName;\n return acc;\n },\n {} as Record<string, MethodName>\n);\n\n// Legacy V2 method hash for Zelle (ASCII 'zelle' padded to 32 bytes)\n// Some historical deposits may use this selector. Map it to Zelle.\nconst LEGACY_ZELLE_V2_HASH = '0x7a656c6c650000000000000000000000000000000000000000000000000000'.toLowerCase();\n\nfunction methodNameToPlatform(method: MethodName): PaymentPlatformType | undefined {\n switch (method) {\n case 'venmo':\n return PaymentPlatform.VENMO;\n case 'revolut':\n return PaymentPlatform.REVOLUT;\n case 'cashapp':\n return PaymentPlatform.CASHAPP;\n case 'chime':\n return PaymentPlatform.CHIME;\n case 'wise':\n return PaymentPlatform.WISE;\n case 'mercadopago':\n return PaymentPlatform.MERCADO_PAGO;\n case 'paypal':\n return PaymentPlatform.PAYPAL;\n case 'monzo':\n return PaymentPlatform.MONZO;\n case 'n26':\n return PaymentPlatform.N26;\n case 'alipay':\n return PaymentPlatform.ALIPAY;\n case 'zelle-citi':\n case 'zelle-chase':\n case 'zelle-bofa':\n return PaymentPlatform.ZELLE;\n default:\n return undefined;\n }\n}\n\n/**\n * Resolve a platform id from a payment method hash.\n * Returns undefined when the hash is unknown.\n */\nexport function resolvePlatformFromMethodHash(hash?: string | null): PaymentPlatformType | undefined {\n if (!hash) return undefined;\n const normalized = hash.toLowerCase();\n\n // Handle legacy V2 Zelle deposits that use the ASCII 'zelle' 32-byte selector\n if (normalized === LEGACY_ZELLE_V2_HASH) {\n return PaymentPlatform.ZELLE;\n }\n\n const method = HASH_TO_METHOD_NAME[normalized];\n if (!method) return undefined;\n return methodNameToPlatform(method);\n}\n\n\nconst METHOD_VARIANT_LABEL_MAP: Record<string, string> = {\n 'zelle-chase': 'Chase',\n 'zelle-bofa': 'Bank of America',\n 'zelle-citi': 'Citi',\n};\n\nexport function getMethodVariantLabel(methodName?: string | null): string | null {\n if (!methodName) return null;\n const normalized = methodName.toLowerCase();\n const mapped = METHOD_VARIANT_LABEL_MAP[normalized];\n if (mapped) return mapped;\n if (normalized.includes('-')) {\n return normalized\n .split('-')\n .map(segment => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join(' ');\n }\n return null;\n}\n\nexport function getMethodVariantLabelFromHash(hash?: string | null): string | null {\n if (!hash) return null;\n const method = HASH_TO_METHOD_NAME[hash.toLowerCase()];\n if (!method) return null;\n return getMethodVariantLabel(method);\n}\n","import type { PublicClient } from 'viem';\n\nexport interface GasPricing {\n priority: bigint;\n max: bigint;\n baseFee: bigint;\n isCongested: boolean;\n}\n\nexport interface GasEstimationParams {\n estimated: bigint;\n baseFee: bigint;\n isCongested: boolean;\n}\n\n/**\n * Congestion threshold - base fee above this level triggers higher gas fees\n */\nexport const CONGESTION_THRESHOLD = BigInt(5000000000); // 5 gwei\n\n/**\n * Minimum gas fees required for account abstraction bundlers\n */\nexport const MIN_PRIORITY_FEE = BigInt(1000000000); // 1 gwei\nexport const MIN_MAX_FEE = BigInt(2000000000); // 2 gwei\n\n/**\n * Get dynamic gas pricing based on current network conditions\n * Applies congestion multiplier when base fee > 5 gwei\n */\nexport async function getDynamicGasPricing(publicClient: PublicClient | null): Promise<GasPricing> {\n try {\n if (!publicClient) {\n console.warn('[Gas] Public client not available, using fallback gas prices');\n return {\n priority: BigInt(2000000000), // 2 gwei fallback\n max: BigInt(4000000000), // 4 gwei fallback\n baseFee: BigInt(1000000000), // 1 gwei fallback\n isCongested: false\n };\n }\n\n // Get current base fee from latest block\n const block = await publicClient.getBlock({ blockTag: 'latest' });\n const baseFee = block.baseFeePerGas || BigInt(1000000000); // 1 gwei fallback\n \n // Check if network is congested\n const isCongested = baseFee > CONGESTION_THRESHOLD;\n \n // Apply congestion multiplier when network is congested\n const congestionMultiplier = isCongested ? 2n : 1n;\n \n // Calculate priority and max fees with congestion adjustment\n const priorityFee = (baseFee * congestionMultiplier) / 10n; // 10% of adjusted base fee\n const maxFee = (baseFee * congestionMultiplier * 12n) / 10n; // 120% of adjusted base fee\n \n // Ensure minimum values for account abstraction bundlers\n const finalPriorityFee = priorityFee > MIN_PRIORITY_FEE ? priorityFee : MIN_PRIORITY_FEE;\n const finalMaxFee = maxFee > MIN_MAX_FEE ? maxFee : MIN_MAX_FEE;\n\n return {\n priority: finalPriorityFee,\n max: finalMaxFee,\n baseFee,\n isCongested\n };\n } catch (error) {\n console.error('[Gas] Failed to fetch dynamic gas price:', error);\n // Return conservative fallback values\n return {\n priority: BigInt(2000000000), // 2 gwei\n max: BigInt(4000000000), // 4 gwei\n baseFee: BigInt(1000000000), // 1 gwei\n isCongested: false\n };\n }\n}\n\n/**\n * Calculate gas estimation with adaptive buffer based on network conditions\n * Uses 30% buffer during congestion, 20% during normal conditions\n */\nexport function calculateGasWithBuffer(params: GasEstimationParams): bigint {\n const { estimated, isCongested } = params;\n \n // Apply 30% buffer during congestion, 20% during normal conditions\n const bufferMultiplier = isCongested ? 130n : 120n;\n const gasWithBuffer = (estimated * bufferMultiplier) / 100n;\n \n return gasWithBuffer;\n}\n\n/**\n * Get network conditions for gas optimization decisions\n */\nexport async function getNetworkConditions(publicClient: PublicClient | null): Promise<{\n baseFee: bigint;\n isCongested: boolean;\n recommendedBuffer: number;\n}> {\n try {\n if (!publicClient) {\n return {\n baseFee: BigInt(1000000000),\n isCongested: false,\n recommendedBuffer: 20\n };\n }\n\n const block = await publicClient.getBlock({ blockTag: 'latest' });\n const baseFee = block.baseFeePerGas || BigInt(1000000000);\n const isCongested = baseFee > CONGESTION_THRESHOLD;\n \n return {\n baseFee,\n isCongested,\n recommendedBuffer: isCongested ? 30 : 20\n };\n } catch (error) {\n console.error('[Gas] Failed to get network conditions:', error);\n return {\n baseFee: BigInt(1000000000),\n isCongested: false,\n recommendedBuffer: 25 // Conservative fallback\n };\n }\n}","import { usdcUnits } from \"../utils/units\";\n\n// Re-export time constants\nexport * from \"./time\";\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt\nexport const ZERO = 0n;\nexport const SECONDS_IN_DAY = 86400n;\n\n// =============================================================================\n// QUERY & POLLING CONFIGURATION\n// =============================================================================\n// Centralized configuration for all data fetching, polling intervals, and cache times.\n// Rule: staleTime should be slightly LESS than polling interval to prevent unnecessary\n// refetches on remount/focus while still allowing polling to work correctly.\n// =============================================================================\n\n// --- Base Network Timing ---\n// Base has 2 second block times - this affects how quickly on-chain data propagates\nexport const BASE_BLOCK_TIME_MS = 2000;\n// Delay after transaction to allow RPC nodes to sync (block time + propagation margin)\nexport const RPC_PROPAGATION_DELAY_MS = 2000;\n\n// --- RPC Direct Reads (ProtocolViewer) ---\n// Used for instant on-chain data after transactions\nexport const RPC_STALE_TIME_MS = 3000; // Block time + 1s margin\nexport const RPC_GC_TIME_MS = 30000; // Keep in cache for quick re-access\n\n// --- Intent Polling (Active Swap Flow) ---\n// Fast polling for responsive UX during active order, pauses when tab hidden\nexport const INTENT_POLLING_INTERVAL_MS = 3000;\nexport const INTENT_STALE_TIME_MS = 2500; // < polling interval to prevent double-fetch on remount\n\n// --- Balance Polling ---\n// Background refresh for wallet balances, not critical path\nexport const BALANCE_POLLING_INTERVAL_MS = 30000;\nexport const BALANCE_STALE_TIME_MS = 25000; // < polling interval\n\n// --- Deposit List Polling ---\n// Slower polling for deposit management pages\nexport const DEPOSIT_REFETCH_INTERVAL = 300000; // 5 minutes\nexport const DEPOSIT_STALE_TIME_MS = 290000; // 4:50 - slightly less than polling\n\n// --- Liquidity Table Polling ---\n// Medium-frequency polling for orderbook/liquidity views\nexport const LIQUIDITY_POLLING_INTERVAL_MS = 60000; // 1 minute\nexport const LIQUIDITY_STALE_TIME_MS = 55000; // 55s - slightly less than polling\n\n// --- Backend API Queries ---\n// Longer stale times since RPC provides real-time data for critical flows\nexport const BACKEND_DEPOSITS_STALE_TIME_MS = 30000;\nexport const BACKEND_DEPOSITS_GC_TIME_MS = 120000; // 2 minutes\nexport const BACKEND_INTENTS_STALE_TIME_MS = 30000;\nexport const BACKEND_INTENTS_GC_TIME_MS = 60000; // 1 minute\nexport const BACKEND_DEPOSIT_ORDERS_STALE_TIME_MS = 30000;\nexport const BACKEND_DEPOSIT_ORDERS_GC_TIME_MS = 120000;\n\n// --- Proof Polling (Order Completion Flow) ---\n// Fast polling while waiting for proof generation\nexport const PROOF_POLL_INTERVAL_MS = 3000;\n\n// --- ENS Resolution ---\n// Long cache time since ENS names rarely change\nexport const ENS_STALE_TIME_MS = 900000; // 15 minutes\nexport const ENS_GC_TIME_MS = 1800000; // 30 minutes\n\n// --- Past Deposits (No Polling) ---\n// Historical data that only updates on explicit invalidation\nexport const PAST_DEPOSITS_STALE_TIME_MS = Infinity;\nexport const PAST_DEPOSITS_GC_TIME_MS = 60000;\n\n// =============================================================================\n// END QUERY & POLLING CONFIGURATION\n// =============================================================================\n\n// =============================================================================\n// SESSION STORAGE KEYS\n// =============================================================================\n// Namespaced keys for cross-component communication via sessionStorage.\n// These enable data-aware UI updates (e.g., skeleton clearing after deposits).\n//\n// Usage pattern:\n// 1. Component A sets a key before navigation/action\n// 2. Component B reads and clears the key on mount/update\n// 3. Component B uses the value to determine UI behavior\n//\n// All keys are namespaced with 'zkp2p:' to avoid collisions with other storage.\n// =============================================================================\n\n/**\n * Signals that the deposit list needs refreshing with skeleton loading.\n * Set by DepositDetailsView when closing a deposit before navigating back.\n * Cleared by Deposits/index.tsx after initiating refresh.\n */\nexport const DEPOSIT_REFRESH_PENDING_KEY = 'zkp2p:deposit:refreshPending';\n\n/**\n * Stores the deposit ID that was just closed.\n * Used for data-aware skeleton clearing - skeleton clears when this ID\n * is no longer present in the deposit list.\n * Set by DepositDetailsView, cleared by Deposits/index.tsx.\n */\nexport const DEPOSIT_CLOSED_ID_KEY = 'zkp2p:deposit:closedId';\n\n/**\n * Stores the expected deposit count after creating a new deposit.\n * Used for data-aware skeleton clearing - skeleton clears when the\n * actual count matches or exceeds the expected count.\n * Set by NewDeposit flow, cleared by Deposits/index.tsx.\n */\nexport const DEPOSIT_EXPECTED_COUNT_KEY = 'zkp2p:deposit:expectedCount';\n\n// =============================================================================\n// END SESSION STORAGE KEYS\n// =============================================================================\n\n// =============================================================================\n// UI TIMING CONSTANTS\n// =============================================================================\n// Constants for skeleton loading states, animations, and visual feedback timing.\n// These ensure consistent UX across the application.\n// =============================================================================\n\n/**\n * Minimum time to show skeleton loading state for visual feedback.\n * Prevents jarring flash if data loads very quickly.\n */\nexport const MIN_REFRESH_SKELETON_MS = 1500;\n\n/**\n * Maximum time to show skeleton loading state before giving up.\n * Safety timeout if data change detection fails.\n */\nexport const MAX_REFRESH_SKELETON_MS = 6000;\n\n// =============================================================================\n// END UI TIMING CONSTANTS\n// =============================================================================\n\n// Chain IDs\nconst BASE_MAINNET_CHAIN_ID = 8453;\nexport const BASE_SEPOLIA_CHAIN_ID = 84532;\nexport const SOLANA_CHAIN_ID = 792703809;\nexport const TRON_CHAIN_ID = 728126428;\nexport const HYPEREVM_CHAIN_ID = 999;\nexport const HYPERLIQUID_CHAIN_ID = 1337;\nexport const PLASMA_CHAIN_ID = 9745;\nexport const BITCOIN_CHAIN_ID = 8253038;\nexport const SUI_CHAIN_ID = 103665049;\nexport const TAIKO_CHAIN_ID = 167000;\n\n// Hyperliquid uses a special USDC token with different decimals\nexport const HYPERLIQUID_USDC_ADDRESS = \"0x00000000000000000000000000000000\";\n\n// Bitcoin uses a special address format for BTC\nexport const BITCOIN_BTC_ADDRESS = \"bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8\";\n\n// Both STAGING and PRODUCTION use Base mainnet\nexport const BASE_CHAIN_ID = BASE_MAINNET_CHAIN_ID;\n\n// USDC addresses\nconst BASE_MAINNET_USDC_ADDRESS = \"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913\";\nexport const BASE_USDC_ADDRESS = BASE_MAINNET_USDC_ADDRESS;\n\n// Excluded origin chains for Relay deposit-address flow (keep in sync with provider checks)\nexport const RELAY_DEPOSIT_ORIGIN_EXCLUDED_CHAIN_IDS: number[] = [\n BASE_MAINNET_CHAIN_ID, // Base mainnet\n BASE_SEPOLIA_CHAIN_ID, // Base Sepolia\n 43114, // Avalanche\n 1301, // Unichain\n 80084, // Berachain (testnet)\n 1088, // Metis\n 21000000, // Corn\n];\n\nexport const MINIMUM_DEPOSIT_AMOUNT = usdcUnits(0.1);\n\n// Order limit constants\nexport const MIN_ORDER_FLOOR = 5; // Minimum allowed order amount in USDC\nexport const MIN_ORDER_CAP = 50; // Maximum value for minimum order amount in USDC\nexport const MAX_ORDER_ADVISORY_THRESHOLD = 3000; // Advisory threshold for high per-order amounts in USDC\nexport const MIN_ORDER_DEPOSIT_THRESHOLD = 5; // Deposits below this amount are not subject to formula enforcement\nexport const DEFAULT_MAX_ORDER_CAP = 3000; // Default per-order cap applied when auto-filling max\n\n// Dust filtering threshold - hide liquidity entries below this USD value\nexport const DUST_THRESHOLD_USD = 5;\n\n// Extreme spread filtering threshold - hide orders with spread above this percentage\nexport const EXTREME_SPREAD_THRESHOLD_PERCENT = 100; // +100% spread\n\n// Success-rate and order-threshold configuration\nexport const MIN_ORDERS_FOR_SUCCESS_METRIC = 10; // minimum finalized intents before surfacing stats\nexport const LOW_SUCCESS_RATE_FILTER_PERCENT = 20; // Deposits below this hidden by default\nexport const LOW_SUCCESS_RATE_WARNING_PERCENT = 50; // Warn users below this completion rate\nexport const EXTREMELY_LOW_SUCCESS_RATE_PERCENT = 10; // Stronger warning badge threshold\n\n// Intent expiration fallback when indexer expiryTime unavailable.\n// On-chain: Production = 6 hours, Staging = 1 hour.\n// This is only used as a fallback; prefer expiryTime from indexer which reads the real on-chain value.\n// Note: In production, use the 6-hour default. Consuming apps can override this based on their environment.\nexport const INTENT_EXPIRATION_PERIOD_IN_SECONDS = 3600 * 6; // 6 hours (production default)\nexport const INTENT_EXPIRATION_PERIOD_STAGING_IN_SECONDS = 3600; // 1 hour (staging)\n\nexport const PRECISION = 1000000000000000000n; // 18\n\nexport const QUOTE_DEFAULT_ADDRESS = \"0x18Cc6F90512C6D95ACA0d57F98C727D61873c06a\";\nexport const QUOTE_DEFAULT_BTC_ADDRESS = \"34FzWazeBFL1mWF8tn36635hPsnJEzTrMR\"; // Default Bitcoin address for quotes\nexport const QUOTE_DEFAULT_SOL_ADDRESS = \"8pHKRNF3u8tndkUJ4euAddNWM9EAMWbUiK5GVmtaGY5U\";\nexport const QUOTE_DEFAULT_TRON_ADDRESS = \"TT2T17KZhoDu47i2E4FWxfG79zdkEWkU9N\"; // justin's tron address\nexport const QUOTE_DEFAULT_SUI_ADDRESS = \"0x2dad0710678565a0045073af0327a945e93c9c3bff31169ee689739558ed8b6b\";\n \n\n// the numeric form of the payload1 passed into the primitive\n// corresponds to the openssh signature produced by the following command:\n// echo \"E PLURIBUS UNUM; DO NOT SHARE\" | ssh-keygen -Y sign -n double-blind.xyz -f ~/.ssh/id_rsa | pbcopy\n \n\nexport const CLIENT_VERSION = \"3.0.0\";\n\n// circom constants from main.circom / https://zkrepl.dev/?gist=30d21c7a7285b1b14f608325f172417b\n// template RSAGroupSigVerify(n, k, levels) {\n// component main { public [ modulus ] } = RSAVerify(121, 17);\n// component main { public [ root, payload1 ] } = RSAGroupSigVerify(121, 17, 30);\n \n\n// Misc smart contract values\n \nexport const ZERO_ADDRESS = \"0x0000000000000000000000000000000000000000\";\n// Default intent guardian for V3 deposits\nexport const DEFAULT_INTENT_GUARDIAN_ADDRESS = \"0xe29a5BD4D0CEbA6C125A0361E7D20ab4eA275C2f\";\nexport const CALLER_ACCOUNT = \"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266\";\nexport const DEFAULT_NETWORK = \"base\";\n\n// Relay bridge app fee configuration\nexport const RELAY_APP_FEE_RECIPIENT = \"0x0bC26FF515411396DD588Abd6Ef6846E04470227\";\nexport const RELAY_APP_FEE_BPS = \"50\"; // 50 basis points = 0.5%\n\n// Cross-chain destination token addresses eligible for zero app fees when bridging from Base\nexport const RELAY_ZERO_FEE_TOKEN_ADDRESSES: Record<number, string[]> = {\n 1: [\n \"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48\", // USDC\n \"0xdAC17F958D2ee523a2206206994597C13D831ec7\", // USDT\n ],\n 10: [\n \"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85\", // USDC\n \"0x01bFf41798a0bcF287b996046cA68B395dbc1071\", // USDT\n ],\n 137: [\"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359\"], // Polygon PoS (USDC)\n 42161: [\n \"0xaf88d065e77c8cC2239327C5EDb3A432268e5831\", // USDC\n \"0xfd086BC7CD5C481DCC9C85ebe478A1C0b69FCbb9\", // USDT\n ],\n 43114: [\"0x9702230A8Ea53601F5cD2dc00fDBC13D4dF4A8c7\"], // Avalanche (USDT)\n 480: [\"0x79A02482A880bCe3F13E09da970dC34dB4cD24D1\"], // World Chain (USDC)\n [HYPEREVM_CHAIN_ID]: [\n \"0xb88339CB7199b77E23DB6E890353E22632Ba630f\", // USDC\n \"0xb8cE59fC3717AdA4C02EAdf9682A9e934F625ebb\", // USDT\n ],\n [PLASMA_CHAIN_ID]: [\n \"0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb\", // USDT0\n ],\n 1301: [\n \"0x078D782b760474a361dDA0AF3839290b0EF57AD6\", // USDC\n \"0x9151434b16b9763660705744891Fa906f660EcC5\", // USDT\n ],\n 1329: [\n \"0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392\", // USDC\n \"0x9151434b16b9763660705744891Fa906f660EcC5\", // USDT\n ],\n [HYPERLIQUID_CHAIN_ID]: [HYPERLIQUID_USDC_ADDRESS, \"0x25faEdc3F054130DBB4e4203AcA63567\"],\n 146: [\"0x29219dd400f2Bf60E5a23d13Be72B486D4038894\"], // Sonic (USDC)\n [SOLANA_CHAIN_ID]: [\n \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\", // USDC\n \"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB\", // USDT\n ],\n [TRON_CHAIN_ID]: [\"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t\"],\n 80084: [\"0x779dED0C9E1022225F8E0630B35a9B54Be713736\"], // Berachain (USDT)\n};\n\n// Proving key paths\n \n"]}
@@ -1,4 +1,4 @@
1
- import { currencyKeccak256 } from './chunk-J34QNX2H.mjs';
1
+ import { currencyKeccak256 } from './chunk-GNGQRV2U.mjs';
2
2
 
3
3
  // src/utils/currency.ts
4
4
  var Currency = {
@@ -122,5 +122,5 @@ function isSupportedCurrencyHash(hash) {
122
122
  }
123
123
 
124
124
  export { Currency, currencyInfo, getCurrencyCodeFromHash, getCurrencyInfoFromCountryCode, getCurrencyInfoFromHash, isSupportedCurrencyHash, mapConversionRatesToOnchain, mapConversionRatesToOnchainMinRate };
125
- //# sourceMappingURL=chunk-LZJL5J5X.mjs.map
126
- //# sourceMappingURL=chunk-LZJL5J5X.mjs.map
125
+ //# sourceMappingURL=chunk-IXZY7BSF.mjs.map
126
+ //# sourceMappingURL=chunk-IXZY7BSF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/currency.ts"],"names":[],"mappings":";;;AAiBO,IAAM,QAAA,GAAW;AAAA,EACtB,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,KAAA;AAAA,EACL,GAA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AAI,CAAA,EAAG,YAAA;AACxC;AAQO,SAAS,wBAAwB,IAAA,EAAuB;AAC7D,EAAA,OAAO,OAAA,CAAQ,uBAAA,CAAwB,IAAI,CAAC,CAAA;AAC9C","file":"chunk-LZJL5J5X.mjs","sourcesContent":["import { currencyKeccak256 } from './keccak';\n\n/**\n * Supported fiat currency codes.\n *\n * Use these constants when specifying currencies in conversion rates:\n *\n * @example\n * ```typescript\n * import { Currency } from '@zkp2p/sdk';\n *\n * const rates = [\n * { currency: Currency.USD, conversionRate: '1020000000000000000' },\n * { currency: Currency.EUR, conversionRate: '1100000000000000000' },\n * ];\n * ```\n */\nexport const Currency = {\n AED: 'AED',\n ARS: 'ARS',\n AUD: 'AUD',\n CAD: 'CAD',\n CHF: 'CHF',\n CNY: 'CNY',\n CZK: 'CZK',\n DKK: 'DKK',\n EUR: 'EUR',\n GBP: 'GBP',\n HKD: 'HKD',\n HUF: 'HUF',\n IDR: 'IDR',\n ILS: 'ILS',\n INR: 'INR',\n JPY: 'JPY',\n KES: 'KES',\n MXN: 'MXN',\n MYR: 'MYR',\n NOK: 'NOK',\n NZD: 'NZD',\n PHP: 'PHP',\n PLN: 'PLN',\n RON: 'RON',\n SAR: 'SAR',\n SEK: 'SEK',\n SGD: 'SGD',\n THB: 'THB',\n TRY: 'TRY',\n UGX: 'UGX',\n USD: 'USD',\n VND: 'VND',\n ZAR: 'ZAR'\n} as const;\n\n/**\n * Union type of all supported currency codes.\n */\nexport type CurrencyType = (typeof Currency)[keyof typeof Currency];\n\n/**\n * Complete currency information including name, symbol, and hash.\n */\nexport type CurrencyData = {\n currency: CurrencyType;\n currencyCode: string;\n currencyName: string;\n currencySymbol: string;\n currencyCodeHash: string;\n countryCode: string;\n};\n\n/**\n * Lookup table containing metadata for all supported currencies.\n *\n * Includes currency name, symbol, keccak256 hash (for on-chain use),\n * and ISO country code for flag display.\n *\n * @example\n * ```typescript\n * import { currencyInfo, Currency } from '@zkp2p/sdk';\n *\n * const usd = currencyInfo[Currency.USD];\n * console.log(usd.currencyName); // \"United States Dollar\"\n * console.log(usd.currencySymbol); // \"$\"\n * console.log(usd.currencyCodeHash); // \"0x...\"\n * ```\n */\nexport const currencyInfo: Record<CurrencyType, CurrencyData> = {\n AED: { currency: 'AED', currencyCode: 'AED', currencyName: 'United Arab Emirates Dirham', currencyCodeHash: currencyKeccak256('AED'), currencySymbol: 'د.إ', countryCode: 'ae' },\n ARS: { currency: 'ARS', currencyCode: 'ARS', currencyName: 'Argentine Peso', currencyCodeHash: currencyKeccak256('ARS'), currencySymbol: '$', countryCode: 'ar' },\n AUD: { currency: 'AUD', currencyCode: 'AUD', currencyName: 'Australian Dollar', currencyCodeHash: currencyKeccak256('AUD'), currencySymbol: 'A$', countryCode: 'au' },\n CAD: { currency: 'CAD', currencyCode: 'CAD', currencyName: 'Canadian Dollar', currencyCodeHash: currencyKeccak256('CAD'), currencySymbol: 'C$', countryCode: 'ca' },\n CHF: { currency: 'CHF', currencyCode: 'CHF', currencyName: 'Swiss Franc', currencyCodeHash: currencyKeccak256('CHF'), currencySymbol: 'Fr', countryCode: 'ch' },\n CNY: { currency: 'CNY', currencyCode: 'CNY', currencyName: 'Chinese Yuan', currencyCodeHash: currencyKeccak256('CNY'), currencySymbol: '¥', countryCode: 'cn' },\n CZK: { currency: 'CZK', currencyCode: 'CZK', currencyName: 'Czech Koruna', currencyCodeHash: currencyKeccak256('CZK'), currencySymbol: 'Kč', countryCode: 'cz' },\n DKK: { currency: 'DKK', currencyCode: 'DKK', currencyName: 'Danish Krone', currencyCodeHash: currencyKeccak256('DKK'), currencySymbol: 'kr', countryCode: 'dk' },\n EUR: { currency: 'EUR', currencyCode: 'EUR', currencyName: 'Euro', currencyCodeHash: currencyKeccak256('EUR'), currencySymbol: '€', countryCode: 'eu' },\n GBP: { currency: 'GBP', currencyCode: 'GBP', currencyName: 'British Pound', currencyCodeHash: currencyKeccak256('GBP'), currencySymbol: '£', countryCode: 'gb' },\n HKD: { currency: 'HKD', currencyCode: 'HKD', currencyName: 'Hong Kong Dollar', currencyCodeHash: currencyKeccak256('HKD'), currencySymbol: 'HK$', countryCode: 'hk' },\n HUF: { currency: 'HUF', currencyCode: 'HUF', currencyName: 'Hungarian Forint', currencyCodeHash: currencyKeccak256('HUF'), currencySymbol: 'Ft', countryCode: 'hu' },\n IDR: { currency: 'IDR', currencyCode: 'IDR', currencyName: 'Indonesian Rupiah', currencyCodeHash: currencyKeccak256('IDR'), currencySymbol: 'Rp', countryCode: 'id' },\n ILS: { currency: 'ILS', currencyCode: 'ILS', currencyName: 'Israeli New Shekel', currencyCodeHash: currencyKeccak256('ILS'), currencySymbol: '₪', countryCode: 'il' },\n INR: { currency: 'INR', currencyCode: 'INR', currencyName: 'Indian Rupee', currencyCodeHash: currencyKeccak256('INR'), currencySymbol: '₹', countryCode: 'in' },\n JPY: { currency: 'JPY', currencyCode: 'JPY', currencyName: 'Japanese Yen', currencyCodeHash: currencyKeccak256('JPY'), currencySymbol: '¥', countryCode: 'jp' },\n KES: { currency: 'KES', currencyCode: 'KES', currencyName: 'Kenyan Shilling', currencyCodeHash: currencyKeccak256('KES'), currencySymbol: 'KSh', countryCode: 'ke' },\n MXN: { currency: 'MXN', currencyCode: 'MXN', currencyName: 'Mexican Peso', currencyCodeHash: currencyKeccak256('MXN'), currencySymbol: '$', countryCode: 'mx' },\n MYR: { currency: 'MYR', currencyCode: 'MYR', currencyName: 'Malaysian Ringgit', currencyCodeHash: currencyKeccak256('MYR'), currencySymbol: 'RM', countryCode: 'my' },\n NOK: { currency: 'NOK', currencyCode: 'NOK', currencyName: 'Norwegian Krone', currencyCodeHash: currencyKeccak256('NOK'), currencySymbol: 'kr', countryCode: 'no' },\n NZD: { currency: 'NZD', currencyCode: 'NZD', currencyName: 'New Zealand Dollar', currencyCodeHash: currencyKeccak256('NZD'), currencySymbol: 'NZ$', countryCode: 'nz' },\n PHP: { currency: 'PHP', currencyCode: 'PHP', currencyName: 'Philippine Peso', currencyCodeHash: currencyKeccak256('PHP'), currencySymbol: '₱', countryCode: 'ph' },\n PLN: { currency: 'PLN', currencyCode: 'PLN', currencyName: 'Polish Złoty', currencyCodeHash: currencyKeccak256('PLN'), currencySymbol: 'zł', countryCode: 'pl' },\n RON: { currency: 'RON', currencyCode: 'RON', currencyName: 'Romanian Leu', currencyCodeHash: currencyKeccak256('RON'), currencySymbol: 'lei', countryCode: 'ro' },\n SAR: { currency: 'SAR', currencyCode: 'SAR', currencyName: 'Saudi Riyal', currencyCodeHash: currencyKeccak256('SAR'), currencySymbol: '﷼', countryCode: 'sa' },\n SEK: { currency: 'SEK', currencyCode: 'SEK', currencyName: 'Swedish Krona', currencyCodeHash: currencyKeccak256('SEK'), currencySymbol: 'kr', countryCode: 'se' },\n SGD: { currency: 'SGD', currencyCode: 'SGD', currencyName: 'Singapore Dollar', currencyCodeHash: currencyKeccak256('SGD'), currencySymbol: 'S$', countryCode: 'sg' },\n THB: { currency: 'THB', currencyCode: 'THB', currencyName: 'Thai Baht', currencyCodeHash: currencyKeccak256('THB'), currencySymbol: '฿', countryCode: 'th' },\n TRY: { currency: 'TRY', currencyCode: 'TRY', currencyName: 'Turkish Lira', currencyCodeHash: currencyKeccak256('TRY'), currencySymbol: '₺', countryCode: 'tr' },\n UGX: { currency: 'UGX', currencyCode: 'UGX', currencyName: 'Ugandan Shilling', currencyCodeHash: currencyKeccak256('UGX'), currencySymbol: 'USh', countryCode: 'ug' },\n USD: { currency: 'USD', currencyCode: 'USD', currencyName: 'United States Dollar', currencyCodeHash: currencyKeccak256('USD'), currencySymbol: '$', countryCode: 'us' },\n VND: { currency: 'VND', currencyCode: 'VND', currencyName: 'Vietnamese Dong', currencyCodeHash: currencyKeccak256('VND'), currencySymbol: '₫', countryCode: 'vn' },\n ZAR: { currency: 'ZAR', currencyCode: 'ZAR', currencyName: 'South African Rand', currencyCodeHash: currencyKeccak256('ZAR'), currencySymbol: 'R', countryCode: 'za' },\n} as unknown as Record<CurrencyType, CurrencyData>;\n\n/**\n * UI-friendly currency rate structure used in SDK methods.\n */\nexport type UICurrencyRate = { currency: CurrencyType; conversionRate: string };\n\n/**\n * On-chain currency structure with bytes32 code and bigint rate.\n */\nexport type OnchainCurrency = { code: `0x${string}`; conversionRate: bigint };\n\n/**\n * Maps UI currency rates to on-chain format.\n *\n * @param groups - Nested array of currency rates per payment method\n * @param expectedGroups - Expected number of groups (for validation)\n * @returns On-chain formatted currency arrays\n * @throws Error if groups structure is invalid or lengths don't match\n *\n * @internal Used by createDeposit internally\n */\nexport function mapConversionRatesToOnchain(\n groups: UICurrencyRate[][],\n expectedGroups?: number\n): OnchainCurrency[][] {\n if (!Array.isArray(groups) || !Array.isArray(groups[0])) {\n throw new Error('conversionRates must be a nested array per processor');\n }\n if (typeof expectedGroups === 'number' && groups.length !== expectedGroups) {\n throw new Error(`conversionRates length (${groups.length}) must match processorNames length (${expectedGroups})`);\n }\n return groups.map((group) => group.map((r) => {\n const info = currencyInfo[r.currency as CurrencyType];\n if (!info?.currencyCodeHash) throw new Error('Invalid currency');\n return { code: info.currencyCodeHash as `0x${string}`, conversionRate: BigInt(r.conversionRate) };\n }));\n}\n\n/**\n * On-chain currency structure with minimum conversion rate (V3 escrow format).\n */\nexport type OnchainCurrencyMinRate = { code: `0x${string}`; minConversionRate: bigint };\n\n/**\n * Maps UI currency rates to on-chain V3 escrow format with minConversionRate.\n *\n * @param groups - Nested array of currency rates per payment method\n * @param expectedGroups - Expected number of groups (for validation)\n * @returns On-chain formatted currency arrays for V3 escrow\n * @throws Error if groups structure is invalid or lengths don't match\n */\nexport function mapConversionRatesToOnchainMinRate(\n groups: UICurrencyRate[][],\n expectedGroups?: number\n): OnchainCurrencyMinRate[][] {\n if (!Array.isArray(groups) || !Array.isArray(groups[0])) {\n throw new Error('conversionRates must be a nested array per payment method');\n }\n if (typeof expectedGroups === 'number' && groups.length !== expectedGroups) {\n throw new Error(`conversionRates length (${groups.length}) must match processorNames length (${expectedGroups})`);\n }\n return groups.map((group) =>\n group.map((r) => {\n const info = currencyInfo[r.currency as CurrencyType];\n const hash = info?.currencyCodeHash as `0x${string}` | undefined;\n if (!hash) throw new Error(`Invalid currency: ${r.currency}`);\n return { code: hash, minConversionRate: BigInt(r.conversionRate) };\n })\n );\n}\n\n/**\n * Looks up currency info by its keccak256 hash.\n *\n * @param hash - The currency code hash (0x-prefixed)\n * @returns Currency data if found, undefined otherwise\n *\n * @example\n * ```typescript\n * const info = getCurrencyInfoFromHash('0x...');\n * if (info) {\n * console.log(info.currencyCode); // \"USD\"\n * }\n * ```\n */\nexport function getCurrencyInfoFromHash(hash: string): CurrencyData | undefined {\n if (!hash) return undefined;\n const h = hash.toLowerCase();\n for (const key of Object.keys(currencyInfo) as Array<keyof typeof currencyInfo>) {\n const info = currencyInfo[key];\n if (info?.currencyCodeHash?.toLowerCase() === h) return info;\n }\n return undefined;\n}\n\n/**\n * Looks up currency info by ISO country code.\n *\n * @param code - The ISO country code (e.g., 'US', 'GB')\n * @returns Currency data if found, undefined otherwise\n */\nexport function getCurrencyInfoFromCountryCode(code: string): CurrencyData | undefined {\n if (!code) return undefined;\n const upper = code.toUpperCase() as CurrencyType;\n return currencyInfo[upper];\n}\n\n/**\n * Converts a currency hash to its ISO currency code.\n *\n * @param hash - The currency code hash (0x-prefixed)\n * @returns Currency code string (e.g., 'USD') or undefined if not found\n *\n * @example\n * ```typescript\n * const code = getCurrencyCodeFromHash('0x...');\n * console.log(code); // \"USD\"\n * ```\n */\nexport function getCurrencyCodeFromHash(hash: string): string | undefined {\n return getCurrencyInfoFromHash(hash)?.currencyCode;\n}\n\n/**\n * Checks if a currency hash is recognized by the SDK.\n *\n * @param hash - The currency code hash to check\n * @returns true if the hash corresponds to a supported currency\n */\nexport function isSupportedCurrencyHash(hash: string): boolean {\n return Boolean(getCurrencyInfoFromHash(hash));\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/currency.ts"],"names":[],"mappings":";;;AAiBO,IAAM,QAAA,GAAW;AAAA,EACtB,GAAA,EAAK,KAAA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A,EAAM,mBAAmB,MAAA,CAAO,CAAA,CAAE,cAAc,CAAA,EAAE;AAAA,IACnE,CAAC;AAAA,GACH;AACF;AAgBO,SAAS,wBAAwB,IAAA,EAAwC;AAC9E,EAAA,IAAI,CAAC,MAAM,OAAO,MAAA;AAClB,EAAA,MAAM,CAAA,GAAI,KAAK,WAAA,EAAY;AAC3B,EAAA,KAAA,MAAW,GAAA,IAAO,MAAA,CAAO,IAAA,CAAK,YAAY,CAAA,EAAuC;AAC/E,IAAA,MAAM,IAAA,GAAO,aAAa,GAAG,CAAA;AAC7B,IAAA,IAAI,IAAA,EAAM,gBAAA,EAAkB,WAAA,EAAY,KAAM,GAAG,OAAO,IAAA;AAAA,EAC1D;AACA,EAAA,OAAO,MAAA;AACT;AAQO,SAAS,+BAA+B,IAAA,EAAwC;AACrF,EAAA,IAAI,CAAC,MAAM,OAAO,MAAA;AAClB,EAAA,MAAM,KAAA,GAAQ,KAAK,WAAA,EAAY;AAC/B,EAAA,OAAO,aAAa,KAAK,CAAA;AAC3B;AAcO,SAAS,wBAAwB,IAAA,EAAkC;AACxE,EAAA,OAAO,uBAAA,CAAwB,IAAI,CAAA,EAAG,YAAA;AACxC;AAQO,SAAS,wBAAwB,IAAA,EAAuB;AAC7D,EAAA,OAAO,OAAA,CAAQ,uBAAA,CAAwB,IAAI,CAAC,CAAA;AAC9C","file":"chunk-IXZY7BSF.mjs","sourcesContent":["import { currencyKeccak256 } from './keccak';\n\n/**\n * Supported fiat currency codes.\n *\n * Use these constants when specifying currencies in conversion rates:\n *\n * @example\n * ```typescript\n * import { Currency } from '@zkp2p/sdk';\n *\n * const rates = [\n * { currency: Currency.USD, conversionRate: '1020000000000000000' },\n * { currency: Currency.EUR, conversionRate: '1100000000000000000' },\n * ];\n * ```\n */\nexport const Currency = {\n AED: 'AED',\n ARS: 'ARS',\n AUD: 'AUD',\n CAD: 'CAD',\n CHF: 'CHF',\n CNY: 'CNY',\n CZK: 'CZK',\n DKK: 'DKK',\n EUR: 'EUR',\n GBP: 'GBP',\n HKD: 'HKD',\n HUF: 'HUF',\n IDR: 'IDR',\n ILS: 'ILS',\n INR: 'INR',\n JPY: 'JPY',\n KES: 'KES',\n MXN: 'MXN',\n MYR: 'MYR',\n NOK: 'NOK',\n NZD: 'NZD',\n PHP: 'PHP',\n PLN: 'PLN',\n RON: 'RON',\n SAR: 'SAR',\n SEK: 'SEK',\n SGD: 'SGD',\n THB: 'THB',\n TRY: 'TRY',\n UGX: 'UGX',\n USD: 'USD',\n VND: 'VND',\n ZAR: 'ZAR'\n} as const;\n\n/**\n * Union type of all supported currency codes.\n */\nexport type CurrencyType = (typeof Currency)[keyof typeof Currency];\n\n/**\n * Complete currency information including name, symbol, and hash.\n */\nexport type CurrencyData = {\n currency: CurrencyType;\n currencyCode: string;\n currencyName: string;\n currencySymbol: string;\n currencyCodeHash: string;\n countryCode: string;\n};\n\n/**\n * Lookup table containing metadata for all supported currencies.\n *\n * Includes currency name, symbol, keccak256 hash (for on-chain use),\n * and ISO country code for flag display.\n *\n * @example\n * ```typescript\n * import { currencyInfo, Currency } from '@zkp2p/sdk';\n *\n * const usd = currencyInfo[Currency.USD];\n * console.log(usd.currencyName); // \"United States Dollar\"\n * console.log(usd.currencySymbol); // \"$\"\n * console.log(usd.currencyCodeHash); // \"0x...\"\n * ```\n */\nexport const currencyInfo: Record<CurrencyType, CurrencyData> = {\n AED: { currency: 'AED', currencyCode: 'AED', currencyName: 'United Arab Emirates Dirham', currencyCodeHash: currencyKeccak256('AED'), currencySymbol: 'د.إ', countryCode: 'ae' },\n ARS: { currency: 'ARS', currencyCode: 'ARS', currencyName: 'Argentine Peso', currencyCodeHash: currencyKeccak256('ARS'), currencySymbol: '$', countryCode: 'ar' },\n AUD: { currency: 'AUD', currencyCode: 'AUD', currencyName: 'Australian Dollar', currencyCodeHash: currencyKeccak256('AUD'), currencySymbol: 'A$', countryCode: 'au' },\n CAD: { currency: 'CAD', currencyCode: 'CAD', currencyName: 'Canadian Dollar', currencyCodeHash: currencyKeccak256('CAD'), currencySymbol: 'C$', countryCode: 'ca' },\n CHF: { currency: 'CHF', currencyCode: 'CHF', currencyName: 'Swiss Franc', currencyCodeHash: currencyKeccak256('CHF'), currencySymbol: 'Fr', countryCode: 'ch' },\n CNY: { currency: 'CNY', currencyCode: 'CNY', currencyName: 'Chinese Yuan', currencyCodeHash: currencyKeccak256('CNY'), currencySymbol: '¥', countryCode: 'cn' },\n CZK: { currency: 'CZK', currencyCode: 'CZK', currencyName: 'Czech Koruna', currencyCodeHash: currencyKeccak256('CZK'), currencySymbol: 'Kč', countryCode: 'cz' },\n DKK: { currency: 'DKK', currencyCode: 'DKK', currencyName: 'Danish Krone', currencyCodeHash: currencyKeccak256('DKK'), currencySymbol: 'kr', countryCode: 'dk' },\n EUR: { currency: 'EUR', currencyCode: 'EUR', currencyName: 'Euro', currencyCodeHash: currencyKeccak256('EUR'), currencySymbol: '€', countryCode: 'eu' },\n GBP: { currency: 'GBP', currencyCode: 'GBP', currencyName: 'British Pound', currencyCodeHash: currencyKeccak256('GBP'), currencySymbol: '£', countryCode: 'gb' },\n HKD: { currency: 'HKD', currencyCode: 'HKD', currencyName: 'Hong Kong Dollar', currencyCodeHash: currencyKeccak256('HKD'), currencySymbol: 'HK$', countryCode: 'hk' },\n HUF: { currency: 'HUF', currencyCode: 'HUF', currencyName: 'Hungarian Forint', currencyCodeHash: currencyKeccak256('HUF'), currencySymbol: 'Ft', countryCode: 'hu' },\n IDR: { currency: 'IDR', currencyCode: 'IDR', currencyName: 'Indonesian Rupiah', currencyCodeHash: currencyKeccak256('IDR'), currencySymbol: 'Rp', countryCode: 'id' },\n ILS: { currency: 'ILS', currencyCode: 'ILS', currencyName: 'Israeli New Shekel', currencyCodeHash: currencyKeccak256('ILS'), currencySymbol: '₪', countryCode: 'il' },\n INR: { currency: 'INR', currencyCode: 'INR', currencyName: 'Indian Rupee', currencyCodeHash: currencyKeccak256('INR'), currencySymbol: '₹', countryCode: 'in' },\n JPY: { currency: 'JPY', currencyCode: 'JPY', currencyName: 'Japanese Yen', currencyCodeHash: currencyKeccak256('JPY'), currencySymbol: '¥', countryCode: 'jp' },\n KES: { currency: 'KES', currencyCode: 'KES', currencyName: 'Kenyan Shilling', currencyCodeHash: currencyKeccak256('KES'), currencySymbol: 'KSh', countryCode: 'ke' },\n MXN: { currency: 'MXN', currencyCode: 'MXN', currencyName: 'Mexican Peso', currencyCodeHash: currencyKeccak256('MXN'), currencySymbol: '$', countryCode: 'mx' },\n MYR: { currency: 'MYR', currencyCode: 'MYR', currencyName: 'Malaysian Ringgit', currencyCodeHash: currencyKeccak256('MYR'), currencySymbol: 'RM', countryCode: 'my' },\n NOK: { currency: 'NOK', currencyCode: 'NOK', currencyName: 'Norwegian Krone', currencyCodeHash: currencyKeccak256('NOK'), currencySymbol: 'kr', countryCode: 'no' },\n NZD: { currency: 'NZD', currencyCode: 'NZD', currencyName: 'New Zealand Dollar', currencyCodeHash: currencyKeccak256('NZD'), currencySymbol: 'NZ$', countryCode: 'nz' },\n PHP: { currency: 'PHP', currencyCode: 'PHP', currencyName: 'Philippine Peso', currencyCodeHash: currencyKeccak256('PHP'), currencySymbol: '₱', countryCode: 'ph' },\n PLN: { currency: 'PLN', currencyCode: 'PLN', currencyName: 'Polish Złoty', currencyCodeHash: currencyKeccak256('PLN'), currencySymbol: 'zł', countryCode: 'pl' },\n RON: { currency: 'RON', currencyCode: 'RON', currencyName: 'Romanian Leu', currencyCodeHash: currencyKeccak256('RON'), currencySymbol: 'lei', countryCode: 'ro' },\n SAR: { currency: 'SAR', currencyCode: 'SAR', currencyName: 'Saudi Riyal', currencyCodeHash: currencyKeccak256('SAR'), currencySymbol: '﷼', countryCode: 'sa' },\n SEK: { currency: 'SEK', currencyCode: 'SEK', currencyName: 'Swedish Krona', currencyCodeHash: currencyKeccak256('SEK'), currencySymbol: 'kr', countryCode: 'se' },\n SGD: { currency: 'SGD', currencyCode: 'SGD', currencyName: 'Singapore Dollar', currencyCodeHash: currencyKeccak256('SGD'), currencySymbol: 'S$', countryCode: 'sg' },\n THB: { currency: 'THB', currencyCode: 'THB', currencyName: 'Thai Baht', currencyCodeHash: currencyKeccak256('THB'), currencySymbol: '฿', countryCode: 'th' },\n TRY: { currency: 'TRY', currencyCode: 'TRY', currencyName: 'Turkish Lira', currencyCodeHash: currencyKeccak256('TRY'), currencySymbol: '₺', countryCode: 'tr' },\n UGX: { currency: 'UGX', currencyCode: 'UGX', currencyName: 'Ugandan Shilling', currencyCodeHash: currencyKeccak256('UGX'), currencySymbol: 'USh', countryCode: 'ug' },\n USD: { currency: 'USD', currencyCode: 'USD', currencyName: 'United States Dollar', currencyCodeHash: currencyKeccak256('USD'), currencySymbol: '$', countryCode: 'us' },\n VND: { currency: 'VND', currencyCode: 'VND', currencyName: 'Vietnamese Dong', currencyCodeHash: currencyKeccak256('VND'), currencySymbol: '₫', countryCode: 'vn' },\n ZAR: { currency: 'ZAR', currencyCode: 'ZAR', currencyName: 'South African Rand', currencyCodeHash: currencyKeccak256('ZAR'), currencySymbol: 'R', countryCode: 'za' },\n} as unknown as Record<CurrencyType, CurrencyData>;\n\n/**\n * UI-friendly currency rate structure used in SDK methods.\n */\nexport type UICurrencyRate = { currency: CurrencyType; conversionRate: string };\n\n/**\n * On-chain currency structure with bytes32 code and bigint rate.\n */\nexport type OnchainCurrency = { code: `0x${string}`; conversionRate: bigint };\n\n/**\n * Maps UI currency rates to on-chain format.\n *\n * @param groups - Nested array of currency rates per payment method\n * @param expectedGroups - Expected number of groups (for validation)\n * @returns On-chain formatted currency arrays\n * @throws Error if groups structure is invalid or lengths don't match\n *\n * @internal Used by createDeposit internally\n */\nexport function mapConversionRatesToOnchain(\n groups: UICurrencyRate[][],\n expectedGroups?: number\n): OnchainCurrency[][] {\n if (!Array.isArray(groups) || !Array.isArray(groups[0])) {\n throw new Error('conversionRates must be a nested array per processor');\n }\n if (typeof expectedGroups === 'number' && groups.length !== expectedGroups) {\n throw new Error(`conversionRates length (${groups.length}) must match processorNames length (${expectedGroups})`);\n }\n return groups.map((group) => group.map((r) => {\n const info = currencyInfo[r.currency as CurrencyType];\n if (!info?.currencyCodeHash) throw new Error('Invalid currency');\n return { code: info.currencyCodeHash as `0x${string}`, conversionRate: BigInt(r.conversionRate) };\n }));\n}\n\n/**\n * On-chain currency structure with minimum conversion rate (V3 escrow format).\n */\nexport type OnchainCurrencyMinRate = { code: `0x${string}`; minConversionRate: bigint };\n\n/**\n * Maps UI currency rates to on-chain V3 escrow format with minConversionRate.\n *\n * @param groups - Nested array of currency rates per payment method\n * @param expectedGroups - Expected number of groups (for validation)\n * @returns On-chain formatted currency arrays for V3 escrow\n * @throws Error if groups structure is invalid or lengths don't match\n */\nexport function mapConversionRatesToOnchainMinRate(\n groups: UICurrencyRate[][],\n expectedGroups?: number\n): OnchainCurrencyMinRate[][] {\n if (!Array.isArray(groups) || !Array.isArray(groups[0])) {\n throw new Error('conversionRates must be a nested array per payment method');\n }\n if (typeof expectedGroups === 'number' && groups.length !== expectedGroups) {\n throw new Error(`conversionRates length (${groups.length}) must match processorNames length (${expectedGroups})`);\n }\n return groups.map((group) =>\n group.map((r) => {\n const info = currencyInfo[r.currency as CurrencyType];\n const hash = info?.currencyCodeHash as `0x${string}` | undefined;\n if (!hash) throw new Error(`Invalid currency: ${r.currency}`);\n return { code: hash, minConversionRate: BigInt(r.conversionRate) };\n })\n );\n}\n\n/**\n * Looks up currency info by its keccak256 hash.\n *\n * @param hash - The currency code hash (0x-prefixed)\n * @returns Currency data if found, undefined otherwise\n *\n * @example\n * ```typescript\n * const info = getCurrencyInfoFromHash('0x...');\n * if (info) {\n * console.log(info.currencyCode); // \"USD\"\n * }\n * ```\n */\nexport function getCurrencyInfoFromHash(hash: string): CurrencyData | undefined {\n if (!hash) return undefined;\n const h = hash.toLowerCase();\n for (const key of Object.keys(currencyInfo) as Array<keyof typeof currencyInfo>) {\n const info = currencyInfo[key];\n if (info?.currencyCodeHash?.toLowerCase() === h) return info;\n }\n return undefined;\n}\n\n/**\n * Looks up currency info by ISO country code.\n *\n * @param code - The ISO country code (e.g., 'US', 'GB')\n * @returns Currency data if found, undefined otherwise\n */\nexport function getCurrencyInfoFromCountryCode(code: string): CurrencyData | undefined {\n if (!code) return undefined;\n const upper = code.toUpperCase() as CurrencyType;\n return currencyInfo[upper];\n}\n\n/**\n * Converts a currency hash to its ISO currency code.\n *\n * @param hash - The currency code hash (0x-prefixed)\n * @returns Currency code string (e.g., 'USD') or undefined if not found\n *\n * @example\n * ```typescript\n * const code = getCurrencyCodeFromHash('0x...');\n * console.log(code); // \"USD\"\n * ```\n */\nexport function getCurrencyCodeFromHash(hash: string): string | undefined {\n return getCurrencyInfoFromHash(hash)?.currencyCode;\n}\n\n/**\n * Checks if a currency hash is recognized by the SDK.\n *\n * @param hash - The currency code hash to check\n * @returns true if the hash corresponds to a supported currency\n */\nexport function isSupportedCurrencyHash(hash: string): boolean {\n return Boolean(getCurrencyInfoFromHash(hash));\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { resolvePaymentMethodNameFromHash } from './chunk-MWFONYDJ.mjs';
2
- import { getCurrencyInfoFromHash } from './chunk-LZJL5J5X.mjs';
1
+ import { resolvePaymentMethodNameFromHash } from './chunk-RMWIECY7.mjs';
2
+ import { getCurrencyInfoFromHash } from './chunk-IXZY7BSF.mjs';
3
3
  import baseAddressesRaw from '@zkp2p/contracts-v2/addresses/base';
4
4
  import baseSepoliaAddressesRaw from '@zkp2p/contracts-v2/addresses/baseSepolia';
5
5
  import baseStagingAddressesRaw from '@zkp2p/contracts-v2/addresses/baseStaging';
@@ -240,5 +240,5 @@ function enrichPvIntentView(view, chainId, env = "production") {
240
240
  }
241
241
 
242
242
  export { enrichPvDepositView, enrichPvIntentView, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, parseDepositView, parseIntentView };
243
- //# sourceMappingURL=chunk-NRU6Z6WS.mjs.map
244
- //# sourceMappingURL=chunk-NRU6Z6WS.mjs.map
243
+ //# sourceMappingURL=chunk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O;AAAA,QACpC,GAAG,CAAA;AAAA,QACH,YAAA,EAAc,uBAAA,CAAwB,CAAA,CAAE,IAAI;AAAA,OAC9C,CAAE;AAAA,KACJ,CAAE;AAAA,GACJ;AACF;AAEO,SAAS,kBAAA,CAAmB,IAAA,EAAqB,OAAA,EAAiB,GAAA,GAAkB,YAAA,EAAc;AACvG,EAAA,MAAM,OAAA,GAAU,wBAAA,CAAyB,OAAA,EAAS,GAAG,CAAA;AACrD,EAAA,OAAO;AAAA,IACL,GAAG,IAAA;AAAA,IACH,MAAA,EAAQ;AAAA,MACN,GAAG,IAAA,CAAK,MAAA;AAAA,MACR,aAAA,EAAe,gCAAA,CAAiC,IAAA,CAAK,MAAA,CAAO,eAAe,OAAO,CAAA;AAAA,MAClF,YAAA,EAAc,uBAAA,CAAwB,IAAA,CAAK,MAAA,CAAO,YAAY;AAAA,KAChE;AAAA,IACA,OAAA,EAAS,mBAAA,CAAoB,IAAA,CAAK,OAAA,EAAgB,SAAS,GAAG;AAAA,GAChE;AACF","file":"chunk-NRU6Z6WS.mjs","sourcesContent":["/**\n * Contract resolution utilities for the SDK.\n *\n * Provides access to deployed contract addresses and ABIs for different\n * networks (Base, Base Sepolia) and environments (production, staging).\n *\n * @module contracts\n */\n\nimport type { Abi } from 'abitype';\n\n// Typed imports from @zkp2p/contracts-v2 (module declarations provided in src/@types)\n// Use *Raw suffix for imports that need runtime normalization (addresses, constants)\nimport baseAddressesRaw from '@zkp2p/contracts-v2/addresses/base';\nimport baseSepoliaAddressesRaw from '@zkp2p/contracts-v2/addresses/baseSepolia';\nimport baseStagingAddressesRaw from '@zkp2p/contracts-v2/addresses/baseStaging';\n\nimport EscrowBase from '@zkp2p/contracts-v2/abis/base/Escrow.json';\nimport OrchestratorBase from '@zkp2p/contracts-v2/abis/base/Orchestrator.json';\nimport ProtocolViewerBase from '@zkp2p/contracts-v2/abis/base/ProtocolViewer.json';\nimport UnifiedPaymentVerifierBase from '@zkp2p/contracts-v2/abis/base/UnifiedPaymentVerifier.json';\n\nimport EscrowBaseSepolia from '@zkp2p/contracts-v2/abis/baseSepolia/Escrow.json';\nimport OrchestratorBaseSepolia from '@zkp2p/contracts-v2/abis/baseSepolia/Orchestrator.json';\nimport ProtocolViewerBaseSepolia from '@zkp2p/contracts-v2/abis/baseSepolia/ProtocolViewer.json';\nimport UnifiedPaymentVerifierBaseSepolia from '@zkp2p/contracts-v2/abis/baseSepolia/UnifiedPaymentVerifier.json';\n\nimport EscrowBaseStaging from '@zkp2p/contracts-v2/abis/baseStaging/Escrow.json';\nimport OrchestratorBaseStaging from '@zkp2p/contracts-v2/abis/baseStaging/Orchestrator.json';\nimport UnifiedPaymentVerifierBaseStaging from '@zkp2p/contracts-v2/abis/baseStaging/UnifiedPaymentVerifier.json';\nimport ProtocolViewerBaseStaging from '@zkp2p/contracts-v2/abis/baseStaging/ProtocolViewer.json';\n\nimport baseConstantsRaw from '@zkp2p/contracts-v2/constants/base';\nimport baseStagingConstantsRaw from '@zkp2p/contracts-v2/constants/baseStaging';\n// Payment methods catalogs (JSON). Import statically so ESM bundlers include the data.\n// These modules are present in @zkp2p/contracts-v2; tsconfig sets resolveJsonModule: true\nimport basePaymentMethodsRaw from '@zkp2p/contracts-v2/paymentMethods/base.json';\nimport baseSepoliaPaymentMethodsRaw from '@zkp2p/contracts-v2/paymentMethods/baseSepolia.json';\nimport baseStagingPaymentMethodsRaw from '@zkp2p/contracts-v2/paymentMethods/baseStaging.json';\n\n// ---------------------------------------------------------------------------\n// Runtime normalization helpers for ESM/CJS interoperability\n// ---------------------------------------------------------------------------\n// In certain runtimes (tsx, Node ESM), deep imports from @zkp2p/contracts-v2\n// resolve as { default: [Getter] } or { default: { contracts: {...} } } instead\n// of the expected shape. These helpers unwrap the actual data regardless of shape.\n\n/**\n * Normalize address module shape. Handles:\n * - { contracts: {...} } (direct)\n * - { default: { contracts: {...} } } (wrapped)\n * - { default: [Getter] } (lazy)\n */\nfunction unwrapAddresses(mod: unknown): { name?: string; chainId?: number; contracts?: Record<string, `0x${string}`> } {\n if (!mod) return {} as ReturnType<typeof unwrapAddresses>;\n const m = mod as Record<string, unknown>;\n // Direct shape\n if (m.contracts) return m as ReturnType<typeof unwrapAddresses>;\n // Wrapped shape\n if ((m.default as Record<string, unknown>)?.contracts) return m.default as ReturnType<typeof unwrapAddresses>;\n // Lazy getter shape\n try {\n const d = typeof m.default === 'function' ? (m.default as () => unknown)() : m.default;\n if ((d as Record<string, unknown>)?.contracts) return d as ReturnType<typeof unwrapAddresses>;\n } catch {\n // ignore\n }\n return m as ReturnType<typeof unwrapAddresses>;\n}\n\n/**\n * Normalize payment methods module shape. Handles:\n * - { methods: {...} } (direct)\n * - { default: { methods: {...} } } (wrapped)\n * - { default: [Getter] } (lazy)\n */\nfunction unwrapMethods(mod: unknown): { methods?: Record<string, { paymentMethodHash: `0x${string}`; currencies?: `0x${string}`[] }> } {\n if (!mod) return {} as ReturnType<typeof unwrapMethods>;\n const m = mod as Record<string, unknown>;\n if (m.methods) return m as ReturnType<typeof unwrapMethods>;\n if ((m.default as Record<string, unknown>)?.methods) return m.default as ReturnType<typeof unwrapMethods>;\n try {\n const d = typeof m.default === 'function' ? (m.default as () => unknown)() : m.default;\n if ((d as Record<string, unknown>)?.methods) return d as ReturnType<typeof unwrapMethods>;\n } catch {\n // ignore\n }\n return m as ReturnType<typeof unwrapMethods>;\n}\n\n/**\n * Normalize constants module shape (for USDC address, etc.)\n */\nfunction unwrapConstants(mod: unknown): Record<string, unknown> {\n if (!mod) return {};\n const m = mod as Record<string, unknown>;\n if (m.USDC) return m;\n if ((m.default as Record<string, unknown>)?.USDC) return m.default as Record<string, unknown>;\n try {\n const d = typeof m.default === 'function' ? (m.default as () => unknown)() : m.default;\n if ((d as Record<string, unknown>)?.USDC) return d as Record<string, unknown>;\n } catch {\n // ignore\n }\n return m;\n}\n\n// Apply runtime normalization to all imports\nconst baseAddresses = unwrapAddresses(baseAddressesRaw);\nconst baseSepoliaAddresses = unwrapAddresses(baseSepoliaAddressesRaw);\nconst baseStagingAddresses = unwrapAddresses(baseStagingAddressesRaw);\nconst basePaymentMethods = unwrapMethods(basePaymentMethodsRaw);\nconst baseSepoliaPaymentMethods = unwrapMethods(baseSepoliaPaymentMethodsRaw);\nconst baseStagingPaymentMethods = unwrapMethods(baseStagingPaymentMethodsRaw);\nconst baseConstants = unwrapConstants(baseConstantsRaw);\nconst baseStagingConstants = unwrapConstants(baseStagingConstantsRaw);\n\n/**\n * Contract addresses for a specific deployment.\n */\nexport type V2ContractAddresses = {\n /** Escrow contract (holds deposits and manages intents) */\n escrow: `0x${string}`;\n /** Orchestrator contract (handles intent signaling and fulfillment) */\n orchestrator?: `0x${string}`;\n /** UnifiedPaymentVerifier contract (verifies payment proofs) */\n unifiedPaymentVerifier?: `0x${string}`;\n /** ProtocolViewer contract (batch read operations) */\n protocolViewer?: `0x${string}`;\n /** USDC token address */\n usdc?: `0x${string}`;\n};\n\n/**\n * Contract ABIs for a specific deployment.\n */\nexport type V2ContractAbis = {\n escrow: Abi;\n orchestrator?: Abi;\n unifiedPaymentVerifier?: Abi;\n protocolViewer?: Abi;\n};\n\n/**\n * Runtime environment: 'production' for mainnet, 'staging' for testnet/dev.\n */\nexport type RuntimeEnv = 'production' | 'staging';\n\n/**\n * Converts a chain ID to its network key.\n * @internal\n */\nexport function networkKeyFromChainId(chainId: number): 'base' | 'base_sepolia' {\n if (chainId === 84532) return 'base_sepolia';\n return 'base';\n}\n\n/**\n * Retrieves deployed contract addresses and ABIs for a given chain and environment.\n *\n * @param chainId - The chain ID (8453 for Base, 84532 for Base Sepolia)\n * @param env - Runtime environment ('production' or 'staging')\n * @returns Object containing addresses and ABIs\n *\n * @example\n * ```typescript\n * import { getContracts } from '@zkp2p/sdk';\n *\n * const { addresses, abis } = getContracts(8453, 'production');\n * console.log(addresses.escrow); // \"0x...\"\n * console.log(addresses.usdc); // \"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913\"\n * ```\n */\nexport function getContracts(chainId: number, env: RuntimeEnv = 'production'): { addresses: V2ContractAddresses; abis: V2ContractAbis } {\n const key = networkKeyFromChainId(chainId);\n\n const addressesByKey: Record<'base' | 'base_sepolia', V2ContractAddresses> = {\n base: {\n escrow: (baseAddresses.contracts?.Escrow ?? '') as `0x${string}`,\n orchestrator: (baseAddresses.contracts?.Orchestrator ?? '') as `0x${string}`,\n unifiedPaymentVerifier: (baseAddresses.contracts?.UnifiedPaymentVerifier ?? '') as `0x${string}`,\n protocolViewer: (baseAddresses.contracts?.ProtocolViewer ?? '') as `0x${string}`,\n usdc: (baseConstants as any).USDC,\n },\n base_sepolia: {\n escrow: (baseSepoliaAddresses.contracts?.Escrow ?? '') as `0x${string}`,\n orchestrator: (baseSepoliaAddresses.contracts?.Orchestrator ?? '') as `0x${string}`,\n unifiedPaymentVerifier: (baseSepoliaAddresses.contracts?.UnifiedPaymentVerifier ?? '') as `0x${string}`,\n protocolViewer: (baseSepoliaAddresses.contracts?.ProtocolViewer ?? '') as `0x${string}`,\n // Prefer mock USDC when available on testnet\n usdc: (baseSepoliaAddresses.contracts as any)?.USDCMock as `0x${string}` | undefined,\n },\n };\n\n const abisByKey: Record<'base' | 'base_sepolia', V2ContractAbis> = {\n base: {\n escrow: EscrowBase as unknown as Abi,\n orchestrator: OrchestratorBase as unknown as Abi,\n unifiedPaymentVerifier: UnifiedPaymentVerifierBase as unknown as Abi,\n protocolViewer: ProtocolViewerBase as unknown as Abi,\n },\n base_sepolia: {\n escrow: EscrowBaseSepolia as unknown as Abi,\n orchestrator: OrchestratorBaseSepolia as unknown as Abi,\n unifiedPaymentVerifier: UnifiedPaymentVerifierBaseSepolia as unknown as Abi,\n protocolViewer: ProtocolViewerBaseSepolia as unknown as Abi,\n },\n };\n\n // Staging overrides (custom addresses/abis)\n if (env === 'staging') {\n return {\n addresses: {\n escrow: (baseStagingAddresses.contracts?.Escrow ?? '') as `0x${string}`,\n orchestrator: (baseStagingAddresses.contracts?.Orchestrator ?? '') as `0x${string}`,\n unifiedPaymentVerifier: (baseStagingAddresses.contracts?.UnifiedPaymentVerifier ?? '') as `0x${string}`,\n protocolViewer: (baseStagingAddresses.contracts?.ProtocolViewer ?? '') as `0x${string}`,\n usdc: (baseStagingConstants as any).USDC,\n },\n abis: {\n escrow: EscrowBaseStaging as unknown as Abi,\n orchestrator: OrchestratorBaseStaging as unknown as Abi,\n unifiedPaymentVerifier: UnifiedPaymentVerifierBaseStaging as unknown as Abi,\n protocolViewer: ProtocolViewerBaseStaging as unknown as Abi,\n },\n };\n }\n\n return { addresses: addressesByKey[key], abis: abisByKey[key] };\n}\n\n/**\n * Catalog of payment methods with their hashes and supported currencies.\n */\nexport type PaymentMethodCatalog = Record<string, { paymentMethodHash: `0x${string}`; currencies?: `0x${string}`[] }>;\n\n/**\n * Retrieves the payment methods catalog for a given chain and environment.\n *\n * The catalog maps payment platform names (e.g., 'wise', 'revolut') to their\n * on-chain hashes and supported currency hashes.\n *\n * @param chainId - The chain ID\n * @param env - Runtime environment\n * @returns Payment method catalog keyed by platform name\n *\n * @example\n * ```typescript\n * import { getPaymentMethodsCatalog } from '@zkp2p/sdk';\n *\n * const catalog = getPaymentMethodsCatalog(8453, 'production');\n * console.log(Object.keys(catalog)); // ['wise', 'venmo', 'revolut', ...]\n * console.log(catalog.wise.paymentMethodHash); // \"0x...\"\n * console.log(catalog.wise.currencies); // [\"0x...\", \"0x...\"] (currency hashes)\n * ```\n */\nexport function getPaymentMethodsCatalog(chainId: number, env: RuntimeEnv = 'production'): PaymentMethodCatalog {\n const isBaseSepolia = networkKeyFromChainId(chainId) === 'base_sepolia';\n const src = env === 'staging'\n ? (baseStagingPaymentMethods as any)\n : (isBaseSepolia ? (baseSepoliaPaymentMethods as any) : (basePaymentMethods as any));\n const methods = (src?.methods ?? src?.default?.methods ?? {}) as PaymentMethodCatalog;\n return methods;\n}\n\n/**\n * Returns the gating service address for a given chain and environment.\n *\n * The gating service signs intent parameters before they can be submitted\n * on-chain, providing an additional validation layer.\n *\n * @param chainId - The chain ID\n * @param env - Runtime environment\n * @returns Gating service signer address\n */\nexport function getGatingServiceAddress(chainId: number, env: RuntimeEnv = 'production'): `0x${string}` {\n // Base Staging & Production share the same gating service in current deployments\n if (env === 'staging') {\n return '0x396D31055Db28C0C6f36e8b36f18FE7227248a97' as `0x${string}`;\n }\n // Testnets / Base Sepolia often use a dev signer (Hardhat 0)\n if (networkKeyFromChainId(chainId) === 'base_sepolia') {\n return '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' as `0x${string}`;\n }\n // Base mainnet (production)\n return '0x396D31055Db28C0C6f36e8b36f18FE7227248a97' as `0x${string}`;\n}\n","function toBigInt(v: any): bigint {\n if (typeof v === 'bigint') return v;\n if (typeof v === 'number') return BigInt(v);\n if (typeof v === 'string') return BigInt(v);\n if (v && typeof v.toString === 'function') return BigInt(v.toString());\n throw new Error('Unsupported numeric type for bigint conversion');\n}\n\nexport type PV_Deposit = {\n depositor: string;\n delegate: string;\n token: string;\n amount: bigint;\n intentAmountRange: { min: bigint; max: bigint };\n acceptingIntents: boolean;\n remainingDeposits: bigint;\n outstandingIntentAmount: bigint;\n makerProtocolFee: bigint;\n reservedMakerFees: bigint;\n accruedMakerFees: bigint;\n accruedReferrerFees: bigint;\n intentGuardian: string;\n referrer: string;\n referrerFee: bigint;\n};\n\nexport type PV_Currency = { code: string; minConversionRate: bigint };\nexport type PV_PaymentMethodData = {\n paymentMethod: string; // bytes32\n verificationData: {\n intentGatingService: string;\n payeeDetails: string; // bytes32\n data: string; // bytes\n };\n currencies: PV_Currency[];\n};\n\nexport type PV_DepositView = {\n depositId: bigint;\n deposit: PV_Deposit;\n availableLiquidity: bigint;\n paymentMethods: PV_PaymentMethodData[];\n intentHashes: string[];\n};\n\nexport type PV_Intent = {\n owner: string;\n to: string;\n escrow: string;\n depositId: bigint;\n amount: bigint;\n timestamp: bigint;\n paymentMethod: string; // bytes32\n fiatCurrency: string; // bytes32\n conversionRate: bigint;\n referrer: string;\n referrerFee: bigint;\n postIntentHook: string;\n data: string;\n};\n\nexport type PV_IntentView = {\n intentHash: string;\n intent: PV_Intent;\n deposit: Omit<PV_DepositView, 'intentHashes'>;\n};\n\nexport function parseDepositView(raw: any): PV_DepositView {\n return {\n depositId: toBigInt(raw.depositId),\n deposit: {\n depositor: raw.deposit.depositor,\n delegate: raw.deposit.delegate,\n token: raw.deposit.token,\n amount: toBigInt(raw.deposit.amount),\n intentAmountRange: {\n min: toBigInt(raw.deposit.intentAmountRange.min),\n max: toBigInt(raw.deposit.intentAmountRange.max),\n },\n acceptingIntents: raw.deposit.acceptingIntents,\n remainingDeposits: toBigInt(raw.deposit.remainingDeposits),\n outstandingIntentAmount: toBigInt(raw.deposit.outstandingIntentAmount),\n makerProtocolFee: toBigInt(raw.deposit.makerProtocolFee ?? 0),\n reservedMakerFees: toBigInt(raw.deposit.reservedMakerFees ?? 0),\n accruedMakerFees: toBigInt(raw.deposit.accruedMakerFees ?? 0),\n accruedReferrerFees: toBigInt(raw.deposit.accruedReferrerFees ?? 0),\n intentGuardian: raw.deposit.intentGuardian,\n referrer: raw.deposit.referrer,\n referrerFee: toBigInt(raw.deposit.referrerFee ?? 0),\n },\n availableLiquidity: toBigInt(raw.availableLiquidity),\n paymentMethods: (raw.paymentMethods || []).map((pm: any) => ({\n paymentMethod: pm.paymentMethod,\n verificationData: {\n intentGatingService: pm.verificationData.intentGatingService,\n payeeDetails: pm.verificationData.payeeDetails,\n data: pm.verificationData.data,\n },\n currencies: (pm.currencies || []).map((c: any) => ({\n code: c.code,\n minConversionRate: toBigInt(c.minConversionRate),\n })),\n })),\n intentHashes: raw.intentHashes || [],\n };\n}\n\nexport function parseIntentView(raw: any): PV_IntentView {\n const parsedDeposit = parseDepositView(raw.deposit);\n const deposit: Omit<PV_DepositView, 'intentHashes'> = {\n depositId: parsedDeposit.depositId,\n deposit: parsedDeposit.deposit,\n availableLiquidity: parsedDeposit.availableLiquidity,\n paymentMethods: parsedDeposit.paymentMethods,\n };\n return {\n intentHash: raw.intentHash,\n intent: {\n owner: raw.intent.owner,\n to: raw.intent.to,\n escrow: raw.intent.escrow,\n depositId: toBigInt(raw.intent.depositId),\n amount: toBigInt(raw.intent.amount),\n timestamp: toBigInt(raw.intent.timestamp),\n paymentMethod: raw.intent.paymentMethod,\n fiatCurrency: raw.intent.fiatCurrency,\n conversionRate: toBigInt(raw.intent.conversionRate),\n referrer: raw.intent.referrer,\n referrerFee: toBigInt(raw.intent.referrerFee ?? 0),\n postIntentHook: raw.intent.postIntentHook,\n data: raw.intent.data,\n },\n deposit,\n };\n}\n\n// Enrichment helpers for dashboards/explorers\nimport { getPaymentMethodsCatalog, type RuntimeEnv } from '../contracts';\nimport { resolvePaymentMethodNameFromHash } from './paymentResolution';\nimport { getCurrencyInfoFromHash } from './currency';\n\nexport function enrichPvDepositView(view: PV_DepositView, chainId: number, env: RuntimeEnv = 'production') {\n const catalog = getPaymentMethodsCatalog(chainId, env);\n return {\n ...view,\n paymentMethods: view.paymentMethods.map((pm) => ({\n ...pm,\n processorName: resolvePaymentMethodNameFromHash(pm.paymentMethod, catalog),\n currencies: pm.currencies.map((c) => ({\n ...c,\n currencyInfo: getCurrencyInfoFromHash(c.code),\n })),\n })),\n };\n}\n\nexport function enrichPvIntentView(view: PV_IntentView, chainId: number, env: RuntimeEnv = 'production') {\n const catalog = getPaymentMethodsCatalog(chainId, env);\n return {\n ...view,\n intent: {\n ...view.intent,\n processorName: resolvePaymentMethodNameFromHash(view.intent.paymentMethod, catalog),\n currencyInfo: getCurrencyInfoFromHash(view.intent.fiatCurrency),\n },\n deposit: enrichPvDepositView(view.deposit as any, chainId, env),\n } as any;\n}\n"]}
1
+ {"version":3,"sources":["../src/contracts.ts","../src/utils/protocolViewerParsers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAqDA,SAAS,gBAAgB,GAAA,EAA8F;AACrH,EAAA,IAAI,CAAC,GAAA,EAAK,OAAO,EAAC;AAClB,EAAA,MAAM,CAAA,GAAI,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A;AACrD,EAAA,OAAO;AAAA,IACL,GAAG,IAAA;AAAA,IACH,MAAA,EAAQ;AAAA,MACN,GAAG,IAAA,CAAK,MAAA;AAAA,MACR,aAAA,EAAe,gCAAA,CAAiC,IAAA,CAAK,MAAA,CAAO,eAAe,OAAO,CAAA;AAAA,MAClF,YAAA,EAAc,uBAAA,CAAwB,IAAA,CAAK,MAAA,CAAO,YAAY;AAAA,KAChE;AAAA,IACA,OAAA,EAAS,mBAAA,CAAoB,IAAA,CAAK,OAAA,EAAgB,SAAS,GAAG;AAAA,GAChE;AACF","file":"chunk-PLKVLZVI.mjs","sourcesContent":["/**\n * Contract resolution utilities for the SDK.\n *\n * Provides access to deployed contract addresses and ABIs for different\n * networks (Base, Base Sepolia) and environments (production, staging).\n *\n * @module contracts\n */\n\nimport type { Abi } from 'abitype';\n\n// Typed imports from @zkp2p/contracts-v2 (module declarations provided in src/@types)\n// Use *Raw suffix for imports that need runtime normalization (addresses, constants)\nimport baseAddressesRaw from '@zkp2p/contracts-v2/addresses/base';\nimport baseSepoliaAddressesRaw from '@zkp2p/contracts-v2/addresses/baseSepolia';\nimport baseStagingAddressesRaw from '@zkp2p/contracts-v2/addresses/baseStaging';\n\nimport EscrowBase from '@zkp2p/contracts-v2/abis/base/Escrow.json';\nimport OrchestratorBase from '@zkp2p/contracts-v2/abis/base/Orchestrator.json';\nimport ProtocolViewerBase from '@zkp2p/contracts-v2/abis/base/ProtocolViewer.json';\nimport UnifiedPaymentVerifierBase from '@zkp2p/contracts-v2/abis/base/UnifiedPaymentVerifier.json';\n\nimport EscrowBaseSepolia from '@zkp2p/contracts-v2/abis/baseSepolia/Escrow.json';\nimport OrchestratorBaseSepolia from '@zkp2p/contracts-v2/abis/baseSepolia/Orchestrator.json';\nimport ProtocolViewerBaseSepolia from '@zkp2p/contracts-v2/abis/baseSepolia/ProtocolViewer.json';\nimport UnifiedPaymentVerifierBaseSepolia from '@zkp2p/contracts-v2/abis/baseSepolia/UnifiedPaymentVerifier.json';\n\nimport EscrowBaseStaging from '@zkp2p/contracts-v2/abis/baseStaging/Escrow.json';\nimport OrchestratorBaseStaging from '@zkp2p/contracts-v2/abis/baseStaging/Orchestrator.json';\nimport UnifiedPaymentVerifierBaseStaging from '@zkp2p/contracts-v2/abis/baseStaging/UnifiedPaymentVerifier.json';\nimport ProtocolViewerBaseStaging from '@zkp2p/contracts-v2/abis/baseStaging/ProtocolViewer.json';\n\nimport baseConstantsRaw from '@zkp2p/contracts-v2/constants/base';\nimport baseStagingConstantsRaw from '@zkp2p/contracts-v2/constants/baseStaging';\n// Payment methods catalogs (JSON). Import statically so ESM bundlers include the data.\n// These modules are present in @zkp2p/contracts-v2; tsconfig sets resolveJsonModule: true\nimport basePaymentMethodsRaw from '@zkp2p/contracts-v2/paymentMethods/base.json';\nimport baseSepoliaPaymentMethodsRaw from '@zkp2p/contracts-v2/paymentMethods/baseSepolia.json';\nimport baseStagingPaymentMethodsRaw from '@zkp2p/contracts-v2/paymentMethods/baseStaging.json';\n\n// ---------------------------------------------------------------------------\n// Runtime normalization helpers for ESM/CJS interoperability\n// ---------------------------------------------------------------------------\n// In certain runtimes (tsx, Node ESM), deep imports from @zkp2p/contracts-v2\n// resolve as { default: [Getter] } or { default: { contracts: {...} } } instead\n// of the expected shape. These helpers unwrap the actual data regardless of shape.\n\n/**\n * Normalize address module shape. Handles:\n * - { contracts: {...} } (direct)\n * - { default: { contracts: {...} } } (wrapped)\n * - { default: [Getter] } (lazy)\n */\nfunction unwrapAddresses(mod: unknown): { name?: string; chainId?: number; contracts?: Record<string, `0x${string}`> } {\n if (!mod) return {} as ReturnType<typeof unwrapAddresses>;\n const m = mod as Record<string, unknown>;\n // Direct shape\n if (m.contracts) return m as ReturnType<typeof unwrapAddresses>;\n // Wrapped shape\n if ((m.default as Record<string, unknown>)?.contracts) return m.default as ReturnType<typeof unwrapAddresses>;\n // Lazy getter shape\n try {\n const d = typeof m.default === 'function' ? (m.default as () => unknown)() : m.default;\n if ((d as Record<string, unknown>)?.contracts) return d as ReturnType<typeof unwrapAddresses>;\n } catch {\n // ignore\n }\n return m as ReturnType<typeof unwrapAddresses>;\n}\n\n/**\n * Normalize payment methods module shape. Handles:\n * - { methods: {...} } (direct)\n * - { default: { methods: {...} } } (wrapped)\n * - { default: [Getter] } (lazy)\n */\nfunction unwrapMethods(mod: unknown): { methods?: Record<string, { paymentMethodHash: `0x${string}`; currencies?: `0x${string}`[] }> } {\n if (!mod) return {} as ReturnType<typeof unwrapMethods>;\n const m = mod as Record<string, unknown>;\n if (m.methods) return m as ReturnType<typeof unwrapMethods>;\n if ((m.default as Record<string, unknown>)?.methods) return m.default as ReturnType<typeof unwrapMethods>;\n try {\n const d = typeof m.default === 'function' ? (m.default as () => unknown)() : m.default;\n if ((d as Record<string, unknown>)?.methods) return d as ReturnType<typeof unwrapMethods>;\n } catch {\n // ignore\n }\n return m as ReturnType<typeof unwrapMethods>;\n}\n\n/**\n * Normalize constants module shape (for USDC address, etc.)\n */\nfunction unwrapConstants(mod: unknown): Record<string, unknown> {\n if (!mod) return {};\n const m = mod as Record<string, unknown>;\n if (m.USDC) return m;\n if ((m.default as Record<string, unknown>)?.USDC) return m.default as Record<string, unknown>;\n try {\n const d = typeof m.default === 'function' ? (m.default as () => unknown)() : m.default;\n if ((d as Record<string, unknown>)?.USDC) return d as Record<string, unknown>;\n } catch {\n // ignore\n }\n return m;\n}\n\n// Apply runtime normalization to all imports\nconst baseAddresses = unwrapAddresses(baseAddressesRaw);\nconst baseSepoliaAddresses = unwrapAddresses(baseSepoliaAddressesRaw);\nconst baseStagingAddresses = unwrapAddresses(baseStagingAddressesRaw);\nconst basePaymentMethods = unwrapMethods(basePaymentMethodsRaw);\nconst baseSepoliaPaymentMethods = unwrapMethods(baseSepoliaPaymentMethodsRaw);\nconst baseStagingPaymentMethods = unwrapMethods(baseStagingPaymentMethodsRaw);\nconst baseConstants = unwrapConstants(baseConstantsRaw);\nconst baseStagingConstants = unwrapConstants(baseStagingConstantsRaw);\n\n/**\n * Contract addresses for a specific deployment.\n */\nexport type V2ContractAddresses = {\n /** Escrow contract (holds deposits and manages intents) */\n escrow: `0x${string}`;\n /** Orchestrator contract (handles intent signaling and fulfillment) */\n orchestrator?: `0x${string}`;\n /** UnifiedPaymentVerifier contract (verifies payment proofs) */\n unifiedPaymentVerifier?: `0x${string}`;\n /** ProtocolViewer contract (batch read operations) */\n protocolViewer?: `0x${string}`;\n /** USDC token address */\n usdc?: `0x${string}`;\n};\n\n/**\n * Contract ABIs for a specific deployment.\n */\nexport type V2ContractAbis = {\n escrow: Abi;\n orchestrator?: Abi;\n unifiedPaymentVerifier?: Abi;\n protocolViewer?: Abi;\n};\n\n/**\n * Runtime environment: 'production' for mainnet, 'staging' for testnet/dev.\n */\nexport type RuntimeEnv = 'production' | 'staging';\n\n/**\n * Converts a chain ID to its network key.\n * @internal\n */\nexport function networkKeyFromChainId(chainId: number): 'base' | 'base_sepolia' {\n if (chainId === 84532) return 'base_sepolia';\n return 'base';\n}\n\n/**\n * Retrieves deployed contract addresses and ABIs for a given chain and environment.\n *\n * @param chainId - The chain ID (8453 for Base, 84532 for Base Sepolia)\n * @param env - Runtime environment ('production' or 'staging')\n * @returns Object containing addresses and ABIs\n *\n * @example\n * ```typescript\n * import { getContracts } from '@zkp2p/sdk';\n *\n * const { addresses, abis } = getContracts(8453, 'production');\n * console.log(addresses.escrow); // \"0x...\"\n * console.log(addresses.usdc); // \"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913\"\n * ```\n */\nexport function getContracts(chainId: number, env: RuntimeEnv = 'production'): { addresses: V2ContractAddresses; abis: V2ContractAbis } {\n const key = networkKeyFromChainId(chainId);\n\n const addressesByKey: Record<'base' | 'base_sepolia', V2ContractAddresses> = {\n base: {\n escrow: (baseAddresses.contracts?.Escrow ?? '') as `0x${string}`,\n orchestrator: (baseAddresses.contracts?.Orchestrator ?? '') as `0x${string}`,\n unifiedPaymentVerifier: (baseAddresses.contracts?.UnifiedPaymentVerifier ?? '') as `0x${string}`,\n protocolViewer: (baseAddresses.contracts?.ProtocolViewer ?? '') as `0x${string}`,\n usdc: (baseConstants as any).USDC,\n },\n base_sepolia: {\n escrow: (baseSepoliaAddresses.contracts?.Escrow ?? '') as `0x${string}`,\n orchestrator: (baseSepoliaAddresses.contracts?.Orchestrator ?? '') as `0x${string}`,\n unifiedPaymentVerifier: (baseSepoliaAddresses.contracts?.UnifiedPaymentVerifier ?? '') as `0x${string}`,\n protocolViewer: (baseSepoliaAddresses.contracts?.ProtocolViewer ?? '') as `0x${string}`,\n // Prefer mock USDC when available on testnet\n usdc: (baseSepoliaAddresses.contracts as any)?.USDCMock as `0x${string}` | undefined,\n },\n };\n\n const abisByKey: Record<'base' | 'base_sepolia', V2ContractAbis> = {\n base: {\n escrow: EscrowBase as unknown as Abi,\n orchestrator: OrchestratorBase as unknown as Abi,\n unifiedPaymentVerifier: UnifiedPaymentVerifierBase as unknown as Abi,\n protocolViewer: ProtocolViewerBase as unknown as Abi,\n },\n base_sepolia: {\n escrow: EscrowBaseSepolia as unknown as Abi,\n orchestrator: OrchestratorBaseSepolia as unknown as Abi,\n unifiedPaymentVerifier: UnifiedPaymentVerifierBaseSepolia as unknown as Abi,\n protocolViewer: ProtocolViewerBaseSepolia as unknown as Abi,\n },\n };\n\n // Staging overrides (custom addresses/abis)\n if (env === 'staging') {\n return {\n addresses: {\n escrow: (baseStagingAddresses.contracts?.Escrow ?? '') as `0x${string}`,\n orchestrator: (baseStagingAddresses.contracts?.Orchestrator ?? '') as `0x${string}`,\n unifiedPaymentVerifier: (baseStagingAddresses.contracts?.UnifiedPaymentVerifier ?? '') as `0x${string}`,\n protocolViewer: (baseStagingAddresses.contracts?.ProtocolViewer ?? '') as `0x${string}`,\n usdc: (baseStagingConstants as any).USDC,\n },\n abis: {\n escrow: EscrowBaseStaging as unknown as Abi,\n orchestrator: OrchestratorBaseStaging as unknown as Abi,\n unifiedPaymentVerifier: UnifiedPaymentVerifierBaseStaging as unknown as Abi,\n protocolViewer: ProtocolViewerBaseStaging as unknown as Abi,\n },\n };\n }\n\n return { addresses: addressesByKey[key], abis: abisByKey[key] };\n}\n\n/**\n * Catalog of payment methods with their hashes and supported currencies.\n */\nexport type PaymentMethodCatalog = Record<string, { paymentMethodHash: `0x${string}`; currencies?: `0x${string}`[] }>;\n\n/**\n * Retrieves the payment methods catalog for a given chain and environment.\n *\n * The catalog maps payment platform names (e.g., 'wise', 'revolut') to their\n * on-chain hashes and supported currency hashes.\n *\n * @param chainId - The chain ID\n * @param env - Runtime environment\n * @returns Payment method catalog keyed by platform name\n *\n * @example\n * ```typescript\n * import { getPaymentMethodsCatalog } from '@zkp2p/sdk';\n *\n * const catalog = getPaymentMethodsCatalog(8453, 'production');\n * console.log(Object.keys(catalog)); // ['wise', 'venmo', 'revolut', ...]\n * console.log(catalog.wise.paymentMethodHash); // \"0x...\"\n * console.log(catalog.wise.currencies); // [\"0x...\", \"0x...\"] (currency hashes)\n * ```\n */\nexport function getPaymentMethodsCatalog(chainId: number, env: RuntimeEnv = 'production'): PaymentMethodCatalog {\n const isBaseSepolia = networkKeyFromChainId(chainId) === 'base_sepolia';\n const src = env === 'staging'\n ? (baseStagingPaymentMethods as any)\n : (isBaseSepolia ? (baseSepoliaPaymentMethods as any) : (basePaymentMethods as any));\n const methods = (src?.methods ?? src?.default?.methods ?? {}) as PaymentMethodCatalog;\n return methods;\n}\n\n/**\n * Returns the gating service address for a given chain and environment.\n *\n * The gating service signs intent parameters before they can be submitted\n * on-chain, providing an additional validation layer.\n *\n * @param chainId - The chain ID\n * @param env - Runtime environment\n * @returns Gating service signer address\n */\nexport function getGatingServiceAddress(chainId: number, env: RuntimeEnv = 'production'): `0x${string}` {\n // Base Staging & Production share the same gating service in current deployments\n if (env === 'staging') {\n return '0x396D31055Db28C0C6f36e8b36f18FE7227248a97' as `0x${string}`;\n }\n // Testnets / Base Sepolia often use a dev signer (Hardhat 0)\n if (networkKeyFromChainId(chainId) === 'base_sepolia') {\n return '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' as `0x${string}`;\n }\n // Base mainnet (production)\n return '0x396D31055Db28C0C6f36e8b36f18FE7227248a97' as `0x${string}`;\n}\n","function toBigInt(v: any): bigint {\n if (typeof v === 'bigint') return v;\n if (typeof v === 'number') return BigInt(v);\n if (typeof v === 'string') return BigInt(v);\n if (v && typeof v.toString === 'function') return BigInt(v.toString());\n throw new Error('Unsupported numeric type for bigint conversion');\n}\n\nexport type PV_Deposit = {\n depositor: string;\n delegate: string;\n token: string;\n amount: bigint;\n intentAmountRange: { min: bigint; max: bigint };\n acceptingIntents: boolean;\n remainingDeposits: bigint;\n outstandingIntentAmount: bigint;\n makerProtocolFee: bigint;\n reservedMakerFees: bigint;\n accruedMakerFees: bigint;\n accruedReferrerFees: bigint;\n intentGuardian: string;\n referrer: string;\n referrerFee: bigint;\n};\n\nexport type PV_Currency = { code: string; minConversionRate: bigint };\nexport type PV_PaymentMethodData = {\n paymentMethod: string; // bytes32\n verificationData: {\n intentGatingService: string;\n payeeDetails: string; // bytes32\n data: string; // bytes\n };\n currencies: PV_Currency[];\n};\n\nexport type PV_DepositView = {\n depositId: bigint;\n deposit: PV_Deposit;\n availableLiquidity: bigint;\n paymentMethods: PV_PaymentMethodData[];\n intentHashes: string[];\n};\n\nexport type PV_Intent = {\n owner: string;\n to: string;\n escrow: string;\n depositId: bigint;\n amount: bigint;\n timestamp: bigint;\n paymentMethod: string; // bytes32\n fiatCurrency: string; // bytes32\n conversionRate: bigint;\n referrer: string;\n referrerFee: bigint;\n postIntentHook: string;\n data: string;\n};\n\nexport type PV_IntentView = {\n intentHash: string;\n intent: PV_Intent;\n deposit: Omit<PV_DepositView, 'intentHashes'>;\n};\n\nexport function parseDepositView(raw: any): PV_DepositView {\n return {\n depositId: toBigInt(raw.depositId),\n deposit: {\n depositor: raw.deposit.depositor,\n delegate: raw.deposit.delegate,\n token: raw.deposit.token,\n amount: toBigInt(raw.deposit.amount),\n intentAmountRange: {\n min: toBigInt(raw.deposit.intentAmountRange.min),\n max: toBigInt(raw.deposit.intentAmountRange.max),\n },\n acceptingIntents: raw.deposit.acceptingIntents,\n remainingDeposits: toBigInt(raw.deposit.remainingDeposits),\n outstandingIntentAmount: toBigInt(raw.deposit.outstandingIntentAmount),\n makerProtocolFee: toBigInt(raw.deposit.makerProtocolFee ?? 0),\n reservedMakerFees: toBigInt(raw.deposit.reservedMakerFees ?? 0),\n accruedMakerFees: toBigInt(raw.deposit.accruedMakerFees ?? 0),\n accruedReferrerFees: toBigInt(raw.deposit.accruedReferrerFees ?? 0),\n intentGuardian: raw.deposit.intentGuardian,\n referrer: raw.deposit.referrer,\n referrerFee: toBigInt(raw.deposit.referrerFee ?? 0),\n },\n availableLiquidity: toBigInt(raw.availableLiquidity),\n paymentMethods: (raw.paymentMethods || []).map((pm: any) => ({\n paymentMethod: pm.paymentMethod,\n verificationData: {\n intentGatingService: pm.verificationData.intentGatingService,\n payeeDetails: pm.verificationData.payeeDetails,\n data: pm.verificationData.data,\n },\n currencies: (pm.currencies || []).map((c: any) => ({\n code: c.code,\n minConversionRate: toBigInt(c.minConversionRate),\n })),\n })),\n intentHashes: raw.intentHashes || [],\n };\n}\n\nexport function parseIntentView(raw: any): PV_IntentView {\n const parsedDeposit = parseDepositView(raw.deposit);\n const deposit: Omit<PV_DepositView, 'intentHashes'> = {\n depositId: parsedDeposit.depositId,\n deposit: parsedDeposit.deposit,\n availableLiquidity: parsedDeposit.availableLiquidity,\n paymentMethods: parsedDeposit.paymentMethods,\n };\n return {\n intentHash: raw.intentHash,\n intent: {\n owner: raw.intent.owner,\n to: raw.intent.to,\n escrow: raw.intent.escrow,\n depositId: toBigInt(raw.intent.depositId),\n amount: toBigInt(raw.intent.amount),\n timestamp: toBigInt(raw.intent.timestamp),\n paymentMethod: raw.intent.paymentMethod,\n fiatCurrency: raw.intent.fiatCurrency,\n conversionRate: toBigInt(raw.intent.conversionRate),\n referrer: raw.intent.referrer,\n referrerFee: toBigInt(raw.intent.referrerFee ?? 0),\n postIntentHook: raw.intent.postIntentHook,\n data: raw.intent.data,\n },\n deposit,\n };\n}\n\n// Enrichment helpers for dashboards/explorers\nimport { getPaymentMethodsCatalog, type RuntimeEnv } from '../contracts';\nimport { resolvePaymentMethodNameFromHash } from './paymentResolution';\nimport { getCurrencyInfoFromHash } from './currency';\n\nexport function enrichPvDepositView(view: PV_DepositView, chainId: number, env: RuntimeEnv = 'production') {\n const catalog = getPaymentMethodsCatalog(chainId, env);\n return {\n ...view,\n paymentMethods: view.paymentMethods.map((pm) => ({\n ...pm,\n processorName: resolvePaymentMethodNameFromHash(pm.paymentMethod, catalog),\n currencies: pm.currencies.map((c) => ({\n ...c,\n currencyInfo: getCurrencyInfoFromHash(c.code),\n })),\n })),\n };\n}\n\nexport function enrichPvIntentView(view: PV_IntentView, chainId: number, env: RuntimeEnv = 'production') {\n const catalog = getPaymentMethodsCatalog(chainId, env);\n return {\n ...view,\n intent: {\n ...view.intent,\n processorName: resolvePaymentMethodNameFromHash(view.intent.paymentMethod, catalog),\n currencyInfo: getCurrencyInfoFromHash(view.intent.fiatCurrency),\n },\n deposit: enrichPvDepositView(view.deposit as any, chainId, env),\n } as any;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { currencyKeccak256 } from './chunk-J34QNX2H.mjs';
1
+ import { currencyKeccak256 } from './chunk-GNGQRV2U.mjs';
2
2
  import { hexToBytes, keccak256, toBytes, bytesToHex } from 'viem';
3
3
  import baseSepoliaPaymentMethods from '@zkp2p/contracts-v2/paymentMethods/baseSepolia';
4
4
  import baseStagingPaymentMethods from '@zkp2p/contracts-v2/paymentMethods/baseStaging';
@@ -71,5 +71,5 @@ function resolvePaymentMethodNameFromHash(hash, catalog) {
71
71
  }
72
72
 
73
73
  export { asciiToBytes32, ensureBytes32, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash };
74
- //# sourceMappingURL=chunk-MWFONYDJ.mjs.map
75
- //# sourceMappingURL=chunk-MWFONYDJ.mjs.map
74
+ //# sourceMappingURL=chunk-RMWIECY7.mjs.map
75
+ //# sourceMappingURL=chunk-RMWIECY7.mjs.map