@zkp2p/sdk 0.2.3 → 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/react.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { Z as Zkp2pClient, i as SignalIntentMethodParams, ac as PreparedTransaction, af as TakerTier, f as GetTakerTierRequest, g as GetTakerTierResponse, F as FulfillIntentMethodParams, bu as SendTransactionFn, bv as SendBatchFn, bs as DelegationDepositTarget, bt as BatchResult } from './vaultUtils-DiAumiXp.mjs';
2
- export { bq as DelegationRoute, br as DelegationState, bw as VAULT_ZERO_ADDRESS, bk as ZERO_RATE_MANAGER_ID, bx as asErrorMessage, by as assertDelegationMethodSupport, bp as classifyDelegationState, bo as getDelegationRoute, bl as isZeroRateManagerId, bm as normalizeRateManagerId, bn as normalizeRegistry } from './vaultUtils-DiAumiXp.mjs';
1
+ import { Z as Zkp2pClient, i as SignalIntentMethodParams, aj as PreparedTransaction, am as TakerTier, f as GetTakerTierRequest, g as GetTakerTierResponse, F as FulfillIntentMethodParams, bB as SendTransactionFn, bC as SendBatchFn, bz as DelegationDepositTarget, bA as BatchResult } from './vaultUtils-sodi4Xx-.mjs';
2
+ export { bx as DelegationRoute, by as DelegationState, bD as VAULT_ZERO_ADDRESS, br as ZERO_RATE_MANAGER_ID, bE as asErrorMessage, bF as assertDelegationMethodSupport, bw as classifyDelegationState, bv as getDelegationRoute, bs as isZeroRateManagerId, bt as normalizeRateManagerId, bu as normalizeRegistry } from './vaultUtils-sodi4Xx-.mjs';
3
3
  import { Hash, Address, Hex } from 'viem';
4
4
  import '@zkp2p/indexer-schema';
5
5
  import 'abitype';
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Z as Zkp2pClient, i as SignalIntentMethodParams, ac as PreparedTransaction, af as TakerTier, f as GetTakerTierRequest, g as GetTakerTierResponse, F as FulfillIntentMethodParams, bu as SendTransactionFn, bv as SendBatchFn, bs as DelegationDepositTarget, bt as BatchResult } from './vaultUtils-DiAumiXp.js';
2
- export { bq as DelegationRoute, br as DelegationState, bw as VAULT_ZERO_ADDRESS, bk as ZERO_RATE_MANAGER_ID, bx as asErrorMessage, by as assertDelegationMethodSupport, bp as classifyDelegationState, bo as getDelegationRoute, bl as isZeroRateManagerId, bm as normalizeRateManagerId, bn as normalizeRegistry } from './vaultUtils-DiAumiXp.js';
1
+ import { Z as Zkp2pClient, i as SignalIntentMethodParams, aj as PreparedTransaction, am as TakerTier, f as GetTakerTierRequest, g as GetTakerTierResponse, F as FulfillIntentMethodParams, bB as SendTransactionFn, bC as SendBatchFn, bz as DelegationDepositTarget, bA as BatchResult } from './vaultUtils-sodi4Xx-.js';
2
+ export { bx as DelegationRoute, by as DelegationState, bD as VAULT_ZERO_ADDRESS, br as ZERO_RATE_MANAGER_ID, bE as asErrorMessage, bF as assertDelegationMethodSupport, bw as classifyDelegationState, bv as getDelegationRoute, bs as isZeroRateManagerId, bt as normalizeRateManagerId, bu as normalizeRegistry } from './vaultUtils-sodi4Xx-.js';
3
3
  import { Hash, Address, Hex } from 'viem';
4
4
  import '@zkp2p/indexer-schema';
5
5
  import 'abitype';
@@ -1,5 +1,5 @@
1
1
  import * as _zkp2p_indexer_schema from '@zkp2p/indexer-schema';
2
- import { Deposit, DepositStatus as DepositStatus$2, IntentStatus as IntentStatus$1, DepositPaymentMethod, MethodCurrency, Intent as Intent$1, RateManager, ManagerAggregateStats, RateManagerRate, ManagerStats, DepositFundActivity, DepositDailySnapshot, ManagerDailySnapshot } from '@zkp2p/indexer-schema';
2
+ import { Deposit, DepositStatus as DepositStatus$2, IntentStatus as IntentStatus$1, DepositPaymentMethod, MethodCurrency, Intent as Intent$1, MakerProfitSnapshot, RateManager, ManagerAggregateStats, RateManagerRate, ManagerStats, DepositFundActivity, DepositDailySnapshot, ManagerDailySnapshot } from '@zkp2p/indexer-schema';
3
3
  import { Address, Hex, AccessList, AuthorizationList, Hash, WalletClient, PublicClient } from 'viem';
4
4
  import { Abi } from 'abitype';
5
5
 
@@ -485,6 +485,7 @@ type ManagerAggregateStatsEntity = WithOverrides<ManagerAggregateStats, {
485
485
  }>;
486
486
  type ManagerStatsEntity = ManagerStats;
487
487
  type ManagerDailySnapshotEntity = ManagerDailySnapshot;
488
+ type MakerProfitSnapshotEntity = MakerProfitSnapshot;
488
489
  interface ManualRateUpdateEntity {
489
490
  id: string;
490
491
  rateManagerId: string;
@@ -570,6 +571,7 @@ declare class IndexerDepositService {
570
571
  }): Promise<DepositWithRelations[]>;
571
572
  fetchIntentsForDeposits(depositIds: string[], statuses?: IntentStatus[]): Promise<IntentEntity[]>;
572
573
  fetchIntentsByOwner(owner: string, statuses?: IntentStatus[]): Promise<IntentEntity[]>;
574
+ fetchIntentsByRateManager(rateManagerId: string, statuses?: IntentStatus[]): Promise<IntentEntity[]>;
573
575
  fetchIntentByHash(intentHash: string): Promise<IntentEntity | null>;
