@zkp2p/cash 0.2.1 → 0.3.0-rc.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/AGENTS.md +2 -1
- package/README.md +7 -3
- package/dist/{createCashClient-Clg5Fa1H.d.cts → createCashClient-DGMd8Swr.d.cts} +11 -7
- package/dist/{createCashClient-Clg5Fa1H.d.ts → createCashClient-DGMd8Swr.d.ts} +11 -7
- package/dist/index.cjs +34 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +34 -0
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/tools.cjs +1 -1
- package/dist/tools.js +1 -1
- package/docs/lifecycle-and-recovery.md +3 -1
- package/llms.txt +5 -4
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -59,8 +59,9 @@ const est = await cash.estimate({ amount: usdc(500), currency: 'EUR' });
|
|
|
59
59
|
// Progressive UI: do not let indexer-backed history hold up the oracle rate.
|
|
60
60
|
const rateOnly = await cash.estimate({ amount: usdc(500), currency: 'EUR' }, { includeEta: false });
|
|
61
61
|
|
|
62
|
-
// Optional: raw demand + speed evidence per offered
|
|
62
|
+
// Optional: raw demand + speed evidence per offered pair or sorted currency set.
|
|
63
63
|
const stats = await cash.fillStats();
|
|
64
|
+
console.log(stats['revolut:EUR+GBP+USD']);
|
|
64
65
|
|
|
65
66
|
// 3. Execute.
|
|
66
67
|
const { depositId } = await cash.cashout(
|
package/README.md
CHANGED
|
@@ -39,7 +39,9 @@ const rateOnly = await cash.estimate(
|
|
|
39
39
|
{ amount: usdc(1000), currency: 'USD' },
|
|
40
40
|
{ includeEta: false },
|
|
41
41
|
);
|
|
42
|
-
const
|
|
42
|
+
const fillStats = await cash.fillStats();
|
|
43
|
+
const pairStats = fillStats['venmo:USD'];
|
|
44
|
+
const multiCurrencyStats = fillStats['revolut:EUR+GBP+USD'];
|
|
43
45
|
|
|
44
46
|
const { depositId } = await cash.cashout(
|
|
45
47
|
{
|
|
@@ -97,7 +99,7 @@ console.log(source?.transactions?.origin, source?.transactions?.destination);
|
|
|
97
99
|
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
98
100
|
| `capabilities()` | Sync discovery: Base USDC destination/default source, platforms × currencies × payee hints × amount bounds |
|
|
99
101
|
| `capabilities({ includeRelaySources: true })` | Async discovery: adds live Relay SDK EVM source chains/tokens |
|
|
100
|
-
| `fillStats()` | Cached 30-day fill counts and median first-fill time per exact `platform:currency` pair
|
|
102
|
+
| `fillStats()` | Cached 30-day fill counts and median first-fill time per exact `platform:currency` pair or sorted multi-currency set |
|
|
101
103
|
| `quoteSource(input)` / `executeSourceQuote(quote, { signer })` | Relay SDK EVM source routing into Base USDC before cashout |
|
|
102
104
|
| `relayStatus(requestId)` | Relay request status from the Relay SDK request path |
|
|
103
105
|
| `estimate({ amount, currency }, { includeEta? })` | Base USDC oracle estimate; optionally skip the historical ETA for progressive rendering |
|
|
@@ -235,7 +237,9 @@ awaiting-buyer ──────────► matched ───────
|
|
|
235
237
|
by the same rolling 30-day, intent-attributed pair sampler as `fillStats()`,
|
|
236
238
|
measured from deposit creation to the first fulfilled fill through the pair.
|
|
237
239
|
The raw snapshot is cached for 15 minutes per client and each ETA is still
|
|
238
|
-
resolved from its exact normalized `platform:currency` key.
|
|
240
|
+
resolved from its exact normalized `platform:currency` key. Multi-currency
|
|
241
|
+
deposits also produce sorted keys such as `revolut:EUR+GBP+USD`, measured to
|
|
242
|
+
the first fill in any offered currency. Use
|
|
239
243
|
`{ includeEta: false }` when rate and receive amount should render first.
|
|
240
244
|
- **Availability thresholds belong to the consumer.** `fillStats()` returns raw
|
|
241
245
|
evidence. A recommended gate is `fills >= 10 && medianFillSeconds <= 48h`.
|
|
@@ -363,12 +363,15 @@ interface CashCapabilities {
|
|
|
363
363
|
declare function buildCapabilities(environment: RuntimeEnv): CashCapabilities;
|
|
364
364
|
|
|
365
365
|
interface CashPairFillStats {
|
|
366
|
-
/** Fulfilled intents through this pair inside the rolling 30-day window. */
|
|
366
|
+
/** Fulfilled intents through this pair or currency set inside the rolling 30-day window. */
|
|
367
367
|
fills: number;
|
|
368
|
-
/** Median deposit-to-first-fill seconds, sampled once per deposit for this pair. */
|
|
368
|
+
/** Median deposit-to-first-fill seconds, sampled once per deposit for this pair or set. */
|
|
369
369
|
medianFillSeconds?: number;
|
|
370
370
|
}
|
|
371
|
-
/**
|
|
371
|
+
/**
|
|
372
|
+
* Raw demand and speed evidence keyed by `basePlatform:currencyCode` or a
|
|
373
|
+
* sorted multi-currency set such as `revolut:EUR+GBP+USD`.
|
|
374
|
+
*/
|
|
372
375
|
type CashFillStats = Record<string, CashPairFillStats>;
|
|
373
376
|
interface CashFillEta {
|
|
374
377
|
/** Simple headline ETA from recent deposits. Undefined when no recent sample exists. */
|
|
@@ -622,10 +625,11 @@ interface CashClient {
|
|
|
622
625
|
includeRelaySources: true;
|
|
623
626
|
}): Promise<CashCapabilities>;
|
|
624
627
|
/**
|
|
625
|
-
* 0c - Raw 30-day demand and first-fill speed evidence keyed by
|
|
626
|
-
* `platform:currency
|
|
627
|
-
* medianFillSeconds <= 48h`; fail open to
|
|
628
|
-
* stats are unavailable or the gate would
|
|
628
|
+
* 0c - Raw 30-day demand and first-fill speed evidence keyed by an exact
|
|
629
|
+
* `platform:currency` pair or sorted multi-currency set. A recommended
|
|
630
|
+
* consumer gate is `fills >= 10 && medianFillSeconds <= 48h`; fail open to
|
|
631
|
+
* the full capability catalog when stats are unavailable or the gate would
|
|
632
|
+
* remove every pair.
|
|
629
633
|
*/
|
|
630
634
|
fillStats(): Promise<CashFillStats>;
|
|
631
635
|
/** Relay-only source discovery helper. */
|
|
@@ -363,12 +363,15 @@ interface CashCapabilities {
|
|
|
363
363
|
declare function buildCapabilities(environment: RuntimeEnv): CashCapabilities;
|
|
364
364
|
|
|
365
365
|
interface CashPairFillStats {
|
|
366
|
-
/** Fulfilled intents through this pair inside the rolling 30-day window. */
|
|
366
|
+
/** Fulfilled intents through this pair or currency set inside the rolling 30-day window. */
|
|
367
367
|
fills: number;
|
|
368
|
-
/** Median deposit-to-first-fill seconds, sampled once per deposit for this pair. */
|
|
368
|
+
/** Median deposit-to-first-fill seconds, sampled once per deposit for this pair or set. */
|
|
369
369
|
medianFillSeconds?: number;
|
|
370
370
|
}
|
|
371
|
-
/**
|
|
371
|
+
/**
|
|
372
|
+
* Raw demand and speed evidence keyed by `basePlatform:currencyCode` or a
|
|
373
|
+
* sorted multi-currency set such as `revolut:EUR+GBP+USD`.
|
|
374
|
+
*/
|
|
372
375
|
type CashFillStats = Record<string, CashPairFillStats>;
|
|
373
376
|
interface CashFillEta {
|
|
374
377
|
/** Simple headline ETA from recent deposits. Undefined when no recent sample exists. */
|
|
@@ -622,10 +625,11 @@ interface CashClient {
|
|
|
622
625
|
includeRelaySources: true;
|
|
623
626
|
}): Promise<CashCapabilities>;
|
|
624
627
|
/**
|
|
625
|
-
* 0c - Raw 30-day demand and first-fill speed evidence keyed by
|
|
626
|
-
* `platform:currency
|
|
627
|
-
* medianFillSeconds <= 48h`; fail open to
|
|
628
|
-
* stats are unavailable or the gate would
|
|
628
|
+
* 0c - Raw 30-day demand and first-fill speed evidence keyed by an exact
|
|
629
|
+
* `platform:currency` pair or sorted multi-currency set. A recommended
|
|
630
|
+
* consumer gate is `fills >= 10 && medianFillSeconds <= 48h`; fail open to
|
|
631
|
+
* the full capability catalog when stats are unavailable or the gate would
|
|
632
|
+
* remove every pair.
|
|
629
633
|
*/
|
|
630
634
|
fillStats(): Promise<CashFillStats>;
|
|
631
635
|
/** Relay-only source discovery helper. */
|
package/dist/index.cjs
CHANGED
|
@@ -959,6 +959,26 @@ function computeFillStatsSample(deposits, nowSeconds, environment) {
|
|
|
959
959
|
const createdAt = toUnixSeconds2(deposit.createdAt ?? deposit.timestamp);
|
|
960
960
|
const firstFillByPair = /* @__PURE__ */ new Map();
|
|
961
961
|
const firstFillByCurrency = /* @__PURE__ */ new Map();
|
|
962
|
+
const offeredCurrenciesByMethod = /* @__PURE__ */ new Map();
|
|
963
|
+
for (const offered of deposit.currencies ?? []) {
|
|
964
|
+
let method;
|
|
965
|
+
try {
|
|
966
|
+
method = offered.paymentMethodHash ? sdk.resolvePaymentMethodNameFromHash(offered.paymentMethodHash, catalog) : void 0;
|
|
967
|
+
} catch {
|
|
968
|
+
method = void 0;
|
|
969
|
+
}
|
|
970
|
+
const currency = normalizeCurrencyCode(offered.currencyCode);
|
|
971
|
+
if (!method || !currency) continue;
|
|
972
|
+
const currencies = offeredCurrenciesByMethod.get(method) ?? /* @__PURE__ */ new Set();
|
|
973
|
+
currencies.add(currency);
|
|
974
|
+
offeredCurrenciesByMethod.set(method, currencies);
|
|
975
|
+
}
|
|
976
|
+
const multiCurrencyKeyByMethod = /* @__PURE__ */ new Map();
|
|
977
|
+
for (const [method, currencies] of offeredCurrenciesByMethod) {
|
|
978
|
+
if (currencies.size > 1) {
|
|
979
|
+
multiCurrencyKeyByMethod.set(method, `${method}:${[...currencies].sort().join("+")}`);
|
|
980
|
+
}
|
|
981
|
+
}
|
|
962
982
|
for (const intent of deposit.intents ?? []) {
|
|
963
983
|
const fulfilledAt = toUnixSeconds2(intent.fulfillTimestamp);
|
|
964
984
|
if (fulfilledAt === void 0 || fulfilledAt < windowStart) continue;
|
|
@@ -972,11 +992,25 @@ function computeFillStatsSample(deposits, nowSeconds, environment) {
|
|
|
972
992
|
if (!method || !currency) continue;
|
|
973
993
|
const pair = `${method}:${currency}`;
|
|
974
994
|
fillCounts.set(pair, (fillCounts.get(pair) ?? 0) + 1);
|
|
995
|
+
const multiCurrencyKey = multiCurrencyKeyByMethod.get(method);
|
|
996
|
+
const matchingMultiCurrencyKey = multiCurrencyKey && offeredCurrenciesByMethod.get(method)?.has(currency) ? multiCurrencyKey : void 0;
|
|
997
|
+
if (matchingMultiCurrencyKey) {
|
|
998
|
+
fillCounts.set(
|
|
999
|
+
matchingMultiCurrencyKey,
|
|
1000
|
+
(fillCounts.get(matchingMultiCurrencyKey) ?? 0) + 1
|
|
1001
|
+
);
|
|
1002
|
+
}
|
|
975
1003
|
if (createdAt === void 0 || createdAt < windowStart || fulfilledAt < createdAt) continue;
|
|
976
1004
|
const previousPairFill = firstFillByPair.get(pair);
|
|
977
1005
|
if (previousPairFill === void 0 || fulfilledAt < previousPairFill) {
|
|
978
1006
|
firstFillByPair.set(pair, fulfilledAt);
|
|
979
1007
|
}
|
|
1008
|
+
if (matchingMultiCurrencyKey) {
|
|
1009
|
+
const previousMultiCurrencyFill = firstFillByPair.get(matchingMultiCurrencyKey);
|
|
1010
|
+
if (previousMultiCurrencyFill === void 0 || fulfilledAt < previousMultiCurrencyFill) {
|
|
1011
|
+
firstFillByPair.set(matchingMultiCurrencyKey, fulfilledAt);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
980
1014
|
const previousCurrencyFill = firstFillByCurrency.get(currency);
|
|
981
1015
|
if (previousCurrencyFill === void 0 || fulfilledAt < previousCurrencyFill) {
|
|
982
1016
|
firstFillByCurrency.set(currency, fulfilledAt);
|
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, 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-
|
|
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 CashMultiCurrencyLeg, w as CashNextAction, x as CashOrderState, y as CashPairFillStats, z as CashPayeeInput, A as CashPayout, B as CashPayoutPricing, D as CashPlatformCapability, E as CashPreparedStepKind, F as CashoutInput, G as CashoutOptions, H as CuratorPayeeDataInput, J as EstimateInput, K as EstimateOptions, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, L as PreparedCashoutReceipt, N as RECOMMENDED_MIN_CASHOUT_AMOUNT, Q as RelayOptions, S as RelayQuoteInput, U as RelaySourceInput, V as RelayTransaction, X as SignerOptions, Y as WatchOptions, Z as WithdrawOptions, _ as buildCapabilities, $ as createCashClient, a0 as normalizeCashPayee } from './createCashClient-
|
|
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-DGMd8Swr.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 CashMultiCurrencyLeg, w as CashNextAction, x as CashOrderState, y as CashPairFillStats, z as CashPayeeInput, A as CashPayout, B as CashPayoutPricing, D as CashPlatformCapability, E as CashPreparedStepKind, F as CashoutInput, G as CashoutOptions, H as CuratorPayeeDataInput, J as EstimateInput, K as EstimateOptions, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, L as PreparedCashoutReceipt, N as RECOMMENDED_MIN_CASHOUT_AMOUNT, Q as RelayOptions, S as RelayQuoteInput, U as RelaySourceInput, V as RelayTransaction, X as SignerOptions, Y as WatchOptions, Z as WithdrawOptions, _ as buildCapabilities, $ as createCashClient, a0 as normalizeCashPayee } from './createCashClient-DGMd8Swr.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';
|
|
@@ -2718,8 +2718,8 @@ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
|
|
|
2718
2718
|
decimals: number;
|
|
2719
2719
|
};
|
|
2720
2720
|
};
|
|
2721
|
-
environment: "production" | "preproduction" | "staging";
|
|
2722
2721
|
currencies: string[];
|
|
2722
|
+
environment: "production" | "preproduction" | "staging";
|
|
2723
2723
|
platforms: {
|
|
2724
2724
|
platform: string;
|
|
2725
2725
|
currencies: string[];
|
|
@@ -2789,8 +2789,8 @@ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
|
|
|
2789
2789
|
decimals: number;
|
|
2790
2790
|
};
|
|
2791
2791
|
};
|
|
2792
|
-
environment: "production" | "preproduction" | "staging";
|
|
2793
2792
|
currencies: string[];
|
|
2793
|
+
environment: "production" | "preproduction" | "staging";
|
|
2794
2794
|
platforms: {
|
|
2795
2795
|
platform: string;
|
|
2796
2796
|
currencies: string[];
|
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, 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-
|
|
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 CashMultiCurrencyLeg, w as CashNextAction, x as CashOrderState, y as CashPairFillStats, z as CashPayeeInput, A as CashPayout, B as CashPayoutPricing, D as CashPlatformCapability, E as CashPreparedStepKind, F as CashoutInput, G as CashoutOptions, H as CuratorPayeeDataInput, J as EstimateInput, K as EstimateOptions, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, L as PreparedCashoutReceipt, N as RECOMMENDED_MIN_CASHOUT_AMOUNT, Q as RelayOptions, S as RelayQuoteInput, U as RelaySourceInput, V as RelayTransaction, X as SignerOptions, Y as WatchOptions, Z as WithdrawOptions, _ as buildCapabilities, $ as createCashClient, a0 as normalizeCashPayee } from './createCashClient-
|
|
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-DGMd8Swr.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 CashMultiCurrencyLeg, w as CashNextAction, x as CashOrderState, y as CashPairFillStats, z as CashPayeeInput, A as CashPayout, B as CashPayoutPricing, D as CashPlatformCapability, E as CashPreparedStepKind, F as CashoutInput, G as CashoutOptions, H as CuratorPayeeDataInput, J as EstimateInput, K as EstimateOptions, M as MIN_CASHOUT_AMOUNT, O as OrdersOptions, L as PreparedCashoutReceipt, N as RECOMMENDED_MIN_CASHOUT_AMOUNT, Q as RelayOptions, S as RelayQuoteInput, U as RelaySourceInput, V as RelayTransaction, X as SignerOptions, Y as WatchOptions, Z as WithdrawOptions, _ as buildCapabilities, $ as createCashClient, a0 as normalizeCashPayee } from './createCashClient-DGMd8Swr.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';
|
|
@@ -2718,8 +2718,8 @@ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
|
|
|
2718
2718
|
decimals: number;
|
|
2719
2719
|
};
|
|
2720
2720
|
};
|
|
2721
|
-
environment: "production" | "preproduction" | "staging";
|
|
2722
2721
|
currencies: string[];
|
|
2722
|
+
environment: "production" | "preproduction" | "staging";
|
|
2723
2723
|
platforms: {
|
|
2724
2724
|
platform: string;
|
|
2725
2725
|
currencies: string[];
|
|
@@ -2789,8 +2789,8 @@ declare const cashCapabilitiesJsonSchema: z.ZodObject<{
|
|
|
2789
2789
|
decimals: number;
|
|
2790
2790
|
};
|
|
2791
2791
|
};
|
|
2792
|
-
environment: "production" | "preproduction" | "staging";
|
|
2793
2792
|
currencies: string[];
|
|
2793
|
+
environment: "production" | "preproduction" | "staging";
|
|
2794
2794
|
platforms: {
|
|
2795
2795
|
platform: string;
|
|
2796
2796
|
currencies: string[];
|
package/dist/index.js
CHANGED
|
@@ -523,6 +523,26 @@ function computeFillStatsSample(deposits, nowSeconds, environment) {
|
|
|
523
523
|
const createdAt = toUnixSeconds2(deposit.createdAt ?? deposit.timestamp);
|
|
524
524
|
const firstFillByPair = /* @__PURE__ */ new Map();
|
|
525
525
|
const firstFillByCurrency = /* @__PURE__ */ new Map();
|
|
526
|
+
const offeredCurrenciesByMethod = /* @__PURE__ */ new Map();
|
|
527
|
+
for (const offered of deposit.currencies ?? []) {
|
|
528
|
+
let method;
|
|
529
|
+
try {
|
|
530
|
+
method = offered.paymentMethodHash ? resolvePaymentMethodNameFromHash(offered.paymentMethodHash, catalog) : void 0;
|
|
531
|
+
} catch {
|
|
532
|
+
method = void 0;
|
|
533
|
+
}
|
|
534
|
+
const currency = normalizeCurrencyCode(offered.currencyCode);
|
|
535
|
+
if (!method || !currency) continue;
|
|
536
|
+
const currencies = offeredCurrenciesByMethod.get(method) ?? /* @__PURE__ */ new Set();
|
|
537
|
+
currencies.add(currency);
|
|
538
|
+
offeredCurrenciesByMethod.set(method, currencies);
|
|
539
|
+
}
|
|
540
|
+
const multiCurrencyKeyByMethod = /* @__PURE__ */ new Map();
|
|
541
|
+
for (const [method, currencies] of offeredCurrenciesByMethod) {
|
|
542
|
+
if (currencies.size > 1) {
|
|
543
|
+
multiCurrencyKeyByMethod.set(method, `${method}:${[...currencies].sort().join("+")}`);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
526
546
|
for (const intent of deposit.intents ?? []) {
|
|
527
547
|
const fulfilledAt = toUnixSeconds2(intent.fulfillTimestamp);
|
|
528
548
|
if (fulfilledAt === void 0 || fulfilledAt < windowStart) continue;
|
|
@@ -536,11 +556,25 @@ function computeFillStatsSample(deposits, nowSeconds, environment) {
|
|
|
536
556
|
if (!method || !currency) continue;
|
|
537
557
|
const pair = `${method}:${currency}`;
|
|
538
558
|
fillCounts.set(pair, (fillCounts.get(pair) ?? 0) + 1);
|
|
559
|
+
const multiCurrencyKey = multiCurrencyKeyByMethod.get(method);
|
|
560
|
+
const matchingMultiCurrencyKey = multiCurrencyKey && offeredCurrenciesByMethod.get(method)?.has(currency) ? multiCurrencyKey : void 0;
|
|
561
|
+
if (matchingMultiCurrencyKey) {
|
|
562
|
+
fillCounts.set(
|
|
563
|
+
matchingMultiCurrencyKey,
|
|
564
|
+
(fillCounts.get(matchingMultiCurrencyKey) ?? 0) + 1
|
|
565
|
+
);
|
|
566
|
+
}
|
|
539
567
|
if (createdAt === void 0 || createdAt < windowStart || fulfilledAt < createdAt) continue;
|
|
540
568
|
const previousPairFill = firstFillByPair.get(pair);
|
|
541
569
|
if (previousPairFill === void 0 || fulfilledAt < previousPairFill) {
|
|
542
570
|
firstFillByPair.set(pair, fulfilledAt);
|
|
543
571
|
}
|
|
572
|
+
if (matchingMultiCurrencyKey) {
|
|
573
|
+
const previousMultiCurrencyFill = firstFillByPair.get(matchingMultiCurrencyKey);
|
|
574
|
+
if (previousMultiCurrencyFill === void 0 || fulfilledAt < previousMultiCurrencyFill) {
|
|
575
|
+
firstFillByPair.set(matchingMultiCurrencyKey, fulfilledAt);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
544
578
|
const previousCurrencyFill = firstFillByCurrency.get(currency);
|
|
545
579
|
if (previousCurrencyFill === void 0 || fulfilledAt < previousCurrencyFill) {
|
|
546
580
|
firstFillByCurrency.set(currency, fulfilledAt);
|
package/dist/react.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CurrencyType } from '@zkp2p/sdk';
|
|
2
|
-
import { r as CashClient, J as EstimateInput, i as CashEstimate, G as CashoutOptions, h as CashoutResult, F as CashoutInput, T as TopUpResult, W as WithdrawResult, e as CashOrder } from './createCashClient-
|
|
2
|
+
import { r as CashClient, J as EstimateInput, i as CashEstimate, G as CashoutOptions, h as CashoutResult, F as CashoutInput, T as TopUpResult, W as WithdrawResult, e as CashOrder } from './createCashClient-DGMd8Swr.cjs';
|
|
3
3
|
import { WalletClient } from 'viem';
|
|
4
4
|
import '@relayprotocol/relay-sdk';
|
|
5
5
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CurrencyType } from '@zkp2p/sdk';
|
|
2
|
-
import { r as CashClient, J as EstimateInput, i as CashEstimate, G as CashoutOptions, h as CashoutResult, F as CashoutInput, T as TopUpResult, W as WithdrawResult, e as CashOrder } from './createCashClient-
|
|
2
|
+
import { r as CashClient, J as EstimateInput, i as CashEstimate, G as CashoutOptions, h as CashoutResult, F as CashoutInput, T as TopUpResult, W as WithdrawResult, e as CashOrder } from './createCashClient-DGMd8Swr.js';
|
|
3
3
|
import { WalletClient } from 'viem';
|
|
4
4
|
import '@relayprotocol/relay-sdk';
|
|
5
5
|
|
package/dist/tools.cjs
CHANGED
package/dist/tools.js
CHANGED
|
@@ -132,7 +132,9 @@ measure buyer signal to fulfillment; that would miss the buyer-arrival wait
|
|
|
132
132
|
that users actually care about. The public shape is small: `{ seconds, label }`.
|
|
133
133
|
|
|
134
134
|
`fillStats()` exposes the sampler's raw evidence for catalog filtering as
|
|
135
|
-
`Record<
|
|
135
|
+
`Record<string, { fills, medianFillSeconds? }>`. Keys are exact
|
|
136
|
+
`platform:currency` pairs or sorted sets such as `revolut:EUR+GBP+USD`; set
|
|
137
|
+
medians measure time to the first fill in any offered currency. Generic Zelle
|
|
136
138
|
fills are reported as `zelle:USD`. Consumers own thresholding; the recommended
|
|
137
139
|
gate is `fills >= 10 && medianFillSeconds <= 48h`, with a fail-open fallback to
|
|
138
140
|
the full capability catalog when the read fails or filtering would empty it.
|
package/llms.txt
CHANGED
|
@@ -22,10 +22,11 @@ Key facts:
|
|
|
22
22
|
resolves at fill time. ETA is `{ seconds, label }` from the same rolling
|
|
23
23
|
30-day, intent-attributed pair sampler as fillStats(), not a guarantee.
|
|
24
24
|
- fillStats() returns raw `{ fills, medianFillSeconds? }` evidence keyed by
|
|
25
|
-
`platform:currency
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
`platform:currency` or a sorted set such as `revolut:EUR+GBP+USD`. Set
|
|
26
|
+
medians measure time to the first fill in any offered currency. Recommended
|
|
27
|
+
consumer gate: fills >= 10 and median <= 48h; fail open to capabilities() if
|
|
28
|
+
unavailable or filtering empties it. Its raw environment snapshot is cached
|
|
29
|
+
for 15 minutes.
|
|
29
30
|
- Progressive UIs can call estimate(input, { includeEta: false }) so the
|
|
30
31
|
oracle rate is not blocked by indexer history, then load the exact pair from
|
|
31
32
|
fillStats() separately.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zkp2p/cash",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-rc.0",
|
|
4
4
|
"description": "Peer Cash - offramp-only SDK for routing crypto to Base USDC, then cashing out to fiat at the live oracle market rate.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Peer (https://peer.xyz)",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
},
|
|
107
107
|
"dependencies": {
|
|
108
108
|
"@relayprotocol/relay-sdk": "^6.1.3",
|
|
109
|
-
"@zkp2p/sdk": "
|
|
109
|
+
"@zkp2p/sdk": "0.10.0-rc.7",
|
|
110
110
|
"zod": "^3.25.76"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|