@zkp2p/sdk 0.2.4 → 0.3.0

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 { R as ReferrerFeeConfig, 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 GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-C2wT1ZYY.mjs';
2
- export { m as ActionCallback, O as ApiDeposit, a1 as ApiIntentStatus, A as AuthorizationTokenProvider, bt as BatchResult, j as CancelIntentMethodParams, t as CancelIntentParams, o as CreateDepositConversionRate, n as CreateDepositParams, aY as Currency, b3 as CurrencyData, bs as DelegationDepositTarget, bq as DelegationRoute, br as DelegationState, be as Deposit, bg as DepositCurrency, ae as DepositIntentStatistics, Y as DepositStatus, U as DepositVerifier, X as DepositVerifierCurrency, ab as DepositVerifierData, bd as DepositView, K as FiatResponse, F as FulfillIntentMethodParams, r as FulfillIntentParams, _ as GetDepositByIdRequest, $ as GetDepositByIdResponse, a6 as GetIntentByHashRequest, a7 as GetIntentByHashResponse, a4 as GetIntentsByDepositRequest, a5 as GetIntentsByDepositResponse, u as GetNearbyQuote, v as GetNearbySuggestions, a2 as GetOwnerIntentsRequest, a3 as GetOwnerIntentsResponse, w as GetQuoteResponse, x as GetQuoteResponseObject, y as GetQuoteSingleResponse, ak as IndexerClient, aS as IndexerDeploymentEnv, aq as IndexerDeposit, aH as IndexerDepositDailySnapshot, aJ as IndexerDepositFilter, aG as IndexerDepositFundActivity, aI as IndexerDepositFundActivityType, aM as IndexerDepositOrderDirection, aL as IndexerDepositOrderField, aK as IndexerDepositPagination, at as IndexerDepositPaymentMethod, am as IndexerDepositService, aV as IndexerFulfillmentAndPaymentResponse, aT as IndexerFulfillmentRecord, ar as IndexerIntentFulfilled, as as IndexerIntentFulfillmentAmounts, av as IndexerIntentStatus, az as IndexerManagerAggregateStats, aB as IndexerManagerDailySnapshot, aA as IndexerManagerStats, aE as IndexerManualRateUpdate, au as IndexerMethodCurrency, aF as IndexerOracleConfigUpdate, aU as IndexerPaymentVerifiedRecord, aw as IndexerRateManager, ay as IndexerRateManagerDelegation, aP as IndexerRateManagerDelegationPagination, aD as IndexerRateManagerDetail, aN as IndexerRateManagerFilter, aC as IndexerRateManagerListItem, aR as IndexerRateManagerOrderDirection, aQ as IndexerRateManagerOrderField, aO as IndexerRateManagerPagination, ax as IndexerRateManagerRate, an as IndexerRateManagerService, a0 as Intent, bi as IntentView, N as NearbyQuote, M as NearbySuggestions, Z as OfframpClient, aa as OnchainCurrency, bj as OnchainIntent, ad as OrderStats, aW as PAYMENT_PLATFORMS, bf as PaymentMethodData, aX as PaymentPlatformType, ai as PlatformLimit, aj as PlatformRiskLevel, ac as PreparedTransaction, J as QuoteFeesResponse, H as QuoteIntentResponse, Q as QuoteRequest, z as QuoteResponse, B as QuoteResponseObject, E as QuoteSingleResponse, p as Range, bh as ReferralFee, a8 as RegisterPayeeDetailsRequest, a9 as RegisterPayeeDetailsResponse, s as ReleaseFundsToPayerParams, b8 as RuntimeEnv, bv as SendBatchFn, bu as SendTransactionFn, i as SignalIntentMethodParams, q as SignalIntentParams, S as SignalIntentReferralFee, af as TakerTier, ah as TakerTierLevel, ag as TakerTierStats, l as TimeoutConfig, L as TokenResponse, W as WithdrawDepositParams, bk as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, k as Zkp2pClientOptions, bp as classifyDelegationState, ao as compareEventCursorIdsByRecency, aZ as currencyInfo, al as defaultIndexerEndpoint, bb as enrichPvDepositView, bc as enrichPvIntentView, ap as fetchIndexerFulfillmentAndPayment, b4 as getContracts, b0 as getCurrencyCodeFromHash, a$ as getCurrencyInfoFromCountryCode, a_ as getCurrencyInfoFromHash, bo as getDelegationRoute, b7 as getGatingServiceAddress, b6 as getPaymentMethodsCatalog, b5 as getRateManagerContracts, b1 as isSupportedCurrencyHash, bl as isZeroRateManagerId, b2 as mapConversionRatesToOnchainMinRate, bm as normalizeRateManagerId, bn as normalizeRegistry, b9 as parseDepositView, ba as parseIntentView } from './vaultUtils-C2wT1ZYY.mjs';
1
+ import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, Q as QuotesBestByPlatformRequest, B as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-sodi4Xx-.mjs';
2
+ export { m as ActionCallback, a1 as ApiDeposit, a8 as ApiIntentStatus, A as AuthorizationTokenProvider, bA as BatchResult, u as BestByPlatformResponseObject, j as CancelIntentMethodParams, t as CancelIntentParams, o as CreateDepositConversionRate, n as CreateDepositParams, b3 as Currency, ba as CurrencyData, bz as DelegationDepositTarget, bx as DelegationRoute, by as DelegationState, bl as Deposit, bn as DepositCurrency, al as DepositIntentStatistics, a4 as DepositStatus, a2 as DepositVerifier, a3 as DepositVerifierCurrency, ai as DepositVerifierData, bk as DepositView, Y as FiatResponse, F as FulfillIntentMethodParams, r as FulfillIntentParams, v as GetBestByPlatformResponse, w as GetBestByPlatformResponseObject, a5 as GetDepositByIdRequest, a6 as GetDepositByIdResponse, ad as GetIntentByHashRequest, ae as GetIntentByHashResponse, ab as GetIntentsByDepositRequest, ac as GetIntentsByDepositResponse, E as GetNearbyQuote, H as GetNearbySuggestions, a9 as GetOwnerIntentsRequest, aa as GetOwnerIntentsResponse, x as GetPlatformQuote, J as GetQuoteResponse, K as GetQuoteResponseObject, L as GetQuoteSingleResponse, ar as IndexerClient, aZ as IndexerDeploymentEnv, ax as IndexerDeposit, aO as IndexerDepositDailySnapshot, aQ as IndexerDepositFilter, aN as IndexerDepositFundActivity, aP as IndexerDepositFundActivityType, aT as IndexerDepositOrderDirection, aS as IndexerDepositOrderField, aR as IndexerDepositPagination, aA as IndexerDepositPaymentMethod, at as IndexerDepositService, b0 as IndexerFulfillmentAndPaymentResponse, a_ as IndexerFulfillmentRecord, ay as IndexerIntentFulfilled, az as IndexerIntentFulfillmentAmounts, aC as IndexerIntentStatus, aG as IndexerManagerAggregateStats, aI as IndexerManagerDailySnapshot, aH as IndexerManagerStats, aL as IndexerManualRateUpdate, aB as IndexerMethodCurrency, aM as IndexerOracleConfigUpdate, a$ as IndexerPaymentVerifiedRecord, aD as IndexerRateManager, aF as IndexerRateManagerDelegation, aW as IndexerRateManagerDelegationPagination, aK as IndexerRateManagerDetail, aU as IndexerRateManagerFilter, aJ as IndexerRateManagerListItem, aY as IndexerRateManagerOrderDirection, aX as IndexerRateManagerOrderField, aV as IndexerRateManagerPagination, aE as IndexerRateManagerRate, au as IndexerRateManagerService, a7 as Intent, bp as IntentView, $ as NearbyQuote, a0 as NearbySuggestions, Z as OfframpClient, ah as OnchainCurrency, bq as OnchainIntent, ak as OrderStats, b1 as PAYMENT_PLATFORMS, bm as PaymentMethodData, b2 as PaymentPlatformType, ap as PlatformLimit, y as PlatformQuote, aq as PlatformRiskLevel, aj as PreparedTransaction, X as QuoteFeesResponse, U as QuoteIntentResponse, z as QuoteRequest, M as QuoteResponse, N as QuoteResponseObject, O as QuoteSingleResponse, p as Range, bo as ReferralFee, af as RegisterPayeeDetailsRequest, ag as RegisterPayeeDetailsResponse, s as ReleaseFundsToPayerParams, bf as RuntimeEnv, bC as SendBatchFn, bB as SendTransactionFn, i as SignalIntentMethodParams, q as SignalIntentParams, S as SignalIntentReferralFee, am as TakerTier, ao as TakerTierLevel, an as TakerTierStats, l as TimeoutConfig, _ as TokenResponse, W as WithdrawDepositParams, br as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, k as Zkp2pClientOptions, bw as classifyDelegationState, av as compareEventCursorIdsByRecency, b4 as currencyInfo, as as defaultIndexerEndpoint, bi as enrichPvDepositView, bj as enrichPvIntentView, aw as fetchIndexerFulfillmentAndPayment, bb as getContracts, b7 as getCurrencyCodeFromHash, b6 as getCurrencyInfoFromCountryCode, b5 as getCurrencyInfoFromHash, bv as getDelegationRoute, be as getGatingServiceAddress, bd as getPaymentMethodsCatalog, bc as getRateManagerContracts, b8 as isSupportedCurrencyHash, bs as isZeroRateManagerId, b9 as mapConversionRatesToOnchainMinRate, bt as normalizeRateManagerId, bu as normalizeRegistry, bg as parseDepositView, bh as parseIntentView } from './vaultUtils-sodi4Xx-.mjs';
3
3
  import { Address, Hex, WalletClient, Hash } from 'viem';
4
4
  import { Abi } from 'abitype';
5
5
  import '@zkp2p/indexer-schema';
@@ -65,7 +65,7 @@ interface EscrowIntentView {
65
65
 
66
66
  declare const isValidReferrerFeeRecipient: (value: string) => value is `0x${string}`;
67
67
  declare const isValidReferrerFeeBps: (value: number) => boolean;
68
- declare const assertValidReferrerFeeConfig: (config: ReferrerFeeConfig | undefined, context: "getQuote" | "signalIntent") => ReferrerFeeConfig | undefined;
68
+ declare const assertValidReferrerFeeConfig: (config: ReferrerFeeConfig | undefined, context: "getQuote" | "getQuotesBestByPlatform" | "signalIntent") => ReferrerFeeConfig | undefined;
69
69
  declare const parseReferrerFeeConfig: (recipient: string | null | undefined, feeBpsValue: string | number | null | undefined) => ReferrerFeeConfig | null;
70
70
  declare const referrerFeeConfigToPreciseUnits: (config: ReferrerFeeConfig) => bigint;
71
71
 
@@ -192,10 +192,14 @@ declare const peerExtensionSdk: PeerExtensionSdk;
192
192
 
193
193
  declare function createCompositeDepositId(escrowAddress: string, depositId: string | bigint): string;
194
194
  declare function convertIndexerDepositToEscrowView(deposit: DepositWithRelations, _chainId: number, _escrowAddress: string): EscrowDepositView;
195
- declare function convertDepositsForLiquidity(deposits: DepositWithRelations[], chainId: number, escrowAddress: string): EscrowDepositView[];
195
+ interface ConvertLiquidityOptions {
196
+ includePrivateOrderbooks?: boolean;
197
+ }
198
+ declare function convertDepositsForLiquidity(deposits: DepositWithRelations[], chainId: number, escrowAddress: string, options?: ConvertLiquidityOptions): EscrowDepositView[];
196
199
  declare function convertIndexerIntentsToEscrowViews(intents: IntentEntity[], depositViewsById: Map<string, EscrowDepositView>): EscrowIntentView[];
197
200
 
198
- declare function apiPostDepositDetails(req: PostDepositDetailsRequest, baseApiUrl: string, timeoutMs?: number, apiKey?: string, authToken?: string): Promise<PostDepositDetailsResponse>;
201
+ declare function apiPostDepositDetails(req: PostDepositDetailsRequest, baseApiUrl: string, timeoutMs?: number, _apiKey?: string, _authToken?: string): Promise<PostDepositDetailsResponse>;
202
+ declare function apiGetQuotesBestByPlatform(req: QuotesBestByPlatformRequest, baseApiUrl: string, timeoutMs?: number, apiKey?: string, authToken?: string): Promise<BestByPlatformResponse>;
199
203
  declare function apiGetPayeeDetails(req: GetPayeeDetailsRequest, apiKey: string | undefined, baseApiUrl: string, authToken?: string, timeoutMs?: number): Promise<GetPayeeDetailsResponse>;
200
204
  declare function apiValidatePayeeDetails(req: ValidatePayeeDetailsRequest, baseApiUrl: string, timeoutMs?: number): Promise<ValidatePayeeDetailsResponse>;
201
205
  declare function apiGetOwnerDeposits(req: GetOwnerDepositsRequest, apiKey: string | undefined, baseApiUrl: string, authToken?: string, timeoutMs?: number): Promise<GetOwnerDepositsResponse>;
@@ -701,4 +705,4 @@ declare class ContractError extends ZKP2PError {
701
705
  constructor(message: string, details?: unknown);
702
706
  }
703
707
 
704
- export { APIError, BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractError, ContractRouter, type ContractRouterConfig, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetOwnerDepositsRequest, GetOwnerDepositsResponse, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, type MulticallClient, NetworkError, type OracleAdapterOverrides, type OracleKind, type OrchestratorContractContext, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, PaymentMethodCatalog, type PeerConnectionStatus, type PeerExtensionApi, type PeerExtensionOnrampParams, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type PeerIntentFulfilledBridgeStatus, type PeerIntentFulfilledCallback, type PeerIntentFulfilledResult, PostDepositDetailsRequest, PostDepositDetailsResponse, type PythFeedConfig, ReferrerFeeConfig, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, type SpreadOracleConfig, type SpreadOracleFeedConfig, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, assertValidReferrerFeeConfig, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, ensureBytes32, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
708
+ export { APIError, BASE_BUILDER_CODE, BestByPlatformResponse, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractError, ContractRouter, type ContractRouterConfig, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetOwnerDepositsRequest, GetOwnerDepositsResponse, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, type MulticallClient, NetworkError, type OracleAdapterOverrides, type OracleKind, type OrchestratorContractContext, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, PaymentMethodCatalog, type PeerConnectionStatus, type PeerExtensionApi, type PeerExtensionOnrampParams, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type PeerIntentFulfilledBridgeStatus, type PeerIntentFulfilledCallback, type PeerIntentFulfilledResult, PostDepositDetailsRequest, PostDepositDetailsResponse, type PythFeedConfig, QuotesBestByPlatformRequest, ReferrerFeeConfig, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, type SpreadOracleConfig, type SpreadOracleFeedConfig, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, assertValidReferrerFeeConfig, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, ensureBytes32, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as ReferrerFeeConfig, 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 GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-C2wT1ZYY.js';
2
- export { m as ActionCallback, O as ApiDeposit, a1 as ApiIntentStatus, A as AuthorizationTokenProvider, bt as BatchResult, j as CancelIntentMethodParams, t as CancelIntentParams, o as CreateDepositConversionRate, n as CreateDepositParams, aY as Currency, b3 as CurrencyData, bs as DelegationDepositTarget, bq as DelegationRoute, br as DelegationState, be as Deposit, bg as DepositCurrency, ae as DepositIntentStatistics, Y as DepositStatus, U as DepositVerifier, X as DepositVerifierCurrency, ab as DepositVerifierData, bd as DepositView, K as FiatResponse, F as FulfillIntentMethodParams, r as FulfillIntentParams, _ as GetDepositByIdRequest, $ as GetDepositByIdResponse, a6 as GetIntentByHashRequest, a7 as GetIntentByHashResponse, a4 as GetIntentsByDepositRequest, a5 as GetIntentsByDepositResponse, u as GetNearbyQuote, v as GetNearbySuggestions, a2 as GetOwnerIntentsRequest, a3 as GetOwnerIntentsResponse, w as GetQuoteResponse, x as GetQuoteResponseObject, y as GetQuoteSingleResponse, ak as IndexerClient, aS as IndexerDeploymentEnv, aq as IndexerDeposit, aH as IndexerDepositDailySnapshot, aJ as IndexerDepositFilter, aG as IndexerDepositFundActivity, aI as IndexerDepositFundActivityType, aM as IndexerDepositOrderDirection, aL as IndexerDepositOrderField, aK as IndexerDepositPagination, at as IndexerDepositPaymentMethod, am as IndexerDepositService, aV as IndexerFulfillmentAndPaymentResponse, aT as IndexerFulfillmentRecord, ar as IndexerIntentFulfilled, as as IndexerIntentFulfillmentAmounts, av as IndexerIntentStatus, az as IndexerManagerAggregateStats, aB as IndexerManagerDailySnapshot, aA as IndexerManagerStats, aE as IndexerManualRateUpdate, au as IndexerMethodCurrency, aF as IndexerOracleConfigUpdate, aU as IndexerPaymentVerifiedRecord, aw as IndexerRateManager, ay as IndexerRateManagerDelegation, aP as IndexerRateManagerDelegationPagination, aD as IndexerRateManagerDetail, aN as IndexerRateManagerFilter, aC as IndexerRateManagerListItem, aR as IndexerRateManagerOrderDirection, aQ as IndexerRateManagerOrderField, aO as IndexerRateManagerPagination, ax as IndexerRateManagerRate, an as IndexerRateManagerService, a0 as Intent, bi as IntentView, N as NearbyQuote, M as NearbySuggestions, Z as OfframpClient, aa as OnchainCurrency, bj as OnchainIntent, ad as OrderStats, aW as PAYMENT_PLATFORMS, bf as PaymentMethodData, aX as PaymentPlatformType, ai as PlatformLimit, aj as PlatformRiskLevel, ac as PreparedTransaction, J as QuoteFeesResponse, H as QuoteIntentResponse, Q as QuoteRequest, z as QuoteResponse, B as QuoteResponseObject, E as QuoteSingleResponse, p as Range, bh as ReferralFee, a8 as RegisterPayeeDetailsRequest, a9 as RegisterPayeeDetailsResponse, s as ReleaseFundsToPayerParams, b8 as RuntimeEnv, bv as SendBatchFn, bu as SendTransactionFn, i as SignalIntentMethodParams, q as SignalIntentParams, S as SignalIntentReferralFee, af as TakerTier, ah as TakerTierLevel, ag as TakerTierStats, l as TimeoutConfig, L as TokenResponse, W as WithdrawDepositParams, bk as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, k as Zkp2pClientOptions, bp as classifyDelegationState, ao as compareEventCursorIdsByRecency, aZ as currencyInfo, al as defaultIndexerEndpoint, bb as enrichPvDepositView, bc as enrichPvIntentView, ap as fetchIndexerFulfillmentAndPayment, b4 as getContracts, b0 as getCurrencyCodeFromHash, a$ as getCurrencyInfoFromCountryCode, a_ as getCurrencyInfoFromHash, bo as getDelegationRoute, b7 as getGatingServiceAddress, b6 as getPaymentMethodsCatalog, b5 as getRateManagerContracts, b1 as isSupportedCurrencyHash, bl as isZeroRateManagerId, b2 as mapConversionRatesToOnchainMinRate, bm as normalizeRateManagerId, bn as normalizeRegistry, b9 as parseDepositView, ba as parseIntentView } from './vaultUtils-C2wT1ZYY.js';
1
+ import { R as ReferrerFeeConfig, D as DepositWithRelations, I as IntentEntity, Q as QuotesBestByPlatformRequest, B as BestByPlatformResponse, V as ValidatePayeeDetailsRequest, a as ValidatePayeeDetailsResponse, P as PostDepositDetailsRequest, b as PostDepositDetailsResponse, G as GetPayeeDetailsRequest, c as GetPayeeDetailsResponse, d as GetOwnerDepositsRequest, e as GetOwnerDepositsResponse, f as GetTakerTierRequest, g as GetTakerTierResponse, C as CurrencyType, h as PaymentMethodCatalog, T as TxOverrides } from './vaultUtils-sodi4Xx-.js';
2
+ export { m as ActionCallback, a1 as ApiDeposit, a8 as ApiIntentStatus, A as AuthorizationTokenProvider, bA as BatchResult, u as BestByPlatformResponseObject, j as CancelIntentMethodParams, t as CancelIntentParams, o as CreateDepositConversionRate, n as CreateDepositParams, b3 as Currency, ba as CurrencyData, bz as DelegationDepositTarget, bx as DelegationRoute, by as DelegationState, bl as Deposit, bn as DepositCurrency, al as DepositIntentStatistics, a4 as DepositStatus, a2 as DepositVerifier, a3 as DepositVerifierCurrency, ai as DepositVerifierData, bk as DepositView, Y as FiatResponse, F as FulfillIntentMethodParams, r as FulfillIntentParams, v as GetBestByPlatformResponse, w as GetBestByPlatformResponseObject, a5 as GetDepositByIdRequest, a6 as GetDepositByIdResponse, ad as GetIntentByHashRequest, ae as GetIntentByHashResponse, ab as GetIntentsByDepositRequest, ac as GetIntentsByDepositResponse, E as GetNearbyQuote, H as GetNearbySuggestions, a9 as GetOwnerIntentsRequest, aa as GetOwnerIntentsResponse, x as GetPlatformQuote, J as GetQuoteResponse, K as GetQuoteResponseObject, L as GetQuoteSingleResponse, ar as IndexerClient, aZ as IndexerDeploymentEnv, ax as IndexerDeposit, aO as IndexerDepositDailySnapshot, aQ as IndexerDepositFilter, aN as IndexerDepositFundActivity, aP as IndexerDepositFundActivityType, aT as IndexerDepositOrderDirection, aS as IndexerDepositOrderField, aR as IndexerDepositPagination, aA as IndexerDepositPaymentMethod, at as IndexerDepositService, b0 as IndexerFulfillmentAndPaymentResponse, a_ as IndexerFulfillmentRecord, ay as IndexerIntentFulfilled, az as IndexerIntentFulfillmentAmounts, aC as IndexerIntentStatus, aG as IndexerManagerAggregateStats, aI as IndexerManagerDailySnapshot, aH as IndexerManagerStats, aL as IndexerManualRateUpdate, aB as IndexerMethodCurrency, aM as IndexerOracleConfigUpdate, a$ as IndexerPaymentVerifiedRecord, aD as IndexerRateManager, aF as IndexerRateManagerDelegation, aW as IndexerRateManagerDelegationPagination, aK as IndexerRateManagerDetail, aU as IndexerRateManagerFilter, aJ as IndexerRateManagerListItem, aY as IndexerRateManagerOrderDirection, aX as IndexerRateManagerOrderField, aV as IndexerRateManagerPagination, aE as IndexerRateManagerRate, au as IndexerRateManagerService, a7 as Intent, bp as IntentView, $ as NearbyQuote, a0 as NearbySuggestions, Z as OfframpClient, ah as OnchainCurrency, bq as OnchainIntent, ak as OrderStats, b1 as PAYMENT_PLATFORMS, bm as PaymentMethodData, b2 as PaymentPlatformType, ap as PlatformLimit, y as PlatformQuote, aq as PlatformRiskLevel, aj as PreparedTransaction, X as QuoteFeesResponse, U as QuoteIntentResponse, z as QuoteRequest, M as QuoteResponse, N as QuoteResponseObject, O as QuoteSingleResponse, p as Range, bo as ReferralFee, af as RegisterPayeeDetailsRequest, ag as RegisterPayeeDetailsResponse, s as ReleaseFundsToPayerParams, bf as RuntimeEnv, bC as SendBatchFn, bB as SendTransactionFn, i as SignalIntentMethodParams, q as SignalIntentParams, S as SignalIntentReferralFee, am as TakerTier, ao as TakerTierLevel, an as TakerTierStats, l as TimeoutConfig, _ as TokenResponse, W as WithdrawDepositParams, br as ZERO_RATE_MANAGER_ID, Z as Zkp2pClient, k as Zkp2pClientOptions, bw as classifyDelegationState, av as compareEventCursorIdsByRecency, b4 as currencyInfo, as as defaultIndexerEndpoint, bi as enrichPvDepositView, bj as enrichPvIntentView, aw as fetchIndexerFulfillmentAndPayment, bb as getContracts, b7 as getCurrencyCodeFromHash, b6 as getCurrencyInfoFromCountryCode, b5 as getCurrencyInfoFromHash, bv as getDelegationRoute, be as getGatingServiceAddress, bd as getPaymentMethodsCatalog, bc as getRateManagerContracts, b8 as isSupportedCurrencyHash, bs as isZeroRateManagerId, b9 as mapConversionRatesToOnchainMinRate, bt as normalizeRateManagerId, bu as normalizeRegistry, bg as parseDepositView, bh as parseIntentView } from './vaultUtils-sodi4Xx-.js';
3
3
  import { Address, Hex, WalletClient, Hash } from 'viem';
4
4
  import { Abi } from 'abitype';
5
5
  import '@zkp2p/indexer-schema';
@@ -65,7 +65,7 @@ interface EscrowIntentView {
65
65
 
66
66
  declare const isValidReferrerFeeRecipient: (value: string) => value is `0x${string}`;
67
67
  declare const isValidReferrerFeeBps: (value: number) => boolean;
68
- declare const assertValidReferrerFeeConfig: (config: ReferrerFeeConfig | undefined, context: "getQuote" | "signalIntent") => ReferrerFeeConfig | undefined;
68
+ declare const assertValidReferrerFeeConfig: (config: ReferrerFeeConfig | undefined, context: "getQuote" | "getQuotesBestByPlatform" | "signalIntent") => ReferrerFeeConfig | undefined;
69
69
  declare const parseReferrerFeeConfig: (recipient: string | null | undefined, feeBpsValue: string | number | null | undefined) => ReferrerFeeConfig | null;
70
70
  declare const referrerFeeConfigToPreciseUnits: (config: ReferrerFeeConfig) => bigint;
71
71
 
@@ -192,10 +192,14 @@ declare const peerExtensionSdk: PeerExtensionSdk;
192
192
 
193
193
  declare function createCompositeDepositId(escrowAddress: string, depositId: string | bigint): string;
194
194
  declare function convertIndexerDepositToEscrowView(deposit: DepositWithRelations, _chainId: number, _escrowAddress: string): EscrowDepositView;
195
- declare function convertDepositsForLiquidity(deposits: DepositWithRelations[], chainId: number, escrowAddress: string): EscrowDepositView[];
195
+ interface ConvertLiquidityOptions {
196
+ includePrivateOrderbooks?: boolean;
197
+ }
198
+ declare function convertDepositsForLiquidity(deposits: DepositWithRelations[], chainId: number, escrowAddress: string, options?: ConvertLiquidityOptions): EscrowDepositView[];
196
199
  declare function convertIndexerIntentsToEscrowViews(intents: IntentEntity[], depositViewsById: Map<string, EscrowDepositView>): EscrowIntentView[];
197
200
 
198
- declare function apiPostDepositDetails(req: PostDepositDetailsRequest, baseApiUrl: string, timeoutMs?: number, apiKey?: string, authToken?: string): Promise<PostDepositDetailsResponse>;
201
+ declare function apiPostDepositDetails(req: PostDepositDetailsRequest, baseApiUrl: string, timeoutMs?: number, _apiKey?: string, _authToken?: string): Promise<PostDepositDetailsResponse>;
202
+ declare function apiGetQuotesBestByPlatform(req: QuotesBestByPlatformRequest, baseApiUrl: string, timeoutMs?: number, apiKey?: string, authToken?: string): Promise<BestByPlatformResponse>;
199
203
  declare function apiGetPayeeDetails(req: GetPayeeDetailsRequest, apiKey: string | undefined, baseApiUrl: string, authToken?: string, timeoutMs?: number): Promise<GetPayeeDetailsResponse>;
200
204
  declare function apiValidatePayeeDetails(req: ValidatePayeeDetailsRequest, baseApiUrl: string, timeoutMs?: number): Promise<ValidatePayeeDetailsResponse>;
201
205
  declare function apiGetOwnerDeposits(req: GetOwnerDepositsRequest, apiKey: string | undefined, baseApiUrl: string, authToken?: string, timeoutMs?: number): Promise<GetOwnerDepositsResponse>;
@@ -701,4 +705,4 @@ declare class ContractError extends ZKP2PError {
701
705
  constructor(message: string, details?: unknown);
702
706
  }
703
707
 
704
- export { APIError, BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractError, ContractRouter, type ContractRouterConfig, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetOwnerDepositsRequest, GetOwnerDepositsResponse, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, type MulticallClient, NetworkError, type OracleAdapterOverrides, type OracleKind, type OrchestratorContractContext, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, PaymentMethodCatalog, type PeerConnectionStatus, type PeerExtensionApi, type PeerExtensionOnrampParams, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type PeerIntentFulfilledBridgeStatus, type PeerIntentFulfilledCallback, type PeerIntentFulfilledResult, PostDepositDetailsRequest, PostDepositDetailsResponse, type PythFeedConfig, ReferrerFeeConfig, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, type SpreadOracleConfig, type SpreadOracleFeedConfig, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, assertValidReferrerFeeConfig, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, ensureBytes32, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
708
+ export { APIError, BASE_BUILDER_CODE, BestByPlatformResponse, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractError, ContractRouter, type ContractRouterConfig, CurrencyType, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, ErrorCode, type EscrowContractContext, type EscrowDepositView, type EscrowIntentView, GetOwnerDepositsRequest, GetOwnerDepositsResponse, GetPayeeDetailsRequest, GetPayeeDetailsResponse, GetTakerTierRequest, GetTakerTierResponse, DepositWithRelations as IndexerDepositWithRelations, IntentEntity as IndexerIntent, type LogLevel, type MulticallClient, NetworkError, type OracleAdapterOverrides, type OracleKind, type OrchestratorContractContext, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, PaymentMethodCatalog, type PeerConnectionStatus, type PeerExtensionApi, type PeerExtensionOnrampParams, type PeerExtensionSdk, type PeerExtensionSdkOptions, type PeerExtensionState, type PeerExtensionWindow, type PeerIntentFulfilledBridgeStatus, type PeerIntentFulfilledCallback, type PeerIntentFulfilledResult, PostDepositDetailsRequest, PostDepositDetailsResponse, type PythFeedConfig, QuotesBestByPlatformRequest, ReferrerFeeConfig, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, type SpreadOracleConfig, type SpreadOracleFeedConfig, type SupportedChainId, TOKEN_METADATA, TxOverrides, ValidatePayeeDetailsRequest, ValidatePayeeDetailsResponse, ValidationError, ZKP2PError, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, asciiToBytes32, assertValidReferrerFeeConfig, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, ensureBytes32, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, resolveFiatCurrencyBytes32, resolvePaymentMethodHash, resolvePaymentMethodHashFromCatalog, resolvePaymentMethodNameFromHash, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
package/dist/index.mjs CHANGED
@@ -11,16 +11,8 @@ import { AbiCoder } from 'ethers';
11
11
  import { Attribution } from 'ox/erc8021';
12
12
  import chainlinkFeeds from '@zkp2p/contracts-v2/oracleFeeds/chainlink.json';
13
13
 
14
- // src/client/clientUtils.ts
14
+ // src/utils/address.ts
15
15
  var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
16
- var MIN_ORACLE_SPREAD_BPS = -32768;
17
- var MAX_ORACLE_SPREAD_BPS = 32767;
18
- var EMPTY_ORACLE_RATE_CONFIG = {
19
- adapter: ZERO_ADDRESS,
20
- adapterConfig: "0x",
21
- spreadBps: 0,
22
- maxStaleness: 0
23
- };
24
16
  var isValidHexAddress = (addr) => {
25
17
  if (typeof addr !== "string") return false;
26
18
  return /^0x[0-9a-fA-F]{40}$/.test(addr);
@@ -29,6 +21,16 @@ var normalizeAddress = (addr) => {
29
21
  if (!isValidHexAddress(addr)) return void 0;
30
22
  return addr;
31
23
  };
24
+
25
+ // src/client/clientUtils.ts
26
+ var MIN_ORACLE_SPREAD_BPS = -32768;
27
+ var MAX_ORACLE_SPREAD_BPS = 32767;
28
+ var EMPTY_ORACLE_RATE_CONFIG = {
29
+ adapter: ZERO_ADDRESS,
30
+ adapterConfig: "0x",
31
+ spreadBps: 0,
32
+ maxStaleness: 0
33
+ };
32
34
  var parseEscrowAddressFromCompositeDepositId = (depositId) => {
33
35
  if (typeof depositId !== "string") return void 0;
34
36
  const parts = depositId.split("_");
@@ -331,9 +333,6 @@ function parseAPIError(response, responseText) {
331
333
  } catch {
332
334
  if (responseText && responseText.length < 200) message = responseText;
333
335
  }
334
- if (response.status === 429) {
335
- message = "Too many requests. Please try again later.";
336
- }
337
336
  return new APIError(message, response.status, { url: response.url });
338
337
  }
339
338
  async function withRetry(fn, maxRetries = 3, delayMs = 1e3, timeoutMs) {
@@ -397,11 +396,13 @@ async function apiSignIntentV3(request, opts) {
397
396
  const sig = json?.responseObject?.signedIntent;
398
397
  const expStr = json?.responseObject?.intentData?.signatureExpiration ?? json?.responseObject?.signatureExpiration;
399
398
  const preIntentHookData = json?.responseObject?.intentData?.preIntentHookData ?? json?.responseObject?.preIntentHookData;
399
+ const referralFees = json?.responseObject?.intentData?.referralFees ?? json?.responseObject?.referralFees;
400
400
  if (!sig || !expStr) throw new Error("v3/intent missing signature or expiration");
401
401
  return {
402
402
  signature: sig,
403
403
  signatureExpiration: BigInt(expStr),
404
- preIntentHookData
404
+ preIntentHookData,
405
+ referralFees
405
406
  };
406
407
  }
407
408
 
@@ -820,7 +821,7 @@ var IntentOperations = class {
820
821
  const depositId = parseRawDepositId(params.depositId);
821
822
  const amount = typeof params.amount === "bigint" ? params.amount : BigInt(params.amount);
822
823
  const conversionRate = typeof params.conversionRate === "bigint" ? params.conversionRate : BigInt(params.conversionRate);
823
- const referralFees = referrerFeeConfig !== void 0 ? [
824
+ let referralFees = referrerFeeConfig !== void 0 ? [
824
825
  {
825
826
  recipient: referrerFeeConfig.recipient,
826
827
  fee: referrerFeeConfigToPreciseUnits(referrerFeeConfig)
@@ -862,6 +863,23 @@ var IntentOperations = class {
862
863
  gatingServiceSignature = response.signature;
863
864
  signatureExpiration = response.signatureExpiration;
864
865
  preIntentHookData = response.preIntentHookData ?? preIntentHookData;
866
+ if (response.referralFees !== void 0) {
867
+ referralFees = response.referralFees.map((referralFee) => {
868
+ if (!isValidReferrerFeeRecipient(referralFee.recipient)) {
869
+ throw new Error("v3/intent returned invalid referral fee recipient");
870
+ }
871
+ let fee;
872
+ try {
873
+ fee = BigInt(referralFee.fee);
874
+ } catch {
875
+ throw new Error("v3/intent returned non-integer referral fee value");
876
+ }
877
+ return {
878
+ recipient: referralFee.recipient,
879
+ fee
880
+ };
881
+ });
882
+ }
865
883
  }
866
884
  if (!gatingServiceSignature || !signatureExpiration) {
867
885
  throw new Error("Missing gatingServiceSignature/signatureExpiration");
@@ -3489,9 +3507,10 @@ function convertIndexerDepositToEscrowView(deposit, _chainId, _escrowAddress) {
3489
3507
  verifiers
3490
3508
  };
3491
3509
  }
3492
- function convertDepositsForLiquidity(deposits, chainId, escrowAddress) {
3510
+ function convertDepositsForLiquidity(deposits, chainId, escrowAddress, options = {}) {
3511
+ const { includePrivateOrderbooks = false } = options;
3493
3512
  return deposits.filter(
3494
- (d) => d.depositor && d.depositor.toLowerCase() !== ZERO && normalizeAddress2(d.whitelistHookAddress).toLowerCase() === ZERO && d.acceptingIntents && toBigInt(d.remainingDeposits) > 0n && d.status === "ACTIVE"
3513
+ (d) => d.depositor && d.depositor.toLowerCase() !== ZERO && (includePrivateOrderbooks || normalizeAddress2(d.whitelistHookAddress).toLowerCase() === ZERO) && d.acceptingIntents && toBigInt(d.remainingDeposits) > 0n && d.status === "ACTIVE"
3495
3514
  ).map((d) => convertIndexerDepositToEscrowView(d));
3496
3515
  }
3497
3516
  function convertIndexerIntentsToEscrowViews(intents, depositViewsById) {
@@ -4821,13 +4840,11 @@ function convertIndexerDepositToLegacyApiDeposit(deposit) {
4821
4840
  verifiers
4822
4841
  };
4823
4842
  }
4824
- async function apiPostDepositDetails(req, baseApiUrl, timeoutMs, apiKey, authToken) {
4843
+ async function apiPostDepositDetails(req, baseApiUrl, timeoutMs, _apiKey, _authToken) {
4825
4844
  return apiFetch({
4826
4845
  url: `${withApiBase(baseApiUrl)}/v1/makers/create`,
4827
4846
  method: "POST",
4828
4847
  body: req,
4829
- apiKey,
4830
- authToken,
4831
4848
  timeoutMs
4832
4849
  });
4833
4850
  }
@@ -4837,13 +4854,25 @@ async function apiGetQuote(req, baseApiUrl, timeoutMs, apiKey, authToken) {
4837
4854
  throw new ValidationError("quotesToReturn must be a positive integer", "quotesToReturn");
4838
4855
  }
4839
4856
  }
4857
+ if (!isValidHexAddress(req.user)) {
4858
+ throw new ValidationError("user must be a valid Ethereum address", "user");
4859
+ }
4860
+ if (!isValidHexAddress(req.recipient)) {
4861
+ throw new ValidationError("recipient must be a valid Ethereum address", "recipient");
4862
+ }
4863
+ if (!isValidHexAddress(req.destinationToken)) {
4864
+ throw new ValidationError(
4865
+ "destinationToken must be a valid Ethereum address",
4866
+ "destinationToken"
4867
+ );
4868
+ }
4840
4869
  const isExactFiat = req.isExactFiat !== false;
4841
4870
  const endpoint = isExactFiat ? "exact-fiat" : "exact-token";
4842
4871
  let url = `${withApiBase(baseApiUrl)}/v2/quote/${endpoint}`;
4843
4872
  if (req.quotesToReturn) url += `?quotesToReturn=${req.quotesToReturn}`;
4844
4873
  const requestBody = {
4845
4874
  ...req,
4846
- [isExactFiat ? "exactFiatAmount" : "exactTokenAmount"]: req.amount,
4875
+ [isExactFiat ? "exactFiatAmount" : "exactTokenAmount"]: String(req.amount),
4847
4876
  amount: void 0,
4848
4877
  isExactFiat: void 0,
4849
4878
  quotesToReturn: void 0
@@ -4858,6 +4887,29 @@ async function apiGetQuote(req, baseApiUrl, timeoutMs, apiKey, authToken) {
4858
4887
  timeoutMs
4859
4888
  });
4860
4889
  }
4890
+ async function apiGetQuotesBestByPlatform(req, baseApiUrl, timeoutMs, apiKey, authToken) {
4891
+ const isExactFiat = req.isExactFiat !== false;
4892
+ const endpoint = isExactFiat ? "best-by-platform" : "best-by-platform-exact-token";
4893
+ const url = `${withApiBase(baseApiUrl)}/v2/quote/${endpoint}`;
4894
+ const requestBody = {
4895
+ ...req,
4896
+ [isExactFiat ? "exactFiatAmount" : "exactTokenAmount"]: String(req.amount),
4897
+ amount: void 0,
4898
+ isExactFiat: void 0,
4899
+ referrerFeeConfig: void 0
4900
+ };
4901
+ Object.keys(requestBody).forEach(
4902
+ (key) => requestBody[key] === void 0 && delete requestBody[key]
4903
+ );
4904
+ return apiFetch({
4905
+ url,
4906
+ method: "POST",
4907
+ body: requestBody,
4908
+ apiKey,
4909
+ authToken,
4910
+ timeoutMs
4911
+ });
4912
+ }
4861
4913
  async function apiGetPayeeDetails(req, apiKey, baseApiUrl, authToken, timeoutMs) {
4862
4914
  return apiFetch({
4863
4915
  url: `${baseApiUrl.replace(/\/$/, "")}/v1/makers/${req.processorName}/${req.hashedOnchainId}`,
@@ -4924,7 +4976,6 @@ async function apiGetTakerTier(req, apiKey, baseApiUrl, timeoutMs) {
4924
4976
  return apiFetch({
4925
4977
  url: `${withApiBase(baseApiUrl)}${endpoint}`,
4926
4978
  method: "GET",
4927
- apiKey,
4928
4979
  timeoutMs
4929
4980
  });
4930
4981
  }
@@ -5021,6 +5072,23 @@ var appendReferrerFeeDisplayFields = (quoteResponse, referrerFeeConfig) => {
5021
5072
  }
5022
5073
  };
5023
5074
  };
5075
+ var appendReferrerFeeDisplayFieldsToBestByPlatform = (quoteResponse, referrerFeeConfig) => {
5076
+ if (!referrerFeeConfig) {
5077
+ return quoteResponse;
5078
+ }
5079
+ const decimals = quoteResponse.responseObject?.token?.decimals ?? 6;
5080
+ const enrichedPlatformQuotes = (quoteResponse.responseObject?.platformQuotes ?? []).map((platformQuote) => ({
5081
+ ...platformQuote,
5082
+ bestQuote: platformQuote.available && platformQuote.bestQuote ? applyReferrerFeeDisplayFieldsToQuote(platformQuote.bestQuote, referrerFeeConfig, decimals) : platformQuote.bestQuote
5083
+ }));
5084
+ return {
5085
+ ...quoteResponse,
5086
+ responseObject: {
5087
+ ...quoteResponse.responseObject,
5088
+ platformQuotes: enrichedPlatformQuotes
5089
+ }
5090
+ };
5091
+ };
5024
5092
 
5025
5093
  // src/utils/erc20.ts
5026
5094
  var ERC20_ABI = [
@@ -5593,7 +5661,9 @@ var Zkp2pClient = class {
5593
5661
  * sending fiat payment to the deposit's payee.
5594
5662
  *
5595
5663
  * If `gatingServiceSignature` is not provided, the SDK will automatically
5596
- * fetch one from the API (requires `apiKey` or `authorizationToken`).
5664
+ * fetch one from curator `/v3/intent` when `apiKey` or `authorizationToken`
5665
+ * is available. Otherwise you must provide `gatingServiceSignature` and
5666
+ * `signatureExpiration` yourself.
5597
5667
  *
5598
5668
  * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
5599
5669
  * ```typescript
@@ -6932,15 +7002,7 @@ var Zkp2pClient = class {
6932
7002
  })
6933
7003
  );
6934
7004
  const apiResponses = await Promise.all(
6935
- depositDetails.map(
6936
- (req) => apiPostDepositDetails(
6937
- req,
6938
- baseApiUrl,
6939
- this.apiTimeoutMs,
6940
- this.apiKey,
6941
- this.authorizationToken
6942
- )
6943
- )
7005
+ depositDetails.map((req) => apiPostDepositDetails(req, baseApiUrl, this.apiTimeoutMs))
6944
7006
  );
6945
7007
  if (!apiResponses.every((r) => r?.success)) {
6946
7008
  const failed = apiResponses.find((r) => !r?.success);
@@ -7067,15 +7129,7 @@ var Zkp2pClient = class {
7067
7129
  } else {
7068
7130
  const baseApiUrl = (this.baseApiUrl ?? "https://api.zkp2p.xyz").replace(/\/$/, "");
7069
7131
  const apiResponses = await Promise.all(
7070
- depositDetails.map(
7071
- (req) => apiPostDepositDetails(
7072
- req,
7073
- baseApiUrl,
7074
- this.apiTimeoutMs,
7075
- this.apiKey,
7076
- this.authorizationToken
7077
- )
7078
- )
7132
+ depositDetails.map((req) => apiPostDepositDetails(req, baseApiUrl, this.apiTimeoutMs))
7079
7133
  );
7080
7134
  if (!apiResponses.every((r) => r?.success)) {
7081
7135
  const failed = apiResponses.find((r) => !r?.success);
@@ -7278,6 +7332,57 @@ var Zkp2pClient = class {
7278
7332
  }
7279
7333
  return appendReferrerFeeDisplayFields(quote, referrerFeeConfig);
7280
7334
  }
7335
+ /**
7336
+ * **Supporting Method** - Fetches the best available quote per supported payment platform.
7337
+ *
7338
+ * Returns one quote per platform when available. When authenticated, the API
7339
+ * returns payee details in each platform's best quote.
7340
+ *
7341
+ * @param req - Best-by-platform quote request parameters
7342
+ * @param opts - Optional overrides for API URL and timeout
7343
+ * @returns Best-by-platform quote response
7344
+ */
7345
+ async getQuotesBestByPlatform(req, opts) {
7346
+ const referrerFeeConfig = assertValidReferrerFeeConfig(
7347
+ req.referrerFeeConfig,
7348
+ "getQuotesBestByPlatform"
7349
+ );
7350
+ const baseApiUrl = (opts?.baseApiUrl ?? this.baseApiUrl ?? "https://api.zkp2p.xyz").replace(
7351
+ /\/$/,
7352
+ ""
7353
+ );
7354
+ const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
7355
+ const reqWithEscrow = { ...req };
7356
+ if (!reqWithEscrow.escrowAddresses || reqWithEscrow.escrowAddresses.length === 0) {
7357
+ const configuredEscrows = this.escrowAddresses.length > 0 ? [...this.escrowAddresses] : this.escrowAddress ? [this.escrowAddress] : [];
7358
+ if (configuredEscrows.length > 0) {
7359
+ reqWithEscrow.escrowAddresses = configuredEscrows;
7360
+ }
7361
+ }
7362
+ const quote = await apiGetQuotesBestByPlatform(
7363
+ reqWithEscrow,
7364
+ baseApiUrl,
7365
+ timeoutMs,
7366
+ this.apiKey,
7367
+ this.authorizationToken
7368
+ );
7369
+ const enrichedQuote = quote ? {
7370
+ ...quote,
7371
+ responseObject: {
7372
+ ...quote.responseObject,
7373
+ platformQuotes: (quote.responseObject?.platformQuotes ?? []).map((platformQuote) => {
7374
+ const bestQuote = platformQuote?.bestQuote;
7375
+ const makerDepositData = bestQuote?.maker?.depositData;
7376
+ if (!bestQuote || !makerDepositData) return platformQuote;
7377
+ return {
7378
+ ...platformQuote,
7379
+ bestQuote: { ...bestQuote, payeeData: makerDepositData }
7380
+ };
7381
+ })
7382
+ }
7383
+ } : quote;
7384
+ return appendReferrerFeeDisplayFieldsToBestByPlatform(enrichedQuote, referrerFeeConfig);
7385
+ }
7281
7386
  // ───────────────────────────────────────────────────────────────────────────
7282
7387
  // SUPPORTING: TAKER TIER
7283
7388
  // (Used by frontends to display taker limits)
@@ -7297,7 +7402,7 @@ var Zkp2pClient = class {
7297
7402
  ""
7298
7403
  );
7299
7404
  const timeoutMs = opts?.timeoutMs ?? this.apiTimeoutMs;
7300
- return apiGetTakerTier(req, this.apiKey, baseApiUrl, timeoutMs);
7405
+ return apiGetTakerTier(req, void 0, baseApiUrl, timeoutMs);
7301
7406
  }
7302
7407
  // ╔═══════════════════════════════════════════════════════════════════════════╗
7303
7408
  // ║ CORE: ON-CHAIN DEPOSIT VIEWS ║
@@ -7666,6 +7771,6 @@ var logger = {
7666
7771
  }
7667
7772
  };
7668
7773
 
7669
- export { BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractRouter, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, IndexerClient, IndexerDepositService, IndexerRateManagerService, Zkp2pClient as OfframpClient, PAYMENT_PLATFORMS, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, TOKEN_METADATA, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, assertValidReferrerFeeConfig, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, defaultIndexerEndpoint, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
7774
+ export { BASE_BUILDER_CODE, CHAINLINK_ORACLE_ADAPTER, CHAINLINK_ORACLE_FEEDS, ContractRouter, DEFAULT_ORACLE_MAX_STALENESS_SECONDS, IndexerClient, IndexerDepositService, IndexerRateManagerService, Zkp2pClient as OfframpClient, PAYMENT_PLATFORMS, PEER_EXTENSION_CHROME_URL, PLATFORM_METADATA, PYTH_CONTRACT_BASE, PYTH_ORACLE_ADAPTER, PYTH_ORACLE_FEEDS, SPREAD_ORACLE_FEEDS, SUPPORTED_CHAIN_IDS, TOKEN_METADATA, ZKP2P_ANDROID_REFERRER, ZKP2P_IOS_REFERRER, Zkp2pClient, apiGetOwnerDeposits, apiGetPayeeDetails, apiGetQuotesBestByPlatform, apiGetTakerTier, apiPostDepositDetails, apiValidatePayeeDetails, appendAttributionToCalldata, assertValidReferrerFeeConfig, compareEventCursorIdsByRecency, convertDepositsForLiquidity, convertIndexerDepositToEscrowView, convertIndexerIntentsToEscrowViews, createCompositeDepositId, createPeerExtensionSdk, defaultIndexerEndpoint, encodePythAdapterConfig, encodeSpreadOracleAdapterConfig, encodeWithAttribution, fetchFulfillmentAndPayment as fetchIndexerFulfillmentAndPayment, getAttributionDataSuffix, getPeerExtensionState, getSpreadOracleConfig, isPeerExtensionAvailable, isValidReferrerFeeBps, isValidReferrerFeeRecipient, logger, openPeerExtensionInstallPage, parseReferrerFeeConfig, peerExtensionSdk, referrerFeeConfigToPreciseUnits, sendTransactionWithAttribution, setLogLevel, validateOracleFeedsOnChain };
7670
7775
  //# sourceMappingURL=index.mjs.map
7671
7776
  //# sourceMappingURL=index.mjs.map