@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/react.d.ts 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.js';
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.js';
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;
package/dist/react.js CHANGED
@@ -7,6 +7,7 @@ function useEstimate({
7
7
  currency,
8
8
  platform,
9
9
  source,
10
+ includeEta = true,
10
11
  refreshIntervalMs = 0
11
12
  }) {
12
13
  const [estimate, setEstimate] = useState(null);
@@ -32,7 +33,7 @@ function useEstimate({
32
33
  }
33
34
  return;
34
35
  }
35
- const identity = { client, amount, currency, platform, source };
36
+ const identity = { client, amount, currency, platform, source, includeEta };
36
37
  if (isCurrent()) {
37
38
  loadingIdentityRef.current = identity;
38
39
  errorIdentityRef.current = null;
@@ -40,12 +41,15 @@ function useEstimate({
40
41
  setError(null);
41
42
  }
42
43
  try {
43
- const result = await client.estimate({
44
- amount,
45
- currency,
46
- ...platform ? { platform } : {},
47
- ...source ? { source } : {}
48
- });
44
+ const result = await client.estimate(
45
+ {
46
+ amount,
47
+ currency,
48
+ ...platform ? { platform } : {},
49
+ ...source ? { source } : {}
50
+ },
51
+ { includeEta }
52
+ );
49
53
  if (isCurrent()) {
50
54
  estimateIdentityRef.current = identity;
51
55
  setEstimate(result);
@@ -61,7 +65,7 @@ function useEstimate({
61
65
  } finally {
62
66
  if (isCurrent()) setIsLoading(false);
63
67
  }
64
- }, [client, currency, amount, platform, source]);
68
+ }, [client, currency, amount, platform, source, includeEta]);
65
69
  useEffect(() => {
66
70
  latestRequestRef.current += 1;
67
71
  estimateIdentityRef.current = null;
@@ -70,7 +74,7 @@ function useEstimate({
70
74
  setEstimate(null);
71
75
  setIsLoading(false);
72
76
  setError(null);
73
- }, [client, amount, currency, platform, source]);
77
+ }, [client, amount, currency, platform, source, includeEta]);
74
78
  useEffect(() => {
75
79
  mountedRef.current = true;
76
80
  void refresh();
@@ -83,7 +87,7 @@ function useEstimate({
83
87
  if (timerRef.current) clearInterval(timerRef.current);
84
88
  };
85
89
  }, [refresh, refreshIntervalMs]);
86
- const matchesCurrentIdentity = (identity) => identity?.client === client && identity.amount === amount && identity.currency === currency && identity.platform === platform && identity.source === source;
90
+ const matchesCurrentIdentity = (identity) => identity?.client === client && identity.amount === amount && identity.currency === currency && identity.platform === platform && identity.source === source && identity.includeEta === includeEta;
87
91
  return {
88
92
  estimate: matchesCurrentIdentity(estimateIdentityRef.current) ? estimate : null,
89
93
  isLoading: matchesCurrentIdentity(loadingIdentityRef.current) ? isLoading : false,
package/dist/tools.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // package.json
4
4
  var package_default = {
5
- version: "0.1.7"};
5
+ version: "0.1.9"};
6
6
 
7
7
  // src/tools/index.ts
8
8
  var bigintString = {
@@ -112,6 +112,15 @@ var builtInCashTools = [
112
112
  additionalProperties: false
113
113
  }
114
114
  },
115
+ {
116
+ name: "cash_fill_stats",
117
+ description: "Read raw 30-day demand and first-fill speed evidence for every observed platform:currency pair. Consumers should apply their own threshold and fail open to cash_capabilities when stats are unavailable or filtering would empty the catalog.",
118
+ inputSchema: {
119
+ type: "object",
120
+ properties: {},
121
+ additionalProperties: false
122
+ }
123
+ },
115
124
  {
116
125
  name: "cash_cashout",
117
126
  description: "Start a Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.",
package/dist/tools.d.cts CHANGED
@@ -135,6 +135,14 @@ declare const builtInCashTools: readonly [{
135
135
  readonly required: readonly ["amount", "currency"];
136
136
  readonly additionalProperties: false;
137
137
  };
138
+ }, {
139
+ readonly name: "cash_fill_stats";
140
+ readonly description: "Read raw 30-day demand and first-fill speed evidence for every observed platform:currency pair. Consumers should apply their own threshold and fail open to cash_capabilities when stats are unavailable or filtering would empty the catalog.";
141
+ readonly inputSchema: {
142
+ readonly type: "object";
143
+ readonly properties: {};
144
+ readonly additionalProperties: false;
145
+ };
138
146
  }, {
139
147
  readonly name: "cash_cashout";
140
148
  readonly description: "Start a Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.";
package/dist/tools.d.ts CHANGED
@@ -135,6 +135,14 @@ declare const builtInCashTools: readonly [{
135
135
  readonly required: readonly ["amount", "currency"];
136
136
  readonly additionalProperties: false;
137
137
  };
138
+ }, {
139
+ readonly name: "cash_fill_stats";
140
+ readonly description: "Read raw 30-day demand and first-fill speed evidence for every observed platform:currency pair. Consumers should apply their own threshold and fail open to cash_capabilities when stats are unavailable or filtering would empty the catalog.";
141
+ readonly inputSchema: {
142
+ readonly type: "object";
143
+ readonly properties: {};
144
+ readonly additionalProperties: false;
145
+ };
138
146
  }, {
139
147
  readonly name: "cash_cashout";
140
148
  readonly description: "Start a Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.";
package/dist/tools.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // package.json
2
2
  var package_default = {
3
- version: "0.1.7"};
3
+ version: "0.1.9"};
4
4
 
5
5
  // src/tools/index.ts
6
6
  var bigintString = {
@@ -110,6 +110,15 @@ var builtInCashTools = [
110
110
  additionalProperties: false
111
111
  }
112
112
  },
113
+ {
114
+ name: "cash_fill_stats",
115
+ description: "Read raw 30-day demand and first-fill speed evidence for every observed platform:currency pair. Consumers should apply their own threshold and fail open to cash_capabilities when stats are unavailable or filtering would empty the catalog.",
116
+ inputSchema: {
117
+ type: "object",
118
+ properties: {},
119
+ additionalProperties: false
120
+ }
121
+ },
113
122
  {
114
123
  name: "cash_cashout",
115
124
  description: "Start a Base-USDC cash-out using the custody-separated prepare path. Returns UNSIGNED transactions plus same-index steps [approve, createDeposit]; signing and ordered submission stay host-side. For another source asset, complete cash_source_quote and cash_source_status first, then pass the guaranteed Base USDC output amount here.",
@@ -124,10 +124,22 @@ passes through `delivering` until the last one completes. `filledAmount`,
124
124
  ## The ETA principle
125
125
 
126
126
  `estimate().eta` is historical, not a promise. It uses rolling 30-day indexer
127
- data from deposit/order creation to the first fulfilled fill. It deliberately
128
- does **not** measure buyer signal to fulfillment; that would miss the
129
- buyer-arrival wait that users actually care about. The public shape is small:
130
- `{ seconds, label }`.
127
+ data from deposit/order creation to the first fulfilled fill through the
128
+ intent's actual platform and currency pair. It deliberately does **not**
129
+ measure buyer signal to fulfillment; that would miss the buyer-arrival wait
130
+ that users actually care about. The public shape is small: `{ seconds, label }`.
131
+
132
+ `fillStats()` exposes the sampler's raw evidence for catalog filtering as
133
+ `Record<"platform:currency", { fills, medianFillSeconds? }>`. Bank-scoped Zelle
134
+ methods aggregate to `zelle:USD`. Consumers own thresholding; the recommended
135
+ gate is `fills >= 10 && medianFillSeconds <= 48h`, with a fail-open fallback to
136
+ the full capability catalog when the read fails or filtering would empty it.
137
+ Medians are per-deposit first-fill latencies, never means or censored cohorts.
138
+ The client caches one raw environment snapshot for 15 minutes and de-duplicates
139
+ concurrent reads; ETA resolution still uses only the requested normalized
140
+ `platform:currency` key. A progressive UI can call
141
+ `estimate(input, { includeEta: false })` to render rate/receive immediately,
142
+ then read that pair from `fillStats()` without coupling the two loading states.
131
143
 
132
144
  - **Buyer arrival time is market-driven.** A deposit at market rate should
133
145
  fill fast, but the ETA is only a recent historical sample.
package/llms.txt CHANGED
@@ -19,9 +19,18 @@ Key facts:
19
19
  source.amount is Relay's guaranteed minimum Base USDC output and the exact
20
20
  order deposit amount, not the route's actual output.
21
21
  - There is NO locked fiat quote. estimate() reads the oracle; the binding rate
22
- resolves at fill time. ETA is `{ seconds, label }` from rolling 30-day,
23
- zero-spread market-rate deposits in the same payout corridor, not a
24
- guarantee.
22
+ resolves at fill time. ETA is `{ seconds, label }` from the same rolling
23
+ 30-day, intent-attributed pair sampler as fillStats(), not a guarantee.
24
+ - fillStats() returns raw `{ fills, medianFillSeconds? }` evidence keyed by
25
+ `platform:currency`. Recommended consumer gate: fills >= 10 and median <=
26
+ 48h; fail open to capabilities() if unavailable or filtering empties it.
27
+ Its raw environment snapshot is cached for 15 minutes, while lookups remain
28
+ exact to the normalized platform:currency pair.
29
+ - Progressive UIs can call estimate(input, { includeEta: false }) so the
30
+ oracle rate is not blocked by indexer history, then load the exact pair from
31
+ fillStats() separately.
32
+ - capabilities() exposes one Zelle platform. A zelle cashout internally attaches
33
+ the generic method plus Chase, Bank of America, and Citi buyer routes.
25
34
  - Resume any order from its depositId alone (composite escrow_onchainId).
26
35
  - One unwind verb: withdraw(depositId) - prunes expired intents automatically;
27
36
  pass amount for a partial withdrawal of the unlocked balance.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zkp2p/cash",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
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)",
@@ -92,13 +92,15 @@
92
92
  "scripts": {
93
93
  "build": "tsup",
94
94
  "typecheck": "tsc --noEmit",
95
- "lint": "eslint src test examples",
95
+ "lint": "eslint src test examples scripts",
96
96
  "format": "prettier --write .",
97
97
  "format:check": "prettier --check .",
98
98
  "test": "vitest run",
99
99
  "test:watch": "vitest",
100
100
  "audit": "bun audit --production",
101
101
  "pack:check": "bun scripts/check-packed-package.ts",
102
+ "verify:production-crosschain-relay": "bun scripts/verify-production-crosschain-relay.ts",
103
+ "verify:production-maker": "bun scripts/verify-production-maker.ts",
102
104
  "prepack": "bun run build",
103
105
  "ci": "bun run typecheck && bun run lint && bun run format:check && bun run test && bun run audit && bun run build && bun run pack:check"
104
106
  },