@zkp2p/sdk 0.0.5 → 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.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DepositWithRelations, I as IntentEntity, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetTakerTierRequest, e as GetTakerTierResponse, f as PaymentMethodCatalog, T as TxOverrides } from './Zkp2pClient-CIMGTCFg.mjs';
2
- export { A as ActionCallback, t as ApiDeposit, H as ApiIntentStatus, k as CancelIntentParams, i as CreateDepositConversionRate, C as CreateDepositParams, aq as Currency, ay as CurrencyData, ax as CurrencyType, aI as Deposit, aK as DepositCurrency, a1 as DepositIntentStatistics, w as DepositStatus, u as DepositVerifier, v as DepositVerifierCurrency, $ as DepositVerifierData, aH as DepositView, q as FiatResponse, F as FulfillIntentParams, z as GetDepositByIdRequest, B as GetDepositByIdResponse, O as GetIntentByHashRequest, U as GetIntentByHashResponse, L as GetIntentsByDepositRequest, M as GetIntentsByDepositResponse, x as GetOwnerDepositsRequest, y as GetOwnerDepositsResponse, J as GetOwnerIntentsRequest, K as GetOwnerIntentsResponse, a7 as IndexerClient, ak as IndexerDeploymentEnv, ab as IndexerDeposit, ag as IndexerDepositFilter, aj as IndexerDepositOrderDirection, ai as IndexerDepositOrderField, ah as IndexerDepositPagination, ad as IndexerDepositPaymentMethod, a9 as IndexerDepositService, an as IndexerFulfillmentAndPaymentResponse, al as IndexerFulfillmentRecord, ac as IndexerIntentFulfilled, af as IndexerIntentStatus, ae as IndexerMethodCurrency, am as IndexerPaymentVerifiedRecord, E as Intent, aL as IntentView, N as NearbyQuote, s as NearbySuggestions, Z as OfframpClient, _ as OnchainCurrency, aM as OnchainIntent, a0 as OrderStats, ao as PAYMENT_PLATFORMS, aJ as PaymentMethodData, ap as PaymentPlatformType, a5 as PlatformLimit, a6 as PlatformRiskLevel, p as QuoteFeesResponse, o as QuoteIntentResponse, Q as QuoteRequest, l as QuoteResponse, m as QuoteResponseObject, n as QuoteSingleResponse, R as Range, X as RegisterPayeeDetailsRequest, Y as RegisterPayeeDetailsResponse, j as ReleaseFundsToPayerParams, aC as RuntimeEnv, S as SignalIntentParams, a2 as TakerTier, a4 as TakerTierLevel, a3 as TakerTierStats, h as TimeoutConfig, r as TokenResponse, W as WithdrawDepositParams, Z as Zkp2pClient, g as Zkp2pClientOptions, ar as currencyInfo, a8 as defaultIndexerEndpoint, aF as enrichPvDepositView, aG as enrichPvIntentView, aa as fetchIndexerFulfillmentAndPayment, az as getContracts, au as getCurrencyCodeFromHash, at as getCurrencyInfoFromCountryCode, as as getCurrencyInfoFromHash, aB as getGatingServiceAddress, aA as getPaymentMethodsCatalog, av as isSupportedCurrencyHash, aw as mapConversionRatesToOnchainMinRate, aD as parseDepositView, aE as parseIntentView } from './Zkp2pClient-CIMGTCFg.mjs';
1
+ import { D as DepositWithRelations, I as IntentEntity, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetTakerTierRequest, e as GetTakerTierResponse, f as PaymentMethodCatalog, T as TxOverrides } from './Zkp2pClient-D-eU4dxy.mjs';
2
+ export { A as ActionCallback, w as ApiDeposit, L as ApiIntentStatus, C as CancelIntentMethodParams, n as CancelIntentParams, j as CreateDepositConversionRate, i as CreateDepositParams, au as Currency, aC as CurrencyData, aB as CurrencyType, aM as Deposit, aO as DepositCurrency, a5 as DepositIntentStatistics, z as DepositStatus, x as DepositVerifier, y as DepositVerifierCurrency, a2 as DepositVerifierData, aL as DepositView, t as FiatResponse, F as FulfillIntentMethodParams, l as FulfillIntentParams, H as GetDepositByIdRequest, J as GetDepositByIdResponse, Y as GetIntentByHashRequest, _ as GetIntentByHashResponse, U as GetIntentsByDepositRequest, X as GetIntentsByDepositResponse, B as GetOwnerDepositsRequest, E as GetOwnerDepositsResponse, M as GetOwnerIntentsRequest, O as GetOwnerIntentsResponse, ab as IndexerClient, ao as IndexerDeploymentEnv, af as IndexerDeposit, ak as IndexerDepositFilter, an as IndexerDepositOrderDirection, am as IndexerDepositOrderField, al as IndexerDepositPagination, ah as IndexerDepositPaymentMethod, ad as IndexerDepositService, ar as IndexerFulfillmentAndPaymentResponse, ap as IndexerFulfillmentRecord, ag as IndexerIntentFulfilled, aj as IndexerIntentStatus, ai as IndexerMethodCurrency, aq as IndexerPaymentVerifiedRecord, K as Intent, aP as IntentView, N as NearbyQuote, v as NearbySuggestions, Z as OfframpClient, a1 as OnchainCurrency, aQ as OnchainIntent, a4 as OrderStats, as as PAYMENT_PLATFORMS, aN as PaymentMethodData, at as PaymentPlatformType, a9 as PlatformLimit, aa as PlatformRiskLevel, a3 as PreparedTransaction, s as QuoteFeesResponse, r as QuoteIntentResponse, Q as QuoteRequest, o as QuoteResponse, p as QuoteResponseObject, q as QuoteSingleResponse, R as Range, $ as RegisterPayeeDetailsRequest, a0 as RegisterPayeeDetailsResponse, m as ReleaseFundsToPayerParams, aG as RuntimeEnv, S as SignalIntentMethodParams, k as SignalIntentParams, a6 as TakerTier, a8 as TakerTierLevel, a7 as TakerTierStats, h as TimeoutConfig, u as TokenResponse, W as WithdrawDepositParams, Z as Zkp2pClient, g as Zkp2pClientOptions, av as currencyInfo, ac as defaultIndexerEndpoint, aJ as enrichPvDepositView, aK as enrichPvIntentView, ae as fetchIndexerFulfillmentAndPayment, aD as getContracts, ay as getCurrencyCodeFromHash, ax as getCurrencyInfoFromCountryCode, aw as getCurrencyInfoFromHash, aF as getGatingServiceAddress, aE as getPaymentMethodsCatalog, az as isSupportedCurrencyHash, aA as mapConversionRatesToOnchainMinRate, aH as parseDepositView, aI as parseIntentView } from './Zkp2pClient-D-eU4dxy.mjs';
3
3
  import { Abi } from 'abitype';
