@zkp2p/sdk 0.0.4 → 0.0.6

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.
@@ -1 +1 @@
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,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,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EAAE,UAAA,EAAY,eAAA,EAAiB,gBAAgB,MAAA,EAAO;AAAA,EAC5D,KAAA,EAAO,EAAE,UAAA,EAAY,gBAAA,EAAkB,gBAAgB,OAAA,EAAQ;AAAA,EAC/D,OAAA,EAAS,EAAE,UAAA,EAAY,kBAAA,EAAoB,gBAAgB,SAAA,EAAU;AAAA,EACrE,OAAA,EAAS,EAAE,UAAA,EAAY,kBAAA,EAAoB,gBAAgB,SAAA,EAAU;AAAA,EACrE,WAAA,EAAa,EAAE,UAAA,EAAY,sBAAA,EAAwB,gBAAgB,aAAA,EAAc;AAAA,EACjF,MAAA,EAAQ,EAAE,UAAA,EAAY,iBAAA,EAAmB,gBAAgB,QAAA,EAAS;AAAA,EAClE,KAAA,EAAO,EAAE,UAAA,EAAY,gBAAA,EAAkB,gBAAgB,OAAA,EAAQ;AAAA,EAC/D,aAAA,EAAe,EAAE,UAAA,EAAY,gBAAA,EAAkB,gBAAgB,OAAA,EAAQ;AAAA,EACvE,YAAA,EAAc,EAAE,UAAA,EAAY,gBAAA,EAAkB,gBAAgB,eAAA,EAAgB;AAAA,EAC9E,YAAA,EAAc,EAAE,UAAA,EAAY,gBAAA,EAAkB,gBAAgB,MAAA;AAChE;AAWO,SAAS,iCAAiC,YAAA,EAAsE;AACrH,EAAA,MAAM,UAAA,GAAa,aAAa,WAAA,EAAY;AAC5C,EAAA,MAAM,MAAA,GAAS,4BAA4B,UAAU,CAAA;AACrD,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,0BAAA,EAA6B,YAAY,CAAA,CAAE,CAAA;AAAA,EAC7D;AACA,EAAA,OAAO,MAAA;AACT","file":"chunk-P3NOBRQB.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","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
+ {"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,M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C,YAAA,EAAsE;AACrH,EAAA,MAAM,UAAA,GAAa,aAAa,WAAA,EAAY;AAC5C,EAAA,MAAM,MAAA,GAAS,4BAA4B,UAAU,CAAA;AACrD,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,MAAM,IAAI,KAAA,CAAM,CAAA,0BAAA,EAA6B,YAAY,CAAA,CAAE,CAAA;AAAA,EAC7D;AACA,EAAA,OAAO,MAAA;AACT","file":"chunk-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,4 +1,4 @@
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-P3NOBRQB.mjs';
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
2
  export { Currency, currencyInfo } from './chunk-CM3RH5VZ.mjs';
3
- //# sourceMappingURL=constants-Y2IWTA6H.mjs.map
4
- //# sourceMappingURL=constants-Y2IWTA6H.mjs.map
3
+ //# sourceMappingURL=constants-MQB4AQDD.mjs.map
4
+ //# sourceMappingURL=constants-MQB4AQDD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"constants-Y2IWTA6H.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"constants-MQB4AQDD.mjs"}
package/dist/index.cjs CHANGED
@@ -3701,6 +3701,14 @@ function appendAttributionToCalldata(calldata, referrer) {
3701
3701
  const suffix = getAttributionDataSuffix(referrer);
3702
3702
  return viem.concatHex([calldata, suffix]);
3703
3703
  }
3704
+ function encodeWithAttribution(request, referrer) {
3705
+ const functionData = viem.encodeFunctionData({
3706
+ abi: request.abi,
3707
+ functionName: request.functionName,
3708
+ args: request.args || []
3709
+ });
3710
+ return appendAttributionToCalldata(functionData, referrer);
3711
+ }
3704
3712
  async function sendTransactionWithAttribution(walletClient, request, referrer, overrides) {
3705
3713
  const functionData = viem.encodeFunctionData({
3706
3714
  abi: request.abi,
@@ -3746,6 +3754,201 @@ var Zkp2pClient = class {
3746
3754
  * @throws Error if walletClient is missing an account
3747
3755
  */
3748
3756
  constructor(opts) {
3757
+ // ───────────────────────────────────────────────────────────────────────────
3758
+ // SUPPORTING: INTENT OPERATIONS
3759
+ // (Used by takers/buyers - not primary SDK functionality)
3760
+ // ───────────────────────────────────────────────────────────────────────────
3761
+ /**
3762
+ * **Supporting Method** - Signals intent to use a deposit.
3763
+ *
3764
+ * > **Note**: This method is typically used by takers/buyers who want to
3765
+ * > purchase crypto by paying fiat. Liquidity providers generally don't
3766
+ * > need to call this method directly.
3767
+ *
3768
+ * This reserves funds from a deposit and creates an intent that must be
3769
+ * fulfilled (via `fulfillIntent`) or will expire. The taker commits to
3770
+ * sending fiat payment to the deposit's payee.
3771
+ *
3772
+ * If `gatingServiceSignature` is not provided, the SDK will automatically
3773
+ * fetch one from the API (requires `apiKey` or `authorizationToken`).
3774
+ *
3775
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
3776
+ * ```typescript
3777
+ * const prepared = await client.signalIntent.prepare(params);
3778
+ * // Submit via relayer or inspect calldata
3779
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
3780
+ * ```
3781
+ *
3782
+ * @param params.depositId - The deposit to use
3783
+ * @param params.amount - Amount of tokens to claim (in token units)
3784
+ * @param params.toAddress - Address to receive the tokens when fulfilled
3785
+ * @param params.processorName - Payment platform (e.g., 'wise', 'revolut')
3786
+ * @param params.payeeDetails - Hashed payee details (from deposit)
3787
+ * @param params.fiatCurrencyCode - Fiat currency code (e.g., 'USD', 'EUR')
3788
+ * @param params.conversionRate - Agreed conversion rate (18 decimals)
3789
+ * @param params.referrer - Optional referrer address for fee sharing
3790
+ * @param params.referrerFee - Optional referrer fee amount
3791
+ * @param params.postIntentHook - Optional hook contract to call after signaling
3792
+ * @param params.data - Optional data to pass to the hook
3793
+ * @param params.gatingServiceSignature - Pre-obtained signature (if not auto-fetching)
3794
+ * @param params.signatureExpiration - Signature expiration timestamp
3795
+ * @param params.txOverrides - Optional viem transaction overrides
3796
+ * @returns Transaction hash
3797
+ *
3798
+ * @example
3799
+ * ```typescript
3800
+ * // Execute directly
3801
+ * const hash = await client.signalIntent({
3802
+ * depositId: 42n,
3803
+ * amount: 100_000000n, // 100 USDC
3804
+ * toAddress: '0x...',
3805
+ * processorName: 'wise',
3806
+ * payeeDetails: '0x...',
3807
+ * fiatCurrencyCode: 'USD',
3808
+ * conversionRate: 1_020000000000000000n, // 1.02
3809
+ * });
3810
+ *
3811
+ * // Or prepare for relayer submission
3812
+ * const prepared = await client.signalIntent.prepare({
3813
+ * depositId: 42n,
3814
+ * amount: 100_000000n,
3815
+ * toAddress: '0x...',
3816
+ * processorName: 'wise',
3817
+ * payeeDetails: '0x...',
3818
+ * fiatCurrencyCode: 'USD',
3819
+ * conversionRate: 1_020000000000000000n,
3820
+ * });
3821
+ * // prepared.to, prepared.data, prepared.value, prepared.chainId
3822
+ * ```
3823
+ */
3824
+ this.signalIntent = Object.assign(
3825
+ async (params) => {
3826
+ const prepared = await this.prepareSignalIntent(params);
3827
+ return this.executePreparedTransaction(prepared, params.txOverrides);
3828
+ },
3829
+ {
3830
+ prepare: async (params) => {
3831
+ const prepared = await this.prepareSignalIntent(params);
3832
+ return {
3833
+ to: prepared.to,
3834
+ data: prepared.data,
3835
+ value: prepared.value,
3836
+ chainId: prepared.chainId
3837
+ };
3838
+ }
3839
+ }
3840
+ );
3841
+ /**
3842
+ * **Supporting Method** - Cancels a signaled intent before fulfillment.
3843
+ *
3844
+ * Only the intent owner can cancel. Releases reserved funds back to the deposit.
3845
+ *
3846
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
3847
+ * ```typescript
3848
+ * const prepared = await client.cancelIntent.prepare({ intentHash });
3849
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
3850
+ * ```
3851
+ *
3852
+ * @param params.intentHash - The intent hash to cancel (0x-prefixed, 32 bytes)
3853
+ * @param params.txOverrides - Optional viem transaction overrides
3854
+ * @returns Transaction hash
3855
+ *
3856
+ * @example
3857
+ * ```typescript
3858
+ * // Execute directly
3859
+ * const hash = await client.cancelIntent({ intentHash: '0x...' });
3860
+ *
3861
+ * // Or prepare for relayer submission
3862
+ * const prepared = await client.cancelIntent.prepare({ intentHash: '0x...' });
3863
+ * ```
3864
+ */
3865
+ this.cancelIntent = Object.assign(
3866
+ async (params) => {
3867
+ const prepared = await this.prepareCancelIntent(params);
3868
+ return this.executePreparedTransaction(prepared, params.txOverrides);
3869
+ },
3870
+ {
3871
+ prepare: async (params) => {
3872
+ const prepared = await this.prepareCancelIntent(params);
3873
+ return {
3874
+ to: prepared.to,
3875
+ data: prepared.data,
3876
+ value: prepared.value,
3877
+ chainId: prepared.chainId
3878
+ };
3879
+ }
3880
+ }
3881
+ );
3882
+ /**
3883
+ * **Supporting Method** - Fulfills an intent by submitting a payment proof.
3884
+ *
3885
+ * > **Note**: This method is typically used by takers/buyers after they've
3886
+ * > sent fiat payment. Liquidity providers generally don't call this directly.
3887
+ *
3888
+ * This is the final step in the off-ramp flow. After the taker has sent
3889
+ * fiat payment, they generate a proof (via the browser extension) and
3890
+ * submit it here. The SDK handles attestation service calls automatically.
3891
+ *
3892
+ * **Flow:**
3893
+ * 1. Intent parameters are derived from the indexer/ProtocolViewer
3894
+ * 2. Proof is sent to the attestation service for verification
3895
+ * 3. Attestation response is encoded and submitted on-chain
3896
+ * 4. Funds are released to the intent's `toAddress`
3897
+ *
3898
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
3899
+ * ```typescript
3900
+ * const prepared = await client.fulfillIntent.prepare(params);
3901
+ * // Submit via relayer or inspect calldata
3902
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
3903
+ * ```
3904
+ *
3905
+ * @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
3906
+ * @param params.proof - Payment proof from Reclaim (object or JSON string)
3907
+ * @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
3908
+ * @param params.attestationServiceUrl - Override attestation service URL
3909
+ * @param params.verifyingContract - Override verifier contract address
3910
+ * @param params.postIntentHookData - Data to pass to post-intent hook
3911
+ * @param params.txOverrides - Optional viem transaction overrides
3912
+ * @param params.callbacks - Lifecycle callbacks for UI updates
3913
+ * @returns Transaction hash
3914
+ *
3915
+ * @example
3916
+ * ```typescript
3917
+ * // Execute directly
3918
+ * const hash = await client.fulfillIntent({
3919
+ * intentHash: '0x...',
3920
+ * proof: proofFromExtension,
3921
+ * });
3922
+ *
3923
+ * // Or prepare for relayer submission
3924
+ * const prepared = await client.fulfillIntent.prepare({
3925
+ * intentHash: '0x...',
3926
+ * proof: proofFromExtension,
3927
+ * });
3928
+ * // prepared.to, prepared.data, prepared.value, prepared.chainId
3929
+ * ```
3930
+ */
3931
+ this.fulfillIntent = Object.assign(
3932
+ async (params) => {
3933
+ params?.callbacks?.onAttestationStart?.();
3934
+ const prepared = await this.prepareFulfillIntent(params);
3935
+ const txHash = await this.executePreparedTransaction(prepared, params.txOverrides);
3936
+ params?.callbacks?.onTxSent?.(txHash);
3937
+ return txHash;
3938
+ },
3939
+ {
3940
+ prepare: async (params) => {
3941
+ params?.callbacks?.onAttestationStart?.();
3942
+ const prepared = await this.prepareFulfillIntent(params);
3943
+ return {
3944
+ to: prepared.to,
3945
+ data: prepared.data,
3946
+ value: prepared.value,
3947
+ chainId: prepared.chainId
3948
+ };
3949
+ }
3950
+ }
3951
+ );
3749
3952
  this.walletClient = opts.walletClient;
3750
3953
  this.chainId = opts.chainId;
3751
3954
  this.runtimeEnv = opts.runtimeEnv ?? "production";
@@ -3808,6 +4011,29 @@ var Zkp2pClient = class {
3808
4011
  txOverrides
3809
4012
  );
3810
4013
  }
4014
+ /**
4015
+ * Execute a prepared transaction (simulation + send).
4016
+ * Used internally by prepareable methods after preparation.
4017
+ */
4018
+ async executePreparedTransaction(prepared, txOverrides) {
4019
+ const { referrer, ...overrides } = txOverrides ?? {};
4020
+ await this.publicClient.simulateContract({
4021
+ address: prepared.to,
4022
+ abi: prepared.abi,
4023
+ functionName: prepared.functionName,
4024
+ args: prepared.args,
4025
+ account: this.walletClient.account,
4026
+ ...overrides
4027
+ });
4028
+ return this.walletClient.sendTransaction({
4029
+ to: prepared.to,
4030
+ data: prepared.data,
4031
+ value: prepared.value,
4032
+ account: this.walletClient.account,
4033
+ chain: this.walletClient.chain,
4034
+ ...overrides
4035
+ });
4036
+ }
3811
4037
  // ╔═══════════════════════════════════════════════════════════════════════════╗
3812
4038
  // ║ CORE: DEPOSIT QUERIES (RPC-first via ProtocolViewer) ║
3813
4039
  // ╚═══════════════════════════════════════════════════════════════════════════╝
@@ -4471,54 +4697,11 @@ var Zkp2pClient = class {
4471
4697
  txOverrides: params.txOverrides
4472
4698
  });
4473
4699
  }
4474
- // ───────────────────────────────────────────────────────────────────────────
4475
- // SUPPORTING: INTENT OPERATIONS
4476
- // (Used by takers/buyers - not primary SDK functionality)
4477
- // ───────────────────────────────────────────────────────────────────────────
4478
4700
  /**
4479
- * **Supporting Method** - Signals intent to use a deposit.
4480
- *
4481
- * > **Note**: This method is typically used by takers/buyers who want to
4482
- * > purchase crypto by paying fiat. Liquidity providers generally don't
4483
- * > need to call this method directly.
4484
- *
4485
- * This reserves funds from a deposit and creates an intent that must be
4486
- * fulfilled (via `fulfillIntent`) or will expire. The taker commits to
4487
- * sending fiat payment to the deposit's payee.
4488
- *
4489
- * If `gatingServiceSignature` is not provided, the SDK will automatically
4490
- * fetch one from the API (requires `apiKey` or `authorizationToken`).
4491
- *
4492
- * @param params.depositId - The deposit to use
4493
- * @param params.amount - Amount of tokens to claim (in token units)
4494
- * @param params.toAddress - Address to receive the tokens when fulfilled
4495
- * @param params.processorName - Payment platform (e.g., 'wise', 'revolut')
4496
- * @param params.payeeDetails - Hashed payee details (from deposit)
4497
- * @param params.fiatCurrencyCode - Fiat currency code (e.g., 'USD', 'EUR')
4498
- * @param params.conversionRate - Agreed conversion rate (18 decimals)
4499
- * @param params.referrer - Optional referrer address for fee sharing
4500
- * @param params.referrerFee - Optional referrer fee amount
4501
- * @param params.postIntentHook - Optional hook contract to call after signaling
4502
- * @param params.data - Optional data to pass to the hook
4503
- * @param params.gatingServiceSignature - Pre-obtained signature (if not auto-fetching)
4504
- * @param params.signatureExpiration - Signature expiration timestamp
4505
- * @param params.txOverrides - Optional viem transaction overrides
4506
- * @returns Transaction hash
4507
- *
4508
- * @example
4509
- * ```typescript
4510
- * const hash = await client.signalIntent({
4511
- * depositId: 42n,
4512
- * amount: 100_000000n, // 100 USDC
4513
- * toAddress: '0x...',
4514
- * processorName: 'wise',
4515
- * payeeDetails: '0x...',
4516
- * fiatCurrencyCode: 'USD',
4517
- * conversionRate: 1_020000000000000000n, // 1.02
4518
- * });
4519
- * ```
4701
+ * Prepare signalIntent transaction (all logic except simulation/send).
4702
+ * Returns the prepared transaction with encoded calldata.
4520
4703
  */
4521
- async signalIntent(params) {
4704
+ async prepareSignalIntent(params) {
4522
4705
  if (!this.orchestratorAddress || !this.orchestratorAbi) throw new Error("Orchestrator not available");
4523
4706
  const catalog = getPaymentMethodsCatalog(this.chainId, this.runtimeEnv);
4524
4707
  const paymentMethod = resolvePaymentMethodHashFromCatalog(params.processorName, catalog);
@@ -4564,32 +4747,49 @@ var Zkp2pClient = class {
4564
4747
  postIntentHook: params.postIntentHook ?? "0x0000000000000000000000000000000000000000",
4565
4748
  data: params.data ?? "0x"
4566
4749
  }];
4567
- return this.simulateAndSendWithAttribution({
4568
- address: this.orchestratorAddress,
4750
+ const { referrer } = params.txOverrides ?? {};
4751
+ const data = encodeWithAttribution(
4752
+ {
4753
+ abi: this.orchestratorAbi,
4754
+ functionName: "signalIntent",
4755
+ args
4756
+ },
4757
+ referrer
4758
+ );
4759
+ return {
4760
+ to: this.orchestratorAddress,
4761
+ data,
4762
+ value: 0n,
4763
+ chainId: this.chainId,
4569
4764
  abi: this.orchestratorAbi,
4570
4765
  functionName: "signalIntent",
4571
- args,
4572
- txOverrides: params.txOverrides
4573
- });
4766
+ args
4767
+ };
4574
4768
  }
4575
4769
  /**
4576
- * **Supporting Method** - Cancels a signaled intent before fulfillment.
4577
- *
4578
- * Only the intent owner can cancel. Releases reserved funds back to the deposit.
4579
- *
4580
- * @param params.intentHash - The intent hash to cancel (0x-prefixed, 32 bytes)
4581
- * @param params.txOverrides - Optional viem transaction overrides
4582
- * @returns Transaction hash
4770
+ * Prepare cancelIntent transaction (all logic except simulation/send).
4583
4771
  */
4584
- async cancelIntent(params) {
4772
+ async prepareCancelIntent(params) {
4585
4773
  if (!this.orchestratorAddress || !this.orchestratorAbi) throw new Error("Orchestrator not available");
4586
- return this.simulateAndSendWithAttribution({
4587
- address: this.orchestratorAddress,
4774
+ const args = [params.intentHash];
4775
+ const { referrer } = params.txOverrides ?? {};
4776
+ const data = encodeWithAttribution(
4777
+ {
4778
+ abi: this.orchestratorAbi,
4779
+ functionName: "cancelIntent",
4780
+ args
4781
+ },
4782
+ referrer
4783
+ );
4784
+ return {
4785
+ to: this.orchestratorAddress,
4786
+ data,
4787
+ value: 0n,
4788
+ chainId: this.chainId,
4588
4789
  abi: this.orchestratorAbi,
4589
4790
  functionName: "cancelIntent",
4590
- args: [params.intentHash],
4591
- txOverrides: params.txOverrides
4592
- });
4791
+ args
4792
+ };
4593
4793
  }
4594
4794
  /**
4595
4795
  * **Supporting Method** - Releases funds back to the deposit owner.
@@ -4612,32 +4812,10 @@ var Zkp2pClient = class {
4612
4812
  });
4613
4813
  }
4614
4814
  /**
4615
- * **Supporting Method** - Fulfills an intent by submitting a payment proof.
4616
- *
4617
- * > **Note**: This method is typically used by takers/buyers after they've
4618
- * > sent fiat payment. Liquidity providers generally don't call this directly.
4619
- *
4620
- * This is the final step in the off-ramp flow. After the taker has sent
4621
- * fiat payment, they generate a proof (via the browser extension) and
4622
- * submit it here. The SDK handles attestation service calls automatically.
4623
- *
4624
- * **Flow:**
4625
- * 1. Intent parameters are derived from the indexer/ProtocolViewer
4626
- * 2. Proof is sent to the attestation service for verification
4627
- * 3. Attestation response is encoded and submitted on-chain
4628
- * 4. Funds are released to the intent's `toAddress`
4629
- *
4630
- * @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
4631
- * @param params.proof - Payment proof from Reclaim (object or JSON string)
4632
- * @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
4633
- * @param params.attestationServiceUrl - Override attestation service URL
4634
- * @param params.verifyingContract - Override verifier contract address
4635
- * @param params.postIntentHookData - Data to pass to post-intent hook
4636
- * @param params.txOverrides - Optional viem transaction overrides
4637
- * @param params.callbacks - Lifecycle callbacks for UI updates
4638
- * @returns Transaction hash
4815
+ * Prepare fulfillIntent transaction (all logic except simulation/send).
4816
+ * Includes fetching intent inputs and calling attestation service.
4639
4817
  */
4640
- async fulfillIntent(params) {
4818
+ async prepareFulfillIntent(params) {
4641
4819
  if (!this.orchestratorAddress || !this.orchestratorAbi) throw new Error("Orchestrator not available");
4642
4820
  const intentHash = params.intentHash;
4643
4821
  const attUrl = params.attestationServiceUrl ?? this.defaultAttestationService();
@@ -4675,7 +4853,6 @@ var Zkp2pClient = class {
4675
4853
  timestampBufferMs
4676
4854
  }
4677
4855
  };
4678
- params?.callbacks?.onAttestationStart?.();
4679
4856
  const att = await apiCreatePaymentAttestation(payload, attUrl, platform, actionType);
4680
4857
  const paymentProof = encodePaymentAttestation(att);
4681
4858
  const verificationData = encodeVerifyPaymentData({
@@ -4689,15 +4866,24 @@ var Zkp2pClient = class {
4689
4866
  verificationData,
4690
4867
  postIntentHookData: params.postIntentHookData ?? "0x"
4691
4868
  }];
4692
- const txHash = await this.simulateAndSendWithAttribution({
4693
- address: this.orchestratorAddress,
4869
+ const { referrer } = params.txOverrides ?? {};
4870
+ const data = encodeWithAttribution(
4871
+ {
4872
+ abi: this.orchestratorAbi,
4873
+ functionName: "fulfillIntent",
4874
+ args
4875
+ },
4876
+ referrer
4877
+ );
4878
+ return {
4879
+ to: this.orchestratorAddress,
4880
+ data,
4881
+ value: 0n,
4882
+ chainId: this.chainId,
4694
4883
  abi: this.orchestratorAbi,
4695
4884
  functionName: "fulfillIntent",
4696
- args,
4697
- txOverrides: params.txOverrides
4698
- });
4699
- params?.callbacks?.onTxSent?.(txHash);
4700
- return txHash;
4885
+ args
4886
+ };
4701
4887
  }
4702
4888
  defaultAttestationService() {
4703
4889
  return this.runtimeEnv === "staging" ? "https://attestation-service-staging.zkp2p.xyz" : "https://attestation-service.zkp2p.xyz";
@@ -5066,6 +5252,7 @@ exports.convertIndexerDepositToEscrowView = convertIndexerDepositToEscrowView;
5066
5252
  exports.convertIndexerIntentsToEscrowViews = convertIndexerIntentsToEscrowViews;
5067
5253
  exports.createCompositeDepositId = createCompositeDepositId;
5068
5254
  exports.defaultIndexerEndpoint = defaultIndexerEndpoint;
5255
+ exports.encodeWithAttribution = encodeWithAttribution;
5069
5256
  exports.enrichPvDepositView = enrichPvDepositView;
5070
5257
  exports.enrichPvIntentView = enrichPvIntentView;
5071
5258
  exports.ensureBytes32 = ensureBytes32;