@zkp2p/cash 0.1.7 → 0.1.9

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.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IntentStatus, C as CashPayoutInfo, a as IntentEntity, b as CashBuyerProfile, c as CashDepositInput, d as CreateDepositParamsArg, e as CashOrder, f as CashFill, g as CashCapabilities, h as CashoutResult, i as CashEstimate, P as PrepareResult, j as CashPreparedStep, R as RelayExecutionResult, k as RelayQuote, l as RelayStatus, m as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-jUA_GNdh.cjs';
2
- export { n as CASH_ATTRIBUTION_CODE, o as CashAsset, p as CashChain, q as CashClient, r as CashClientOptions, s as CashFillEta, t as CashLeg, u as CashNextAction, v as CashOrderState, w as CashPayout, x as CashPayoutPricing, y as CashPlatformCapability, z as CashPreparedStepKind, A as CashoutInput, B as CashoutOptions, D as CuratorPayeeDataInput, E as EstimateInput, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, F as RECOMMENDED_MIN_CASHOUT_AMOUNT, G as RelayOptions, H as RelayQuoteInput, J as RelaySourceInput, K as RelayTransaction, S as SignerOptions, L as WatchOptions, N as WithdrawOptions, Q as buildCapabilities, U as createCashClient } from './createCashClient-jUA_GNdh.cjs';
1
+ import { I as IntentStatus, C as CashPayoutInfo, a as IntentEntity, b as CashBuyerProfile, c as CashDepositInput, d as CreateDepositParamsArg, e as CashOrder, f as CashFill, g as CashCapabilities, h as CashoutResult, i as CashEstimate, j as CashFillStats, P as PrepareResult, k as CashPreparedStep, R as RelayExecutionResult, l as RelayQuote, m as RelayStatus, n as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-BhOytyHE.cjs';
2
+ export { o as CASH_ATTRIBUTION_CODE, p as CashAsset, q as CashChain, r as CashClient, s as CashClientOptions, t as CashFillEta, u as CashLeg, v as CashNextAction, w as CashOrderState, x as CashPairFillStats, y as CashPayout, z as CashPayoutPricing, A as CashPlatformCapability, B as CashPreparedStepKind, D as CashoutInput, E as CashoutOptions, F as CuratorPayeeDataInput, G as EstimateInput, H as EstimateOptions, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, J as RECOMMENDED_MIN_CASHOUT_AMOUNT, K as RelayOptions, L as RelayQuoteInput, N as RelaySourceInput, Q as RelayTransaction, S as SignerOptions, U as WatchOptions, V as WithdrawOptions, X as buildCapabilities, Y as createCashClient } from './createCashClient-BhOytyHE.cjs';
3
3
  import { PaymentMethodCatalog, CurrencyType, OracleAdapterOverrides, OnchainCurrency, Zkp2pClient, PreparedTransaction } from '@zkp2p/sdk';
4
4
  export { CurrencyType, PreparedTransaction, RuntimeEnv } from '@zkp2p/sdk';
5
5
  import { Log, Abi } from 'viem';
@@ -1432,6 +1432,26 @@ declare const cashEstimateJsonSchema: z.ZodObject<{
1432
1432
  seconds?: number | undefined;
1433
1433
  } | undefined;
1434
1434
  }>;
1435
+ declare const cashPairFillStatsJsonSchema: z.ZodObject<{
1436
+ fills: z.ZodNumber;
1437
+ medianFillSeconds: z.ZodOptional<z.ZodNumber>;
1438
+ }, "strict", z.ZodTypeAny, {
1439
+ fills: number;
1440
+ medianFillSeconds?: number | undefined;
1441
+ }, {
1442
+ fills: number;
1443
+ medianFillSeconds?: number | undefined;
1444
+ }>;
1445
+ declare const cashFillStatsJsonSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
1446
+ fills: z.ZodNumber;
1447
+ medianFillSeconds: z.ZodOptional<z.ZodNumber>;
1448
+ }, "strict", z.ZodTypeAny, {
1449
+ fills: number;
1450
+ medianFillSeconds?: number | undefined;
1451
+ }, {
1452
+ fills: number;
1453
+ medianFillSeconds?: number | undefined;
1454
+ }>>;
1435
1455
  declare const preparedTransactionJsonSchema: z.ZodObject<{
1436
1456
  to: z.ZodString;
1437
1457
  data: z.ZodString;
@@ -2688,8 +2708,8 @@ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
2688
2708
  decimals: number;
2689
2709
  };
2690
2710
  };
2691
- environment: "production" | "preproduction" | "staging";
2692
2711
  currencies: string[];
2712
+ environment: "production" | "preproduction" | "staging";
2693
2713
  platforms: {
2694
2714
  platform: string;
2695
2715
  currencies: string[];
@@ -2759,8 +2779,8 @@ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
2759
2779
  decimals: number;
2760
2780
  };
2761
2781
  };
2762
- environment: "production" | "preproduction" | "staging";
2763
2782
  currencies: string[];