4
4
  import { Hex, WalletClient, Hash } from 'viem';
5
5
 
@@ -312,6 +312,30 @@ declare function getAttributionDataSuffix(referrer?: string | string[]): Hex;
312
312
  * @returns Calldata with attribution suffix appended
313
313
  */
314
314
  declare function appendAttributionToCalldata(calldata: Hex, referrer?: string | string[]): Hex;
315
+ /**
316
+ * Encode a contract call with ERC-8021 attribution suffix.
317
+ *
318
+ * This function encodes function data and appends the attribution suffix
319
+ * without sending the transaction. Use this when you need the calldata
320
+ * for relayer submission or inspection.
321
+ *
322
+ * @param request - The request with abi, functionName, args
323
+ * @param referrer - Optional referrer code(s) to prepend before the base builder code
324
+ * @returns Encoded calldata with attribution suffix
325
+ *
326
+ * @example
327
+ * ```typescript
328
+ * const calldata = encodeWithAttribution({
329
+ * abi: escrowAbi,
330
+ * functionName: 'signalIntent',
331
+ * args: [intentParams],
332
+ * }, 'zkp2p-ios');
333
+ *
334
+ * // Submit via relayer
335
+ * await relayer.submit({ to: escrowAddress, data: calldata });
336
+ * ```
337
+ */
338
+ declare function encodeWithAttribution(request: Pick<AttributionRequest, 'abi' | 'functionName' | 'args'>, referrer?: string | string[]): Hex;
315
339
  /**
316
340
  * Request parameters for sendTransactionWithAttribution
317
341
  */
@@ -432,4 +456,4 @@ declare class ContractError extends ZKP2PError {
432
456
  constructor(message: string, details?: unknown);
433
457
  }
434
458
 
