@zkp2p/sdk 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -1
- package/dist/{Zkp2pClient-D-eU4dxy.d.mts → Zkp2pClient-w5Pzlea6.d.mts} +102 -36
- package/dist/{Zkp2pClient-D-eU4dxy.d.ts → Zkp2pClient-w5Pzlea6.d.ts} +102 -36
- package/dist/chunk-3QS3WKRC.mjs +29 -0
- package/dist/chunk-3QS3WKRC.mjs.map +1 -0
- package/dist/{chunk-ARFGMPYS.mjs → chunk-GYYD6SSA.mjs} +2 -2
- package/dist/chunk-GYYD6SSA.mjs.map +1 -0
- package/dist/{chunk-CM3RH5VZ.mjs → chunk-NZ53KYLT.mjs} +42 -2
- package/dist/chunk-NZ53KYLT.mjs.map +1 -0
- package/dist/{chunk-PYEJ4L76.mjs → chunk-W247BDNW.mjs} +3 -3
- package/dist/{chunk-PYEJ4L76.mjs.map → chunk-W247BDNW.mjs.map} +1 -1
- package/dist/constants-ZICRSYZM.mjs +5 -0
- package/dist/{constants-MQB4AQDD.mjs.map → constants-ZICRSYZM.mjs.map} +1 -1
- package/dist/{currency-RSSHQOM3.mjs → currency-UVK4OKUR.mjs} +4 -3
- package/dist/{currency-RSSHQOM3.mjs.map → currency-UVK4OKUR.mjs.map} +1 -1
- package/dist/index.cjs +904 -362
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +68 -4
- package/dist/index.d.ts +68 -4
- package/dist/index.mjs +633 -345
- package/dist/index.mjs.map +1 -1
- package/dist/{paymentResolution-4AAJVIIC.mjs → paymentResolution-2FP3NLM3.mjs} +3 -2
- package/dist/{paymentResolution-4AAJVIIC.mjs.map → paymentResolution-2FP3NLM3.mjs.map} +1 -1
- package/dist/protocolViewerParsers-EH5DGVSU.mjs +6 -0
- package/dist/{protocolViewerParsers-3QIR3XMT.mjs.map → protocolViewerParsers-EH5DGVSU.mjs.map} +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{timeout-QB7K5SOB.mjs → timeout-7HCFGU6P.mjs} +3 -2
- package/dist/timeout-7HCFGU6P.mjs.map +1 -0
- package/package.json +4 -3
- package/dist/chunk-ARFGMPYS.mjs.map +0 -1
- package/dist/chunk-CM3RH5VZ.mjs.map +0 -1
- package/dist/constants-MQB4AQDD.mjs +0 -4
- package/dist/protocolViewerParsers-3QIR3XMT.mjs +0 -5
- package/dist/timeout-QB7K5SOB.mjs.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash } from './chunk-GDKCACWH.mjs';
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=paymentResolution-
|
|
2
|
+
import './chunk-3QS3WKRC.mjs';
|
|
3
|
+
//# sourceMappingURL=paymentResolution-2FP3NLM3.mjs.map
|
|
4
|
+
//# sourceMappingURL=paymentResolution-2FP3NLM3.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"paymentResolution-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"paymentResolution-2FP3NLM3.mjs"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { enrichPvDepositView, enrichPvIntentView, parseDepositView, parseIntentView } from './chunk-W247BDNW.mjs';
|
|
2
|
+
import './chunk-GDKCACWH.mjs';
|
|
3
|
+
import './chunk-NZ53KYLT.mjs';
|
|
4
|
+
import './chunk-3QS3WKRC.mjs';
|
|
5
|
+
//# sourceMappingURL=protocolViewerParsers-EH5DGVSU.mjs.map
|
|
6
|
+
//# sourceMappingURL=protocolViewerParsers-EH5DGVSU.mjs.map
|
package/dist/{protocolViewerParsers-3QIR3XMT.mjs.map → protocolViewerParsers-EH5DGVSU.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"protocolViewerParsers-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"protocolViewerParsers-EH5DGVSU.mjs"}
|
package/dist/react.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Z as Zkp2pClient, S as SignalIntentMethodParams, a3 as PreparedTransaction, a6 as TakerTier,
|
|
1
|
+
import { Z as Zkp2pClient, S as SignalIntentMethodParams, a3 as PreparedTransaction, a6 as TakerTier, f as GetTakerTierRequest, g as GetTakerTierResponse, F as FulfillIntentMethodParams } from './Zkp2pClient-w5Pzlea6.mjs';
|
|
2
2
|
import { Hash } from 'viem';
|
|
3
3
|
import 'abitype';
|
|
4
4
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Z as Zkp2pClient, S as SignalIntentMethodParams, a3 as PreparedTransaction, a6 as TakerTier,
|
|
1
|
+
import { Z as Zkp2pClient, S as SignalIntentMethodParams, a3 as PreparedTransaction, a6 as TakerTier, f as GetTakerTierRequest, g as GetTakerTierResponse, F as FulfillIntentMethodParams } from './Zkp2pClient-w5Pzlea6.js';
|
|
2
2
|
import { Hash } from 'viem';
|
|
3
3
|
import 'abitype';
|
|
4
4
|
|
package/dist/react.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import './chunk-3QS3WKRC.mjs';
|
|
1
2
|
import { useState, useCallback, useMemo, useEffect } from 'react';
|
|
2
3
|
import { formatUnits } from 'viem';
|
|
3
4
|
|
|
4
|
-
// src/react/hooks/useCreateDeposit.ts
|
|
5
5
|
function useCreateDeposit({ client, onSuccess, onError }) {
|
|
6
6
|
const [isLoading, setIsLoading] = useState(false);
|
|
7
7
|
const [error, setError] = useState(null);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NetworkError } from './chunk-GHQK65J2.mjs';
|
|
2
|
+
import './chunk-3QS3WKRC.mjs';
|
|
2
3
|
|
|
3
4
|
// src/utils/timeout.ts
|
|
4
5
|
async function withTimeout(promise, timeoutMs, timeoutMessage) {
|
|
@@ -29,5 +30,5 @@ var DEFAULT_TIMEOUTS = {
|
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
export { DEFAULT_TIMEOUTS, withTimeout };
|
|
32
|
-
//# sourceMappingURL=timeout-
|
|
33
|
-
//# sourceMappingURL=timeout-
|
|
33
|
+
//# sourceMappingURL=timeout-7HCFGU6P.mjs.map
|
|
34
|
+
//# sourceMappingURL=timeout-7HCFGU6P.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/timeout.ts"],"names":[],"mappings":";;;;AASA,eAAsB,WAAA,CACpB,OAAA,EACA,SAAA,EACA,cAAA,EACY;AACZ,EAAA,IAAI,SAAA;AAEJ,EAAA,MAAM,cAAA,GAAiB,IAAI,OAAA,CAAe,CAAC,GAAG,MAAA,KAAW;AACvD,IAAA,SAAA,GAAY,WAAW,MAAM;AAC3B,MAAA,MAAA,CAAO,IAAI,YAAA,CAAa,cAAA,EAAgB,EAAE,OAAA,EAAS,SAAA,EAAW,CAAC,CAAA;AAAA,IACjE,GAAG,SAAS,CAAA;AAAA,EACd,CAAC,CAAA;AAED,EAAA,IAAI;AACF,IAAA,MAAM,SAAS,MAAM,OAAA,CAAQ,KAAK,CAAC,OAAA,EAAS,cAAc,CAAC,CAAA;AAC3D,IAAA,IAAI,SAAA,eAAwB,SAAS,CAAA;AACrC,IAAA,OAAO,MAAA;AAAA,EACT,SAAS,KAAA,EAAO;AACd,IAAA,IAAI,SAAA,eAAwB,SAAS,CAAA;AACrC,IAAA,MAAM,KAAA;AAAA,EACR;AACF;AAKO,IAAM,gBAAA,GAAmB;AAAA;AAAA,EAE9B,GAAA,EAAK,GAAA;AAAA;AAAA,EAEL,WAAA,EAAa,GAAA;AAAA;AAAA,EAEb,gBAAA,EAAkB,IAAA;AAAA;AAAA,EAElB,SAAA,EAAW;AACb","file":"timeout-7HCFGU6P.mjs","sourcesContent":["import { NetworkError } from '../errors';\n\n/**\n * Wraps a promise with a timeout\n * @param promise - The promise to wrap\n * @param timeoutMs - Timeout in milliseconds\n * @param timeoutMessage - Error message when timeout occurs\n * @returns Promise that rejects if timeout occurs\n */\nexport async function withTimeout<T>(\n promise: Promise<T>,\n timeoutMs: number,\n timeoutMessage: string\n): Promise<T> {\n let timeoutId: NodeJS.Timeout | undefined;\n\n const timeoutPromise = new Promise<never>((_, reject) => {\n timeoutId = setTimeout(() => {\n reject(new NetworkError(timeoutMessage, { timeout: timeoutMs }));\n }, timeoutMs);\n });\n\n try {\n const result = await Promise.race([promise, timeoutPromise]);\n if (timeoutId) clearTimeout(timeoutId);\n return result;\n } catch (error) {\n if (timeoutId) clearTimeout(timeoutId);\n throw error;\n }\n}\n\n/**\n * Default timeout values for different operation types\n */\nexport const DEFAULT_TIMEOUTS = {\n /** API call timeout (30 seconds) */\n API: 30000,\n /** Blockchain transaction timeout (60 seconds) */\n TRANSACTION: 60000,\n /** Proof generation timeout (120 seconds) */\n PROOF_GENERATION: 120000,\n /** Extension communication timeout (60 seconds) */\n EXTENSION: 60000,\n} as const;"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zkp2p/sdk",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "ZKP2P Client SDK - TypeScript SDK for deposit management, liquidity provision, and
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"description": "ZKP2P Client SDK - TypeScript SDK for deposit management, liquidity provision, and onramping",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
83
|
"engines": {
|
|
84
|
-
"node": ">=
|
|
84
|
+
"node": ">=22"
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
87
|
"@zkp2p/contracts-v2": "^0.0.8",
|
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
"ox": "^0.11.1"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
+
"@zkp2p/core": "workspace:*",
|
|
92
93
|
"@release-it/conventional-changelog": "^9.0.4",
|
|
93
94
|
"@types/node": "^20.10.0",
|
|
94
95
|
"@types/react": "^19.1.11",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/index.ts","../src/utils/constants.ts","../src/constants.ts"],"names":[],"mappings":";AAwmBO,IAAM,iBAAA,GAAoB;AAAA,EAC/B,MAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,aAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF;;;AC9mBO,IAAM,oBAAA,GAAuB;AAC7B,IAAM,mBAAA,GAAsB;AAkC5B,IAAM,kBAAA,GAAgC;AAAA,EAC3C,IAAA,EAAM;AAAA,IACJ,UAAA,EAAY;AAAA;AAAA,MAEV,IAAA,EAAM,4CAAA;AAAA;AAAA,MAGN,MAAA,EAAQ,4CAAA;AAAA;AAAA,MAGR,KAAA,EAAO,4CAAA;AAAA,MACP,OAAA,EAAS,4CAAA;AAAA,MACT,OAAA,EAAS,4CAAA;AAAA,MACT,IAAA,EAAM,4CAAA;AAAA,MACN,WAAA,EAAa,4CAAA;AAAA,MACb,KAAA,EAAO,4CAAA;AAAA,MACP,MAAA,EAAQ,4CAAA;AAAA,MACR,KAAA,EAAO,4CAAA;AAAA;AAAA,MAGP,aAAA,EAAe,4CAAA;AAAA,MACf,kBAAA,EAAoB;AAAA,KACtB;AAAA,IACA,OAAA,EAAS;AAAA;AAAA,MAEP,IAAA,EAAM,4CAAA;AAAA;AAAA,MAGN,MAAA,EAAQ,4CAAA;AAAA;AAAA,MAGR,KAAA,EAAO,4CAAA;AAAA,MACP,OAAA,EAAS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ARFGMPYS.mjs","sourcesContent":["// Minimal initial type surface for Offramp SDK\nimport type { AccessList, Address, AuthorizationList, Hash, WalletClient } from 'viem';\nimport type { CurrencyType } from '../utils/currency';\n\n/**\n * Timeout configuration for different operation types\n */\nexport type TimeoutConfig = {\n /** API call timeout in milliseconds (default: 30000) */\n api?: number;\n /** Transaction timeout in milliseconds (default: 60000) */\n transaction?: number;\n};\n\nexport type Zkp2pClientOptions = {\n walletClient: WalletClient;\n apiKey: string;\n chainId: number;\n environment?: 'production' | 'staging';\n baseApiUrl?: string;\n witnessUrl?: string;\n rpcUrl?: string;\n /** Optional bearer token for hybrid auth */\n authorizationToken?: string;\n /** Optional timeout configuration */\n timeouts?: TimeoutConfig;\n};\n\n/**\n * Callback function for transaction actions\n * @param params - Transaction callback parameters\n * @param params.hash - Transaction hash\n * @param params.data - Optional additional data from the transaction\n */\nexport type ActionCallback = (params: { hash: Hash; data?: unknown }) => void;\n\n/**\n * Safe transaction overrides including ERC-8021 referrers.\n * Referrer codes are prepended before the Base builder code (bc_nbn6qkni).\n */\nexport type TxOverrides = {\n gas?: bigint;\n gasPrice?: bigint;\n maxFeePerGas?: bigint;\n maxPriorityFeePerGas?: bigint;\n nonce?: number;\n value?: bigint;\n accessList?: AccessList;\n authorizationList?: AuthorizationList;\n /**\n * ERC-8021 referrer code(s) to prepend before the Base builder code.\n * Accepts a single code or multiple (e.g., ['zkp2p-bot', 'merchant-id']).\n */\n referrer?: string | string[];\n};\n\n/**\n * Parameters for fulfilling an intent with payment attestation\n */\nexport type FulfillIntentParams = {\n /** Hash of the intent to fulfill */\n intentHash: Hash;\n /** Attestation proof - object or stringified JSON from attestation service */\n proof: Record<string, unknown> | string;\n /** Optional attestation timestamp buffer override in milliseconds */\n timestampBufferMs?: number | string;\n /** Override the attestation service base URL */\n attestationServiceUrl?: string;\n /** Override the verifying contract (defaults to UnifiedPaymentVerifier) */\n verifyingContract?: Address;\n /** Optional hook payload passed to orchestrator */\n postIntentHookData?: `0x${string}`;\n /** Optional viem transaction overrides */\n txOverrides?: TxOverrides;\n /** Optional lifecycle callbacks */\n callbacks?: {\n onAttestationStart?: () => void;\n onTxSent?: (hash: Hash) => void;\n onTxMined?: (hash: Hash) => void;\n };\n};\n\n/**\n * Parameters for releasing funds back to the payer\n */\nexport type ReleaseFundsToPayerParams = {\n /** Hash of the intent to release funds for */\n intentHash: Hash;\n /** Callback when transaction is successfully sent */\n onSuccess?: ActionCallback;\n /** Callback when an error occurs */\n onError?: (error: Error) => void;\n /** Callback when transaction is mined */\n onMined?: ActionCallback;\n};\n\n/**\n * Parameters for signaling an intent to use a deposit\n */\nexport type SignalIntentParams = {\n /** Payment processor name (e.g., 'wise', 'revolut') */\n processorName: string;\n /** ID of the deposit to use */\n depositId: string;\n /** Amount of tokens to transfer */\n tokenAmount: string;\n /** Payee details for the payment */\n payeeDetails: string;\n /** Recipient blockchain address */\n toAddress: string;\n /** Currency type for the payment */\n currency: CurrencyType;\n /** Callback when transaction is successfully sent */\n onSuccess?: ActionCallback;\n /** Callback when an error occurs */\n onError?: (error: Error) => void;\n /** Callback when transaction is mined */\n onMined?: ActionCallback;\n};\n\n// (removed placeholder Create/Withdraw/Cancel types; see refined forms below)\n\n/**\n * Request structure for signaling an intent via the API\n */\nexport type IntentSignalRequest = {\n /** Payment processor name */\n processorName: string;\n /** ID of the deposit */\n depositId: string;\n /** Amount of tokens */\n tokenAmount: string;\n /** Payee details */\n payeeDetails: string;\n /** Recipient address */\n toAddress: string;\n /** Fiat currency code */\n fiatCurrencyCode: string;\n /** Chain ID as string */\n chainId: string;\n};\n\n/**\n * Response from signaling an intent via the API\n */\nexport type SignalIntentResponse = {\n /** Whether the request was successful */\n success: boolean;\n /** Response message */\n message: string;\n /** Response object containing intent details */\n responseObject: {\n /** Deposit data associated with the intent */\n depositData: Record<string, string | number | boolean>;\n /** Signed intent string */\n signedIntent: string;\n /** Intent data details */\n intentData: {\n /** Deposit ID */\n depositId: string;\n /** Token amount */\n tokenAmount: string;\n /** Recipient address */\n recipientAddress: string;\n /** Verifier contract address */\n verifierAddress: string;\n /** Hash of the currency code */\n currencyCodeHash: string;\n /** Signature from the gating service */\n gatingServiceSignature: string;\n };\n };\n /** HTTP status code */\n statusCode: number;\n};\n\n/**\n * Request structure for posting deposit details\n */\nexport type PostDepositDetailsRequest = {\n /** Deposit data key-value pairs */\n depositData: { [key: string]: string };\n /** Payment processor name */\n processorName: string;\n};\n\n/**\n * Response from posting deposit details\n */\nexport type PostDepositDetailsResponse = {\n /** Whether the request was successful */\n success: boolean;\n message: string;\n responseObject: {\n id: number;\n processorName: string;\n depositData: { [key: string]: string };\n hashedOnchainId: string;\n createdAt: string;\n };\n statusCode: number;\n};\n\n/**\n * Alias types for clarity when registering payee details (makers/create)\n */\nexport type RegisterPayeeDetailsRequest = PostDepositDetailsRequest;\nexport type RegisterPayeeDetailsResponse = PostDepositDetailsResponse;\n\nexport type QuoteRequest = {\n paymentPlatforms: string[];\n fiatCurrency: string;\n user: string;\n recipient: string;\n destinationChainId: number;\n destinationToken: string;\n referrer?: string;\n useMultihop?: boolean;\n quotesToReturn?: number;\n amount: string;\n isExactFiat?: boolean;\n /** Optional filter: limit quotes to these escrow contracts */\n escrowAddresses?: string[];\n /** Enable nearby quote discovery when exact match unavailable */\n includeNearbyQuotes?: boolean;\n /** Max % deviation to search for nearby quotes (e.g., 10 = ±10%) */\n nearbySearchRange?: number;\n /** Max suggestions per direction (1-10, default: 3) */\n nearbyQuotesCount?: number;\n};\n\nexport type FiatResponse = { currencyCode: string; currencyName: string; currencySymbol: string; countryCode: string };\nexport type TokenResponse = { token: string; decimals: number; name: string; symbol: string; chainId: number };\n/**\n * Intent details within a quote response\n */\nexport type QuoteIntentResponse = {\n /** Deposit ID */\n depositId: string;\n /** Payment processor name */\n processorName: string;\n /** Amount to transfer */\n amount: string;\n /** Recipient address */\n toAddress: string;\n /** Payee details */\n payeeDetails: string;\n /** Processor-specific intent data */\n processorIntentData: Record<string, unknown>;\n /** Fiat currency code */\n fiatCurrencyCode: string;\n /** Chain ID */\n chainId: string;\n};\nexport type QuoteSingleResponse = {\n fiatAmount: string;\n fiatAmountFormatted: string;\n tokenAmount: string;\n tokenAmountFormatted: string;\n paymentMethod: string;\n payeeAddress: string;\n conversionRate: string;\n intent: QuoteIntentResponse;\n payeeData?: Record<string, string>;\n};\nexport type QuoteFeesResponse = { zkp2pFee: string; zkp2pFeeFormatted: string; swapFee: string; swapFeeFormatted: string };\n\n/**\n * A nearby quote suggestion returned when no exact match is available.\n * Fields vary based on whether request was exact-token or exact-fiat mode.\n */\nexport type NearbyQuote = {\n /** For exact-token mode: suggested token amount */\n suggestedTokenAmount?: string;\n /** For exact-token mode: formatted suggested token amount */\n suggestedTokenAmountFormatted?: string;\n /** For exact-token mode: percentage difference from requested (e.g., \"-5.0%\" or \"+10.0%\") */\n tokenPercentDifference?: string;\n /** For exact-fiat mode: suggested fiat amount */\n suggestedFiatAmount?: string;\n /** For exact-fiat mode: formatted suggested fiat amount */\n suggestedFiatAmountFormatted?: string;\n /** For exact-fiat mode: percentage difference from requested */\n fiatPercentDifference?: string;\n /** The full quote at this suggested amount */\n quote: QuoteSingleResponse;\n};\n\n/**\n * Nearby quote suggestions when no exact match is available.\n * Only present in response when includeNearbyQuotes=true and no exact quotes found.\n */\nexport type NearbySuggestions = {\n /** Quotes at amounts below the requested amount (sorted by closest first) */\n below: NearbyQuote[];\n /** Quotes at amounts above the requested amount (sorted by closest first) */\n above: NearbyQuote[];\n};\n\nexport type QuoteResponseObject = {\n fiat: FiatResponse;\n token: TokenResponse;\n quotes: QuoteSingleResponse[];\n fees: QuoteFeesResponse;\n /** Nearby suggestions when no exact quotes available (only present with includeNearbyQuotes=true) */\n nearbySuggestions?: NearbySuggestions;\n};\n\nexport type QuoteResponse = {\n message: string;\n success: boolean;\n responseObject: QuoteResponseObject;\n statusCode: number;\n};\n\n/**\n * Request to fetch payee details\n * Prefer `processorName`; `platform` kept for backward compatibility.\n */\nexport type GetPayeeDetailsRequest = { hashedOnchainId: string; processorName: string };\nexport type GetPayeeDetailsResponse = {\n success: boolean;\n message: string;\n responseObject: {\n id: number;\n processorName: string;\n depositData: { [key: string]: string };\n hashedOnchainId: string;\n createdAt: string;\n};\n statusCode: number;\n};\n\n// Makers list (presented)\nexport type ListPayeesRequest = { processorName?: string };\nexport type PresentedMaker = { id?: number; processorName: string; hashedOnchainId: string; createdAt: string };\nexport type ListPayeesResponse = { success: boolean; message: string; responseObject: PresentedMaker[]; statusCode: number };\n\nexport type ValidatePayeeDetailsRequest = {\n processorName: string;\n depositData: { [key: string]: string };\n};\n\nexport type ValidatePayeeDetailsResponse = {\n success: boolean;\n message: string;\n responseObject: { isValid: boolean; errors?: string[] };\n statusCode: number;\n};\n\n// Onchain currency and deposit verifier types used in createDeposit action\nexport type OnchainCurrency = { code: `0x${string}`; conversionRate: bigint };\nexport type DepositVerifierData = {\n intentGatingService: `0x${string}`;\n payeeDetails: string;\n data: `0x${string}`;\n};\n\n// CreateDeposit refined inputs\nexport type Range = { min: bigint; max: bigint };\nexport type CreateDepositConversionRate = { currency: CurrencyType; conversionRate: string };\nexport type CreateDepositParams = {\n token: Address;\n amount: bigint;\n intentAmountRange: Range;\n conversionRates: CreateDepositConversionRate[][];\n processorNames: string[];\n depositData: { [key: string]: string }[];\n onSuccess?: ActionCallback;\n onError?: (error: Error) => void;\n onMined?: ActionCallback;\n};\n\nexport type WithdrawDepositParams = {\n depositId: string | number | bigint;\n onSuccess?: ActionCallback;\n onError?: (error: Error) => void;\n onMined?: ActionCallback;\n};\n\nexport type CancelIntentParams = {\n intentHash: Hash;\n onSuccess?: ActionCallback;\n onError?: (error: Error) => void;\n onMined?: ActionCallback;\n};\n\n\n// Historical Event Types (for deposits and intents)\nexport type DepositStatus = 'ACTIVE' | 'WITHDRAWN' | 'CLOSED';\n\nexport type Deposit = {\n id: string;\n owner: string;\n amount: string;\n minimumIntent: string;\n maximumIntent: string;\n status: DepositStatus;\n updatedAt: Date;\n createdAt: Date;\n processorPaymentData: Array<{\n processor: string;\n paymentDetailsHash: string;\n isHashed: boolean;\n paymentDetails: string;\n updatedAt: Date;\n createdAt: Date;\n }>;\n};\n\n// API Intent status per v1 Orders API\n// Note: MANUALLY_RELEASED can occur when maker releases funds without payment verification\nexport type ApiIntentStatus = 'SIGNALED' | 'FULFILLED' | 'PRUNED' | 'MANUALLY_RELEASED';\n\nexport type Intent = {\n id: number;\n intentHash: string;\n depositId: string;\n verifier: string;\n owner: string;\n toAddress: string;\n amount: string;\n fiatCurrency: string;\n conversionRate: string;\n sustainabilityFee: string | null;\n verifierFee: string | null;\n status: ApiIntentStatus;\n signalTxHash: string;\n signalTimestamp: Date;\n fulfillTxHash: string | null;\n fulfillTimestamp: Date | null;\n pruneTxHash: string | null;\n prunedTimestamp: Date | null;\n createdAt: Date;\n updatedAt: Date;\n};\n\nexport type GetOwnerIntentsRequest = {\n ownerAddress: string;\n status?: ApiIntentStatus | ApiIntentStatus[];\n};\n\nexport type GetOwnerIntentsResponse = {\n success: boolean;\n message: string;\n responseObject: Intent[];\n statusCode: number;\n};\n\n// Orders API types\nexport type GetIntentsByDepositRequest = {\n depositId: string;\n status?: ApiIntentStatus | ApiIntentStatus[];\n};\n\nexport type GetIntentsByDepositResponse = {\n success: boolean;\n message: string;\n responseObject: Intent[];\n statusCode: number;\n};\n\nexport type GetIntentsByTakerRequest = {\n takerAddress: string;\n status?: ApiIntentStatus | ApiIntentStatus[];\n};\n\nexport type GetIntentsByTakerResponse = {\n success: boolean;\n message: string;\n responseObject: Intent[];\n statusCode: number;\n};\n\nexport type GetIntentsByRecipientRequest = {\n recipientAddress: string;\n status?: ApiIntentStatus | ApiIntentStatus[];\n};\n\nexport type GetIntentsByRecipientResponse = {\n success: boolean;\n message: string;\n responseObject: Intent[];\n statusCode: number;\n};\n\nexport type GetIntentByHashRequest = {\n intentHash: string;\n};\n\nexport type GetIntentByHashResponse = {\n success: boolean;\n message: string;\n responseObject: Intent;\n statusCode: number;\n};\n\n// Deposits API types aligned with v1\nexport type DepositVerifierCurrency = { id?: number; depositVerifierId?: number; currencyCode: string; conversionRate: string; createdAt?: Date; updatedAt?: Date };\nexport type DepositVerifier = { id?: number; depositId: number; verifier: string; intentGatingService: string; payeeDetailsHash: string; data: string; createdAt?: Date; updatedAt?: Date; currencies: DepositVerifierCurrency[] };\nexport type ApiDeposit = {\n id: number;\n depositor: string;\n token: string;\n amount: string;\n remainingDeposits: string;\n intentAmountMin: string;\n intentAmountMax: string;\n acceptingIntents: boolean;\n outstandingIntentAmount: string;\n availableLiquidity: string;\n status: 'ACTIVE' | 'WITHDRAWN' | 'CLOSED';\n totalIntents: number;\n signaledIntents: number;\n fulfilledIntents: number;\n prunedIntents: number;\n createdAt?: Date;\n updatedAt?: Date;\n verifiers: DepositVerifier[];\n};\n\nexport type GetOwnerDepositsRequest = {\n ownerAddress: string;\n /** Optional status filter: 'ACTIVE' | 'WITHDRAWN' | 'CLOSED' */\n status?: DepositStatus;\n};\n\nexport type GetOwnerDepositsResponse = {\n success: boolean;\n message: string;\n responseObject: ApiDeposit[];\n statusCode: number;\n};\n\nexport type GetDepositByIdRequest = { depositId: string };\nexport type GetDepositByIdResponse = { success: boolean; message: string; responseObject: ApiDeposit; statusCode: number };\n\n// Intent/order statistics returned by `/deposits/order-stats`\nexport type OrderStats = {\n id: number;\n totalIntents: number;\n signaledIntents: number;\n fulfilledIntents: number;\n prunedIntents: number;\n};\n\n// Kept for backward compatibility\nexport type DepositIntentStatistics = OrderStats;\nexport type GetDepositsOrderStatsRequest = { depositIds: number[] };\nexport type GetDepositsOrderStatsResponse = { success: boolean; message: string; responseObject: OrderStats[]; statusCode: number };\n\n// Taker tier API types\nexport type TakerTierStats = {\n lifetimeSignaledCount: number;\n lifetimeFulfilledCount: number;\n lifetimeManualReleaseCount: number;\n lifetimePruneCount: number;\n totalCancelledVolume: string;\n totalFulfilledVolume: string;\n lockScore: string;\n lockScoreDiluted: string;\n firstSeenAt: string;\n lastIntentAt: string;\n updatedAt: string;\n};\n\nexport type TakerTierLevel = 'PEASANT' | 'PEER' | 'PLUS' | 'PRO' | 'PLATINUM' | 'PEER_PRESIDENT';\nexport type PlatformRiskLevel = 'LOW' | 'MEDIUM_HIGH' | 'HIGH' | 'HIGHEST';\n\nexport type PlatformLimit = {\n paymentMethodHash: string;\n platformName: string;\n riskLevel: PlatformRiskLevel;\n capMultiplier: number;\n effectiveCap: string;\n effectiveCapDisplay: string;\n hasCooldown: boolean;\n cooldownHours: number;\n isLocked: boolean;\n minTierRequired: TakerTierLevel | null;\n};\n\nexport type TakerTier = {\n owner: string;\n chainId: number;\n tier: TakerTierLevel;\n perIntentCapBaseUnits: string;\n perIntentCapDisplay: string;\n lastUpdated: string;\n source: 'computed' | 'fallback';\n stats: TakerTierStats | null;\n cooldownHours: number;\n cooldownSeconds: number;\n cooldownActive: boolean;\n cooldownRemainingSeconds: number;\n nextIntentAvailableAt: string | null;\n platformLimits?: PlatformLimit[];\n};\n\nexport type GetTakerTierRequest = {\n owner: string;\n chainId: number;\n};\n\nexport type GetTakerTierResponse = {\n success: boolean;\n message: string;\n responseObject: TakerTier;\n statusCode?: number;\n};\n\n// Currency domain (ISO) and on-chain currency mapping\nexport { Currency } from '../utils/currency';\nexport type { CurrencyType } from '../utils/currency';\n\n// Payment platforms (derived as a closed union for safety)\nexport const PAYMENT_PLATFORMS = [\n 'wise',\n 'venmo',\n 'revolut',\n 'cashapp',\n 'mercadopago',\n 'zelle',\n 'paypal',\n 'monzo',\n] as const;\nexport type PaymentPlatformType = typeof PAYMENT_PLATFORMS[number];\n\n\n// On-chain views\nexport type { EscrowDepositView, EscrowIntentView } from './escrowViews';\n\n// Prepared transaction types\nexport type {\n PreparedTransaction,\n PreparedTransactionWithAbi,\n PrepareableMethod,\n} from './prepared';\n","import type { Address } from 'viem';\n\n// Unversioned base; callers/providers must append /v1 or /v2 in adapters\nexport const DEFAULT_BASE_API_URL = 'https://api.zkp2p.xyz';\nexport const DEFAULT_WITNESS_URL = 'https://witness-proxy.zkp2p.xyz';\n\n// Enabled payment platforms (verifiers) for enrichment and platform-aware logic\nexport const ENABLED_PLATFORMS = [\n 'venmo',\n 'revolut',\n 'cashapp',\n 'wise',\n 'mercadopago',\n 'zelle',\n 'paypal',\n 'monzo',\n] as const;\n\nexport type EnabledPlatform = (typeof ENABLED_PLATFORMS)[number];\n\ntype PlatformAddresses = { [P in EnabledPlatform]: Address };\n\nexport type ContractSet = PlatformAddresses & {\n usdc: Address;\n escrow: Address;\n gatingService: Address;\n zkp2pWitnessSigner: Address;\n};\n\ntype Contracts = {\n [chainId: number]:\n | ContractSet\n | {\n production: ContractSet;\n staging: ContractSet;\n };\n};\n\nexport const DEPLOYED_ADDRESSES: Contracts = {\n 8453: {\n production: {\n // external contracts\n usdc: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',\n \n // escrow + verifiers\n escrow: '0xCA38607D85E8F6294Dc10728669605E6664C2D70',\n \n // Processor names to deployed addresses\n venmo: '0x9a733B55a875D0DB4915c6B36350b24F8AB99dF5',\n revolut: '0xAA5A1B62B01781E789C900d616300717CD9A41aB',\n cashapp: '0x76D33A33068D86016B806dF02376dDBb23Dd3703',\n wise: '0xFF0149799631D7A5bdE2e7eA9b306c42b3d9a9ca',\n mercadopago: '0xf2AC5be14F32Cbe6A613CFF8931d95460D6c33A3',\n zelle: '0x431a078A5029146aAB239c768A615CD484519aF7',\n paypal: '0x03d17E9371C858072E171276979f6B44571C5DeA',\n monzo: '0x0dE46433bD251027f73eD8f28E01eF05DA36a2E0',\n \n // offchain services\n gatingService: '0x396D31055Db28C0C6f36e8b36f18FE7227248a97',\n zkp2pWitnessSigner: '0x0636c417755E3ae25C6c166D181c0607F4C572A3',\n },\n staging: {\n // external contracts\n usdc: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',\n \n // escrow + verifiers\n escrow: '0xC8cd114C6274Ef1066840337E7678BC9731BEa68',\n \n // Processor names to deployed addresses\n venmo: '0xCE6454f272127ba69e8C8128B92F2388Ca343257',\n revolut: '0xb941e69B6C1A23A88cf9DA7D243bAE1D2Cb8eb6b',\n cashapp: '0xdDB9d452180398F456Fe89A43Df9C65B19756CEa',\n wise: '0x79F35E2f65ff917BE35686d34932C8Ef5a30631f',\n mercadopago: '0xA2d54F983B8201c7b276C9705641C49C2FBD1A36',\n zelle: '0x0Ed3c3DB9CF8458e5D9991712552539675D2C896',\n paypal: '0xB07764999679a9136d6853a5D4c70449afbfc2f8',\n monzo: '0x179792F99C0eFBFa06c3F6747989a96c58544f6F',\n \n // offchain services\n gatingService: '0x396D31055Db28C0C6f36e8b36f18FE7227248a97',\n zkp2pWitnessSigner: '0x0636c417755E3ae25C6c166D181c0607F4C572A3',\n },\n },\n 84532: {\n usdc: '0x17463cb89A62c7b4A5ecD949aFDEDBD0Aa047ad1',\n escrow: '0x15EF83EBB422B4AC8e3b8393d016Ed076dc50CB7',\n venmo: '0x8499f2e7c4496Acfe0D7Ca5C7b6522514877b33F',\n revolut: '0x7E34909A1C1b2a4D2FAbA61c17a0F59ECAce6F29',\n cashapp: '0xe4148B108Fe4D7421853FE8cFfd35bDc2c0d95Ec',\n wise: '0x54c92a8828A393C5A6D1DfbB71d0e9e97329b39C',\n mercadopago: '0x4367155Fe7BAA99d9AE99fE4F6aC1b8E87012e6b',\n zelle: '0xbeeC239145b3c461422BC2fC45B78E5fd70862F1',\n paypal: '0xC8cd114C6274Ef1066840337E7678BC9731BEa68',\n monzo: '0xe2B378D9181046c84dB1156B0F90cF3108e25E9D',\n \n gatingService: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',\n zkp2pWitnessSigner: '0x0636c417755E3ae25C6c166D181c0607F4C572A3',\n },\n 31337: {\n usdc: '0x5FbDB2315678afecb367f032d93F642f64180aa3',\n escrow: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512',\n venmo: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',\n revolut: '0xa513E6E4b8f2a923D98304ec87F64353C4D5C853',\n cashapp: '0x610178dA211FEF7D417bC0e6FeD39F05609AD788',\n wise: '0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82',\n mercadopago: '0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1',\n zelle: '0x3Aa5ebB10DC797CAC828524e59A333d0A371443c',\n paypal: '0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E',\n monzo: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042',\n \n // offchain services\n gatingService: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', // Hardhat 0\n zkp2pWitnessSigner: '0x0636c417755E3ae25C6c166D181c0607F4C572A3',\n },\n};\n\nexport function getPlatformAddressMap(\n addresses: ContractSet\n): Record<EnabledPlatform, Address> {\n const entries = ENABLED_PLATFORMS.map((p) => [p, addresses[p]] as const);\n return Object.fromEntries(entries) as Record<EnabledPlatform, Address>;\n}\n\nexport function platformFromVerifierAddress(\n addresses: ContractSet,\n verifierAddress: string\n): EnabledPlatform | null {\n if (!verifierAddress) return null;\n const target = verifierAddress.toLowerCase();\n for (const p of ENABLED_PLATFORMS) {\n const addr = addresses[p]?.toLowerCase?.();\n if (addr && addr === target) return p;\n }\n return null;\n}\n","/**\n * SDK Constants\n *\n * This module exports all public constants for the SDK including:\n * - Payment platforms (Wise, Venmo, Revolut, etc.)\n * - Currencies (USD, EUR, GBP, etc.)\n * - Chain IDs and network configuration\n * - Token metadata\n *\n * @module constants\n */\n\n// Payment platforms\nexport { PAYMENT_PLATFORMS, type PaymentPlatformType } from './types';\n\n// Currencies\nexport { Currency, currencyInfo } from './utils/currency';\nexport type { CurrencyType, CurrencyData } from './utils/currency';\n\n// Contract addresses and deployment info\nexport { DEPLOYED_ADDRESSES } from './utils/constants';\n\n// API URLs\nexport { DEFAULT_BASE_API_URL, DEFAULT_WITNESS_URL } from './utils/constants';\n\n/**\n * Supported blockchain chain IDs.\n *\n * @example\n * ```typescript\n * import { SUPPORTED_CHAIN_IDS } from '@zkp2p/sdk';\n *\n * const client = new Zkp2pClient({\n * chainId: SUPPORTED_CHAIN_IDS.BASE_MAINNET,\n * // ...\n * });\n * ```\n */\nexport const SUPPORTED_CHAIN_IDS = {\n /** Base mainnet (8453) */\n BASE_MAINNET: 8453,\n /** Base Sepolia testnet (84532) */\n BASE_SEPOLIA: 84532,\n /** Scroll mainnet (534352) */\n SCROLL_MAINNET: 534352,\n /** Local Hardhat network (31337) */\n HARDHAT: 31337,\n} as const;\n\n/**\n * Union type of supported chain IDs.\n */\nexport type SupportedChainId = typeof SUPPORTED_CHAIN_IDS[keyof typeof SUPPORTED_CHAIN_IDS];\n\n/**\n * Metadata for each supported payment platform.\n *\n * Includes display names, logos, and the number of proofs required\n * for payment verification.\n */\nexport const PLATFORM_METADATA = {\n venmo: {\n name: 'Venmo',\n displayName: 'Venmo',\n logo: '💵',\n requiredProofs: 1,\n },\n revolut: {\n name: 'Revolut',\n displayName: 'Revolut',\n logo: '💳',\n requiredProofs: 1,\n },\n cashapp: {\n name: 'CashApp',\n displayName: 'Cash App',\n logo: '💸',\n requiredProofs: 1,\n },\n wise: {\n name: 'Wise',\n displayName: 'Wise',\n logo: '🌍',\n requiredProofs: 2,\n },\n mercadopago: {\n name: 'MercadoPago',\n displayName: 'Mercado Pago',\n logo: '💰',\n requiredProofs: 1,\n },\n zelle: {\n name: 'Zelle',\n displayName: 'Zelle',\n logo: '💲',\n requiredProofs: 1,\n },\n paypal: {\n name: 'PayPal',\n displayName: 'PayPal',\n logo: '💙',\n requiredProofs: 1,\n },\n monzo: {\n name: 'Monzo',\n displayName: 'Monzo',\n logo: '🏦',\n requiredProofs: 1,\n },\n} as const;\n\n/**\n * Token metadata for supported tokens.\n */\nexport const TOKEN_METADATA = {\n USDC: {\n symbol: 'USDC',\n decimals: 6,\n name: 'USD Coin',\n },\n} as const;\n\n/**\n * Attestation service configuration for each payment platform.\n *\n * Maps platform names to their corresponding action types for the\n * attestation service endpoints.\n *\n * @internal Used internally by fulfillIntent\n */\nexport const PLATFORM_ATTESTATION_CONFIG: Record<string, { actionType: string; actionPlatform: string }> = {\n wise: { actionType: 'transfer_wise', actionPlatform: 'wise' },\n venmo: { actionType: 'transfer_venmo', actionPlatform: 'venmo' },\n revolut: { actionType: 'transfer_revolut', actionPlatform: 'revolut' },\n cashapp: { actionType: 'transfer_cashapp', actionPlatform: 'cashapp' },\n mercadopago: { actionType: 'transfer_mercadopago', actionPlatform: 'mercadopago' },\n paypal: { actionType: 'transfer_paypal', actionPlatform: 'paypal' },\n monzo: { actionType: 'transfer_monzo', actionPlatform: 'monzo' },\n 'zelle-chase': { actionType: 'transfer_zelle', actionPlatform: 'chase' },\n 'zelle-bofa': { actionType: 'transfer_zelle', actionPlatform: 'bankofamerica' },\n 'zelle-citi': { actionType: 'transfer_zelle', actionPlatform: 'citi' },\n} as const;\n\n/**\n * Resolves attestation platform configuration for a given payment platform.\n *\n * @param platformName - The payment platform name (e.g., 'wise', 'venmo', 'zelle-citi')\n * @returns Attestation configuration with actionType and actionPlatform\n * @throws Error if the platform is not supported\n *\n * @internal Used internally by fulfillIntent\n */\nexport function resolvePlatformAttestationConfig(platformName: string): { actionType: string; actionPlatform: string } {\n const normalized = platformName.toLowerCase();\n const config = PLATFORM_ATTESTATION_CONFIG[normalized];\n if (!config) {\n throw new Error(`Unknown payment platform: ${platformName}`);\n }\n return config;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../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","../src/utils/currency.ts"],"names":["viemKeccak256","Currency","currencyInfo"],"mappings":";;;;AAOO,IAAM,SAAA,GAAY,CAAC,MAAA,KAA6C;AACrE,EAAA,OAAO,UAAA,CAAW,MAAA,CAAO,QAAA,EAAA,EAAY,CAAC,CAAA;AACxC,CAAA;ACHO,IAAM,iBAAA,GAAoB,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BAAmB,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,CAAKA,aAAY,CAAA,EAAuC;AAC/E,IAAA,MAAM,IAAA,GAAOA,cAAa,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,OAAOA,cAAa,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-CM3RH5VZ.mjs","sourcesContent":["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 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 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 '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;\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","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,4 +0,0 @@
|
|
|
1
|
-
export { DEFAULT_BASE_API_URL, DEFAULT_WITNESS_URL, DEPLOYED_ADDRESSES, PAYMENT_PLATFORMS, PLATFORM_ATTESTATION_CONFIG, PLATFORM_METADATA, SUPPORTED_CHAIN_IDS, TOKEN_METADATA, resolvePlatformAttestationConfig } from './chunk-ARFGMPYS.mjs';
|
|
2
|
-
export { Currency, currencyInfo } from './chunk-CM3RH5VZ.mjs';
|
|
3
|
-
//# sourceMappingURL=constants-MQB4AQDD.mjs.map
|
|
4
|
-
//# sourceMappingURL=constants-MQB4AQDD.mjs.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { enrichPvDepositView, enrichPvIntentView, parseDepositView, parseIntentView } from './chunk-PYEJ4L76.mjs';
|
|
2
|
-
import './chunk-GDKCACWH.mjs';
|
|
3
|
-
import './chunk-CM3RH5VZ.mjs';
|
|
4
|
-
//# sourceMappingURL=protocolViewerParsers-3QIR3XMT.mjs.map
|
|
5
|
-
//# sourceMappingURL=protocolViewerParsers-3QIR3XMT.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/timeout.ts"],"names":[],"mappings":";;;AASA,eAAsB,WAAA,CACpB,OAAA,EACA,SAAA,EACA,cAAA,EACY;AACZ,EAAA,IAAI,SAAA;AAEJ,EAAA,MAAM,cAAA,GAAiB,IAAI,OAAA,CAAe,CAAC,GAAG,MAAA,KAAW;AACvD,IAAA,SAAA,GAAY,WAAW,MAAM;AAC3B,MAAA,MAAA,CAAO,IAAI,YAAA,CAAa,cAAA,EAAgB,EAAE,OAAA,EAAS,SAAA,EAAW,CAAC,CAAA;AAAA,IACjE,GAAG,SAAS,CAAA;AAAA,EACd,CAAC,CAAA;AAED,EAAA,IAAI;AACF,IAAA,MAAM,SAAS,MAAM,OAAA,CAAQ,KAAK,CAAC,OAAA,EAAS,cAAc,CAAC,CAAA;AAC3D,IAAA,IAAI,SAAA,eAAwB,SAAS,CAAA;AACrC,IAAA,OAAO,MAAA;AAAA,EACT,SAAS,KAAA,EAAO;AACd,IAAA,IAAI,SAAA,eAAwB,SAAS,CAAA;AACrC,IAAA,MAAM,KAAA;AAAA,EACR;AACF;AAKO,IAAM,gBAAA,GAAmB;AAAA;AAAA,EAE9B,GAAA,EAAK,GAAA;AAAA;AAAA,EAEL,WAAA,EAAa,GAAA;AAAA;AAAA,EAEb,gBAAA,EAAkB,IAAA;AAAA;AAAA,EAElB,SAAA,EAAW;AACb","file":"timeout-QB7K5SOB.mjs","sourcesContent":["import { NetworkError } from '../errors';\n\n/**\n * Wraps a promise with a timeout\n * @param promise - The promise to wrap\n * @param timeoutMs - Timeout in milliseconds\n * @param timeoutMessage - Error message when timeout occurs\n * @returns Promise that rejects if timeout occurs\n */\nexport async function withTimeout<T>(\n promise: Promise<T>,\n timeoutMs: number,\n timeoutMessage: string\n): Promise<T> {\n let timeoutId: NodeJS.Timeout | undefined;\n\n const timeoutPromise = new Promise<never>((_, reject) => {\n timeoutId = setTimeout(() => {\n reject(new NetworkError(timeoutMessage, { timeout: timeoutMs }));\n }, timeoutMs);\n });\n\n try {\n const result = await Promise.race([promise, timeoutPromise]);\n if (timeoutId) clearTimeout(timeoutId);\n return result;\n } catch (error) {\n if (timeoutId) clearTimeout(timeoutId);\n throw error;\n }\n}\n\n/**\n * Default timeout values for different operation types\n */\nexport const DEFAULT_TIMEOUTS = {\n /** API call timeout (30 seconds) */\n API: 30000,\n /** Blockchain transaction timeout (60 seconds) */\n TRANSACTION: 60000,\n /** Proof generation timeout (120 seconds) */\n PROOF_GENERATION: 120000,\n /** Extension communication timeout (60 seconds) */\n EXTENSION: 60000,\n} as const;"]}
|