@zkp2p/cash 0.1.2 → 0.1.4
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 +92 -28
- package/README.md +69 -25
- package/dist/chunk-P3KYZ2FX.js +373 -0
- package/dist/{createCashClient-iHuGgjH_.d.cts → createCashClient-BbkfxILl.d.cts} +37 -8
- package/dist/{createCashClient-iHuGgjH_.d.ts → createCashClient-BbkfxILl.d.ts} +37 -8
- package/dist/index.cjs +1099 -254
- package/dist/index.d.cts +1554 -74
- package/dist/index.d.ts +1554 -74
- package/dist/index.js +886 -248
- package/dist/react.cjs +239 -59
- package/dist/react.d.cts +6 -4
- package/dist/react.d.ts +6 -4
- package/dist/react.js +236 -59
- package/dist/tools.cjs +36 -36
- package/dist/tools.d.cts +282 -3
- package/dist/tools.d.ts +282 -3
- package/dist/tools.js +36 -36
- package/docs/lifecycle-and-recovery.md +278 -0
- package/examples/agent-tool-use.ts +122 -0
- package/examples/node-cashout.ts +79 -0
- package/llms.txt +23 -5
- package/package.json +51 -21
- package/skills/peer-cash-integration/SKILL.md +82 -19
- package/dist/chunk-FKVPZVFH.js +0 -188
- package/dist/chunk-FKVPZVFH.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/react.cjs.map +0 -1
- package/dist/react.js.map +0 -1
- package/dist/tools.cjs.map +0 -1
- package/dist/tools.js.map +0 -1
package/dist/tools.d.cts
CHANGED
|
@@ -18,14 +18,293 @@ interface CashToolDefinition {
|
|
|
18
18
|
/** JSON Schema (draft-07 compatible) for the tool input. */
|
|
19
19
|
inputSchema: Record<string, unknown>;
|
|
20
20
|
}
|
|
21
|
+
declare const builtInCashTools: readonly [{
|
|
22
|
+
readonly name: "cash_capabilities";
|
|
23
|
+
readonly description: "Discover what Peer Cash can do: payout platforms, oracle-priced currencies per platform, Base USDC destination, default Base USDC source, payee handle hints, and amount bounds. Set includeRelaySources=true to fetch live Relay-supported EVM source chains/tokens through the Relay SDK.";
|
|
24
|
+
readonly inputSchema: {
|
|
25
|
+
readonly type: "object";
|
|
26
|
+
readonly properties: {
|
|
27
|
+
readonly includeRelaySources: {
|
|
28
|
+
readonly type: "boolean";
|
|
29
|
+
readonly description: "Fetch live Relay SDK EVM source chain/token metadata.";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
readonly additionalProperties: false;
|
|
33
|
+
};
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "cash_source_quote";
|
|
36
|
+
readonly description: "Quote any Relay-supported EVM source asset into Base USDC through @relayprotocol/relay-sdk. A custody-capable host must submit the returned route, poll cash_source_status to success, then call Base-USDC cash_cashout with the guaranteed output amount. Never submit the route twice.";
|
|
37
|
+
readonly inputSchema: {
|
|
38
|
+
readonly type: "object";
|
|
39
|
+
readonly properties: {
|
|
40
|
+
readonly user: {
|
|
41
|
+
readonly description: "Source wallet submitting the Relay transaction.";
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
44
|
+
};
|
|
45
|
+
readonly amount: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly pattern: "^0*[1-9][0-9]*$";
|
|
48
|
+
readonly description: "Base units as a decimal string. For the default path this is USDC 6 decimals; with source it is source-token base units.";
|
|
49
|
+
};
|
|
50
|
+
readonly source: {
|
|
51
|
+
readonly type: "object";
|
|
52
|
+
readonly properties: {
|
|
53
|
+
readonly chainId: {
|
|
54
|
+
readonly description: "Relay-supported EVM source chain id.";
|
|
55
|
+
readonly type: "integer";
|
|
56
|
+
readonly minimum: 1;
|
|
57
|
+
readonly maximum: number;
|
|
58
|
+
};
|
|
59
|
+
readonly currency: {
|
|
60
|
+
readonly description: "Source token/native address.";
|
|
61
|
+
readonly type: "string";
|
|
62
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly required: readonly ["chainId", "currency"];
|
|
66
|
+
readonly additionalProperties: false;
|
|
67
|
+
};
|
|
68
|
+
readonly recipient: {
|
|
69
|
+
readonly description: "Base recipient for Relay-delivered USDC. Defaults to user.";
|
|
70
|
+
readonly type: "string";
|
|
71
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
72
|
+
};
|
|
73
|
+
readonly tradeType: {
|
|
74
|
+
readonly type: "string";
|
|
75
|
+
readonly enum: readonly ["EXACT_INPUT", "EXACT_OUTPUT", "EXPECTED_OUTPUT"];
|
|
76
|
+
readonly description: "Relay quote trade type. Defaults to EXACT_INPUT.";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly required: readonly ["user", "amount", "source"];
|
|
80
|
+
readonly additionalProperties: false;
|
|
81
|
+
};
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "cash_estimate";
|
|
84
|
+
readonly description: "Estimate fiat received at the live oracle market rate and include a simple recent-fill ETA. Without source, amount is Base USDC. With source, the SDK first quotes source->Base USDC through Relay SDK, then estimates the cashout.";
|
|
85
|
+
readonly inputSchema: {
|
|
86
|
+
readonly type: "object";
|
|
87
|
+
readonly properties: {
|
|
88
|
+
readonly amount: {
|
|
89
|
+
readonly type: "string";
|
|
90
|
+
readonly pattern: "^0*[1-9][0-9]*$";
|
|
91
|
+
readonly description: "Base units as a decimal string. For the default path this is USDC 6 decimals; with source it is source-token base units.";
|
|
92
|
+
};
|
|
93
|
+
readonly currency: {
|
|
94
|
+
readonly type: "string";
|
|
95
|
+
readonly description: "Fiat currency code from cash_capabilities, e.g. \"USD\"";
|
|
96
|
+
};
|
|
97
|
+
readonly platform: {
|
|
98
|
+
readonly type: "string";
|
|
99
|
+
readonly description: "Optional payout platform for platform-specific ETA sampling.";
|
|
100
|
+
};
|
|
101
|
+
readonly source: {
|
|
102
|
+
readonly type: "object";
|
|
103
|
+
readonly description: "Optional Relay EVM source asset. Omit for the Base USDC default path.";
|
|
104
|
+
readonly properties: {
|
|
105
|
+
readonly chainId: {
|
|
106
|
+
readonly description: "Relay-supported EVM source chain id.";
|
|
107
|
+
readonly type: "integer";
|
|
108
|
+
readonly minimum: 1;
|
|
109
|
+
readonly maximum: number;
|
|
110
|
+
};
|
|
111
|
+
readonly currency: {
|
|
112
|
+
readonly description: "Source token/native address.";
|
|
113
|
+
readonly type: "string";
|
|
114
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
115
|
+
};
|
|
116
|
+
readonly user: {
|
|
117
|
+
readonly description: "Source wallet submitting the Relay transaction.";
|
|
118
|
+
readonly type: "string";
|
|
119
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
120
|
+
};
|
|
121
|
+
readonly recipient: {
|
|
122
|
+
readonly description: "Base recipient for Relay-delivered USDC. Defaults to user.";
|
|
123
|
+
readonly type: "string";
|
|
124
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
125
|
+
};
|
|
126
|
+
readonly tradeType: {
|
|
127
|
+
readonly type: "string";
|
|
128
|
+
readonly enum: readonly ["EXACT_INPUT", "EXACT_OUTPUT", "EXPECTED_OUTPUT"];
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
readonly required: readonly ["chainId", "currency", "user"];
|
|
132
|
+
readonly additionalProperties: false;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
readonly required: readonly ["amount", "currency"];
|
|
136
|
+
readonly additionalProperties: false;
|
|
137
|
+
};
|
|
138
|
+
}, {
|
|
139
|
+
readonly name: "cash_cashout";
|
|
140
|
+
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.";
|
|
141
|
+
readonly inputSchema: {
|
|
142
|
+
readonly type: "object";
|
|
143
|
+
readonly properties: {
|
|
144
|
+
readonly amount: {
|
|
145
|
+
readonly type: "string";
|
|
146
|
+
readonly pattern: "^0*[1-9][0-9]*$";
|
|
147
|
+
readonly description: "Base units as a decimal string. For the default path this is USDC 6 decimals; with source it is source-token base units.";
|
|
148
|
+
};
|
|
149
|
+
readonly receive: {
|
|
150
|
+
readonly type: "object";
|
|
151
|
+
readonly description: "Where the fiat should arrive";
|
|
152
|
+
readonly properties: {
|
|
153
|
+
readonly platform: {
|
|
154
|
+
readonly type: "string";
|
|
155
|
+
readonly description: "Platform id from cash_capabilities, e.g. \"venmo\"";
|
|
156
|
+
};
|
|
157
|
+
readonly currency: {
|
|
158
|
+
readonly type: "string";
|
|
159
|
+
readonly description: "Fiat currency code, e.g. \"USD\"";
|
|
160
|
+
};
|
|
161
|
+
readonly payee: {
|
|
162
|
+
readonly type: "object";
|
|
163
|
+
readonly description: "Payee handle for the platform";
|
|
164
|
+
readonly properties: {
|
|
165
|
+
readonly offchainId: {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
readonly description: "The handle, e.g. \"@andrew\" for Venmo - see payeeHint in cash_capabilities";
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
readonly required: readonly ["offchainId"];
|
|
171
|
+
readonly additionalProperties: true;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
readonly required: readonly ["platform", "currency", "payee"];
|
|
175
|
+
readonly additionalProperties: false;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
readonly required: readonly ["amount", "receive"];
|
|
179
|
+
readonly additionalProperties: false;
|
|
180
|
+
};
|
|
181
|
+
}, {
|
|
182
|
+
readonly name: "cash_order";
|
|
183
|
+
readonly description: "Observe one cash-out order by depositId - fully resumable, no session state. Returns state (awaiting-buyer | matched | delivering | delivered | returned), amounts, fills, and nextActions (wait | withdraw). Errors are typed with retryable + remediation; ORDER_NOT_FOUND right after cashout means indexer lag - retry in a few seconds.";
|
|
184
|
+
readonly inputSchema: {
|
|
185
|
+
readonly type: "object";
|
|
186
|
+
readonly properties: {
|
|
187
|
+
readonly depositId: {
|
|
188
|
+
readonly type: "string";
|
|
189
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}_[0-9]+$";
|
|
190
|
+
readonly description: "Composite deposit id (escrow_onchainId) returned by cash_cashout - the resume key";
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
readonly required: readonly ["depositId"];
|
|
194
|
+
readonly additionalProperties: false;
|
|
195
|
+
};
|
|
196
|
+
}, {
|
|
197
|
+
readonly name: "cash_orders";
|
|
198
|
+
readonly description: "List all cash-out orders for a wallet address (the chain is the database - a cash order IS a deposit, keyed by depositor). Use inFlight=true for only the orders still needing attention.";
|
|
199
|
+
readonly inputSchema: {
|
|
200
|
+
readonly type: "object";
|
|
201
|
+
readonly properties: {
|
|
202
|
+
readonly owner: {
|
|
203
|
+
readonly description: "The maker wallet address (0x...)";
|
|
204
|
+
readonly type: "string";
|
|
205
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
206
|
+
};
|
|
207
|
+
readonly inFlight: {
|
|
208
|
+
readonly type: "boolean";
|
|
209
|
+
readonly description: "Only awaiting-buyer / matched / delivering orders";
|
|
210
|
+
};
|
|
211
|
+
readonly limit: {
|
|
212
|
+
readonly type: "integer";
|
|
213
|
+
readonly minimum: 1;
|
|
214
|
+
readonly maximum: 1000;
|
|
215
|
+
readonly description: "Max deposits to scan (default 100)";
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
readonly required: readonly ["owner"];
|
|
219
|
+
readonly additionalProperties: false;
|
|
220
|
+
};
|
|
221
|
+
}, {
|
|
222
|
+
readonly name: "cash_buyer";
|
|
223
|
+
readonly description: "Look up a buyer's protocol track record from their full intent history: lifetime intents, fulfilled vs pruned counts, success rate (bps), first/last seen. Use during the matched state to answer \"who just committed to my order?\".";
|
|
224
|
+
readonly inputSchema: {
|
|
225
|
+
readonly type: "object";
|
|
226
|
+
readonly properties: {
|
|
227
|
+
readonly address: {
|
|
228
|
+
readonly description: "The buyer (taker) wallet address (0x...)";
|
|
229
|
+
readonly type: "string";
|
|
230
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
readonly required: readonly ["address"];
|
|
234
|
+
readonly additionalProperties: false;
|
|
235
|
+
};
|
|
236
|
+
}, {
|
|
237
|
+
readonly name: "cash_source_status";
|
|
238
|
+
readonly description: "Read Relay request status through the Relay SDK request utility using the requestId returned from cash_source_quote or Relay execution progress.";
|
|
239
|
+
readonly inputSchema: {
|
|
240
|
+
readonly type: "object";
|
|
241
|
+
readonly properties: {
|
|
242
|
+
readonly requestId: {
|
|
243
|
+
readonly type: "string";
|
|
244
|
+
readonly description: "Relay request id.";
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
readonly required: readonly ["requestId"];
|
|
248
|
+
readonly additionalProperties: false;
|
|
249
|
+
};
|
|
250
|
+
}, {
|
|
251
|
+
readonly name: "cash_withdraw";
|
|
252
|
+
readonly description: "Unwind a cash-out: returns UNSIGNED transaction(s) plus same-index steps (prepare path - signing stays host-side). With amount: partial withdrawal of the unlocked balance (a live buyer intent does not block it). Without amount: closes the order fully, state-aware - when the only live intents have expired it includes a pruneExpiredIntents transaction first; while a live buyer intent locks funds it fails with ACTIVE_INTENT_BLOCKS_WITHDRAWAL (retryable - wait for expiry).";
|
|
253
|
+
readonly inputSchema: {
|
|
254
|
+
readonly type: "object";
|
|
255
|
+
readonly properties: {
|
|
256
|
+
readonly depositId: {
|
|
257
|
+
readonly type: "string";
|
|
258
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}_[0-9]+$";
|
|
259
|
+
readonly description: "Composite deposit id (escrow_onchainId) returned by cash_cashout - the resume key";
|
|
260
|
+
};
|
|
261
|
+
readonly amount: {
|
|
262
|
+
readonly description: "Optional partial amount (USDC base units, decimal string). Omit to close the order fully.";
|
|
263
|
+
readonly type: "string";
|
|
264
|
+
readonly pattern: "^0*[1-9][0-9]*$";
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
readonly required: readonly ["depositId"];
|
|
268
|
+
readonly additionalProperties: false;
|
|
269
|
+
};
|
|
270
|
+
}, {
|
|
271
|
+
readonly name: "cash_topup";
|
|
272
|
+
readonly description: "Add USDC to a live cash-out order (same payee, same market rate). Returns UNSIGNED transactions plus same-index steps [approve, addFunds] for the host to sign and submit in order. Fails with ORDER_NOT_ACTIVE if the order is already delivered or returned.";
|
|
273
|
+
readonly inputSchema: {
|
|
274
|
+
readonly type: "object";
|
|
275
|
+
readonly properties: {
|
|
276
|
+
readonly depositId: {
|
|
277
|
+
readonly type: "string";
|
|
278
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}_[0-9]+$";
|
|
279
|
+
readonly description: "Composite deposit id (escrow_onchainId) returned by cash_cashout - the resume key";
|
|
280
|
+
};
|
|
281
|
+
readonly amount: {
|
|
282
|
+
readonly type: "string";
|
|
283
|
+
readonly pattern: "^0*[1-9][0-9]*$";
|
|
284
|
+
readonly description: "Base units as a decimal string. For the default path this is USDC 6 decimals; with source it is source-token base units.";
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
readonly required: readonly ["depositId", "amount"];
|
|
288
|
+
readonly additionalProperties: false;
|
|
289
|
+
};
|
|
290
|
+
}];
|
|
291
|
+
/** Literal names shipped by this package. Use this for exhaustive built-in dispatch. */
|
|
292
|
+
type BuiltInCashToolName = (typeof builtInCashTools)[number]['name'];
|
|
293
|
+
/**
|
|
294
|
+
* Mutable tool registry for hosts that append their own definitions.
|
|
295
|
+
*
|
|
296
|
+
* This was part of the 0.1.x public contract: keep the element name open as a
|
|
297
|
+
* string rather than narrowing consumers to only the built-in verbs.
|
|
298
|
+
*/
|
|
21
299
|
declare const cashTools: CashToolDefinition[];
|
|
22
300
|
/** Manifest wrapper with versioning for host registries. */
|
|
23
301
|
declare const cashToolManifest: {
|
|
24
302
|
readonly name: "@zkp2p/cash";
|
|
25
|
-
readonly version:
|
|
303
|
+
readonly version: string;
|
|
26
304
|
readonly description: "Peer Cash - offramp-only: route any Relay-supported EVM source asset to Base USDC, then cash out to fiat at the live oracle market rate (0% spread). Mutating protocol tools return unsigned transactions plus step labels with ERC-8021 peer-cash attribution.";
|
|
27
305
|
readonly tools: CashToolDefinition[];
|
|
28
306
|
};
|
|
29
|
-
|
|
307
|
+
/** Tool names accepted by an extensible host registry, including custom tools. */
|
|
308
|
+
type CashToolName = string;
|
|
30
309
|
|
|
31
|
-
export { type CashToolDefinition, type CashToolName, cashToolManifest, cashTools };
|
|
310
|
+
export { type BuiltInCashToolName, type CashToolDefinition, type CashToolName, cashToolManifest, cashTools };
|
package/dist/tools.d.ts
CHANGED
|
@@ -18,14 +18,293 @@ interface CashToolDefinition {
|
|
|
18
18
|
/** JSON Schema (draft-07 compatible) for the tool input. */
|
|
19
19
|
inputSchema: Record<string, unknown>;
|
|
20
20
|
}
|
|
21
|
+
declare const builtInCashTools: readonly [{
|
|
22
|
+
readonly name: "cash_capabilities";
|
|
23
|
+
readonly description: "Discover what Peer Cash can do: payout platforms, oracle-priced currencies per platform, Base USDC destination, default Base USDC source, payee handle hints, and amount bounds. Set includeRelaySources=true to fetch live Relay-supported EVM source chains/tokens through the Relay SDK.";
|
|
24
|
+
readonly inputSchema: {
|
|
25
|
+
readonly type: "object";
|
|
26
|
+
readonly properties: {
|
|
27
|
+
readonly includeRelaySources: {
|
|
28
|
+
readonly type: "boolean";
|
|
29
|
+
readonly description: "Fetch live Relay SDK EVM source chain/token metadata.";
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
readonly additionalProperties: false;
|
|
33
|
+
};
|
|
34
|
+
}, {
|
|
35
|
+
readonly name: "cash_source_quote";
|
|
36
|
+
readonly description: "Quote any Relay-supported EVM source asset into Base USDC through @relayprotocol/relay-sdk. A custody-capable host must submit the returned route, poll cash_source_status to success, then call Base-USDC cash_cashout with the guaranteed output amount. Never submit the route twice.";
|
|
37
|
+
readonly inputSchema: {
|
|
38
|
+
readonly type: "object";
|
|
39
|
+
readonly properties: {
|
|
40
|
+
readonly user: {
|
|
41
|
+
readonly description: "Source wallet submitting the Relay transaction.";
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
44
|
+
};
|
|
45
|
+
readonly amount: {
|
|
46
|
+
readonly type: "string";
|
|
47
|
+
readonly pattern: "^0*[1-9][0-9]*$";
|
|
48
|
+
readonly description: "Base units as a decimal string. For the default path this is USDC 6 decimals; with source it is source-token base units.";
|
|
49
|
+
};
|
|
50
|
+
readonly source: {
|
|
51
|
+
readonly type: "object";
|
|
52
|
+
readonly properties: {
|
|
53
|
+
readonly chainId: {
|
|
54
|
+
readonly description: "Relay-supported EVM source chain id.";
|
|
55
|
+
readonly type: "integer";
|
|
56
|
+
readonly minimum: 1;
|
|
57
|
+
readonly maximum: number;
|
|
58
|
+
};
|
|
59
|
+
readonly currency: {
|
|
60
|
+
readonly description: "Source token/native address.";
|
|
61
|
+
readonly type: "string";
|
|
62
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
readonly required: readonly ["chainId", "currency"];
|
|
66
|
+
readonly additionalProperties: false;
|
|
67
|
+
};
|
|
68
|
+
readonly recipient: {
|
|
69
|
+
readonly description: "Base recipient for Relay-delivered USDC. Defaults to user.";
|
|
70
|
+
readonly type: "string";
|
|
71
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
72
|
+
};
|
|
73
|
+
readonly tradeType: {
|
|
74
|
+
readonly type: "string";
|
|
75
|
+
readonly enum: readonly ["EXACT_INPUT", "EXACT_OUTPUT", "EXPECTED_OUTPUT"];
|
|
76
|
+
readonly description: "Relay quote trade type. Defaults to EXACT_INPUT.";
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly required: readonly ["user", "amount", "source"];
|
|
80
|
+
readonly additionalProperties: false;
|
|
81
|
+
};
|
|
82
|
+
}, {
|
|
83
|
+
readonly name: "cash_estimate";
|
|
84
|
+
readonly description: "Estimate fiat received at the live oracle market rate and include a simple recent-fill ETA. Without source, amount is Base USDC. With source, the SDK first quotes source->Base USDC through Relay SDK, then estimates the cashout.";
|
|
85
|
+
readonly inputSchema: {
|
|
86
|
+
readonly type: "object";
|
|
87
|
+
readonly properties: {
|
|
88
|
+
readonly amount: {
|
|
89
|
+
readonly type: "string";
|
|
90
|
+
readonly pattern: "^0*[1-9][0-9]*$";
|
|
91
|
+
readonly description: "Base units as a decimal string. For the default path this is USDC 6 decimals; with source it is source-token base units.";
|
|
92
|
+
};
|
|
93
|
+
readonly currency: {
|
|
94
|
+
readonly type: "string";
|
|
95
|
+
readonly description: "Fiat currency code from cash_capabilities, e.g. \"USD\"";
|
|
96
|
+
};
|
|
97
|
+
readonly platform: {
|
|
98
|
+
readonly type: "string";
|
|
99
|
+
readonly description: "Optional payout platform for platform-specific ETA sampling.";
|
|
100
|
+
};
|
|
101
|
+
readonly source: {
|
|
102
|
+
readonly type: "object";
|
|
103
|
+
readonly description: "Optional Relay EVM source asset. Omit for the Base USDC default path.";
|
|
104
|
+
readonly properties: {
|
|
105
|
+
readonly chainId: {
|
|
106
|
+
readonly description: "Relay-supported EVM source chain id.";
|
|
107
|
+
readonly type: "integer";
|
|
108
|
+
readonly minimum: 1;
|
|
109
|
+
readonly maximum: number;
|
|
110
|
+
};
|
|
111
|
+
readonly currency: {
|
|
112
|
+
readonly description: "Source token/native address.";
|
|
113
|
+
readonly type: "string";
|
|
114
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
115
|
+
};
|
|
116
|
+
readonly user: {
|
|
117
|
+
readonly description: "Source wallet submitting the Relay transaction.";
|
|
118
|
+
readonly type: "string";
|
|
119
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
120
|
+
};
|
|
121
|
+
readonly recipient: {
|
|
122
|
+
readonly description: "Base recipient for Relay-delivered USDC. Defaults to user.";
|
|
123
|
+
readonly type: "string";
|
|
124
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
125
|
+
};
|
|
126
|
+
readonly tradeType: {
|
|
127
|
+
readonly type: "string";
|
|
128
|
+
readonly enum: readonly ["EXACT_INPUT", "EXACT_OUTPUT", "EXPECTED_OUTPUT"];
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
readonly required: readonly ["chainId", "currency", "user"];
|
|
132
|
+
readonly additionalProperties: false;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
readonly required: readonly ["amount", "currency"];
|
|
136
|
+
readonly additionalProperties: false;
|
|
137
|
+
};
|
|
138
|
+
}, {
|
|
139
|
+
readonly name: "cash_cashout";
|
|
140
|
+
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.";
|
|
141
|
+
readonly inputSchema: {
|
|
142
|
+
readonly type: "object";
|
|
143
|
+
readonly properties: {
|
|
144
|
+
readonly amount: {
|
|
145
|
+
readonly type: "string";
|
|
146
|
+
readonly pattern: "^0*[1-9][0-9]*$";
|
|
147
|
+
readonly description: "Base units as a decimal string. For the default path this is USDC 6 decimals; with source it is source-token base units.";
|
|
148
|
+
};
|
|
149
|
+
readonly receive: {
|
|
150
|
+
readonly type: "object";
|
|
151
|
+
readonly description: "Where the fiat should arrive";
|
|
152
|
+
readonly properties: {
|
|
153
|
+
readonly platform: {
|
|
154
|
+
readonly type: "string";
|
|
155
|
+
readonly description: "Platform id from cash_capabilities, e.g. \"venmo\"";
|
|
156
|
+
};
|
|
157
|
+
readonly currency: {
|
|
158
|
+
readonly type: "string";
|
|
159
|
+
readonly description: "Fiat currency code, e.g. \"USD\"";
|
|
160
|
+
};
|
|
161
|
+
readonly payee: {
|
|
162
|
+
readonly type: "object";
|
|
163
|
+
readonly description: "Payee handle for the platform";
|
|
164
|
+
readonly properties: {
|
|
165
|
+
readonly offchainId: {
|
|
166
|
+
readonly type: "string";
|
|
167
|
+
readonly description: "The handle, e.g. \"@andrew\" for Venmo - see payeeHint in cash_capabilities";
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
readonly required: readonly ["offchainId"];
|
|
171
|
+
readonly additionalProperties: true;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
readonly required: readonly ["platform", "currency", "payee"];
|
|
175
|
+
readonly additionalProperties: false;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
readonly required: readonly ["amount", "receive"];
|
|
179
|
+
readonly additionalProperties: false;
|
|
180
|
+
};
|
|
181
|
+
}, {
|
|
182
|
+
readonly name: "cash_order";
|
|
183
|
+
readonly description: "Observe one cash-out order by depositId - fully resumable, no session state. Returns state (awaiting-buyer | matched | delivering | delivered | returned), amounts, fills, and nextActions (wait | withdraw). Errors are typed with retryable + remediation; ORDER_NOT_FOUND right after cashout means indexer lag - retry in a few seconds.";
|
|
184
|
+
readonly inputSchema: {
|
|
185
|
+
readonly type: "object";
|
|
186
|
+
readonly properties: {
|
|
187
|
+
readonly depositId: {
|
|
188
|
+
readonly type: "string";
|
|
189
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}_[0-9]+$";
|
|
190
|
+
readonly description: "Composite deposit id (escrow_onchainId) returned by cash_cashout - the resume key";
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
readonly required: readonly ["depositId"];
|
|
194
|
+
readonly additionalProperties: false;
|
|
195
|
+
};
|
|
196
|
+
}, {
|
|
197
|
+
readonly name: "cash_orders";
|
|
198
|
+
readonly description: "List all cash-out orders for a wallet address (the chain is the database - a cash order IS a deposit, keyed by depositor). Use inFlight=true for only the orders still needing attention.";
|
|
199
|
+
readonly inputSchema: {
|
|
200
|
+
readonly type: "object";
|
|
201
|
+
readonly properties: {
|
|
202
|
+
readonly owner: {
|
|
203
|
+
readonly description: "The maker wallet address (0x...)";
|
|
204
|
+
readonly type: "string";
|
|
205
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
206
|
+
};
|
|
207
|
+
readonly inFlight: {
|
|
208
|
+
readonly type: "boolean";
|
|
209
|
+
readonly description: "Only awaiting-buyer / matched / delivering orders";
|
|
210
|
+
};
|
|
211
|
+
readonly limit: {
|
|
212
|
+
readonly type: "integer";
|
|
213
|
+
readonly minimum: 1;
|
|
214
|
+
readonly maximum: 1000;
|
|
215
|
+
readonly description: "Max deposits to scan (default 100)";
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
readonly required: readonly ["owner"];
|
|
219
|
+
readonly additionalProperties: false;
|
|
220
|
+
};
|
|
221
|
+
}, {
|
|
222
|
+
readonly name: "cash_buyer";
|
|
223
|
+
readonly description: "Look up a buyer's protocol track record from their full intent history: lifetime intents, fulfilled vs pruned counts, success rate (bps), first/last seen. Use during the matched state to answer \"who just committed to my order?\".";
|
|
224
|
+
readonly inputSchema: {
|
|
225
|
+
readonly type: "object";
|
|
226
|
+
readonly properties: {
|
|
227
|
+
readonly address: {
|
|
228
|
+
readonly description: "The buyer (taker) wallet address (0x...)";
|
|
229
|
+
readonly type: "string";
|
|
230
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}$";
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
readonly required: readonly ["address"];
|
|
234
|
+
readonly additionalProperties: false;
|
|
235
|
+
};
|
|
236
|
+
}, {
|
|
237
|
+
readonly name: "cash_source_status";
|
|
238
|
+
readonly description: "Read Relay request status through the Relay SDK request utility using the requestId returned from cash_source_quote or Relay execution progress.";
|
|
239
|
+
readonly inputSchema: {
|
|
240
|
+
readonly type: "object";
|
|
241
|
+
readonly properties: {
|
|
242
|
+
readonly requestId: {
|
|
243
|
+
readonly type: "string";
|
|
244
|
+
readonly description: "Relay request id.";
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
readonly required: readonly ["requestId"];
|
|
248
|
+
readonly additionalProperties: false;
|
|
249
|
+
};
|
|
250
|
+
}, {
|
|
251
|
+
readonly name: "cash_withdraw";
|
|
252
|
+
readonly description: "Unwind a cash-out: returns UNSIGNED transaction(s) plus same-index steps (prepare path - signing stays host-side). With amount: partial withdrawal of the unlocked balance (a live buyer intent does not block it). Without amount: closes the order fully, state-aware - when the only live intents have expired it includes a pruneExpiredIntents transaction first; while a live buyer intent locks funds it fails with ACTIVE_INTENT_BLOCKS_WITHDRAWAL (retryable - wait for expiry).";
|
|
253
|
+
readonly inputSchema: {
|
|
254
|
+
readonly type: "object";
|
|
255
|
+
readonly properties: {
|
|
256
|
+
readonly depositId: {
|
|
257
|
+
readonly type: "string";
|
|
258
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}_[0-9]+$";
|
|
259
|
+
readonly description: "Composite deposit id (escrow_onchainId) returned by cash_cashout - the resume key";
|
|
260
|
+
};
|
|
261
|
+
readonly amount: {
|
|
262
|
+
readonly description: "Optional partial amount (USDC base units, decimal string). Omit to close the order fully.";
|
|
263
|
+
readonly type: "string";
|
|
264
|
+
readonly pattern: "^0*[1-9][0-9]*$";
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
readonly required: readonly ["depositId"];
|
|
268
|
+
readonly additionalProperties: false;
|
|
269
|
+
};
|
|
270
|
+
}, {
|
|
271
|
+
readonly name: "cash_topup";
|
|
272
|
+
readonly description: "Add USDC to a live cash-out order (same payee, same market rate). Returns UNSIGNED transactions plus same-index steps [approve, addFunds] for the host to sign and submit in order. Fails with ORDER_NOT_ACTIVE if the order is already delivered or returned.";
|
|
273
|
+
readonly inputSchema: {
|
|
274
|
+
readonly type: "object";
|
|
275
|
+
readonly properties: {
|
|
276
|
+
readonly depositId: {
|
|
277
|
+
readonly type: "string";
|
|
278
|
+
readonly pattern: "^0x[0-9a-fA-F]{40}_[0-9]+$";
|
|
279
|
+
readonly description: "Composite deposit id (escrow_onchainId) returned by cash_cashout - the resume key";
|
|
280
|
+
};
|
|
281
|
+
readonly amount: {
|
|
282
|
+
readonly type: "string";
|
|
283
|
+
readonly pattern: "^0*[1-9][0-9]*$";
|
|
284
|
+
readonly description: "Base units as a decimal string. For the default path this is USDC 6 decimals; with source it is source-token base units.";
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
readonly required: readonly ["depositId", "amount"];
|
|
288
|
+
readonly additionalProperties: false;
|
|
289
|
+
};
|
|
290
|
+
}];
|
|
291
|
+
/** Literal names shipped by this package. Use this for exhaustive built-in dispatch. */
|
|
292
|
+
type BuiltInCashToolName = (typeof builtInCashTools)[number]['name'];
|
|
293
|
+
/**
|
|
294
|
+
* Mutable tool registry for hosts that append their own definitions.
|
|
295
|
+
*
|
|
296
|
+
* This was part of the 0.1.x public contract: keep the element name open as a
|
|
297
|
+
* string rather than narrowing consumers to only the built-in verbs.
|
|
298
|
+
*/
|
|
21
299
|
declare const cashTools: CashToolDefinition[];
|
|
22
300
|
/** Manifest wrapper with versioning for host registries. */
|
|
23
301
|
declare const cashToolManifest: {
|
|
24
302
|
readonly name: "@zkp2p/cash";
|
|
25
|
-
readonly version:
|
|
303
|
+
readonly version: string;
|
|
26
304
|
readonly description: "Peer Cash - offramp-only: route any Relay-supported EVM source asset to Base USDC, then cash out to fiat at the live oracle market rate (0% spread). Mutating protocol tools return unsigned transactions plus step labels with ERC-8021 peer-cash attribution.";
|
|
27
305
|
readonly tools: CashToolDefinition[];
|
|
28
306
|
};
|
|
29
|
-
|
|
307
|
+
/** Tool names accepted by an extensible host registry, including custom tools. */
|
|
308
|
+
type CashToolName = string;
|
|
30
309
|
|
|
31
|
-
export { type CashToolDefinition, type CashToolName, cashToolManifest, cashTools };
|
|
310
|
+
export { type BuiltInCashToolName, type CashToolDefinition, type CashToolName, cashToolManifest, cashTools };
|