435
- export { APIError, BASE_BUILDER_CODE, ContractError, ErrorCode, type EscrowDepositView, type EscrowIntentView, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, NetworkError, PLATFORM_METADATA, PaymentMethodCatalog, PostDepositDetailsRequest, PostDepositDetailsResponse, SUPPORTED_CHAIN_IDS, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, ensureBytes32, getAttributionDataSuffix, logger, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, sendTransactionWithAttribution, setLogLevel };
459
+ export { APIError, BASE_BUILDER_CODE, ContractError, ErrorCode, type EscrowDepositView, type EscrowIntentView, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, NetworkError, PLATFORM_METADATA, PaymentMethodCatalog, PostDepositDetailsRequest, PostDepositDetailsResponse, SUPPORTED_CHAIN_IDS, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, encodeWithAttribution, ensureBytes32, getAttributionDataSuffix, logger, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, sendTransactionWithAttribution, setLogLevel };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DepositWithRelations, I as IntentEntity, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetTakerTierRequest, e as GetTakerTierResponse, f as PaymentMethodCatalog, T as TxOverrides } from './Zkp2pClient-CIMGTCFg.js';
2
- export { A as ActionCallback, t as ApiDeposit, H as ApiIntentStatus, k as CancelIntentParams, i as CreateDepositConversionRate, C as CreateDepositParams, aq as Currency, ay as CurrencyData, ax as CurrencyType, aI as Deposit, aK as DepositCurrency, a1 as DepositIntentStatistics, w as DepositStatus, u as DepositVerifier, v as DepositVerifierCurrency, $ as DepositVerifierData, aH as DepositView, q as FiatResponse, F as FulfillIntentParams, z as GetDepositByIdRequest, B as GetDepositByIdResponse, O as GetIntentByHashRequest, U as GetIntentByHashResponse, L as GetIntentsByDepositRequest, M as GetIntentsByDepositResponse, x as GetOwnerDepositsRequest, y as GetOwnerDepositsResponse, J as GetOwnerIntentsRequest, K as GetOwnerIntentsResponse, a7 as IndexerClient, ak as IndexerDeploymentEnv, ab as IndexerDeposit, ag as IndexerDepositFilter, aj as IndexerDepositOrderDirection, ai as IndexerDepositOrderField, ah as IndexerDepositPagination, ad as IndexerDepositPaymentMethod, a9 as IndexerDepositService, an as IndexerFulfillmentAndPaymentResponse, al as IndexerFulfillmentRecord, ac as IndexerIntentFulfilled, af as IndexerIntentStatus, ae as IndexerMethodCurrency, am as IndexerPaymentVerifiedRecord, E as Intent, aL as IntentView, N as NearbyQuote, s as NearbySuggestions, Z as OfframpClient, _ as OnchainCurrency, aM as OnchainIntent, a0 as OrderStats, ao as PAYMENT_PLATFORMS, aJ as PaymentMethodData, ap as PaymentPlatformType, a5 as PlatformLimit, a6 as PlatformRiskLevel, p as QuoteFeesResponse, o as QuoteIntentResponse, Q as QuoteRequest, l as QuoteResponse, m as QuoteResponseObject, n as QuoteSingleResponse, R as Range, X as RegisterPayeeDetailsRequest, Y as RegisterPayeeDetailsResponse, j as ReleaseFundsToPayerParams, aC as RuntimeEnv, S as SignalIntentParams, a2 as TakerTier, a4 as TakerTierLevel, a3 as TakerTierStats, h as TimeoutConfig, r as TokenResponse, W as WithdrawDepositParams, Z as Zkp2pClient, g as Zkp2pClientOptions, ar as currencyInfo, a8 as defaultIndexerEndpoint, aF as enrichPvDepositView, aG as enrichPvIntentView, aa as fetchIndexerFulfillmentAndPayment, az as getContracts, au as getCurrencyCodeFromHash, at as getCurrencyInfoFromCountryCode, as as getCurrencyInfoFromHash, aB as getGatingServiceAddress, aA as getPaymentMethodsCatalog, av as isSupportedCurrencyHash, aw as mapConversionRatesToOnchainMinRate, aD as parseDepositView, aE as parseIntentView } from './Zkp2pClient-CIMGTCFg.js';
1
+ import { D as DepositWithRelations, I as IntentEntity, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetTakerTierRequest, e as GetTakerTierResponse, f as PaymentMethodCatalog, T as TxOverrides } from './Zkp2pClient-D-eU4dxy.js';
2
+ export { A as ActionCallback, w as ApiDeposit, L as ApiIntentStatus, C as CancelIntentMethodParams, n as CancelIntentParams, j as CreateDepositConversionRate, i as CreateDepositParams, au as Currency, aC as CurrencyData, aB as CurrencyType, aM as Deposit, aO as DepositCurrency, a5 as DepositIntentStatistics, z as DepositStatus, x as DepositVerifier, y as DepositVerifierCurrency, a2 as DepositVerifierData, aL as DepositView, t as FiatResponse, F as FulfillIntentMethodParams, l as FulfillIntentParams, H as GetDepositByIdRequest, J as GetDepositByIdResponse, Y as GetIntentByHashRequest, _ as GetIntentByHashResponse, U as GetIntentsByDepositRequest, X as GetIntentsByDepositResponse, B as GetOwnerDepositsRequest, E as GetOwnerDepositsResponse, M as GetOwnerIntentsRequest, O as GetOwnerIntentsResponse, ab as IndexerClient, ao as IndexerDeploymentEnv, af as IndexerDeposit, ak as IndexerDepositFilter, an as IndexerDepositOrderDirection, am as IndexerDepositOrderField, al as IndexerDepositPagination, ah as IndexerDepositPaymentMethod, ad as IndexerDepositService, ar as IndexerFulfillmentAndPaymentResponse, ap as IndexerFulfillmentRecord, ag as IndexerIntentFulfilled, aj as IndexerIntentStatus, ai as IndexerMethodCurrency, aq as IndexerPaymentVerifiedRecord, K as Intent, aP as IntentView, N as NearbyQuote, v as NearbySuggestions, Z as OfframpClient, a1 as OnchainCurrency, aQ as OnchainIntent, a4 as OrderStats, as as PAYMENT_PLATFORMS, aN as PaymentMethodData, at as PaymentPlatformType, a9 as PlatformLimit, aa as PlatformRiskLevel, a3 as PreparedTransaction, s as QuoteFeesResponse, r as QuoteIntentResponse, Q as QuoteRequest, o as QuoteResponse, p as QuoteResponseObject, q as QuoteSingleResponse, R as Range, $ as RegisterPayeeDetailsRequest, a0 as RegisterPayeeDetailsResponse, m as ReleaseFundsToPayerParams, aG as RuntimeEnv, S as SignalIntentMethodParams, k as SignalIntentParams, a6 as TakerTier, a8 as TakerTierLevel, a7 as TakerTierStats, h as TimeoutConfig, u as TokenResponse, W as WithdrawDepositParams, Z as Zkp2pClient, g as Zkp2pClientOptions, av as currencyInfo, ac as defaultIndexerEndpoint, aJ as enrichPvDepositView, aK as enrichPvIntentView, ae as fetchIndexerFulfillmentAndPayment, aD as getContracts, ay as getCurrencyCodeFromHash, ax as getCurrencyInfoFromCountryCode, aw as getCurrencyInfoFromHash, aF as getGatingServiceAddress, aE as getPaymentMethodsCatalog, az as isSupportedCurrencyHash, aA as mapConversionRatesToOnchainMinRate, aH as parseDepositView, aI as parseIntentView } from './Zkp2pClient-D-eU4dxy.js';
3
3
  import { Abi } from 'abitype';