2783
+ environment: "production" | "preproduction" | "staging";
2764
2784
  platforms: {
2765
2785
  platform: string;
2766
2786
  currencies: string[];
@@ -3707,6 +3727,7 @@ declare const cashErrorJsonSchema: z.ZodObject<{
3707
3727
  type CashOrderJson = z.infer<typeof cashOrderJsonSchema>;
3708
3728
  type CashFillJson = z.infer<typeof cashFillJsonSchema>;
3709
3729
  type CashEstimateJson = z.infer<typeof cashEstimateJsonSchema>;
3730
+ type CashFillStatsJson = z.infer<typeof cashFillStatsJsonSchema>;
3710
3731
  type PreparedTransactionJson = z.infer<typeof preparedTransactionJsonSchema>;
3711
3732
  type CashoutResultJson = z.infer<typeof cashoutResultJsonSchema>;
3712
3733
  type PrepareResultJson = z.infer<typeof prepareResultJsonSchema>;
@@ -3739,6 +3760,8 @@ declare function orderToJson(order: CashOrder): CashOrderJson;
3739
3760
  declare function orderFromJson(json: unknown): CashOrder;
3740
3761
  declare function estimateToJson(estimate: CashEstimate): CashEstimateJson;
3741
3762
  declare function estimateFromJson(json: unknown): CashEstimate;
3763
+ declare function fillStatsToJson(stats: CashFillStats): CashFillStatsJson;
3764
+ declare function fillStatsFromJson(json: unknown): CashFillStats;
3742
3765
  declare function relayQuoteToJson(quote: RelayQuote): RelayQuoteJson;
3743
3766
  declare function relayQuoteFromJson(json: unknown): RelayQuote;
3744
3767
  declare function sourceCapabilitiesToJson(capabilities: CashSourceCapabilities): CashSourceCapabilitiesJson;
@@ -3766,4 +3789,4 @@ declare function capabilitiesFromJson(json: unknown): CashCapabilities;
3766
3789
  declare function cashErrorToJson(error: CashErrorShape): CashErrorJson;
3767
3790
  declare function cashErrorFromJson(json: unknown): CashError;
3768
3791
 
3769
- export { BASE_CHAIN_ID, BASE_USDC_ADDRESS, CASH_ORDER_POLL_INTERVAL_MS, CASH_ORDER_STATUSES, CASH_RETAIN_ON_EMPTY, type CashAssetJson, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, type CashChainJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorJson, type CashErrorRecovery, type CashErrorRecoveryJson, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashSourceCapabilities, type CashSourceCapabilitiesJson, CashoutResult, type CashoutResultJson, type DeriveCashOrderOptions, MARKET_SPREAD_BPS, type MethodCurrencyLike, ORACLE_MIN_CONVERSION_RATE_SENTINEL, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, RATE_PRECISION, RelayExecutionResult, type RelayExecutionResultJson, RelayQuote, type RelayQuoteJson, RelayStatus, type RelayStatusJson, type RelayTransactionJson, type RelayTransactionsJson, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, USDC_DECIMALS, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillToJson, formatUsdc, intentStatusSchema, isCashError, isFillLive, isMarketRateSupported, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
3792
+ export { BASE_CHAIN_ID, BASE_USDC_ADDRESS, CASH_ORDER_POLL_INTERVAL_MS, CASH_ORDER_STATUSES, CASH_RETAIN_ON_EMPTY, type CashAssetJson, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, type CashChainJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorJson, type CashErrorRecovery, type CashErrorRecoveryJson, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashFillStats, type CashFillStatsJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashSourceCapabilities, type CashSourceCapabilitiesJson, CashoutResult, type CashoutResultJson, type DeriveCashOrderOptions, MARKET_SPREAD_BPS, type MethodCurrencyLike, ORACLE_MIN_CONVERSION_RATE_SENTINEL, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, RATE_PRECISION, RelayExecutionResult, type RelayExecutionResultJson, RelayQuote, type RelayQuoteJson, RelayStatus, type RelayStatusJson, type RelayTransactionJson, type RelayTransactionsJson, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, USDC_DECIMALS, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isCashError, isFillLive, isMarketRateSupported, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IntentStatus, C as CashPayoutInfo, a as IntentEntity, b as CashBuyerProfile, c as CashDepositInput, d as CreateDepositParamsArg, e as CashOrder, f as CashFill, g as CashCapabilities, h as CashoutResult, i as CashEstimate, P as PrepareResult, j as CashPreparedStep, R as RelayExecutionResult, k as RelayQuote, l as RelayStatus, m as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-jUA_GNdh.js';
2
- export { n as CASH_ATTRIBUTION_CODE, o as CashAsset, p as CashChain, q as CashClient, r as CashClientOptions, s as CashFillEta, t as CashLeg, u as CashNextAction, v as CashOrderState, w as CashPayout, x as CashPayoutPricing, y as CashPlatformCapability, z as CashPreparedStepKind, A as CashoutInput, B as CashoutOptions, D as CuratorPayeeDataInput, E as EstimateInput, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, F as RECOMMENDED_MIN_CASHOUT_AMOUNT, G as RelayOptions, H as RelayQuoteInput, J as RelaySourceInput, K as RelayTransaction, S as SignerOptions, L as WatchOptions, N as WithdrawOptions, Q as buildCapabilities, U as createCashClient } from './createCashClient-jUA_GNdh.js';
1
+ import { I as IntentStatus, C as CashPayoutInfo, a as IntentEntity, b as CashBuyerProfile, c as CashDepositInput, d as CreateDepositParamsArg, e as CashOrder, f as CashFill, g as CashCapabilities, h as CashoutResult, i as CashEstimate, j as CashFillStats, P as PrepareResult, k as CashPreparedStep, R as RelayExecutionResult, l as RelayQuote, m as RelayStatus, n as CashSourceCapabilities, T as TopUpResult, W as WithdrawResult } from './createCashClient-BhOytyHE.js';
2
+ export { o as CASH_ATTRIBUTION_CODE, p as CashAsset, q as CashChain, r as CashClient, s as CashClientOptions, t as CashFillEta, u as CashLeg, v as CashNextAction, w as CashOrderState, x as CashPairFillStats, y as CashPayout, z as CashPayoutPricing, A as CashPlatformCapability, B as CashPreparedStepKind, D as CashoutInput, E as CashoutOptions, F as CuratorPayeeDataInput, G as EstimateInput, H as EstimateOptions, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, J as RECOMMENDED_MIN_CASHOUT_AMOUNT, K as RelayOptions, L as RelayQuoteInput, N as RelaySourceInput, Q as RelayTransaction, S as SignerOptions, U as WatchOptions, V as WithdrawOptions, X as buildCapabilities, Y as createCashClient } from './createCashClient-BhOytyHE.js';
3
3
  import { PaymentMethodCatalog, CurrencyType, OracleAdapterOverrides, OnchainCurrency, Zkp2pClient, PreparedTransaction } from '@zkp2p/sdk';
4
4
  export { CurrencyType, PreparedTransaction, RuntimeEnv } from '@zkp2p/sdk';
5
5
  import { Log, Abi } from 'viem';
@@ -1432,6 +1432,26 @@ declare const cashEstimateJsonSchema: z.ZodObject<{
1432
1432
  seconds?: number | undefined;
1433
1433
  } | undefined;
1434
1434
  }>;
1435
+ declare const cashPairFillStatsJsonSchema: z.ZodObject<{
1436
+ fills: z.ZodNumber;
1437
+ medianFillSeconds: z.ZodOptional<z.ZodNumber>;
1438
+ }, "strict", z.ZodTypeAny, {
1439
+ fills: number;
1440
+ medianFillSeconds?: number | undefined;
1441
+ }, {
1442
+ fills: number;
1443
+ medianFillSeconds?: number | undefined;
1444
+ }>;
1445
+ declare const cashFillStatsJsonSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
1446
+ fills: z.ZodNumber;
1447
+ medianFillSeconds: z.ZodOptional<z.ZodNumber>;
1448
+ }, "strict", z.ZodTypeAny, {
1449
+ fills: number;
1450
+ medianFillSeconds?: number | undefined;
1451
+ }, {
1452
+ fills: number;
1453
+ medianFillSeconds?: number | undefined;
1454
+ }>>;
1435
1455
  declare const preparedTransactionJsonSchema: z.ZodObject<{
1436
1456
  to: z.ZodString;
1437
1457
  data: z.ZodString;
@@ -2688,8 +2708,8 @@ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
2688
2708
  decimals: number;
2689
2709
  };
2690
2710
  };
2691
- environment: "production" | "preproduction" | "staging";
2692
2711
  currencies: string[];
2712
+ environment: "production" | "preproduction" | "staging";
2693
2713
  platforms: {
2694
2714
  platform: string;
2695
2715
  currencies: string[];
@@ -2759,8 +2779,8 @@ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
2759
2779
  decimals: number;
2760
2780
  };
2761
2781
  };
