@zkp2p/cash 0.2.0 → 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 +21 -3
- package/README.md +51 -5
- package/dist/{chunk-TR6JVYYF.js → chunk-5VBP3IWK.js} +59 -2
- package/dist/{createCashClient-CTEXn9FF.d.cts → createCashClient-DGMd8Swr.d.cts} +50 -19
- package/dist/{createCashClient-CTEXn9FF.d.ts → createCashClient-DGMd8Swr.d.ts} +50 -19
- package/dist/index.cjs +243 -38
- package/dist/index.d.cts +18 -10
- package/dist/index.d.ts +18 -10
- package/dist/index.js +186 -40
- 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 +8 -2
- package/llms.txt +5 -4
- package/package.json +2 -2
package/dist/tools.d.cts
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.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.
|
|
3
|
+
version: "0.3.0-rc.0"};
|
|
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,7 +132,9 @@ 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<
|
|
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
|
|
134
138
|
fills are reported as `zelle:USD`. Consumers own thresholding; the recommended
|
|
135
139
|
gate is `fills >= 10 && medianFillSeconds <= 48h`, with a fail-open fallback to
|
|
136
140
|
the full capability catalog when the read fails or filtering would empty it.
|
|
@@ -281,6 +285,7 @@ explicit override.
|
|
|
281
285
|
| `UNSUPPORTED_PLATFORM_CURRENCY` | no | The platform does not support that currency. Use its `capabilities()` currencies. |
|
|
282
286
|
| `AMOUNT_BELOW_MINIMUM` | no | Amount is below the $0.01 hard floor. The recommended minimum is 1 USDC. |
|
|
283
287
|
| `INVALID_INTENT_AMOUNT_RANGE` | no | Min/max is non-positive, inverted, or exceeds the deposit. Correct the range. |
|
|
288
|
+
| `INVALID_PAYOUT_CURRENCIES` | no | The currency set is empty or contains duplicates. Pass a non-empty unique set from `capabilities()`. |
|
|
284
289
|
| `PAYEE_VERIFICATION_REQUIRED` | no | A new Wise/PayPal payee needs an attestation. Register it through Peer first; an existing registration can be reused. |
|
|
285
290
|
| `PAYEE_REGISTRATION_FAILED` | yes | Curator rejected the handle or was unavailable. Check `payeeHint` and retry. |
|
|
286
291
|
| `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. |
|
|
@@ -295,6 +300,7 @@ explicit override.
|
|
|
295
300
|
| `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. |
|
|
296
301
|
| `INSUFFICIENT_TOKEN_BALANCE` | no | Wallet lacks the required token amount. Fund it, then retry. |
|
|
297
302
|
| `ALLOWANCE_NOT_VISIBLE` | yes | Approval mined but a stale RPC replica hid it. Retry the same call after the allowance becomes visible. |
|
|
303
|
+
| `TRANSACTION_REJECTED` | yes | The wallet request was cancelled before broadcast. Retry when ready. |
|
|
298
304
|
| `TRANSACTION_FAILED` | no | The on-chain call failed or reverted. Inspect the cause and transaction before another action. |
|
|
299
305
|
| `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. |
|
|
300
306
|
| `TRANSACTION_STATUS_UNKNOWN` | no | A transaction was submitted but its receipt is unknown. Inspect `recovery.transactionHash` before resubmitting. |
|
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": {
|