4
4
  import { Hex, WalletClient, Hash } from 'viem';
5
5
 
@@ -312,6 +312,30 @@ declare function getAttributionDataSuffix(referrer?: string | string[]): Hex;
312
312
  * @returns Calldata with attribution suffix appended
313
313
  */
314
314
  declare function appendAttributionToCalldata(calldata: Hex, referrer?: string | string[]): Hex;
315
+ /**
316
+ * Encode a contract call with ERC-8021 attribution suffix.
317
+ *
318
+ * This function encodes function data and appends the attribution suffix
319
+ * without sending the transaction. Use this when you need the calldata
320
+ * for relayer submission or inspection.
321
+ *
322
+ * @param request - The request with abi, functionName, args
323
+ * @param referrer - Optional referrer code(s) to prepend before the base builder code
324
+ * @returns Encoded calldata with attribution suffix
325
+ *
326
+ * @example
327
+ * ```typescript
328
+ * const calldata = encodeWithAttribution({
329
+ * abi: escrowAbi,
330
+ * functionName: 'signalIntent',
331
+ * args: [intentParams],
332
+ * }, 'zkp2p-ios');
333
+ *
334
+ * // Submit via relayer
335
+ * await relayer.submit({ to: escrowAddress, data: calldata });
336
+ * ```
337
+ */
338
+ declare function encodeWithAttribution(request: Pick<AttributionRequest, 'abi' | 'functionName' | 'args'>, referrer?: string | string[]): Hex;
315
339
  /**
316
340
  * Request parameters for sendTransactionWithAttribution
317
341
  */
@@ -432,4 +456,4 @@ declare class ContractError extends ZKP2PError {
432
456
  constructor(message: string, details?: unknown);
433
457
  }
434
458
 
435
- export { APIError, BASE_BUILDER_CODE, ContractError, ErrorCode, type EscrowDepositView, type EscrowIntentView, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, NetworkError, PLATFORM_METADATA, PaymentMethodCatalog, PostDepositDetailsRequest, PostDepositDetailsResponse, SUPPORTED_CHAIN_IDS, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, ensureBytes32, getAttributionDataSuffix, logger, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, sendTransactionWithAttribution, setLogLevel };
459
+ export { APIError, BASE_BUILDER_CODE, ContractError, ErrorCode, type EscrowDepositView, type EscrowIntentView, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, NetworkError, PLATFORM_METADATA, PaymentMethodCatalog, PostDepositDetailsRequest, PostDepositDetailsResponse, SUPPORTED_CHAIN_IDS, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, encodeWithAttribution, ensureBytes32, getAttributionDataSuffix, logger, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, sendTransactionWithAttribution, setLogLevel };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ValidationError, APIError, NetworkError } from './chunk-GHQK65J2.mjs';
2
2
  export { APIError, ContractError, ErrorCode, NetworkError, ValidationError, ZKP2PError } from './chunk-GHQK65J2.mjs';
3
- export { PAYMENT_PLATFORMS, PLATFORM_METADATA, SUPPORTED_CHAIN_IDS, TOKEN_METADATA } from './chunk-P3NOBRQB.mjs';
3
+ export { PAYMENT_PLATFORMS, PLATFORM_METADATA, SUPPORTED_CHAIN_IDS, TOKEN_METADATA } from './chunk-ARFGMPYS.mjs';
4
4
  import { getContracts, getPaymentMethodsCatalog, getGatingServiceAddress } from './chunk-PYEJ4L76.mjs';
5
5
  export { enrichPvDepositView, enrichPvIntentView, getContracts, getGatingServiceAddress, getPaymentMethodsCatalog, parseDepositView, parseIntentView } from './chunk-PYEJ4L76.mjs';
6
6
  import { resolvePaymentMethodHashFromCatalog, resolveFiatCurrencyBytes32 } from './chunk-GDKCACWH.mjs';
@@ -884,6 +884,14 @@ function appendAttributionToCalldata(calldata, referrer) {
884
884
  const suffix = getAttributionDataSuffix(referrer);
885
885
  return concatHex([calldata, suffix]);
886
886
  }