2762
- environment: "production" | "preproduction" | "staging";
2763
2782
  currencies: string[];
2783
+ environment: "production" | "preproduction" | "staging";
2764
2784
  platforms: {
2765
2785
  platform: string;
2766
2786
  currencies: string[];
@@ -3707,6 +3727,7 @@ declare const cashErrorJsonSchema: z.ZodObject<{
3707
3727
  type CashOrderJson = z.infer<typeof cashOrderJsonSchema>;
3708
3728
  type CashFillJson = z.infer<typeof cashFillJsonSchema>;
3709
3729
  type CashEstimateJson = z.infer<typeof cashEstimateJsonSchema>;
3730
+ type CashFillStatsJson = z.infer<typeof cashFillStatsJsonSchema>;
3710
3731
  type PreparedTransactionJson = z.infer<typeof preparedTransactionJsonSchema>;
3711
3732
  type CashoutResultJson = z.infer<typeof cashoutResultJsonSchema>;
3712
3733
  type PrepareResultJson = z.infer<typeof prepareResultJsonSchema>;
@@ -3739,6 +3760,8 @@ declare function orderToJson(order: CashOrder): CashOrderJson;
3739
3760
  declare function orderFromJson(json: unknown): CashOrder;
3740
3761
  declare function estimateToJson(estimate: CashEstimate): CashEstimateJson;
3741
3762
  declare function estimateFromJson(json: unknown): CashEstimate;
3763
+ declare function fillStatsToJson(stats: CashFillStats): CashFillStatsJson;
3764
+ declare function fillStatsFromJson(json: unknown): CashFillStats;
3742
3765
  declare function relayQuoteToJson(quote: RelayQuote): RelayQuoteJson;
3743
3766
  declare function relayQuoteFromJson(json: unknown): RelayQuote;
3744
3767
  declare function sourceCapabilitiesToJson(capabilities: CashSourceCapabilities): CashSourceCapabilitiesJson;
@@ -3766,4 +3789,4 @@ declare function capabilitiesFromJson(json: unknown): CashCapabilities;
3766
3789
  declare function cashErrorToJson(error: CashErrorShape): CashErrorJson;
3767
3790
  declare function cashErrorFromJson(json: unknown): CashError;
3768
3791
 
3769
- export { BASE_CHAIN_ID, BASE_USDC_ADDRESS, CASH_ORDER_POLL_INTERVAL_MS, CASH_ORDER_STATUSES, CASH_RETAIN_ON_EMPTY, type CashAssetJson, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, type CashChainJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorJson, type CashErrorRecovery, type CashErrorRecoveryJson, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashSourceCapabilities, type CashSourceCapabilitiesJson, CashoutResult, type CashoutResultJson, type DeriveCashOrderOptions, MARKET_SPREAD_BPS, type MethodCurrencyLike, ORACLE_MIN_CONVERSION_RATE_SENTINEL, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, RATE_PRECISION, RelayExecutionResult, type RelayExecutionResultJson, RelayQuote, type RelayQuoteJson, RelayStatus, type RelayStatusJson, type RelayTransactionJson, type RelayTransactionsJson, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, USDC_DECIMALS, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillToJson, formatUsdc, intentStatusSchema, isCashError, isFillLive, isMarketRateSupported, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
3792
+ export { BASE_CHAIN_ID, BASE_USDC_ADDRESS, CASH_ORDER_POLL_INTERVAL_MS, CASH_ORDER_STATUSES, CASH_RETAIN_ON_EMPTY, type CashAssetJson, CashBuyerProfile, type CashBuyerProfileJson, CashCapabilities, type CashCapabilitiesJson, type CashChainJson, CashDepositInput, CashError, type CashErrorCode, type CashErrorJson, type CashErrorRecovery, type CashErrorRecoveryJson, type CashErrorShape, CashEstimate, type CashEstimateJson, CashFill, type CashFillJson, CashFillStats, type CashFillStatsJson, CashOrder, type CashOrderData, type CashOrderJson, CashPayoutInfo, type CashPayoutInfoJson, CashPreparedStep, type CashPreparedStepJson, CashSourceCapabilities, type CashSourceCapabilitiesJson, CashoutResult, type CashoutResultJson, type DeriveCashOrderOptions, MARKET_SPREAD_BPS, type MethodCurrencyLike, ORACLE_MIN_CONVERSION_RATE_SENTINEL, type PaymentMethodLike, PrepareResult, type PrepareResultJson, type PreparedTransactionJson, RATE_PRECISION, RelayExecutionResult, type RelayExecutionResultJson, RelayQuote, type RelayQuoteJson, RelayStatus, type RelayStatusJson, type RelayTransactionJson, type RelayTransactionsJson, type ResolvedCashDeposit, TopUpResult, type TopUpResultJson, USDC_DECIMALS, WithdrawResult, type WithdrawResultJson, bigintString, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, deriveBuyerProfile, deriveCashOrder, derivePayouts, errors, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isCashError, isFillLive, isMarketRateSupported, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
package/dist/index.js CHANGED
@@ -387,6 +387,26 @@ function parseCompositeDepositId(compositeId) {
387
387
  const onchainDepositId = BigInt(rawDepositId);
388
388
  return { escrowAddress: canonicalEscrowAddress, onchainDepositId };
389
389
  }
390
+
391
+ // src/client/platformGroups.ts
392
+ var PLATFORM_METHOD_GROUPS = {
393
+ zelle: ["zelle", "zelle-chase", "zelle-bofa", "zelle-citi"]
394
+ };
395
+ var METHOD_TO_BASE_PLATFORM = new Map(
396
+ Object.entries(PLATFORM_METHOD_GROUPS).flatMap(
397
+ ([platform, methods]) => methods.map((method) => [method, platform])
398
+ )
399
+ );
400
+ function basePlatformForMethod(method) {
401
+ return METHOD_TO_BASE_PLATFORM.get(method) ?? method;
402
+ }
403
+ function paymentMethodsForPlatform(platform, catalog) {
404
+ const configured = PLATFORM_METHOD_GROUPS[platform];
405
+ const methods = configured ?? [platform];
406
+ return methods.filter((method) => catalog[method] !== void 0);
407
+ }
408
+
409
+ // src/client/capabilities.ts
390
410
  var MIN_CASHOUT_AMOUNT = 10000n;
391
411
  var RECOMMENDED_MIN_CASHOUT_AMOUNT = 1000000n;
392
412
  var PAYEE_HINTS = {
@@ -405,13 +425,20 @@ var PAYEE_HINTS = {
405
425
  var IDENTITY_ATTESTATION_PLATFORMS = /* @__PURE__ */ new Set(["wise", "paypal"]);
406
426
  function buildCapabilities(environment) {
407
427
  const catalog = getPaymentMethodsCatalog(BASE_CHAIN_ID, environment);
408
- const platforms = Object.entries(catalog).map(([platform, entry]) => {
428
+ const currenciesByPlatform = /* @__PURE__ */ new Map();
429
+ for (const [method, entry] of Object.entries(catalog)) {
430
+ const platform = basePlatformForMethod(method);
409
431
  const currencies2 = (entry.currencies ?? []).map((hash) => getCurrencyCodeFromHash(hash)).filter(
410
432
  (code) => code != null && isMarketRateSupported(code)
411
433
  );
434
+ const aggregate = currenciesByPlatform.get(platform) ?? /* @__PURE__ */ new Set();
435
+ for (const currency of currencies2) aggregate.add(currency);
436
+ currenciesByPlatform.set(platform, aggregate);
437
+ }
438
+ const platforms = [...currenciesByPlatform.entries()].map(([platform, currencies2]) => {
412
439
  return {
413
440
  platform,
414
- currencies: [...new Set(currencies2)],
441
+ currencies: [...currencies2].sort(),
415
442
  payeeHint: PAYEE_HINTS[platform] ?? "Your payment handle for this platform",
416
443
  requiresIdentityAttestation: IDENTITY_ATTESTATION_PLATFORMS.has(platform)
417
444
  };
@@ -430,11 +457,8 @@ function buildCapabilities(environment) {
430
457
  pricing: { kind: "oracle-market-rate", spreadBps: 0 }
431
458
  };
432
459
  }
433
- var ETA_WINDOW_DAYS = 30;
434
- var ETA_WINDOW_SECONDS = ETA_WINDOW_DAYS * 24 * 60 * 60;
435
- var ETA_PAGE_LIMIT = 250;
436
- var ETA_MAX_DEPOSIT_SCAN = 2e3;
437
- var FULFILLED = /* @__PURE__ */ new Set(["FULFILLED", "MANUALLY_RELEASED"]);
460
+ var FILL_STATS_WINDOW_SECONDS = 30 * 24 * 60 * 60;
461
+ var FILL_STATS_PAGE_LIMIT = 250;
438
462
  function toUnixSeconds2(value) {
439
463
  if (value === null || value === void 0 || value === "") return void 0;
440
464
  if (value instanceof Date) {
@@ -445,12 +469,22 @@ function toUnixSeconds2(value) {
445
469
  const parsed = Date.parse(value);
446
470
  if (Number.isFinite(parsed)) return Math.floor(parsed / 1e3);
447
471
  }
448
- const n = Number(value);
449
- return Number.isFinite(n) && n > 0 ? n : void 0;
472
+ const numeric = Number(value);
473
+ return Number.isFinite(numeric) && numeric > 0 ? numeric : void 0;
474
+ }
475
+ function normalizeCurrencyCode(value) {
476
+ const raw = value?.trim();
477
+ if (!raw) return void 0;
478
+ if (!raw.toLowerCase().startsWith("0x")) return raw.toUpperCase();
479
+ try {
480
+ return getCurrencyCodeFromHash(raw)?.toUpperCase();
481
+ } catch {
482
+ return void 0;
483
+ }
450
484
  }
451
485
  function median(values) {
452
486
  if (values.length === 0) return void 0;
453
- const sorted = [...values].sort((a, b) => a - b);
487
+ const sorted = [...values].sort((left, right) => left - right);
454
488
  const mid = Math.floor(sorted.length / 2);
455
489
  return sorted.length % 2 === 1 ? sorted[mid] : Math.round((sorted[mid - 1] + sorted[mid]) / 2);
456
490
  }
@@ -462,52 +496,102 @@ function etaLabel(seconds) {
462
496
  const hours = Math.max(1, Math.round(minutes / 60));
463
497
  return `Usually starts in about ${hours} hr`;
464
498
  }
465
- function matchesPayout(deposit, environment, platform, currency) {
466
- const payouts = derivePayouts(
467
- deposit.paymentMethods ?? [],
468
- deposit.currencies ?? [],
469
- getPaymentMethodsCatalog(BASE_CHAIN_ID, environment)
470
- );
471
- return payouts.some(
472
- (payout) => payout.pricing.marketRate && payout.pricing.spreadBps === 0 && (platform === void 0 || payout.platform === platform) && (currency === void 0 || payout.currency === currency)
473
- );
499
+ function computeFillStatsSample(deposits, nowSeconds, environment) {
500
+ const catalog = getPaymentMethodsCatalog(BASE_CHAIN_ID, environment);
501
+ const windowStart = nowSeconds - FILL_STATS_WINDOW_SECONDS;
502
+ const fillCounts = /* @__PURE__ */ new Map();
503
+ const latenciesByPair = /* @__PURE__ */ new Map();
504
+ const latenciesByCurrency = /* @__PURE__ */ new Map();
505
+ for (const deposit of deposits) {
506
+ const createdAt = toUnixSeconds2(deposit.createdAt ?? deposit.timestamp);
507
+ const firstFillByPair = /* @__PURE__ */ new Map();
508
+ const firstFillByCurrency = /* @__PURE__ */ new Map();
509
+ for (const intent of deposit.intents ?? []) {
510
+ const fulfilledAt = toUnixSeconds2(intent.fulfillTimestamp);
511
+ if (fulfilledAt === void 0 || fulfilledAt < windowStart) continue;
512
+ let method;
513
+ try {
514
+ method = intent.paymentMethodHash ? resolvePaymentMethodNameFromHash(intent.paymentMethodHash, catalog) : void 0;
515
+ } catch {
516
+ method = void 0;
517
+ }
518
+ const currency = normalizeCurrencyCode(intent.fiatCurrency);
519
+ if (!method || !currency) continue;
520
+ const pair = `${basePlatformForMethod(method)}:${currency}`;
521
+ fillCounts.set(pair, (fillCounts.get(pair) ?? 0) + 1);
522
+ if (createdAt === void 0 || createdAt < windowStart || fulfilledAt < createdAt) continue;
523
+ const previousPairFill = firstFillByPair.get(pair);
524
+ if (previousPairFill === void 0 || fulfilledAt < previousPairFill) {
525
+ firstFillByPair.set(pair, fulfilledAt);
526
+ }
527
+ const previousCurrencyFill = firstFillByCurrency.get(currency);
528
+ if (previousCurrencyFill === void 0 || fulfilledAt < previousCurrencyFill) {
529
+ firstFillByCurrency.set(currency, fulfilledAt);
530
+ }
531
+ }
532
+ if (createdAt === void 0) continue;
533
+ for (const [pair, firstFill] of firstFillByPair) {
534
+ const latencies = latenciesByPair.get(pair) ?? [];
535
+ latencies.push(firstFill - createdAt);
536
+ latenciesByPair.set(pair, latencies);
537
+ }
538
+ for (const [currency, firstFill] of firstFillByCurrency) {
539
+ const latencies = latenciesByCurrency.get(currency) ?? [];
540
+ latencies.push(firstFill - createdAt);
541
+ latenciesByCurrency.set(currency, latencies);
542
+ }
543
+ }
544
+ const stats = {};
545
+ for (const [pair, fills] of fillCounts) {
546
+ const medianFillSeconds = median(latenciesByPair.get(pair) ?? []);
547
+ stats[pair] = {
548
+ fills,
549
+ ...medianFillSeconds !== void 0 ? { medianFillSeconds } : {}
550
+ };
551
+ }
552
+ const medianFillSecondsByCurrency = /* @__PURE__ */ new Map();
553
+ for (const [currency, latencies] of latenciesByCurrency) {
554
+ const value = median(latencies);
555
+ if (value !== void 0) medianFillSecondsByCurrency.set(currency, value);
556
+ }
557
+ return { stats, medianFillSecondsByCurrency };
474
558
  }
475
- async function readFillEta(client, input) {
559
+ async function readFillStatsSample(client, environment) {
476
560
  const now = Math.floor(Date.now() / 1e3);
477
- const windowStart = now - ETA_WINDOW_SECONDS;
561
+ const windowStart = now - FILL_STATS_WINDOW_SECONDS;
478
562
  const deposits = [];
479
- for (let offset = 0; offset < ETA_MAX_DEPOSIT_SCAN; offset += ETA_PAGE_LIMIT) {
563
+ for (let offset = 0; ; offset += FILL_STATS_PAGE_LIMIT) {
480
564
  const page = await client.indexer.getDepositsWithRelations(
481
565
  { chainId: BASE_CHAIN_ID },
482
- { limit: ETA_PAGE_LIMIT, offset, orderBy: "timestamp", orderDirection: "desc" },
566
+ {
567
+ limit: FILL_STATS_PAGE_LIMIT,
568
+ offset,
569
+ orderBy: "updatedAt",
570
+ orderDirection: "desc"
571
+ },
483
572
  { includeIntents: true, intentStatuses: ["FULFILLED", "MANUALLY_RELEASED"] }
484
573
  );
485
574
  deposits.push(...page);
486
- if (page.length < ETA_PAGE_LIMIT) break;
487
- const oldestCreatedAt = Math.min(
488
- ...page.map((deposit) => toUnixSeconds2(deposit.createdAt ?? deposit.timestamp) ?? Infinity)
575
+ if (page.length < FILL_STATS_PAGE_LIMIT) break;
576
+ const oldestUpdatedAt = Math.min(
577
+ ...page.map((deposit) => toUnixSeconds2(deposit.updatedAt) ?? Infinity)
489
578
  );
490
- if (oldestCreatedAt < windowStart) break;
579
+ if (oldestUpdatedAt < windowStart) break;
491
580
  }
492
- const firstFillLatencies = [];
493
- for (const deposit of deposits) {
494
- const createdAt = toUnixSeconds2(deposit.createdAt ?? deposit.timestamp);
495
- if (createdAt === void 0 || createdAt < windowStart) continue;
496
- if (!matchesPayout(deposit, input.environment, input.platform, input.currency)) continue;
497
- const fulfilled = (deposit.intents ?? []).filter((intent) => intent.status != null && FULFILLED.has(intent.status)).map((intent) => ({
498
- fulfilledAt: toUnixSeconds2(intent.fulfillTimestamp)
499
- })).filter(
500
- (intent) => intent.fulfilledAt !== void 0 && intent.fulfilledAt >= createdAt
501
- ).sort((a, b) => a.fulfilledAt - b.fulfilledAt);
502
- if (fulfilled.length === 0) continue;
503
- firstFillLatencies.push(fulfilled[0].fulfilledAt - createdAt);
504
- }
505
- const seconds = median(firstFillLatencies);
581
+ return computeFillStatsSample(deposits, now, environment);
582
+ }
583
+ function fillEtaFromSample(sample, input) {
584
+ const currency = input.currency.toUpperCase();
585
+ const seconds = input.platform ? sample.stats[`${basePlatformForMethod(input.platform)}:${currency}`]?.medianFillSeconds : sample.medianFillSecondsByCurrency.get(currency);
506
586
  return {
507
587
  ...seconds !== void 0 ? { seconds } : {},
508
588
  label: etaLabel(seconds)
509
589
  };
510
590
  }
591
+ async function readFillEta(client, input) {
592
+ const sample = await readFillStatsSample(client, input.environment);
593
+ return fillEtaFromSample(sample, input);
594
+ }
511
595
  var RELAY_API_URL = MAINNET_RELAY_API;
512
596
  var NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
513
597
  var BASE_USDC_ASSET = {
@@ -1043,13 +1127,18 @@ async function readEstimate(publicClient, input, context = {}) {
1043
1127
  }
1044
1128
  } : {}
1045
1129
  };
1046
- if (context.indexerClient && context.environment) {
1130
+ if (context.includeEta !== false && context.environment) {
1047
1131
  try {
1048
- estimate.eta = await readFillEta(context.indexerClient, {
1132
+ const etaInput = {
1049
1133
  environment: context.environment,
1050
1134
  currency,
1051
1135
  ...input.platform ? { platform: input.platform } : {}
1052
- });
1136
+ };
1137
+ if (context.etaReader) {
1138
+ estimate.eta = await context.etaReader(etaInput);
1139
+ } else if (context.indexerClient) {
1140
+ estimate.eta = await readFillEta(context.indexerClient, etaInput);
1141
+ }
1053
1142
  } catch {
1054
1143
  }
1055
1144
  }
@@ -1058,6 +1147,7 @@ async function readEstimate(publicClient, input, context = {}) {
1058
1147
 
1059
1148
  // src/client/createCashClient.ts
1060
1149
  var DEFAULT_RPC_URL = "https://mainnet.base.org";
1150
+ var FILL_STATS_CACHE_MS = 15 * 60 * 1e3;
1061
1151
  var CASH_ATTRIBUTION_CODE = "peer-cash";
1062
1152
  var DEFAULT_CURATOR_URLS = {
1063
1153
  preproduction: "https://api-preprod.zkp2p.xyz",
@@ -1156,6 +1246,25 @@ function createCashClient(options) {
1156
1246
  });
1157
1247
  }
1158
1248
  const readClient = buildSdkClient(createWalletClient({ chain: base, transport }));
1249
+ let fillStatsCache = null;
1250
+ let fillStatsRequest = null;
1251
+ async function getFillStatsSample() {
1252
+ if (fillStatsCache && fillStatsCache.expiresAt > Date.now()) {
1253
+ return fillStatsCache.sample;
1254
+ }
1255
+ if (fillStatsRequest) return fillStatsRequest;
1256
+ fillStatsRequest = readFillStatsSample(readClient, environment);
1257
+ try {
1258
+ const sample = await fillStatsRequest;
1259
+ fillStatsCache = {
1260
+ sample,
1261
+ expiresAt: Date.now() + FILL_STATS_CACHE_MS
1262
+ };
1263
+ return sample;
1264
+ } finally {
1265
+ fillStatsRequest = null;
1266
+ }
1267
+ }
1159
1268
  const signingClients = /* @__PURE__ */ new WeakMap();
1160
1269
  async function signingClient(verb, opts) {
1161
1270
  const signer = opts?.signer;
@@ -1170,6 +1279,7 @@ function createCashClient(options) {
1170
1279
  }
1171
1280
  function validatePayout(input) {
1172
1281
  const { receive } = input;
1282
+ const catalog = getPaymentMethodsCatalog(BASE_CHAIN_ID, environment);
1173
1283
  const platform = buildCapabilities(environment).platforms.find(
1174
1284
  (capability) => capability.platform === receive.platform
1175
1285
  );
@@ -1180,14 +1290,13 @@ function createCashClient(options) {
1180
1290
  if (!platform.currencies.includes(receive.currency)) {
1181
1291
  throw errors.unsupportedPlatformCurrency(receive.platform, receive.currency);
1182
1292
  }
1293
+ const paymentMethods = paymentMethodsForPlatform(receive.platform, catalog);
1183
1294
  return {
1184
- payouts: [
1185
- {
1186
- processorName: receive.platform,
1187
- currency: receive.currency,
1188
- payeeData: receive.payee
1189
- }
1190
- ]
1295
+ payouts: paymentMethods.map((processorName) => ({
1296
+ processorName,
1297
+ currency: receive.currency,
1298
+ payeeData: receive.payee
1299
+ }))
1191
1300
  };
1192
1301
  }
1193
1302
  function validateDepositInput(amount, input, payoutInput = validatePayout(input)) {
@@ -1458,13 +1567,21 @@ function createCashClient(options) {
1458
1567
  async relayStatus(requestId) {
1459
1568
  return readRelayStatus(requestId, options.relay);
1460
1569
  },
1461
- async estimate(input) {
1570
+ async estimate(input, estimateOptions) {
1462
1571
  return readEstimate(readClient.publicClient, input, {
1463
- indexerClient: readClient,
1464
1572
  environment,
1573
+ ...estimateOptions?.includeEta !== void 0 ? { includeEta: estimateOptions.includeEta } : {},
1574
+ etaReader: async (etaInput) => fillEtaFromSample(await getFillStatsSample(), etaInput),
1465
1575
  ...options.relay ? { relay: options.relay } : {}
1466
1576
  });
1467
1577
  },
1578
+ async fillStats() {
1579
+ try {
1580
+ return (await getFillStatsSample()).stats;
1581
+ } catch (err) {
1582
+ throw errors.indexerUnavailable("fill stats", err);
1583
+ }
1584
+ },
1468
1585
  async cashout(input, opts) {
1469
1586
  const client = await signingClient("cashout", opts);
1470
1587
  const owner = opts.signer.account.address;
@@ -2064,6 +2181,11 @@ var cashEstimateJsonSchema = z.object({
2064
2181
  label: z.string()
2065
2182
  }).optional()
2066
2183
  });
2184
+ var cashPairFillStatsJsonSchema = z.object({
2185
+ fills: z.number().int().nonnegative(),
2186
+ medianFillSeconds: z.number().int().nonnegative().optional()
2187
+ }).strict();
2188
+ var cashFillStatsJsonSchema = z.record(z.string(), cashPairFillStatsJsonSchema);
2067
2189
  var preparedTransactionJsonSchema = z.object({
2068
2190
  to: z.string(),
2069
2191
  data: z.string(),
@@ -2368,6 +2490,21 @@ function estimateFromJson(json) {
2368
2490
  } : void 0
2369
2491
  });
2370
2492
  }
2493
+ function fillStatsToJson(stats) {
2494
+ return cashFillStatsJsonSchema.parse(stats);
2495
+ }
2496
+ function fillStatsFromJson(json) {
2497
+ const parsed = cashFillStatsJsonSchema.parse(json);
2498
+ return Object.fromEntries(
2499
+ Object.entries(parsed).map(([pair, stats]) => [
2500
+ pair,
2501
+ {
2502
+ fills: stats.fills,
2503
+ ...stats.medianFillSeconds !== void 0 ? { medianFillSeconds: stats.medianFillSeconds } : {}
2504
+ }
2505
+ ])
2506
+ );
2507
+ }
2371
2508
  function cashAssetFromJson(asset) {
2372
2509
  return {
2373
2510
  chainId: asset.chainId,
@@ -2645,4 +2782,4 @@ function cashErrorFromJson(json) {
2645
2782
  });
2646
2783
  }
2647
2784
 
2648
- export { CASH_ATTRIBUTION_CODE, MIN_CASHOUT_AMOUNT, RATE_PRECISION, RECOMMENDED_MIN_CASHOUT_AMOUNT, bigintString, buildCapabilities, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, createCashClient, deriveBuyerProfile, deriveCashOrder, derivePayouts, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillToJson, formatUsdc, intentStatusSchema, isFillLive, isMarketRateSupported, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
2785
+ export { CASH_ATTRIBUTION_CODE, MIN_CASHOUT_AMOUNT, RATE_PRECISION, RECOMMENDED_MIN_CASHOUT_AMOUNT, bigintString, buildCapabilities, buildIntentAmountRange, buildMarketRateCurrencyOverride, buyerProfileFromJson, buyerProfileToJson, capabilitiesFromJson, capabilitiesToJson, cashAssetJsonSchema, cashBuyerProfileJsonSchema, cashCapabilitiesJsonSchema, cashChainJsonSchema, cashErrorFromJson, cashErrorJsonSchema, cashErrorRecoveryJsonSchema, cashErrorToJson, cashEstimateJsonSchema, cashFillJsonSchema, cashFillStatsJsonSchema, cashNextActionSchema, cashOrderJsonSchema, cashOrderStateSchema, cashPairFillStatsJsonSchema, cashPayoutInfoJsonSchema, cashPayoutPricingJsonSchema, cashPreparedStepJsonSchema, cashSourceCapabilitiesJsonSchema, cashoutResultFromJson, cashoutResultJsonSchema, cashoutResultToJson, centsToNumber, createCashClient, deriveBuyerProfile, deriveCashOrder, derivePayouts, estimateFromJson, estimateToJson, explainOrder, fiatFromUsdc, fiatToNumber, fillFromJson, fillStatsFromJson, fillStatsToJson, fillToJson, formatUsdc, intentStatusSchema, isFillLive, isMarketRateSupported, nonNegativeBigintString, orderFromJson, orderToJson, parseCompositeDepositId, prepareCashDepositParams, prepareResultFromJson, prepareResultJsonSchema, prepareResultToJson, preparedStepFromJson, preparedStepToJson, preparedTransactionJsonSchema, preparedTxFromJson, preparedTxToJson, rateToNumber, relayExecutionResultFromJson, relayExecutionResultJsonSchema, relayExecutionResultToJson, relayQuoteFromJson, relayQuoteJsonSchema, relayQuoteToJson, relayStatusFromJson, relayStatusJsonSchema, relayStatusToJson, relayTransactionJsonSchema, relayTransactionsJsonSchema, resolveCashDepositId, sourceCapabilitiesFromJson, sourceCapabilitiesToJson, topUpResultFromJson, topUpResultJsonSchema, topUpResultToJson, usdc, withExplain, withdrawResultFromJson, withdrawResultJsonSchema, withdrawResultToJson };
package/dist/react.cjs CHANGED
@@ -9,6 +9,7 @@ function useEstimate({
9
9
  currency,
10
10
  platform,
11
11
  source,
12
+ includeEta = true,
12
13
  refreshIntervalMs = 0
13
14
  }) {
14
15
  const [estimate, setEstimate] = react.useState(null);
@@ -34,7 +35,7 @@ function useEstimate({
34
35
  }
35
36
  return;
36
37
  }
37
- const identity = { client, amount, currency, platform, source };
38
+ const identity = { client, amount, currency, platform, source, includeEta };
38
39
  if (isCurrent()) {
39
40
  loadingIdentityRef.current = identity;
40
41
  errorIdentityRef.current = null;
@@ -42,12 +43,15 @@ function useEstimate({
42
43
  setError(null);
43
44
  }
44
45
  try {
45
- const result = await client.estimate({
46
- amount,
47
- currency,
48
- ...platform ? { platform } : {},
49
- ...source ? { source } : {}
50
- });
46
+ const result = await client.estimate(
47
+ {
48
+ amount,
49
+ currency,
50
+ ...platform ? { platform } : {},
51
+ ...source ? { source } : {}
52
+ },
53
+ { includeEta }
54
+ );
51
55
  if (isCurrent()) {
52
56
  estimateIdentityRef.current = identity;
53
57
  setEstimate(result);
@@ -63,7 +67,7 @@ function useEstimate({
63
67
  } finally {
64
68
  if (isCurrent()) setIsLoading(false);
65
69
  }
66
- }, [client, currency, amount, platform, source]);
70
+ }, [client, currency, amount, platform, source, includeEta]);
67
71
  react.useEffect(() => {
68
72
  latestRequestRef.current += 1;
69
73
  estimateIdentityRef.current = null;
@@ -72,7 +76,7 @@ function useEstimate({
72
76
  setEstimate(null);
73
77
  setIsLoading(false);
74
78
  setError(null);
75
- }, [client, amount, currency, platform, source]);
79
+ }, [client, amount, currency, platform, source, includeEta]);
76
80
  react.useEffect(() => {
77
81
  mountedRef.current = true;
78
82
  void refresh();
@@ -85,7 +89,7 @@ function useEstimate({
85
89
  if (timerRef.current) clearInterval(timerRef.current);
86
90
  };
87
91
  }, [refresh, refreshIntervalMs]);
88
- const matchesCurrentIdentity = (identity) => identity?.client === client && identity.amount === amount && identity.currency === currency && identity.platform === platform && identity.source === source;
92
+ const matchesCurrentIdentity = (identity) => identity?.client === client && identity.amount === amount && identity.currency === currency && identity.platform === platform && identity.source === source && identity.includeEta === includeEta;
89
93
  return {
90
94
  estimate: matchesCurrentIdentity(estimateIdentityRef.current) ? estimate : null,
91
95
  isLoading: matchesCurrentIdentity(loadingIdentityRef.current) ? isLoading : false,
package/dist/react.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CurrencyType } from '@zkp2p/sdk';
2
- import { q as CashClient, E as EstimateInput, i as CashEstimate, B as CashoutOptions, h as CashoutResult, A as CashoutInput, T as TopUpResult, W as WithdrawResult, e as CashOrder } from './createCashClient-jUA_GNdh.cjs';
2
+ import { r as CashClient, G as EstimateInput, i as CashEstimate, E as CashoutOptions, h as CashoutResult, D as CashoutInput, T as TopUpResult, W as WithdrawResult, e as CashOrder } from './createCashClient-BhOytyHE.cjs';
3
3
  import { WalletClient } from 'viem';
4
4
  import '@relayprotocol/relay-sdk';
5
5
 
@@ -12,6 +12,8 @@ interface UseEstimateOptions {
12
12
  platform?: string | null | undefined;
13
13
  /** Optional Relay source. Omit for the Base USDC default path. */
14
14
  source?: EstimateInput['source'] | null | undefined;
15
+ /** Disable to render the oracle rate before loading pair fill stats separately. */
16
+ includeEta?: boolean;
15
17
  /** Re-fetch interval (ms) so the displayed rate tracks the market. 0 = no auto-refresh. */
16
18
  refreshIntervalMs?: number;
17
19
  }
@@ -20,7 +22,7 @@ interface UseEstimateOptions {
20
22
  * estimate; the binding rate resolves at the Chainlink oracle when a buyer
21
23
  * fills - there is no committed quote to show.
22
24
  */
23
- declare function useEstimate({ client, amount, currency, platform, source, refreshIntervalMs, }: UseEstimateOptions): {
25
+ declare function useEstimate({ client, amount, currency, platform, source, includeEta, refreshIntervalMs, }: UseEstimateOptions): {
24
26
  estimate: CashEstimate | null;
25
27
  isLoading: boolean;
26
28
  error: Error | null;