@zkp2p/cash 0.1.9 → 0.2.1
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 +19 -2
- package/README.md +52 -5
- package/dist/{chunk-TR6JVYYF.js → chunk-5VBP3IWK.js} +59 -2
- package/dist/{createCashClient-BhOytyHE.d.cts → createCashClient-Clg5Fa1H.d.cts} +42 -15
- package/dist/{createCashClient-BhOytyHE.d.ts → createCashClient-Clg5Fa1H.d.ts} +42 -15
- package/dist/index.cjs +239 -85
- package/dist/index.d.cts +36 -26
- package/dist/index.d.ts +36 -26
- package/dist/index.js +182 -87
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/tools.cjs +26 -10
- package/dist/tools.d.cts +29 -10
- package/dist/tools.d.ts +29 -10
- package/dist/tools.js +26 -10
- package/docs/lifecycle-and-recovery.md +12 -3
- package/llms.txt +4 -2
- package/package.json +2 -2
package/dist/tools.d.ts
CHANGED
|
@@ -166,20 +166,39 @@ declare const builtInCashTools: readonly [{
|
|
|
166
166
|
readonly type: "string";
|
|
167
167
|
readonly description: "Fiat currency code, e.g. \"USD\"";
|
|
168
168
|
};
|
|
169
|
+
readonly currencies: {
|
|
170
|
+
readonly type: "array";
|
|
171
|
+
readonly minItems: 1;
|
|
172
|
+
readonly uniqueItems: true;
|
|
173
|
+
readonly items: {
|
|
174
|
+
readonly type: "string";
|
|
175
|
+
};
|
|
176
|
+
readonly description: "Fiat currency choices for one payment method, e.g. [\"EUR\", \"GBP\"]";
|
|
177
|
+
};
|
|
169
178
|
readonly payee: {
|
|
170
|
-
readonly
|
|
171
|
-
readonly
|
|
172
|
-
|
|
173
|
-
readonly
|
|
174
|
-
|
|
175
|
-
|
|
179
|
+
readonly description: "Raw payee handle or structured curator payee data";
|
|
180
|
+
readonly oneOf: readonly [{
|
|
181
|
+
readonly type: "string";
|
|
182
|
+
readonly description: "User-entered handle, e.g. \"@andrew\" for Venmo; Peer Cash normalizes it for the selected platform";
|
|
183
|
+
}, {
|
|
184
|
+
readonly type: "object";
|
|
185
|
+
readonly properties: {
|
|
186
|
+
readonly offchainId: {
|
|
187
|
+
readonly type: "string";
|
|
188
|
+
readonly description: "Already-normalized handle for the platform";
|
|
189
|
+
};
|
|
176
190
|
};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
191
|
+
readonly required: readonly ["offchainId"];
|
|
192
|
+
readonly additionalProperties: true;
|
|
193
|
+
}];
|
|
180
194
|
};
|
|
181
195
|
};
|
|
182
|
-
readonly required: readonly ["platform", "
|
|
196
|
+
readonly required: readonly ["platform", "payee"];
|
|
197
|
+
readonly oneOf: readonly [{
|
|
198
|
+
readonly required: readonly ["currency"];
|
|
199
|
+
}, {
|
|
200
|
+
readonly required: readonly ["currencies"];
|
|
201
|
+
}];
|
|
183
202
|
readonly additionalProperties: false;
|
|
184
203
|
};
|
|
185
204
|
};
|
package/dist/tools.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
|
-
version: "0.1
|
|
3
|
+
version: "0.2.1"};
|
|
4
4
|
|
|
5
5
|
// src/tools/index.ts
|
|
6
6
|
var bigintString = {
|
|
@@ -135,20 +135,36 @@ var builtInCashTools = [
|
|
|
135
135
|
description: 'Platform id from cash_capabilities, e.g. "venmo"'
|
|
136
136
|
},
|
|
137
137
|
currency: { type: "string", description: 'Fiat currency code, e.g. "USD"' },
|
|
138
|
+
currencies: {
|
|
139
|
+
type: "array",
|
|
140
|
+
minItems: 1,
|
|
141
|
+
uniqueItems: true,
|
|
142
|
+
items: { type: "string" },
|
|
143
|
+
description: 'Fiat currency choices for one payment method, e.g. ["EUR", "GBP"]'
|
|
144
|
+
},
|
|
138
145
|
payee: {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
offchainId: {
|
|
146
|
+
description: "Raw payee handle or structured curator payee data",
|
|
147
|
+
oneOf: [
|
|
148
|
+
{
|
|
143
149
|
type: "string",
|
|
144
|
-
description: '
|
|
150
|
+
description: 'User-entered handle, e.g. "@andrew" for Venmo; Peer Cash normalizes it for the selected platform'
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
type: "object",
|
|
154
|
+
properties: {
|
|
155
|
+
offchainId: {
|
|
156
|
+
type: "string",
|
|
157
|
+
description: "Already-normalized handle for the platform"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
required: ["offchainId"],
|
|
161
|
+
additionalProperties: true
|
|
145
162
|
}
|
|
146
|
-
|
|
147
|
-
required: ["offchainId"],
|
|
148
|
-
additionalProperties: true
|
|
163
|
+
]
|
|
149
164
|
}
|
|
150
165
|
},
|
|
151
|
-
required: ["platform", "
|
|
166
|
+
required: ["platform", "payee"],
|
|
167
|
+
oneOf: [{ required: ["currency"] }, { required: ["currencies"] }],
|
|
152
168
|
additionalProperties: false
|
|
153
169
|
}
|
|
154
170
|
},
|
|
@@ -61,7 +61,9 @@ The unsigned `prepare()` path is Base-USDC-only and rejects `source` with
|
|
|
61
61
|
`SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE`. The tool manifest follows the same
|
|
62
62
|
boundary: `cash_source_quote` and `cash_source_status` quote and observe Relay,
|
|
63
63
|
but the host or a signer-backed client must execute the route before
|
|
64
|
-
`cash_cashout` prepares the Base-USDC order.
|
|
64
|
+
`cash_cashout` prepares the Base-USDC order. Once the prepared `createDeposit`
|
|
65
|
+
transaction confirms, call `finalizePreparedCashout(receipt)` to decode it with
|
|
66
|
+
the environment-correct escrow ABI and obtain the resumable `CashoutResult`.
|
|
65
67
|
|
|
66
68
|
There is no static chain/token allowlist in Peer Cash. Relay decides source
|
|
67
69
|
support through its metadata and quote execution, filtered to the viem/EVM
|
|
@@ -130,8 +132,8 @@ measure buyer signal to fulfillment; that would miss the buyer-arrival wait
|
|
|
130
132
|
that users actually care about. The public shape is small: `{ seconds, label }`.
|
|
131
133
|
|
|
132
134
|
`fillStats()` exposes the sampler's raw evidence for catalog filtering as
|
|
133
|
-
`Record<"platform:currency", { fills, medianFillSeconds? }>`.
|
|
134
|
-
|
|
135
|
+
`Record<"platform:currency", { fills, medianFillSeconds? }>`. Generic Zelle
|
|
136
|
+
fills are reported as `zelle:USD`. Consumers own thresholding; the recommended
|
|
135
137
|
gate is `fills >= 10 && medianFillSeconds <= 48h`, with a fail-open fallback to
|
|
136
138
|
the full capability catalog when the read fails or filtering would empty it.
|
|
137
139
|
Medians are per-deposit first-fill latencies, never means or censored cohorts.
|
|
@@ -195,6 +197,11 @@ platform, currency, payee hash, and a pricing proof (`spreadBps: 0`,
|
|
|
195
197
|
`kind: 'oracle_chainlink'`, `marketRate: true`): the zero-spread claim is a
|
|
196
198
|
queryable fact, not marketing copy.
|
|
197
199
|
|
|
200
|
+
Reconstruction is fail-closed: every payment method on the indexed deposit
|
|
201
|
+
must resolve through the active SDK catalog, and the result must be exactly
|
|
202
|
+
one zero-spread oracle payout. `orders()` excludes unsupported or mixed rows;
|
|
203
|
+
`order()` returns `ORDER_NOT_FOUND` rather than partially reclassifying them.
|
|
204
|
+
|
|
198
205
|
## Who is this buyer?
|
|
199
206
|
|
|
200
207
|
`buyer(address)` aggregates the matched buyer's full intent history into a
|
|
@@ -276,6 +283,7 @@ explicit override.
|
|
|
276
283
|
| `UNSUPPORTED_PLATFORM_CURRENCY` | no | The platform does not support that currency. Use its `capabilities()` currencies. |
|
|
277
284
|
| `AMOUNT_BELOW_MINIMUM` | no | Amount is below the $0.01 hard floor. The recommended minimum is 1 USDC. |
|
|
278
285
|
| `INVALID_INTENT_AMOUNT_RANGE` | no | Min/max is non-positive, inverted, or exceeds the deposit. Correct the range. |
|
|
286
|
+
| `INVALID_PAYOUT_CURRENCIES` | no | The currency set is empty or contains duplicates. Pass a non-empty unique set from `capabilities()`. |
|
|
279
287
|
| `PAYEE_VERIFICATION_REQUIRED` | no | A new Wise/PayPal payee needs an attestation. Register it through Peer first; an existing registration can be reused. |
|
|
280
288
|
| `PAYEE_REGISTRATION_FAILED` | yes | Curator rejected the handle or was unavailable. Check `payeeHint` and retry. |
|
|
281
289
|
| `SOURCE_ROUTE_UNSUPPORTED_IN_PREPARE` | no | `prepare()` accepts Base USDC only. Use signed source execution, or complete Relay first and then prepare the Base cashout. |
|
|
@@ -290,6 +298,7 @@ explicit override.
|
|
|
290
298
|
| `SOURCE_CASHOUT_STATUS_UNKNOWN` | no | Relay completed and the Base tx was submitted, but its receipt is unknown. Inspect `depositTxHash`; do not resubmit while status is unknown. |
|
|
291
299
|
| `INSUFFICIENT_TOKEN_BALANCE` | no | Wallet lacks the required token amount. Fund it, then retry. |
|
|
292
300
|
| `ALLOWANCE_NOT_VISIBLE` | yes | Approval mined but a stale RPC replica hid it. Retry the same call after the allowance becomes visible. |
|
|
301
|
+
| `TRANSACTION_REJECTED` | yes | The wallet request was cancelled before broadcast. Retry when ready. |
|
|
293
302
|
| `TRANSACTION_FAILED` | no | The on-chain call failed or reverted. Inspect the cause and transaction before another action. |
|
|
294
303
|
| `TRANSACTION_SUBMISSION_UNKNOWN` | no | A Base mutation returned no hash but may have broadcast. Inspect wallet/protocol state and its recovery action before any retry. |
|
|
295
304
|
| `TRANSACTION_STATUS_UNKNOWN` | no | A transaction was submitted but its receipt is unknown. Inspect `recovery.transactionHash` before resubmitting. |
|
package/llms.txt
CHANGED
|
@@ -29,8 +29,8 @@ Key facts:
|
|
|
29
29
|
- Progressive UIs can call estimate(input, { includeEta: false }) so the
|
|
30
30
|
oracle rate is not blocked by indexer history, then load the exact pair from
|
|
31
31
|
fillStats() separately.
|
|
32
|
-
- capabilities() exposes one Zelle platform. A zelle cashout
|
|
33
|
-
|
|
32
|
+
- capabilities() exposes one Zelle platform. A zelle cashout attaches only the
|
|
33
|
+
generic Zelle payment method to the on-chain deposit.
|
|
34
34
|
- Resume any order from its depositId alone (composite escrow_onchainId).
|
|
35
35
|
- One unwind verb: withdraw(depositId) - prunes expired intents automatically;
|
|
36
36
|
pass amount for a partial withdrawal of the unlocked balance.
|
|
@@ -56,6 +56,8 @@ Key facts:
|
|
|
56
56
|
payment id, released USDC, and fill latency after the proof.
|
|
57
57
|
- Orders carry their payout legs (platform, currency, payee hash) plus a
|
|
58
58
|
verifiable pricing proof (spreadBps: 0, oracle kind) from indexed data.
|
|
59
|
+
- Order reads fail closed when any deposit method is absent from the active
|
|
60
|
+
catalog; mixed historical deposits are never partially reclassified.
|
|
59
61
|
- buyer(address) aggregates a buyer's track record (fulfilled/pruned/success
|
|
60
62
|
rate) from their full intent history.
|
|
61
63
|
- Default path is same-chain Base USDC. Optional `source` on `cashout()` runs
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zkp2p/cash",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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": "^0.
|
|
109
|
+
"@zkp2p/sdk": "^0.9.0",
|
|
110
110
|
"zod": "^3.25.76"
|
|
111
111
|
},
|
|
112
112
|
"peerDependencies": {
|