887
+ function encodeWithAttribution(request, referrer) {
888
+ const functionData = encodeFunctionData({
889
+ abi: request.abi,
890
+ functionName: request.functionName,
891
+ args: request.args || []
892
+ });
893
+ return appendAttributionToCalldata(functionData, referrer);
894
+ }
887
895
  async function sendTransactionWithAttribution(walletClient, request, referrer, overrides) {
888
896
  const functionData = encodeFunctionData({
889
897
  abi: request.abi,
@@ -929,6 +937,201 @@ var Zkp2pClient = class {
929
937
  * @throws Error if walletClient is missing an account
930
938
  */
931
939
  constructor(opts) {
940
+ // ───────────────────────────────────────────────────────────────────────────
941
+ // SUPPORTING: INTENT OPERATIONS
942
+ // (Used by takers/buyers - not primary SDK functionality)
943
+ // ───────────────────────────────────────────────────────────────────────────
944
+ /**
945
+ * **Supporting Method** - Signals intent to use a deposit.
946
+ *
947
+ * > **Note**: This method is typically used by takers/buyers who want to
948
+ * > purchase crypto by paying fiat. Liquidity providers generally don't
949
+ * > need to call this method directly.
950
+ *
951
+ * This reserves funds from a deposit and creates an intent that must be
952
+ * fulfilled (via `fulfillIntent`) or will expire. The taker commits to
953
+ * sending fiat payment to the deposit's payee.
954
+ *
955
+ * If `gatingServiceSignature` is not provided, the SDK will automatically
956
+ * fetch one from the API (requires `apiKey` or `authorizationToken`).
957
+ *
958
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
959
+ * ```typescript
960
+ * const prepared = await client.signalIntent.prepare(params);
961
+ * // Submit via relayer or inspect calldata
962
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
963
+ * ```
964
+ *
965
+ * @param params.depositId - The deposit to use
966
+ * @param params.amount - Amount of tokens to claim (in token units)
967
+ * @param params.toAddress - Address to receive the tokens when fulfilled
968
+ * @param params.processorName - Payment platform (e.g., 'wise', 'revolut')
969
+ * @param params.payeeDetails - Hashed payee details (from deposit)
970
+ * @param params.fiatCurrencyCode - Fiat currency code (e.g., 'USD', 'EUR')
971
+ * @param params.conversionRate - Agreed conversion rate (18 decimals)
972
+ * @param params.referrer - Optional referrer address for fee sharing
973
+ * @param params.referrerFee - Optional referrer fee amount
974
+ * @param params.postIntentHook - Optional hook contract to call after signaling
975
+ * @param params.data - Optional data to pass to the hook
976
+ * @param params.gatingServiceSignature - Pre-obtained signature (if not auto-fetching)
977
+ * @param params.signatureExpiration - Signature expiration timestamp
978
+ * @param params.txOverrides - Optional viem transaction overrides
979
+ * @returns Transaction hash
980
+ *
981
+ * @example
982
+ * ```typescript
983
+ * // Execute directly
984
+ * const hash = await client.signalIntent({
985
+ * depositId: 42n,
986
+ * amount: 100_000000n, // 100 USDC
987
+ * toAddress: '0x...',
988
+ * processorName: 'wise',
989
+ * payeeDetails: '0x...',
990
+ * fiatCurrencyCode: 'USD',
991
+ * conversionRate: 1_020000000000000000n, // 1.02
992
+ * });
993
+ *
994
+ * // Or prepare for relayer submission
995
+ * const prepared = await client.signalIntent.prepare({
996
+ * depositId: 42n,
997
+ * amount: 100_000000n,
998
+ * toAddress: '0x...',
999
+ * processorName: 'wise',
1000
+ * payeeDetails: '0x...',
1001
+ * fiatCurrencyCode: 'USD',
1002
+ * conversionRate: 1_020000000000000000n,
1003
+ * });
1004
+ * // prepared.to, prepared.data, prepared.value, prepared.chainId
1005
+ * ```
1006
+ */
1007
+ this.signalIntent = Object.assign(
1008
+ async (params) => {
1009
+ const prepared = await this.prepareSignalIntent(params);
1010
+ return this.executePreparedTransaction(prepared, params.txOverrides);
1011
+ },
1012
+ {
1013
+ prepare: async (params) => {
1014
+ const prepared = await this.prepareSignalIntent(params);
1015
+ return {
1016
+ to: prepared.to,
1017
+ data: prepared.data,
1018
+ value: prepared.value,
1019
+ chainId: prepared.chainId
1020
+ };
1021
+ }
1022
+ }
1023
+ );
1024
+ /**
1025
+ * **Supporting Method** - Cancels a signaled intent before fulfillment.
1026
+ *
1027
+ * Only the intent owner can cancel. Releases reserved funds back to the deposit.
1028
+ *
1029
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
1030
+ * ```typescript
1031
+ * const prepared = await client.cancelIntent.prepare({ intentHash });
1032
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
1033
+ * ```
1034
+ *
1035
+ * @param params.intentHash - The intent hash to cancel (0x-prefixed, 32 bytes)
1036
+ * @param params.txOverrides - Optional viem transaction overrides
1037
+ * @returns Transaction hash
1038
+ *
1039
+ * @example
1040
+ * ```typescript
1041
+ * // Execute directly
1042
+ * const hash = await client.cancelIntent({ intentHash: '0x...' });
1043
+ *
1044
+ * // Or prepare for relayer submission
1045
+ * const prepared = await client.cancelIntent.prepare({ intentHash: '0x...' });
1046
+ * ```
1047
+ */
1048
+ this.cancelIntent = Object.assign(
1049
+ async (params) => {
1050
+ const prepared = await this.prepareCancelIntent(params);
1051
+ return this.executePreparedTransaction(prepared, params.txOverrides);
1052
+ },
1053
+ {
1054
+ prepare: async (params) => {
1055
+ const prepared = await this.prepareCancelIntent(params);
1056
+ return {
1057
+ to: prepared.to,
1058
+ data: prepared.data,
1059
+ value: prepared.value,
1060
+ chainId: prepared.chainId
1061
+ };
1062
+ }
1063
+ }
1064
+ );
1065
+ /**
1066
+ * **Supporting Method** - Fulfills an intent by submitting a payment proof.
1067
+ *
1068
+ * > **Note**: This method is typically used by takers/buyers after they've
1069
+ * > sent fiat payment. Liquidity providers generally don't call this directly.
1070
+ *
1071
+ * This is the final step in the off-ramp flow. After the taker has sent
1072
+ * fiat payment, they generate a proof (via the browser extension) and
1073
+ * submit it here. The SDK handles attestation service calls automatically.
1074
+ *
1075
+ * **Flow:**
1076
+ * 1. Intent parameters are derived from the indexer/ProtocolViewer
1077
+ * 2. Proof is sent to the attestation service for verification
1078
+ * 3. Attestation response is encoded and submitted on-chain
1079
+ * 4. Funds are released to the intent's `toAddress`
1080
+ *
1081
+ * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
1082
+ * ```typescript
1083
+ * const prepared = await client.fulfillIntent.prepare(params);
1084
+ * // Submit via relayer or inspect calldata
1085
+ * await relayer.submit({ to: prepared.to, data: prepared.data });
1086
+ * ```
1087
+ *
1088
+ * @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
1089
+ * @param params.proof - Payment proof from Reclaim (object or JSON string)
1090
+ * @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
1091
+ * @param params.attestationServiceUrl - Override attestation service URL
1092
+ * @param params.verifyingContract - Override verifier contract address
1093
+ * @param params.postIntentHookData - Data to pass to post-intent hook
1094
+ * @param params.txOverrides - Optional viem transaction overrides
1095
+ * @param params.callbacks - Lifecycle callbacks for UI updates
1096
+ * @returns Transaction hash
1097
+ *
1098
+ * @example
1099
+ * ```typescript
1100
+ * // Execute directly
1101
+ * const hash = await client.fulfillIntent({
1102
+ * intentHash: '0x...',
1103
+ * proof: proofFromExtension,
1104
+ * });
1105
+ *
1106
+ * // Or prepare for relayer submission
1107
+ * const prepared = await client.fulfillIntent.prepare({
1108
+ * intentHash: '0x...',
1109
+ * proof: proofFromExtension,
1110
+ * });
1111
+ * // prepared.to, prepared.data, prepared.value, prepared.chainId
1112
+ * ```
1113
+ */
1114
+ this.fulfillIntent = Object.assign(
1115
+ async (params) => {
1116
+ params?.callbacks?.onAttestationStart?.();
1117
+ const prepared = await this.prepareFulfillIntent(params);
1118
+ const txHash = await this.executePreparedTransaction(prepared, params.txOverrides);
1119
+ params?.callbacks?.onTxSent?.(txHash);
1120
+ return txHash;
1121
+ },
1122
+ {
1123
+ prepare: async (params) => {
1124
+ params?.callbacks?.onAttestationStart?.();
1125
+ const prepared = await this.prepareFulfillIntent(params);
1126
+ return {
1127
+ to: prepared.to,
1128
+ data: prepared.data,
1129
+ value: prepared.value,
1130
+ chainId: prepared.chainId
1131
+ };
1132
+ }
1133
+ }
1134
+ );
932
1135
  this.walletClient = opts.walletClient;
933
1136
  this.chainId = opts.chainId;
934
1137
  this.runtimeEnv = opts.runtimeEnv ?? "production";
@@ -991,6 +1194,29 @@ var Zkp2pClient = class {
991
1194
  txOverrides
992
1195
  );
993
1196
  }
1197
+ /**
1198
+ * Execute a prepared transaction (simulation + send).
1199
+ * Used internally by prepareable methods after preparation.
1200
+ */
1201
+ async executePreparedTransaction(prepared, txOverrides) {
1202
+ const { referrer, ...overrides } = txOverrides ?? {};
1203
+ await this.publicClient.simulateContract({
1204
+ address: prepared.to,
1205
+ abi: prepared.abi,
1206
+ functionName: prepared.functionName,
1207
+ args: prepared.args,
1208
+ account: this.walletClient.account,
1209
+ ...overrides
1210
+ });
1211
+ return this.walletClient.sendTransaction({
1212
+ to: prepared.to,
1213
+ data: prepared.data,
1214
+ value: prepared.value,
1215
+ account: this.walletClient.account,
1216
+ chain: this.walletClient.chain,
1217
+ ...overrides
1218
+ });
1219
+ }
994
1220
  // ╔═══════════════════════════════════════════════════════════════════════════╗
995
1221
  // ║ CORE: DEPOSIT QUERIES (RPC-first via ProtocolViewer) ║
996
1222
  // ╚═══════════════════════════════════════════════════════════════════════════╝
@@ -1654,54 +1880,11 @@ var Zkp2pClient = class {
1654
1880
  txOverrides: params.txOverrides
1655
1881
  });
1656
1882
  }
1657
- // ───────────────────────────────────────────────────────────────────────────
1658
- // SUPPORTING: INTENT OPERATIONS
1659
- // (Used by takers/buyers - not primary SDK functionality)
1660
- // ───────────────────────────────────────────────────────────────────────────
1661
1883
  /**
1662
- * **Supporting Method** - Signals intent to use a deposit.
1663
- *
1664
- * > **Note**: This method is typically used by takers/buyers who want to
1665
- * > purchase crypto by paying fiat. Liquidity providers generally don't
1666
- * > need to call this method directly.
1667
- *
1668
- * This reserves funds from a deposit and creates an intent that must be
1669
- * fulfilled (via `fulfillIntent`) or will expire. The taker commits to
1670
- * sending fiat payment to the deposit's payee.
1671
- *
1672
- * If `gatingServiceSignature` is not provided, the SDK will automatically
1673
- * fetch one from the API (requires `apiKey` or `authorizationToken`).
1674
- *
1675
- * @param params.depositId - The deposit to use
1676
- * @param params.amount - Amount of tokens to claim (in token units)
1677
- * @param params.toAddress - Address to receive the tokens when fulfilled
1678
- * @param params.processorName - Payment platform (e.g., 'wise', 'revolut')
1679
- * @param params.payeeDetails - Hashed payee details (from deposit)
1680
- * @param params.fiatCurrencyCode - Fiat currency code (e.g., 'USD', 'EUR')
1681
- * @param params.conversionRate - Agreed conversion rate (18 decimals)
1682
- * @param params.referrer - Optional referrer address for fee sharing
1683
- * @param params.referrerFee - Optional referrer fee amount
1684
- * @param params.postIntentHook - Optional hook contract to call after signaling
1685
- * @param params.data - Optional data to pass to the hook
1686
- * @param params.gatingServiceSignature - Pre-obtained signature (if not auto-fetching)
1687
- * @param params.signatureExpiration - Signature expiration timestamp
1688
- * @param params.txOverrides - Optional viem transaction overrides
1689
- * @returns Transaction hash
1690
- *
1691
- * @example
1692
- * ```typescript
1693
- * const hash = await client.signalIntent({
1694
- * depositId: 42n,
1695
- * amount: 100_000000n, // 100 USDC
1696
- * toAddress: '0x...',
1697
- * processorName: 'wise',
1698
- * payeeDetails: '0x...',
1699
- * fiatCurrencyCode: 'USD',
1700
- * conversionRate: 1_020000000000000000n, // 1.02
1701
- * });
1702
- * ```
1884
+ * Prepare signalIntent transaction (all logic except simulation/send).
1885
+ * Returns the prepared transaction with encoded calldata.
1703
1886
  */
1704
- async signalIntent(params) {
1887
+ async prepareSignalIntent(params) {
1705
1888
  if (!this.orchestratorAddress || !this.orchestratorAbi) throw new Error("Orchestrator not available");
1706
1889
  const catalog = getPaymentMethodsCatalog(this.chainId, this.runtimeEnv);
1707
1890
  const paymentMethod = resolvePaymentMethodHashFromCatalog(params.processorName, catalog);
@@ -1747,32 +1930,49 @@ var Zkp2pClient = class {
1747
1930
  postIntentHook: params.postIntentHook ?? "0x0000000000000000000000000000000000000000",
1748
1931
  data: params.data ?? "0x"
1749
1932
  }];
1750
- return this.simulateAndSendWithAttribution({
1751
- address: this.orchestratorAddress,
1933
+ const { referrer } = params.txOverrides ?? {};
1934
+ const data = encodeWithAttribution(
1935
+ {
1936
+ abi: this.orchestratorAbi,
1937
+ functionName: "signalIntent",
1938
+ args
1939
+ },
1940
+ referrer
1941
+ );
1942
+ return {
1943
+ to: this.orchestratorAddress,
1944
+ data,
1945
+ value: 0n,
1946
+ chainId: this.chainId,
1752
1947
  abi: this.orchestratorAbi,
1753
1948
  functionName: "signalIntent",
1754
- args,
1755
- txOverrides: params.txOverrides
1756
- });
1949
+ args
1950
+ };
1757
1951
  }
1758
1952
  /**
1759
- * **Supporting Method** - Cancels a signaled intent before fulfillment.
1760
- *
1761
- * Only the intent owner can cancel. Releases reserved funds back to the deposit.
1762
- *
1763
- * @param params.intentHash - The intent hash to cancel (0x-prefixed, 32 bytes)
1764
- * @param params.txOverrides - Optional viem transaction overrides
1765
- * @returns Transaction hash
1953
+ * Prepare cancelIntent transaction (all logic except simulation/send).
1766
1954
  */
1767
- async cancelIntent(params) {
1955
+ async prepareCancelIntent(params) {
1768
1956
  if (!this.orchestratorAddress || !this.orchestratorAbi) throw new Error("Orchestrator not available");
1769
- return this.simulateAndSendWithAttribution({
1770
- address: this.orchestratorAddress,
1957
+ const args = [params.intentHash];
1958
+ const { referrer } = params.txOverrides ?? {};
1959
+ const data = encodeWithAttribution(
1960
+ {
1961
+ abi: this.orchestratorAbi,
1962
+ functionName: "cancelIntent",
1963
+ args
1964
+ },
1965
+ referrer
1966
+ );
1967
+ return {
1968
+ to: this.orchestratorAddress,
1969
+ data,
1970
+ value: 0n,
1971
+ chainId: this.chainId,
1771
1972
  abi: this.orchestratorAbi,
1772
1973
  functionName: "cancelIntent",
1773
- args: [params.intentHash],
1774
- txOverrides: params.txOverrides
1775
- });
1974
+ args
1975
+ };
1776
1976
  }
1777
1977
  /**
1778
1978
  * **Supporting Method** - Releases funds back to the deposit owner.
@@ -1795,32 +1995,10 @@ var Zkp2pClient = class {
1795
1995
  });
1796
1996
  }
1797
1997
  /**
1798
- * **Supporting Method** - Fulfills an intent by submitting a payment proof.
1799
- *
1800
- * > **Note**: This method is typically used by takers/buyers after they've
1801
- * > sent fiat payment. Liquidity providers generally don't call this directly.
1802
- *
1803
- * This is the final step in the off-ramp flow. After the taker has sent
1804
- * fiat payment, they generate a proof (via the browser extension) and
1805
- * submit it here. The SDK handles attestation service calls automatically.
1806
- *
1807
- * **Flow:**
1808
- * 1. Intent parameters are derived from the indexer/ProtocolViewer
1809
- * 2. Proof is sent to the attestation service for verification
1810
- * 3. Attestation response is encoded and submitted on-chain
1811
- * 4. Funds are released to the intent's `toAddress`
1812
- *
1813
- * @param params.intentHash - The intent hash to fulfill (0x-prefixed, 32 bytes)
1814
- * @param params.proof - Payment proof from Reclaim (object or JSON string)
1815
- * @param params.timestampBufferMs - Allowed timestamp variance (default: 300000ms)
1816
- * @param params.attestationServiceUrl - Override attestation service URL
1817
- * @param params.verifyingContract - Override verifier contract address
1818
- * @param params.postIntentHookData - Data to pass to post-intent hook
1819
- * @param params.txOverrides - Optional viem transaction overrides
1820
- * @param params.callbacks - Lifecycle callbacks for UI updates
1821
- * @returns Transaction hash
1998
+ * Prepare fulfillIntent transaction (all logic except simulation/send).
1999
+ * Includes fetching intent inputs and calling attestation service.
1822
2000
  */
1823
- async fulfillIntent(params) {
2001
+ async prepareFulfillIntent(params) {
1824
2002
  if (!this.orchestratorAddress || !this.orchestratorAbi) throw new Error("Orchestrator not available");
1825
2003
  const intentHash = params.intentHash;
1826
2004
  const attUrl = params.attestationServiceUrl ?? this.defaultAttestationService();
@@ -1837,7 +2015,7 @@ var Zkp2pClient = class {
1837
2015
  const { resolvePaymentMethodNameFromHash: resolvePaymentMethodNameFromHash2 } = await import('./paymentResolution-4AAJVIIC.mjs');
1838
2016
  const platformName = resolvePaymentMethodNameFromHash2(paymentMethodHash, catalog);
1839
2017
  if (!platformName) throw new Error("Unknown paymentMethodHash for this network/env; update SDK catalogs.");
1840
- const { resolvePlatformAttestationConfig } = await import('./constants-Y2IWTA6H.mjs');
2018
+ const { resolvePlatformAttestationConfig } = await import('./constants-MQB4AQDD.mjs');
1841
2019
  const cfg = resolvePlatformAttestationConfig(platformName);
1842
2020
  const platform = cfg.actionPlatform;
1843
2021
  const actionType = cfg.actionType;
@@ -1858,7 +2036,6 @@ var Zkp2pClient = class {
1858
2036
  timestampBufferMs
1859
2037
  }
1860
2038
  };
1861
- params?.callbacks?.onAttestationStart?.();
1862
2039
  const att = await apiCreatePaymentAttestation(payload, attUrl, platform, actionType);
1863
2040
  const paymentProof = encodePaymentAttestation(att);
1864
2041
  const verificationData = encodeVerifyPaymentData({
@@ -1872,15 +2049,24 @@ var Zkp2pClient = class {
1872
2049
  verificationData,
1873
2050
  postIntentHookData: params.postIntentHookData ?? "0x"
1874
2051
  }];
1875
- const txHash = await this.simulateAndSendWithAttribution({
1876
- address: this.orchestratorAddress,
2052
+ const { referrer } = params.txOverrides ?? {};
2053
+ const data = encodeWithAttribution(
2054
+ {
2055
+ abi: this.orchestratorAbi,
2056
+ functionName: "fulfillIntent",
2057
+ args
2058
+ },
2059
+ referrer
2060
+ );
2061
+ return {
2062
+ to: this.orchestratorAddress,
2063
+ data,
2064
+ value: 0n,
2065
+ chainId: this.chainId,
1877
2066
  abi: this.orchestratorAbi,
1878
2067
  functionName: "fulfillIntent",
1879
- args,
1880
- txOverrides: params.txOverrides
1881
- });
1882
- params?.callbacks?.onTxSent?.(txHash);
1883
- return txHash;
2068
+ args
2069
+ };
1884
2070
  }
1885
2071
  defaultAttestationService() {
1886
2072
  return this.runtimeEnv === "staging" ? "https://attestation-service-staging.zkp2p.xyz" : "https://attestation-service.zkp2p.xyz";
@@ -2220,6 +2406,6 @@ var logger = {
2220
2406
  }
2221
2407
  };
2222
2408
 
2223
- export { BASE_BUILDER_CODE, IndexerClient, IndexerDepositService, Zkp2pClient as OfframpClient, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, defaultIndexerEndpoint, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, logger, sendTransactionWithAttribution, setLogLevel };
2409
+ export { BASE_BUILDER_CODE, IndexerClient, IndexerDepositService, Zkp2pClient as OfframpClient, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, defaultIndexerEndpoint, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, logger, sendTransactionWithAttribution, setLogLevel };
2224
2410
  //# sourceMappingURL=index.mjs.map
2225
2411
  //# sourceMappingURL=index.mjs.map