574
576
  fetchDepositWithRelations(id: string, options?: {
575
577
  includeIntents?: boolean;
@@ -609,6 +611,7 @@ declare class IndexerDepositService {
609
611
  * Fetch daily snapshots for a deposit, ordered by day ascending.
610
612
  */
611
613
  fetchDepositDailySnapshots(compositeDepositId: string, limit?: number): Promise<DepositDailySnapshotEntity[]>;
614
+ fetchProfitSnapshotsByDeposits(depositIds: string[]): Promise<MakerProfitSnapshotEntity[]>;
612
615
  }
613
616
 
614
617
  type OrderDirection = 'asc' | 'desc';
@@ -885,6 +888,27 @@ type QuoteRequest = {
885
888
  /** Max suggestions per direction (1-10, default: 3) */
886
889
  nearbyQuotesCount?: number;
887
890
  };
891
+ type QuotesBestByPlatformRequest = {
892
+ fiatCurrency: string;
893
+ user: string;
894
+ recipient: string;
895
+ destinationChainId: number;
896
+ destinationToken: string;
897
+ referrer?: string;
898
+ referrerFeeConfig?: ReferrerFeeConfig;
899
+ amount: string;
900
+ isExactFiat?: boolean;
901
+ /** Optional filter: limit quotes to these escrow contracts */
902
+ escrowAddresses?: string[];
903
+ /** Minimum maker success rate in basis points (0-10000) */
904
+ minDepositSuccessRateBps?: number;
905
+ /** Whether quotes may include business accounts */
906
+ supportBusinessAccounts?: boolean;
907
+ /** Optional intent gating service address to filter by */
908
+ intentGatingService?: string;
909
+ /** Include whitelist-gated private orderbook deposits */
910
+ includePrivateOrderbooks?: boolean;
911
+ };
888
912
  type FiatResponse = {
889
913
  currencyCode: string;
890
914
  currencyName: string;
@@ -1007,6 +1031,34 @@ type QuoteResponse = {
1007
1031
  type GetQuoteResponse = Omit<QuoteResponse, 'responseObject'> & {
1008
1032
  responseObject: GetQuoteResponseObject;
1009
1033
  };
1034
+ type PlatformQuote = {
1035
+ platform: string;
1036
+ supported: boolean;
1037
+ available: boolean;
1038
+ bestQuote?: QuoteSingleResponse;
1039
+ };
1040
+ type GetPlatformQuote = Omit<PlatformQuote, 'bestQuote'> & {
1041
+ bestQuote?: GetQuoteSingleResponse;
1042
+ };
1043
+ type BestByPlatformResponseObject = {
1044
+ fiat: FiatResponse;
1045
+ token: TokenResponse;
1046
+ fees: QuoteFeesResponse;
1047
+ platformQuotes: PlatformQuote[];
1048
+ quoteExpiresAt: string;
1049
+ };
1050
+ type GetBestByPlatformResponseObject = Omit<BestByPlatformResponseObject, 'platformQuotes'> & {
1051
+ platformQuotes: GetPlatformQuote[];
1052
+ };
1053
+ type BestByPlatformResponse = {
1054
+ message: string;
1055
+ success: boolean;
1056
+ responseObject: BestByPlatformResponseObject;
1057
+ statusCode: number;
1058
+ };
1059
+ type GetBestByPlatformResponse = Omit<BestByPlatformResponse, 'responseObject'> & {
1060
+ responseObject: GetBestByPlatformResponseObject;
1061
+ };
1010
1062
  /**
1011
1063
  * Request to fetch payee details
1012
1064
  * Prefer `processorName`; `platform` kept for backward compatibility.
@@ -1305,7 +1357,7 @@ type PaymentPlatformType = (typeof PAYMENT_PLATFORMS)[number];
1305
1357
  * walletClient,
1306
1358
  * chainId: 8453, // Base mainnet
1307
1359
  * runtimeEnv: 'production',
1308
- * apiKey: 'your-curator-api-key',
1360
+ * // apiKey: 'your-curator-api-key', // Optional: auto gating-signature fetches and quote enrichment
1309
1361
  * indexerApiKey: 'your-indexer-key',
1310
1362
  * };
1311
1363
  * ```
@@ -1323,7 +1375,11 @@ type Zkp2pNextOptions = {
1323
1375
  indexerUrl?: string;
1324
1376
  /** Base API URL for ZKP2P services (defaults to https://api.zkp2p.xyz) */
1325
1377
  baseApiUrl?: string;
1326
- /** Curator API key for authenticated endpoints like registerPayeeDetails, signalIntent (sent as x-api-key to curator) */
1378
+ /**
1379
+ * Optional curator API key (sent as `x-api-key`) for auto-fetching
1380
+ * `signalIntent` gating signatures and authenticated quote enrichment.
1381
+ * Not used by `registerPayeeDetails` or `getTakerTier`.
1382
+ */
1327
1383
  apiKey?: string;
1328
1384
  /** Optional bearer token for hybrid authentication */
1329
1385
  authorizationToken?: string;
@@ -1492,7 +1548,6 @@ type OnchainCurrencyEntry = {
1492
1548
  * const client = new OfframpClient({
1493
1549
  * walletClient,
1494
1550
  * chainId: base.id,
1495
- * apiKey: 'your-api-key',
1496
1551
  * });
1497
1552
  *
1498
1553
  * // Step 1: Register payee details (separate from deposit creation)
@@ -1574,7 +1629,7 @@ declare class Zkp2pClient {
1574
1629
  readonly orchestratorRegistryAbi?: Abi;
1575
1630
  /** Base API URL for ZKP2P services */
1576
1631
  readonly baseApiUrl?: string;
1577
- /** API key for authenticated endpoints */
1632
+ /** Optional curator API key (`x-api-key`) for auto gating-signature fetches and quote enrichment */
1578
1633
  readonly apiKey?: string;
1579
1634
  /** Bearer token for hybrid authentication */
1580
1635
  readonly authorizationToken?: string;
@@ -1798,6 +1853,10 @@ declare class Zkp2pClient {
1798
1853
  * Fetches all intents created by a specific owner address.
1799
1854
  */
1800
1855
  getOwnerIntents: (owner: string, statuses?: IntentStatus[]) => Promise<IntentEntity[]>;
1856
+ /**
1857
+ * Fetches fulfilled intents for a vault by rate manager ID.
1858
+ */
1859
+ getIntentsByRateManager: (rateManagerId: string, statuses?: IntentStatus[]) => Promise<IntentEntity[]>;
1801
1860
  /**
1802
1861
  * Fetches a single intent by hash.
1803
1862
  */
@@ -1844,6 +1903,10 @@ declare class Zkp2pClient {
1844
1903
  includeIntents?: boolean;
1845
1904
  intentStatuses?: IntentStatus[];
1846
1905
  }) => Promise<DepositWithRelations[]>;
1906
+ /**
1907
+ * Fetches maker profit snapshots for the provided deposits.
1908
+ */
1909
+ getProfitSnapshotsByDeposits: (depositIds: string[]) => Promise<MakerProfitSnapshotEntity[]>;
1847
1910
  /**
1848
1911
  * Fetches rate managers (vaults) with aggregate stats.
1849
1912
  */
@@ -2525,7 +2588,9 @@ declare class Zkp2pClient {
2525
2588
  * sending fiat payment to the deposit's payee.
2526
2589
  *
2527
2590
  * If `gatingServiceSignature` is not provided, the SDK will automatically
2528
- * fetch one from the API (requires `apiKey` or `authorizationToken`).
2591
+ * fetch one from curator `/v3/intent` when `apiKey` or `authorizationToken`
2592
+ * is available. Otherwise you must provide `gatingServiceSignature` and
2593
+ * `signatureExpiration` yourself.
2529
2594
  *
2530
2595
  * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
2531
2596
  * ```typescript
@@ -2774,6 +2839,20 @@ declare class Zkp2pClient {
2774
2839
  baseApiUrl?: string;
2775
2840
  timeoutMs?: number;
2776
2841
  }): Promise<GetQuoteResponse>;
2842
+ /**
2843
+ * **Supporting Method** - Fetches the best available quote per supported payment platform.
2844
+ *
2845
+ * Returns one quote per platform when available. When authenticated, the API
2846
+ * returns payee details in each platform's best quote.
2847
+ *
2848
+ * @param req - Best-by-platform quote request parameters
2849
+ * @param opts - Optional overrides for API URL and timeout
2850
+ * @returns Best-by-platform quote response
2851
+ */
2852
+ getQuotesBestByPlatform(req: QuotesBestByPlatformRequest, opts?: {
2853
+ baseApiUrl?: string;
2854
+ timeoutMs?: number;
2855
+ }): Promise<GetBestByPlatformResponse>;
2777
2856
  /**
2778
2857
  * **Supporting Method** - Fetches taker tier information for an address.
2779
2858
  *
@@ -2949,4 +3028,4 @@ type SendBatchFn = (txs: Array<{
2949
3028
  value?: bigint;
2950
3029
  }>) => Promise<string>;
2951
3030
 
2952
- export { type GetDepositByIdResponse as $, type AuthorizationTokenProvider as A, type QuoteResponseObject as B, type CurrencyType as C, type DepositWithRelations as D, type QuoteSingleResponse as E, type FulfillIntentMethodParams as F, type GetPayeeDetailsRequest as G, type QuoteIntentResponse as H, type IntentEntity as I, type QuoteFeesResponse as J, type FiatResponse as K, type TokenResponse as L, type NearbySuggestions as M, type NearbyQuote as N, type ApiDeposit as O, type PostDepositDetailsRequest as P, type QuoteRequest as Q, type ReferrerFeeConfig as R, type SignalIntentReferralFee as S, type TxOverrides as T, type DepositVerifier as U, type ValidatePayeeDetailsRequest as V, type WithdrawDepositParams as W, type DepositVerifierCurrency as X, type DepositStatus as Y, Zkp2pClient as Z, type GetDepositByIdRequest as _, type ValidatePayeeDetailsResponse as a, getCurrencyInfoFromCountryCode as a$, type Intent as a0, type ApiIntentStatus as a1, type GetOwnerIntentsRequest as a2, type GetOwnerIntentsResponse as a3, type GetIntentsByDepositRequest as a4, type GetIntentsByDepositResponse as a5, type GetIntentByHashRequest as a6, type GetIntentByHashResponse as a7, type RegisterPayeeDetailsRequest as a8, type RegisterPayeeDetailsResponse as a9, type ManagerStatsEntity as aA, type ManagerDailySnapshotEntity as aB, type RateManagerListItem as aC, type RateManagerDetail as aD, type ManualRateUpdateEntity as aE, type OracleConfigUpdateEntity as aF, type DepositFundActivityEntity as aG, type DepositDailySnapshotEntity as aH, type DepositFundActivityType as aI, type DepositFilter as aJ, type PaginationOptions as aK, type DepositOrderField as aL, type OrderDirection$1 as aM, type RateManagerFilter as aN, type RateManagerPaginationOptions as aO, type RateManagerDelegationPaginationOptions as aP, type RateManagerOrderField as aQ, type OrderDirection as aR, type DeploymentEnv as aS, type FulfillmentRecord as aT, type PaymentVerifiedRecord as aU, type FulfillmentAndPaymentResponse as aV, PAYMENT_PLATFORMS as aW, type PaymentPlatformType as aX, Currency as aY, currencyInfo as aZ, getCurrencyInfoFromHash as a_, type OnchainCurrency as aa, type DepositVerifierData as ab, type PreparedTransaction as ac, type OrderStats as ad, type DepositIntentStatistics as ae, type TakerTier as af, type TakerTierStats as ag, type TakerTierLevel as ah, type PlatformLimit as ai, type PlatformRiskLevel as aj, IndexerClient as ak, defaultIndexerEndpoint as al, IndexerDepositService as am, IndexerRateManagerService as an, compareEventCursorIdsByRecency as ao, fetchFulfillmentAndPayment as ap, type DepositEntity as aq, type IntentFulfilledEntity as ar, type IntentFulfillmentAmountsEntity as as, type DepositPaymentMethodEntity as at, type MethodCurrencyEntity as au, type IntentStatus as av, type RateManagerEntity as aw, type RateManagerRateEntity as ax, type RateManagerDelegationEntity as ay, type ManagerAggregateStatsEntity as az, type PostDepositDetailsResponse as b, getCurrencyCodeFromHash as b0, isSupportedCurrencyHash as b1, mapConversionRatesToOnchainMinRate as b2, type CurrencyData as b3, getContracts as b4, getRateManagerContracts as b5, getPaymentMethodsCatalog as b6, getGatingServiceAddress as b7, type RuntimeEnv as b8, parseDepositView as b9, parseIntentView as ba, enrichPvDepositView as bb, enrichPvIntentView as bc, type PV_DepositView as bd, type PV_Deposit as be, type PV_PaymentMethodData as bf, type PV_Currency as bg, type PV_ReferralFee as bh, type PV_IntentView as bi, type PV_Intent as bj, ZERO_RATE_MANAGER_ID as bk, isZeroRateManagerId as bl, normalizeRateManagerId as bm, normalizeRegistry as bn, getDelegationRoute as bo, classifyDelegationState as bp, type DelegationRoute as bq, type DelegationState as br, type DelegationDepositTarget as bs, type BatchResult as bt, type SendTransactionFn as bu, type SendBatchFn as bv, ZERO_ADDRESS as bw, asErrorMessage as bx, assertDelegationMethodSupport as by, type GetPayeeDetailsResponse as c, type GetOwnerDepositsRequest as d, type GetOwnerDepositsResponse as e, type GetTakerTierRequest as f, type GetTakerTierResponse as g, type PaymentMethodCatalog as h, type SignalIntentMethodParams as i, type CancelIntentMethodParams as j, type Zkp2pNextOptions as k, type TimeoutConfig as l, type ActionCallback as m, type CreateDepositParams as n, type CreateDepositConversionRate as o, type Range as p, type SignalIntentParams as q, type FulfillIntentParams as r, type ReleaseFundsToPayerParams as s, type CancelIntentParams as t, type GetNearbyQuote as u, type GetNearbySuggestions as v, type GetQuoteResponse as w, type GetQuoteResponseObject as x, type GetQuoteSingleResponse as y, type QuoteResponse as z };
3031
+ export { type NearbyQuote as $, type AuthorizationTokenProvider as A, type BestByPlatformResponse as B, type CurrencyType as C, type DepositWithRelations as D, type GetNearbyQuote as E, type FulfillIntentMethodParams as F, type GetPayeeDetailsRequest as G, type GetNearbySuggestions as H, type IntentEntity as I, type GetQuoteResponse as J, type GetQuoteResponseObject as K, type GetQuoteSingleResponse as L, type QuoteResponse as M, type QuoteResponseObject as N, type QuoteSingleResponse as O, type PostDepositDetailsRequest as P, type QuotesBestByPlatformRequest as Q, type ReferrerFeeConfig as R, type SignalIntentReferralFee as S, type TxOverrides as T, type QuoteIntentResponse as U, type ValidatePayeeDetailsRequest as V, type WithdrawDepositParams as W, type QuoteFeesResponse as X, type FiatResponse as Y, Zkp2pClient as Z, type TokenResponse as _, type ValidatePayeeDetailsResponse as a, type PaymentVerifiedRecord as a$, type NearbySuggestions as a0, type ApiDeposit as a1, type DepositVerifier as a2, type DepositVerifierCurrency as a3, type DepositStatus as a4, type GetDepositByIdRequest as a5, type GetDepositByIdResponse as a6, type Intent as a7, type ApiIntentStatus as a8, type GetOwnerIntentsRequest as a9, type DepositPaymentMethodEntity as aA, type MethodCurrencyEntity as aB, type IntentStatus as aC, type RateManagerEntity as aD, type RateManagerRateEntity as aE, type RateManagerDelegationEntity as aF, type ManagerAggregateStatsEntity as aG, type ManagerStatsEntity as aH, type ManagerDailySnapshotEntity as aI, type RateManagerListItem as aJ, type RateManagerDetail as aK, type ManualRateUpdateEntity as aL, type OracleConfigUpdateEntity as aM, type DepositFundActivityEntity as aN, type DepositDailySnapshotEntity as aO, type DepositFundActivityType as aP, type DepositFilter as aQ, type PaginationOptions as aR, type DepositOrderField as aS, type OrderDirection$1 as aT, type RateManagerFilter as aU, type RateManagerPaginationOptions as aV, type RateManagerDelegationPaginationOptions as aW, type RateManagerOrderField as aX, type OrderDirection as aY, type DeploymentEnv as aZ, type FulfillmentRecord as a_, type GetOwnerIntentsResponse as aa, type GetIntentsByDepositRequest as ab, type GetIntentsByDepositResponse as ac, type GetIntentByHashRequest as ad, type GetIntentByHashResponse as ae, type RegisterPayeeDetailsRequest as af, type RegisterPayeeDetailsResponse as ag, type OnchainCurrency as ah, type DepositVerifierData as ai, type PreparedTransaction as aj, type OrderStats as ak, type DepositIntentStatistics as al, type TakerTier as am, type TakerTierStats as an, type TakerTierLevel as ao, type PlatformLimit as ap, type PlatformRiskLevel as aq, IndexerClient as ar, defaultIndexerEndpoint as as, IndexerDepositService as at, IndexerRateManagerService as au, compareEventCursorIdsByRecency as av, fetchFulfillmentAndPayment as aw, type DepositEntity as ax, type IntentFulfilledEntity as ay, type IntentFulfillmentAmountsEntity as az, type PostDepositDetailsResponse as b, type FulfillmentAndPaymentResponse as b0, PAYMENT_PLATFORMS as b1, type PaymentPlatformType as b2, Currency as b3, currencyInfo as b4, getCurrencyInfoFromHash as b5, getCurrencyInfoFromCountryCode as b6, getCurrencyCodeFromHash as b7, isSupportedCurrencyHash as b8, mapConversionRatesToOnchainMinRate as b9, type BatchResult as bA, type SendTransactionFn as bB, type SendBatchFn as bC, ZERO_ADDRESS as bD, asErrorMessage as bE, assertDelegationMethodSupport as bF, type CurrencyData as ba, getContracts as bb, getRateManagerContracts as bc, getPaymentMethodsCatalog as bd, getGatingServiceAddress as be, type RuntimeEnv as bf, parseDepositView as bg, parseIntentView as bh, enrichPvDepositView as bi, enrichPvIntentView as bj, type PV_DepositView as bk, type PV_Deposit as bl, type PV_PaymentMethodData as bm, type PV_Currency as bn, type PV_ReferralFee as bo, type PV_IntentView as bp, type PV_Intent as bq, ZERO_RATE_MANAGER_ID as br, isZeroRateManagerId as bs, normalizeRateManagerId as bt, normalizeRegistry as bu, getDelegationRoute as bv, classifyDelegationState as bw, type DelegationRoute as bx, type DelegationState as by, type DelegationDepositTarget as bz, type GetPayeeDetailsResponse as c, type GetOwnerDepositsRequest as d, type GetOwnerDepositsResponse as e, type GetTakerTierRequest as f, type GetTakerTierResponse as g, type PaymentMethodCatalog as h, type SignalIntentMethodParams as i, type CancelIntentMethodParams as j, type Zkp2pNextOptions as k, type TimeoutConfig as l, type ActionCallback as m, type CreateDepositParams as n, type CreateDepositConversionRate as o, type Range as p, type SignalIntentParams as q, type FulfillIntentParams as r, type ReleaseFundsToPayerParams as s, type CancelIntentParams as t, type BestByPlatformResponseObject as u, type GetBestByPlatformResponse as v, type GetBestByPlatformResponseObject as w, type GetPlatformQuote as x, type PlatformQuote as y, type QuoteRequest as z };
@@ -1,5 +1,5 @@
1
1
  import * as _zkp2p_indexer_schema from '@zkp2p/indexer-schema';
2
- import { Deposit, DepositStatus as DepositStatus$2, IntentStatus as IntentStatus$1, DepositPaymentMethod, MethodCurrency, Intent as Intent$1, RateManager, ManagerAggregateStats, RateManagerRate, ManagerStats, DepositFundActivity, DepositDailySnapshot, ManagerDailySnapshot } from '@zkp2p/indexer-schema';
2
+ import { Deposit, DepositStatus as DepositStatus$2, IntentStatus as IntentStatus$1, DepositPaymentMethod, MethodCurrency, Intent as Intent$1, MakerProfitSnapshot, RateManager, ManagerAggregateStats, RateManagerRate, ManagerStats, DepositFundActivity, DepositDailySnapshot, ManagerDailySnapshot } from '@zkp2p/indexer-schema';
3
3
  import { Address, Hex, AccessList, AuthorizationList, Hash, WalletClient, PublicClient } from 'viem';
4
4
  import { Abi } from 'abitype';
5
5
 
@@ -485,6 +485,7 @@ type ManagerAggregateStatsEntity = WithOverrides<ManagerAggregateStats, {
485
485
  }>;
486
486
  type ManagerStatsEntity = ManagerStats;
487
487
  type ManagerDailySnapshotEntity = ManagerDailySnapshot;
488
+ type MakerProfitSnapshotEntity = MakerProfitSnapshot;
488
489
  interface ManualRateUpdateEntity {
489
490
  id: string;
490
491
  rateManagerId: string;
@@ -570,6 +571,7 @@ declare class IndexerDepositService {
570
571
  }): Promise<DepositWithRelations[]>;
571
572
  fetchIntentsForDeposits(depositIds: string[], statuses?: IntentStatus[]): Promise<IntentEntity[]>;
572
573
  fetchIntentsByOwner(owner: string, statuses?: IntentStatus[]): Promise<IntentEntity[]>;
574
+ fetchIntentsByRateManager(rateManagerId: string, statuses?: IntentStatus[]): Promise<IntentEntity[]>;
573
575
  fetchIntentByHash(intentHash: string): Promise<IntentEntity | null>;
574
576
  fetchDepositWithRelations(id: string, options?: {
575
577
  includeIntents?: boolean;
@@ -609,6 +611,7 @@ declare class IndexerDepositService {
609
611
  * Fetch daily snapshots for a deposit, ordered by day ascending.
610
612
  */
611
613
  fetchDepositDailySnapshots(compositeDepositId: string, limit?: number): Promise<DepositDailySnapshotEntity[]>;
614
+ fetchProfitSnapshotsByDeposits(depositIds: string[]): Promise<MakerProfitSnapshotEntity[]>;
612
615
  }
613
616
 
614
617
  type OrderDirection = 'asc' | 'desc';
@@ -885,6 +888,27 @@ type QuoteRequest = {
885
888
  /** Max suggestions per direction (1-10, default: 3) */
886
889
  nearbyQuotesCount?: number;
887
890
  };
891
+ type QuotesBestByPlatformRequest = {
892
+ fiatCurrency: string;
893
+ user: string;
894
+ recipient: string;
895
+ destinationChainId: number;
896
+ destinationToken: string;
897
+ referrer?: string;
898
+ referrerFeeConfig?: ReferrerFeeConfig;
899
+ amount: string;
900
+ isExactFiat?: boolean;
901
+ /** Optional filter: limit quotes to these escrow contracts */
902
+ escrowAddresses?: string[];
903
+ /** Minimum maker success rate in basis points (0-10000) */
904
+ minDepositSuccessRateBps?: number;
905
+ /** Whether quotes may include business accounts */
906
+ supportBusinessAccounts?: boolean;
907
+ /** Optional intent gating service address to filter by */
908
+ intentGatingService?: string;
909
+ /** Include whitelist-gated private orderbook deposits */
910
+ includePrivateOrderbooks?: boolean;
911
+ };
888
912
  type FiatResponse = {
889
913
  currencyCode: string;
890
914
  currencyName: string;
@@ -1007,6 +1031,34 @@ type QuoteResponse = {
1007
1031
  type GetQuoteResponse = Omit<QuoteResponse, 'responseObject'> & {
1008
1032
  responseObject: GetQuoteResponseObject;
1009
1033
  };
1034
+ type PlatformQuote = {
1035
+ platform: string;
1036
+ supported: boolean;
1037
+ available: boolean;
1038
+ bestQuote?: QuoteSingleResponse;
1039
+ };
1040
+ type GetPlatformQuote = Omit<PlatformQuote, 'bestQuote'> & {
1041
+ bestQuote?: GetQuoteSingleResponse;
1042
+ };
1043
+ type BestByPlatformResponseObject = {
1044
+ fiat: FiatResponse;
1045
+ token: TokenResponse;
1046
+ fees: QuoteFeesResponse;
1047
+ platformQuotes: PlatformQuote[];
1048
+ quoteExpiresAt: string;
1049
+ };
1050
+ type GetBestByPlatformResponseObject = Omit<BestByPlatformResponseObject, 'platformQuotes'> & {
1051
+ platformQuotes: GetPlatformQuote[];
1052
+ };
1053
+ type BestByPlatformResponse = {
1054
+ message: string;
1055
+ success: boolean;
1056
+ responseObject: BestByPlatformResponseObject;
1057
+ statusCode: number;
1058
+ };
1059
+ type GetBestByPlatformResponse = Omit<BestByPlatformResponse, 'responseObject'> & {
1060
+ responseObject: GetBestByPlatformResponseObject;
1061
+ };
1010
1062
  /**
1011
1063
  * Request to fetch payee details
1012
1064
  * Prefer `processorName`; `platform` kept for backward compatibility.
@@ -1305,7 +1357,7 @@ type PaymentPlatformType = (typeof PAYMENT_PLATFORMS)[number];
1305
1357
  * walletClient,
1306
1358
  * chainId: 8453, // Base mainnet
1307
1359
  * runtimeEnv: 'production',
1308
- * apiKey: 'your-curator-api-key',
1360
+ * // apiKey: 'your-curator-api-key', // Optional: auto gating-signature fetches and quote enrichment
1309
1361
  * indexerApiKey: 'your-indexer-key',
1310
1362
  * };
1311
1363
  * ```
@@ -1323,7 +1375,11 @@ type Zkp2pNextOptions = {
1323
1375
  indexerUrl?: string;
1324
1376
  /** Base API URL for ZKP2P services (defaults to https://api.zkp2p.xyz) */
1325
1377
  baseApiUrl?: string;
1326
- /** Curator API key for authenticated endpoints like registerPayeeDetails, signalIntent (sent as x-api-key to curator) */
1378
+ /**
1379
+ * Optional curator API key (sent as `x-api-key`) for auto-fetching
1380
+ * `signalIntent` gating signatures and authenticated quote enrichment.
1381
+ * Not used by `registerPayeeDetails` or `getTakerTier`.
1382
+ */
1327
1383
  apiKey?: string;
1328
1384
  /** Optional bearer token for hybrid authentication */
1329
1385
  authorizationToken?: string;
@@ -1492,7 +1548,6 @@ type OnchainCurrencyEntry = {
1492
1548
  * const client = new OfframpClient({
1493
1549
  * walletClient,
1494
1550
  * chainId: base.id,
1495
- * apiKey: 'your-api-key',
1496
1551
  * });
1497
1552
  *
1498
1553
  * // Step 1: Register payee details (separate from deposit creation)
@@ -1574,7 +1629,7 @@ declare class Zkp2pClient {
1574
1629
  readonly orchestratorRegistryAbi?: Abi;
1575
1630
  /** Base API URL for ZKP2P services */
1576
1631
  readonly baseApiUrl?: string;
1577
- /** API key for authenticated endpoints */
1632
+ /** Optional curator API key (`x-api-key`) for auto gating-signature fetches and quote enrichment */
1578
1633
  readonly apiKey?: string;
1579
1634
  /** Bearer token for hybrid authentication */
1580
1635
  readonly authorizationToken?: string;
@@ -1798,6 +1853,10 @@ declare class Zkp2pClient {
1798
1853
  * Fetches all intents created by a specific owner address.
1799
1854
  */
1800
1855
  getOwnerIntents: (owner: string, statuses?: IntentStatus[]) => Promise<IntentEntity[]>;
1856
+ /**
1857
+ * Fetches fulfilled intents for a vault by rate manager ID.
1858
+ */
1859
+ getIntentsByRateManager: (rateManagerId: string, statuses?: IntentStatus[]) => Promise<IntentEntity[]>;
1801
1860
  /**
1802
1861
  * Fetches a single intent by hash.
1803
1862
  */
@@ -1844,6 +1903,10 @@ declare class Zkp2pClient {
1844
1903
  includeIntents?: boolean;
1845
1904
  intentStatuses?: IntentStatus[];
1846
1905
  }) => Promise<DepositWithRelations[]>;
1906
+ /**
1907
+ * Fetches maker profit snapshots for the provided deposits.
1908
+ */
1909
+ getProfitSnapshotsByDeposits: (depositIds: string[]) => Promise<MakerProfitSnapshotEntity[]>;
1847
1910
  /**
1848
1911
  * Fetches rate managers (vaults) with aggregate stats.
1849
1912
  */
@@ -2525,7 +2588,9 @@ declare class Zkp2pClient {
2525
2588
  * sending fiat payment to the deposit's payee.
2526
2589
  *
2527
2590
  * If `gatingServiceSignature` is not provided, the SDK will automatically
2528
- * fetch one from the API (requires `apiKey` or `authorizationToken`).
2591
+ * fetch one from curator `/v3/intent` when `apiKey` or `authorizationToken`
2592
+ * is available. Otherwise you must provide `gatingServiceSignature` and
2593
+ * `signatureExpiration` yourself.
2529
2594
  *
2530
2595
  * **Prepare Mode**: Use `.prepare()` to get the transaction calldata without sending:
2531
2596
  * ```typescript
@@ -2774,6 +2839,20 @@ declare class Zkp2pClient {
2774
2839
  baseApiUrl?: string;
2775
2840
  timeoutMs?: number;
2776
2841
  }): Promise<GetQuoteResponse>;
2842
+ /**
2843
+ * **Supporting Method** - Fetches the best available quote per supported payment platform.
2844
+ *
2845
+ * Returns one quote per platform when available. When authenticated, the API
2846
+ * returns payee details in each platform's best quote.
2847
+ *
2848
+ * @param req - Best-by-platform quote request parameters
2849
+ * @param opts - Optional overrides for API URL and timeout
2850
+ * @returns Best-by-platform quote response
2851
+ */
2852
+ getQuotesBestByPlatform(req: QuotesBestByPlatformRequest, opts?: {
2853
+ baseApiUrl?: string;
2854
+ timeoutMs?: number;
2855
+ }): Promise<GetBestByPlatformResponse>;
2777
2856
  /**
2778
2857
  * **Supporting Method** - Fetches taker tier information for an address.
2779
2858
  *
@@ -2949,4 +3028,4 @@ type SendBatchFn = (txs: Array<{
2949
3028
  value?: bigint;
2950
3029
  }>) => Promise<string>;
2951
3030
 
2952
- export { type GetDepositByIdResponse as $, type AuthorizationTokenProvider as A, type QuoteResponseObject as B, type CurrencyType as C, type DepositWithRelations as D, type QuoteSingleResponse as E, type FulfillIntentMethodParams as F, type GetPayeeDetailsRequest as G, type QuoteIntentResponse as H, type IntentEntity as I, type QuoteFeesResponse as J, type FiatResponse as K, type TokenResponse as L, type NearbySuggestions as M, type NearbyQuote as N, type ApiDeposit as O, type PostDepositDetailsRequest as P, type QuoteRequest as Q, type ReferrerFeeConfig as R, type SignalIntentReferralFee as S, type TxOverrides as T, type DepositVerifier as U, type ValidatePayeeDetailsRequest as V, type WithdrawDepositParams as W, type DepositVerifierCurrency as X, type DepositStatus as Y, Zkp2pClient as Z, type GetDepositByIdRequest as _, type ValidatePayeeDetailsResponse as a, getCurrencyInfoFromCountryCode as a$, type Intent as a0, type ApiIntentStatus as a1, type GetOwnerIntentsRequest as a2, type GetOwnerIntentsResponse as a3, type GetIntentsByDepositRequest as a4, type GetIntentsByDepositResponse as a5, type GetIntentByHashRequest as a6, type GetIntentByHashResponse as a7, type RegisterPayeeDetailsRequest as a8, type RegisterPayeeDetailsResponse as a9, type ManagerStatsEntity as aA, type ManagerDailySnapshotEntity as aB, type RateManagerListItem as aC, type RateManagerDetail as aD, type ManualRateUpdateEntity as aE, type OracleConfigUpdateEntity as aF, type DepositFundActivityEntity as aG, type DepositDailySnapshotEntity as aH, type DepositFundActivityType as aI, type DepositFilter as aJ, type PaginationOptions as aK, type DepositOrderField as aL, type OrderDirection$1 as aM, type RateManagerFilter as aN, type RateManagerPaginationOptions as aO, type RateManagerDelegationPaginationOptions as aP, type RateManagerOrderField as aQ, type OrderDirection as aR, type DeploymentEnv as aS, type FulfillmentRecord as aT, type PaymentVerifiedRecord as aU, type FulfillmentAndPaymentResponse as aV, PAYMENT_PLATFORMS as aW, type PaymentPlatformType as aX, Currency as aY, currencyInfo as aZ, getCurrencyInfoFromHash as a_, type OnchainCurrency as aa, type DepositVerifierData as ab, type PreparedTransaction as ac, type OrderStats as ad, type DepositIntentStatistics as ae, type TakerTier as af, type TakerTierStats as ag, type TakerTierLevel as ah, type PlatformLimit as ai, type PlatformRiskLevel as aj, IndexerClient as ak, defaultIndexerEndpoint as al, IndexerDepositService as am, IndexerRateManagerService as an, compareEventCursorIdsByRecency as ao, fetchFulfillmentAndPayment as ap, type DepositEntity as aq, type IntentFulfilledEntity as ar, type IntentFulfillmentAmountsEntity as as, type DepositPaymentMethodEntity as at, type MethodCurrencyEntity as au, type IntentStatus as av, type RateManagerEntity as aw, type RateManagerRateEntity as ax, type RateManagerDelegationEntity as ay, type ManagerAggregateStatsEntity as az, type PostDepositDetailsResponse as b, getCurrencyCodeFromHash as b0, isSupportedCurrencyHash as b1, mapConversionRatesToOnchainMinRate as b2, type CurrencyData as b3, getContracts as b4, getRateManagerContracts as b5, getPaymentMethodsCatalog as b6, getGatingServiceAddress as b7, type RuntimeEnv as b8, parseDepositView as b9, parseIntentView as ba, enrichPvDepositView as bb, enrichPvIntentView as bc, type PV_DepositView as bd, type PV_Deposit as be, type PV_PaymentMethodData as bf, type PV_Currency as bg, type PV_ReferralFee as bh, type PV_IntentView as bi, type PV_Intent as bj, ZERO_RATE_MANAGER_ID as bk, isZeroRateManagerId as bl, normalizeRateManagerId as bm, normalizeRegistry as bn, getDelegationRoute as bo, classifyDelegationState as bp, type DelegationRoute as bq, type DelegationState as br, type DelegationDepositTarget as bs, type BatchResult as bt, type SendTransactionFn as bu, type SendBatchFn as bv, ZERO_ADDRESS as bw, asErrorMessage as bx, assertDelegationMethodSupport as by, type GetPayeeDetailsResponse as c, type GetOwnerDepositsRequest as d, type GetOwnerDepositsResponse as e, type GetTakerTierRequest as f, type GetTakerTierResponse as g, type PaymentMethodCatalog as h, type SignalIntentMethodParams as i, type CancelIntentMethodParams as j, type Zkp2pNextOptions as k, type TimeoutConfig as l, type ActionCallback as m, type CreateDepositParams as n, type CreateDepositConversionRate as o, type Range as p, type SignalIntentParams as q, type FulfillIntentParams as r, type ReleaseFundsToPayerParams as s, type CancelIntentParams as t, type GetNearbyQuote as u, type GetNearbySuggestions as v, type GetQuoteResponse as w, type GetQuoteResponseObject as x, type GetQuoteSingleResponse as y, type QuoteResponse as z };
3031
+ export { type NearbyQuote as $, type AuthorizationTokenProvider as A, type BestByPlatformResponse as B, type CurrencyType as C, type DepositWithRelations as D, type GetNearbyQuote as E, type FulfillIntentMethodParams as F, type GetPayeeDetailsRequest as G, type GetNearbySuggestions as H, type IntentEntity as I, type GetQuoteResponse as J, type GetQuoteResponseObject as K, type GetQuoteSingleResponse as L, type QuoteResponse as M, type QuoteResponseObject as N, type QuoteSingleResponse as O, type PostDepositDetailsRequest as P, type QuotesBestByPlatformRequest as Q, type ReferrerFeeConfig as R, type SignalIntentReferralFee as S, type TxOverrides as T, type QuoteIntentResponse as U, type ValidatePayeeDetailsRequest as V, type WithdrawDepositParams as W, type QuoteFeesResponse as X, type FiatResponse as Y, Zkp2pClient as Z, type TokenResponse as _, type ValidatePayeeDetailsResponse as a, type PaymentVerifiedRecord as a$, type NearbySuggestions as a0, type ApiDeposit as a1, type DepositVerifier as a2, type DepositVerifierCurrency as a3, type DepositStatus as a4, type GetDepositByIdRequest as a5, type GetDepositByIdResponse as a6, type Intent as a7, type ApiIntentStatus as a8, type GetOwnerIntentsRequest as a9, type DepositPaymentMethodEntity as aA, type MethodCurrencyEntity as aB, type IntentStatus as aC, type RateManagerEntity as aD, type RateManagerRateEntity as aE, type RateManagerDelegationEntity as aF, type ManagerAggregateStatsEntity as aG, type ManagerStatsEntity as aH, type ManagerDailySnapshotEntity as aI, type RateManagerListItem as aJ, type RateManagerDetail as aK, type ManualRateUpdateEntity as aL, type OracleConfigUpdateEntity as aM, type DepositFundActivityEntity as aN, type DepositDailySnapshotEntity as aO, type DepositFundActivityType as aP, type DepositFilter as aQ, type PaginationOptions as aR, type DepositOrderField as aS, type OrderDirection$1 as aT, type RateManagerFilter as aU, type RateManagerPaginationOptions as aV, type RateManagerDelegationPaginationOptions as aW, type RateManagerOrderField as aX, type OrderDirection as aY, type DeploymentEnv as aZ, type FulfillmentRecord as a_, type GetOwnerIntentsResponse as aa, type GetIntentsByDepositRequest as ab, type GetIntentsByDepositResponse as ac, type GetIntentByHashRequest as ad, type GetIntentByHashResponse as ae, type RegisterPayeeDetailsRequest as af, type RegisterPayeeDetailsResponse as ag, type OnchainCurrency as ah, type DepositVerifierData as ai, type PreparedTransaction as aj, type OrderStats as ak, type DepositIntentStatistics as al, type TakerTier as am, type TakerTierStats as an, type TakerTierLevel as ao, type PlatformLimit as ap, type PlatformRiskLevel as aq, IndexerClient as ar, defaultIndexerEndpoint as as, IndexerDepositService as at, IndexerRateManagerService as au, compareEventCursorIdsByRecency as av, fetchFulfillmentAndPayment as aw, type DepositEntity as ax, type IntentFulfilledEntity as ay, type IntentFulfillmentAmountsEntity as az, type PostDepositDetailsResponse as b, type FulfillmentAndPaymentResponse as b0, PAYMENT_PLATFORMS as b1, type PaymentPlatformType as b2, Currency as b3, currencyInfo as b4, getCurrencyInfoFromHash as b5, getCurrencyInfoFromCountryCode as b6, getCurrencyCodeFromHash as b7, isSupportedCurrencyHash as b8, mapConversionRatesToOnchainMinRate as b9, type BatchResult as bA, type SendTransactionFn as bB, type SendBatchFn as bC, ZERO_ADDRESS as bD, asErrorMessage as bE, assertDelegationMethodSupport as bF, type CurrencyData as ba, getContracts as bb, getRateManagerContracts as bc, getPaymentMethodsCatalog as bd, getGatingServiceAddress as be, type RuntimeEnv as bf, parseDepositView as bg, parseIntentView as bh, enrichPvDepositView as bi, enrichPvIntentView as bj, type PV_DepositView as bk, type PV_Deposit as bl, type PV_PaymentMethodData as bm, type PV_Currency as bn, type PV_ReferralFee as bo, type PV_IntentView as bp, type PV_Intent as bq, ZERO_RATE_MANAGER_ID as br, isZeroRateManagerId as bs, normalizeRateManagerId as bt, normalizeRegistry as bu, getDelegationRoute as bv, classifyDelegationState as bw, type DelegationRoute as bx, type DelegationState as by, type DelegationDepositTarget as bz, type GetPayeeDetailsResponse as c, type GetOwnerDepositsRequest as d, type GetOwnerDepositsResponse as e, type GetTakerTierRequest as f, type GetTakerTierResponse as g, type PaymentMethodCatalog as h, type SignalIntentMethodParams as i, type CancelIntentMethodParams as j, type Zkp2pNextOptions as k, type TimeoutConfig as l, type ActionCallback as m, type CreateDepositParams as n, type CreateDepositConversionRate as o, type Range as p, type SignalIntentParams as q, type FulfillIntentParams as r, type ReleaseFundsToPayerParams as s, type CancelIntentParams as t, type BestByPlatformResponseObject as u, type GetBestByPlatformResponse as v, type GetBestByPlatformResponseObject as w, type GetPlatformQuote as x, type PlatformQuote as y, type QuoteRequest as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zkp2p/sdk",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "ZKP2P Client SDK - TypeScript SDK for deposit management, liquidity provision, and onramping",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.cjs",
@@ -44,6 +44,7 @@
44
44
  "format": "prettier --check .",
45
45
  "format:write": "prettier --write .",
46
46
  "test": "vitest run",
47
+ "test:regression": "vitest run --config vitest.regression.config.mts",
47
48
  "test:coverage": "vitest run --coverage",
48
49
  "test:watch": "vitest",
49
50
  "release": "release-it",
@@ -86,8 +87,8 @@
86
87
  "node": ">=22"
87
88
  },
88
89
  "dependencies": {
89
- "@zkp2p/indexer-schema": "0.2.2",
90
- "@zkp2p/contracts-v2": "0.2.0",
90
+ "@zkp2p/indexer-schema": "0.2.3",
91
+ "@zkp2p/contracts-v2": "0.2.1",
91
92
  "ethers": "^6.0.0",
92
93
  "ox": "^0.11.1"
93
94
  },