@zkp2p/cash 0.1.0-dev.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 +131 -0
- package/LICENSE +21 -0
- package/README.md +138 -0
- package/dist/chunk-4DRZRWWS.js +176 -0
- package/dist/chunk-4DRZRWWS.js.map +1 -0
- package/dist/createCashClient-DpAx9A1A.d.cts +449 -0
- package/dist/createCashClient-DpAx9A1A.d.ts +449 -0
- package/dist/index.cjs +1572 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1367 -0
- package/dist/index.d.ts +1367 -0
- package/dist/index.js +1322 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +292 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +97 -0
- package/dist/react.d.ts +97 -0
- package/dist/react.js +258 -0
- package/dist/react.js.map +1 -0
- package/dist/tools.cjs +148 -0
- package/dist/tools.cjs.map +1 -0
- package/dist/tools.d.cts +31 -0
- package/dist/tools.d.ts +31 -0
- package/dist/tools.js +145 -0
- package/dist/tools.js.map +1 -0
- package/package.json +89 -0
package/dist/tools.cjs
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/tools/index.ts
|
|
4
|
+
var bigintString = {
|
|
5
|
+
type: "string",
|
|
6
|
+
pattern: "^[0-9]+$",
|
|
7
|
+
description: 'USDC base units (6 decimals) as a decimal string, e.g. "1000000000" for 1000 USDC'
|
|
8
|
+
};
|
|
9
|
+
var depositId = {
|
|
10
|
+
type: "string",
|
|
11
|
+
description: "Composite deposit id (escrow_onchainId) returned by cash_cashout - the resume key"
|
|
12
|
+
};
|
|
13
|
+
var cashTools = [
|
|
14
|
+
{
|
|
15
|
+
name: "cash_capabilities",
|
|
16
|
+
description: "Discover what Peer Cash can do: payout platforms, oracle-priced currencies per platform, payee handle format hints, and amount bounds. Static and side-effect free - call this first.",
|
|
17
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false }
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "cash_estimate",
|
|
21
|
+
description: 'Estimate fiat received for a USDC amount at the live oracle market rate. No payee, no side effects, no expiry - the binding rate resolves at the oracle when a buyer fills, so this is always "approximately", never a committed quote.',
|
|
22
|
+
inputSchema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {
|
|
25
|
+
amount: bigintString,
|
|
26
|
+
currency: {
|
|
27
|
+
type: "string",
|
|
28
|
+
description: 'Fiat currency code from cash_capabilities, e.g. "USD"'
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
required: ["amount", "currency"],
|
|
32
|
+
additionalProperties: false
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "cash_cashout",
|
|
37
|
+
description: "Start a cash-out: registers the payee with the curator and returns UNSIGNED transactions plus same-index steps [approve, createDeposit] for the host to sign and submit (prepare path - signing stays host-side). After submission, parse the depositId from the DepositReceived event or find it via cash_orders, then track with cash_order.",
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: "object",
|
|
40
|
+
properties: {
|
|
41
|
+
amount: bigintString,
|
|
42
|
+
receive: {
|
|
43
|
+
type: "object",
|
|
44
|
+
description: "Where the fiat should arrive",
|
|
45
|
+
properties: {
|
|
46
|
+
platform: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: 'Platform id from cash_capabilities, e.g. "venmo"'
|
|
49
|
+
},
|
|
50
|
+
currency: { type: "string", description: 'Fiat currency code, e.g. "USD"' },
|
|
51
|
+
payee: {
|
|
52
|
+
type: "object",
|
|
53
|
+
description: "Payee handle for the platform",
|
|
54
|
+
properties: {
|
|
55
|
+
offchainId: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: 'The handle, e.g. "@andrew" for Venmo - see payeeHint in cash_capabilities'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
required: ["offchainId"],
|
|
61
|
+
additionalProperties: true
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
required: ["platform", "currency", "payee"],
|
|
65
|
+
additionalProperties: false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
required: ["amount", "receive"],
|
|
69
|
+
additionalProperties: false
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "cash_order",
|
|
74
|
+
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.",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: "object",
|
|
77
|
+
properties: { depositId },
|
|
78
|
+
required: ["depositId"],
|
|
79
|
+
additionalProperties: false
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "cash_orders",
|
|
84
|
+
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.",
|
|
85
|
+
inputSchema: {
|
|
86
|
+
type: "object",
|
|
87
|
+
properties: {
|
|
88
|
+
owner: { type: "string", description: "The maker wallet address (0x...)" },
|
|
89
|
+
inFlight: {
|
|
90
|
+
type: "boolean",
|
|
91
|
+
description: "Only awaiting-buyer / matched / delivering orders"
|
|
92
|
+
},
|
|
93
|
+
limit: { type: "number", description: "Max deposits to scan (default 100)" }
|
|
94
|
+
},
|
|
95
|
+
required: ["owner"],
|
|
96
|
+
additionalProperties: false
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "cash_buyer",
|
|
101
|
+
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?".`,
|
|
102
|
+
inputSchema: {
|
|
103
|
+
type: "object",
|
|
104
|
+
properties: {
|
|
105
|
+
address: { type: "string", description: "The buyer (taker) wallet address (0x...)" }
|
|
106
|
+
},
|
|
107
|
+
required: ["address"],
|
|
108
|
+
additionalProperties: false
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "cash_withdraw",
|
|
113
|
+
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).",
|
|
114
|
+
inputSchema: {
|
|
115
|
+
type: "object",
|
|
116
|
+
properties: {
|
|
117
|
+
depositId,
|
|
118
|
+
amount: {
|
|
119
|
+
...bigintString,
|
|
120
|
+
description: "Optional partial amount (USDC base units, decimal string). Omit to close the order fully."
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
required: ["depositId"],
|
|
124
|
+
additionalProperties: false
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "cash_topup",
|
|
129
|
+
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.",
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: { depositId, amount: bigintString },
|
|
133
|
+
required: ["depositId", "amount"],
|
|
134
|
+
additionalProperties: false
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
var cashToolManifest = {
|
|
139
|
+
name: "@zkp2p/cash",
|
|
140
|
+
version: "0.1.0-dev.0",
|
|
141
|
+
description: "Peer Cash - offramp-only: cash out Base USDC to fiat at the live oracle market rate (0% spread). Eight verbs; mutating tools return unsigned transactions plus step labels with ERC-8021 peer-cash attribution.",
|
|
142
|
+
tools: cashTools
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
exports.cashToolManifest = cashToolManifest;
|
|
146
|
+
exports.cashTools = cashTools;
|
|
147
|
+
//# sourceMappingURL=tools.cjs.map
|
|
148
|
+
//# sourceMappingURL=tools.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tools/index.ts"],"names":[],"mappings":";;;AAsBA,IAAM,YAAA,GAAe;AAAA,EACnB,IAAA,EAAM,QAAA;AAAA,EACN,OAAA,EAAS,UAAA;AAAA,EACT,WAAA,EAAa;AACf,CAAA;AAEA,IAAM,SAAA,GAAY;AAAA,EAChB,IAAA,EAAM,QAAA;AAAA,EACN,WAAA,EAAa;AACf,CAAA;AAEO,IAAM,SAAA,GAAkC;AAAA,EAC7C;AAAA,IACE,IAAA,EAAM,mBAAA;AAAA,IACN,WAAA,EACE,uLAAA;AAAA,IACF,WAAA,EAAa,EAAE,IAAA,EAAM,QAAA,EAAU,YAAY,EAAC,EAAG,sBAAsB,KAAA;AAAM,GAC7E;AAAA,EACA;AAAA,IACE,IAAA,EAAM,eAAA;AAAA,IACN,WAAA,EACE,yOAAA;AAAA,IACF,WAAA,EAAa;AAAA,MACX,IAAA,EAAM,QAAA;AAAA,MACN,UAAA,EAAY;AAAA,QACV,MAAA,EAAQ,YAAA;AAAA,QACR,QAAA,EAAU;AAAA,UACR,IAAA,EAAM,QAAA;AAAA,UACN,WAAA,EAAa;AAAA;AACf,OACF;AAAA,MACA,QAAA,EAAU,CAAC,QAAA,EAAU,UAAU,CAAA;AAAA,MAC/B,oBAAA,EAAsB;AAAA;AACxB,GACF;AAAA,EACA;AAAA,IACE,IAAA,EAAM,cAAA;AAAA,IACN,WAAA,EACE,gVAAA;AAAA,IACF,WAAA,EAAa;AAAA,MACX,IAAA,EAAM,QAAA;AAAA,MACN,UAAA,EAAY;AAAA,QACV,MAAA,EAAQ,YAAA;AAAA,QACR,OAAA,EAAS;AAAA,UACP,IAAA,EAAM,QAAA;AAAA,UACN,WAAA,E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KAAA,EAAO;AACT","file":"tools.cjs","sourcesContent":["/**\n * `@zkp2p/cash/tools` - JSON-schema tool definitions of the verbs, so\n * agent hosts (peer-cli, zkp2p-mcp, any MCP server or tool-use loop) adopt\n * Peer Cash without re-deriving schemas.\n *\n * Design rules:\n * - Mutating verbs default to the **prepare path**: the tool returns unsigned\n * transactions plus readable step labels; signing stays host-side, where key\n * custody and policy live.\n * - Every input/output is plain JSON (bigints as decimal strings) - see the\n * codecs exported from the package root for lossless (de)serialization.\n * - `watch` is intentionally not a tool: agents poll `cash_order` between\n * other work instead of holding a streaming connection open.\n */\n\nexport interface CashToolDefinition {\n name: string;\n description: string;\n /** JSON Schema (draft-07 compatible) for the tool input. */\n inputSchema: Record<string, unknown>;\n}\n\nconst bigintString = {\n type: 'string',\n pattern: '^[0-9]+$',\n description: 'USDC base units (6 decimals) as a decimal string, e.g. \"1000000000\" for 1000 USDC',\n} as const;\n\nconst depositId = {\n type: 'string',\n description: 'Composite deposit id (escrow_onchainId) returned by cash_cashout - the resume key',\n} as const;\n\nexport const cashTools: CashToolDefinition[] = [\n {\n name: 'cash_capabilities',\n description:\n 'Discover what Peer Cash can do: payout platforms, oracle-priced currencies per platform, payee handle format hints, and amount bounds. Static and side-effect free - call this first.',\n inputSchema: { type: 'object', properties: {}, additionalProperties: false },\n },\n {\n name: 'cash_estimate',\n description:\n 'Estimate fiat received for a USDC amount at the live oracle market rate. No payee, no side effects, no expiry - the binding rate resolves at the oracle when a buyer fills, so this is always \"approximately\", never a committed quote.',\n inputSchema: {\n type: 'object',\n properties: {\n amount: bigintString,\n currency: {\n type: 'string',\n description: 'Fiat currency code from cash_capabilities, e.g. \"USD\"',\n },\n },\n required: ['amount', 'currency'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_cashout',\n description:\n 'Start a cash-out: registers the payee with the curator and returns UNSIGNED transactions plus same-index steps [approve, createDeposit] for the host to sign and submit (prepare path - signing stays host-side). After submission, parse the depositId from the DepositReceived event or find it via cash_orders, then track with cash_order.',\n inputSchema: {\n type: 'object',\n properties: {\n amount: bigintString,\n receive: {\n type: 'object',\n description: 'Where the fiat should arrive',\n properties: {\n platform: {\n type: 'string',\n description: 'Platform id from cash_capabilities, e.g. \"venmo\"',\n },\n currency: { type: 'string', description: 'Fiat currency code, e.g. \"USD\"' },\n payee: {\n type: 'object',\n description: 'Payee handle for the platform',\n properties: {\n offchainId: {\n type: 'string',\n description:\n 'The handle, e.g. \"@andrew\" for Venmo - see payeeHint in cash_capabilities',\n },\n },\n required: ['offchainId'],\n additionalProperties: true,\n },\n },\n required: ['platform', 'currency', 'payee'],\n additionalProperties: false,\n },\n },\n required: ['amount', 'receive'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_order',\n description:\n '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.',\n inputSchema: {\n type: 'object',\n properties: { depositId },\n required: ['depositId'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_orders',\n description:\n '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.',\n inputSchema: {\n type: 'object',\n properties: {\n owner: { type: 'string', description: 'The maker wallet address (0x...)' },\n inFlight: {\n type: 'boolean',\n description: 'Only awaiting-buyer / matched / delivering orders',\n },\n limit: { type: 'number', description: 'Max deposits to scan (default 100)' },\n },\n required: ['owner'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_buyer',\n description:\n '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?\".',\n inputSchema: {\n type: 'object',\n properties: {\n address: { type: 'string', description: 'The buyer (taker) wallet address (0x...)' },\n },\n required: ['address'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_withdraw',\n description:\n '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).',\n inputSchema: {\n type: 'object',\n properties: {\n depositId,\n amount: {\n ...bigintString,\n description:\n 'Optional partial amount (USDC base units, decimal string). Omit to close the order fully.',\n },\n },\n required: ['depositId'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_topup',\n description:\n '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.',\n inputSchema: {\n type: 'object',\n properties: { depositId, amount: bigintString },\n required: ['depositId', 'amount'],\n additionalProperties: false,\n },\n },\n];\n\n/** Manifest wrapper with versioning for host registries. */\nexport const cashToolManifest = {\n name: '@zkp2p/cash',\n version: '0.1.0-dev.0',\n description:\n 'Peer Cash - offramp-only: cash out Base USDC to fiat at the live oracle market rate (0% spread). Eight verbs; mutating tools return unsigned transactions plus step labels with ERC-8021 peer-cash attribution.',\n tools: cashTools,\n} as const;\n\nexport type CashToolName = (typeof cashTools)[number]['name'];\n"]}
|
package/dist/tools.d.cts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@zkp2p/cash/tools` - JSON-schema tool definitions of the verbs, so
|
|
3
|
+
* agent hosts (peer-cli, zkp2p-mcp, any MCP server or tool-use loop) adopt
|
|
4
|
+
* Peer Cash without re-deriving schemas.
|
|
5
|
+
*
|
|
6
|
+
* Design rules:
|
|
7
|
+
* - Mutating verbs default to the **prepare path**: the tool returns unsigned
|
|
8
|
+
* transactions plus readable step labels; signing stays host-side, where key
|
|
9
|
+
* custody and policy live.
|
|
10
|
+
* - Every input/output is plain JSON (bigints as decimal strings) - see the
|
|
11
|
+
* codecs exported from the package root for lossless (de)serialization.
|
|
12
|
+
* - `watch` is intentionally not a tool: agents poll `cash_order` between
|
|
13
|
+
* other work instead of holding a streaming connection open.
|
|
14
|
+
*/
|
|
15
|
+
interface CashToolDefinition {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
/** JSON Schema (draft-07 compatible) for the tool input. */
|
|
19
|
+
inputSchema: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
declare const cashTools: CashToolDefinition[];
|
|
22
|
+
/** Manifest wrapper with versioning for host registries. */
|
|
23
|
+
declare const cashToolManifest: {
|
|
24
|
+
readonly name: "@zkp2p/cash";
|
|
25
|
+
readonly version: "0.1.0-dev.0";
|
|
26
|
+
readonly description: "Peer Cash - offramp-only: cash out Base USDC to fiat at the live oracle market rate (0% spread). Eight verbs; mutating tools return unsigned transactions plus step labels with ERC-8021 peer-cash attribution.";
|
|
27
|
+
readonly tools: CashToolDefinition[];
|
|
28
|
+
};
|
|
29
|
+
type CashToolName = (typeof cashTools)[number]['name'];
|
|
30
|
+
|
|
31
|
+
export { type CashToolDefinition, type CashToolName, cashToolManifest, cashTools };
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@zkp2p/cash/tools` - JSON-schema tool definitions of the verbs, so
|
|
3
|
+
* agent hosts (peer-cli, zkp2p-mcp, any MCP server or tool-use loop) adopt
|
|
4
|
+
* Peer Cash without re-deriving schemas.
|
|
5
|
+
*
|
|
6
|
+
* Design rules:
|
|
7
|
+
* - Mutating verbs default to the **prepare path**: the tool returns unsigned
|
|
8
|
+
* transactions plus readable step labels; signing stays host-side, where key
|
|
9
|
+
* custody and policy live.
|
|
10
|
+
* - Every input/output is plain JSON (bigints as decimal strings) - see the
|
|
11
|
+
* codecs exported from the package root for lossless (de)serialization.
|
|
12
|
+
* - `watch` is intentionally not a tool: agents poll `cash_order` between
|
|
13
|
+
* other work instead of holding a streaming connection open.
|
|
14
|
+
*/
|
|
15
|
+
interface CashToolDefinition {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
/** JSON Schema (draft-07 compatible) for the tool input. */
|
|
19
|
+
inputSchema: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
declare const cashTools: CashToolDefinition[];
|
|
22
|
+
/** Manifest wrapper with versioning for host registries. */
|
|
23
|
+
declare const cashToolManifest: {
|
|
24
|
+
readonly name: "@zkp2p/cash";
|
|
25
|
+
readonly version: "0.1.0-dev.0";
|
|
26
|
+
readonly description: "Peer Cash - offramp-only: cash out Base USDC to fiat at the live oracle market rate (0% spread). Eight verbs; mutating tools return unsigned transactions plus step labels with ERC-8021 peer-cash attribution.";
|
|
27
|
+
readonly tools: CashToolDefinition[];
|
|
28
|
+
};
|
|
29
|
+
type CashToolName = (typeof cashTools)[number]['name'];
|
|
30
|
+
|
|
31
|
+
export { type CashToolDefinition, type CashToolName, cashToolManifest, cashTools };
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// src/tools/index.ts
|
|
2
|
+
var bigintString = {
|
|
3
|
+
type: "string",
|
|
4
|
+
pattern: "^[0-9]+$",
|
|
5
|
+
description: 'USDC base units (6 decimals) as a decimal string, e.g. "1000000000" for 1000 USDC'
|
|
6
|
+
};
|
|
7
|
+
var depositId = {
|
|
8
|
+
type: "string",
|
|
9
|
+
description: "Composite deposit id (escrow_onchainId) returned by cash_cashout - the resume key"
|
|
10
|
+
};
|
|
11
|
+
var cashTools = [
|
|
12
|
+
{
|
|
13
|
+
name: "cash_capabilities",
|
|
14
|
+
description: "Discover what Peer Cash can do: payout platforms, oracle-priced currencies per platform, payee handle format hints, and amount bounds. Static and side-effect free - call this first.",
|
|
15
|
+
inputSchema: { type: "object", properties: {}, additionalProperties: false }
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "cash_estimate",
|
|
19
|
+
description: 'Estimate fiat received for a USDC amount at the live oracle market rate. No payee, no side effects, no expiry - the binding rate resolves at the oracle when a buyer fills, so this is always "approximately", never a committed quote.',
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
amount: bigintString,
|
|
24
|
+
currency: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: 'Fiat currency code from cash_capabilities, e.g. "USD"'
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
required: ["amount", "currency"],
|
|
30
|
+
additionalProperties: false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "cash_cashout",
|
|
35
|
+
description: "Start a cash-out: registers the payee with the curator and returns UNSIGNED transactions plus same-index steps [approve, createDeposit] for the host to sign and submit (prepare path - signing stays host-side). After submission, parse the depositId from the DepositReceived event or find it via cash_orders, then track with cash_order.",
|
|
36
|
+
inputSchema: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
amount: bigintString,
|
|
40
|
+
receive: {
|
|
41
|
+
type: "object",
|
|
42
|
+
description: "Where the fiat should arrive",
|
|
43
|
+
properties: {
|
|
44
|
+
platform: {
|
|
45
|
+
type: "string",
|
|
46
|
+
description: 'Platform id from cash_capabilities, e.g. "venmo"'
|
|
47
|
+
},
|
|
48
|
+
currency: { type: "string", description: 'Fiat currency code, e.g. "USD"' },
|
|
49
|
+
payee: {
|
|
50
|
+
type: "object",
|
|
51
|
+
description: "Payee handle for the platform",
|
|
52
|
+
properties: {
|
|
53
|
+
offchainId: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: 'The handle, e.g. "@andrew" for Venmo - see payeeHint in cash_capabilities'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
required: ["offchainId"],
|
|
59
|
+
additionalProperties: true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
required: ["platform", "currency", "payee"],
|
|
63
|
+
additionalProperties: false
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
required: ["amount", "receive"],
|
|
67
|
+
additionalProperties: false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "cash_order",
|
|
72
|
+
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.",
|
|
73
|
+
inputSchema: {
|
|
74
|
+
type: "object",
|
|
75
|
+
properties: { depositId },
|
|
76
|
+
required: ["depositId"],
|
|
77
|
+
additionalProperties: false
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "cash_orders",
|
|
82
|
+
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.",
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: "object",
|
|
85
|
+
properties: {
|
|
86
|
+
owner: { type: "string", description: "The maker wallet address (0x...)" },
|
|
87
|
+
inFlight: {
|
|
88
|
+
type: "boolean",
|
|
89
|
+
description: "Only awaiting-buyer / matched / delivering orders"
|
|
90
|
+
},
|
|
91
|
+
limit: { type: "number", description: "Max deposits to scan (default 100)" }
|
|
92
|
+
},
|
|
93
|
+
required: ["owner"],
|
|
94
|
+
additionalProperties: false
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "cash_buyer",
|
|
99
|
+
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?".`,
|
|
100
|
+
inputSchema: {
|
|
101
|
+
type: "object",
|
|
102
|
+
properties: {
|
|
103
|
+
address: { type: "string", description: "The buyer (taker) wallet address (0x...)" }
|
|
104
|
+
},
|
|
105
|
+
required: ["address"],
|
|
106
|
+
additionalProperties: false
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: "cash_withdraw",
|
|
111
|
+
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).",
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: "object",
|
|
114
|
+
properties: {
|
|
115
|
+
depositId,
|
|
116
|
+
amount: {
|
|
117
|
+
...bigintString,
|
|
118
|
+
description: "Optional partial amount (USDC base units, decimal string). Omit to close the order fully."
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
required: ["depositId"],
|
|
122
|
+
additionalProperties: false
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "cash_topup",
|
|
127
|
+
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.",
|
|
128
|
+
inputSchema: {
|
|
129
|
+
type: "object",
|
|
130
|
+
properties: { depositId, amount: bigintString },
|
|
131
|
+
required: ["depositId", "amount"],
|
|
132
|
+
additionalProperties: false
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
];
|
|
136
|
+
var cashToolManifest = {
|
|
137
|
+
name: "@zkp2p/cash",
|
|
138
|
+
version: "0.1.0-dev.0",
|
|
139
|
+
description: "Peer Cash - offramp-only: cash out Base USDC to fiat at the live oracle market rate (0% spread). Eight verbs; mutating tools return unsigned transactions plus step labels with ERC-8021 peer-cash attribution.",
|
|
140
|
+
tools: cashTools
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export { cashToolManifest, cashTools };
|
|
144
|
+
//# sourceMappingURL=tools.js.map
|
|
145
|
+
//# sourceMappingURL=tools.js.map
|
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AAAA;AACxB,GACF;AAAA,EACA;AAAA,IACE,IAAA,EAAM,YAAA;AAAA,IACN,WAAA,EACE,CAAA,oOAAA,CAAA;AAAA,IACF,WAAA,EAAa;AAAA,MACX,IAAA,EAAM,QAAA;AAAA,MACN,UAAA,EAAY;AAAA,QACV,OAAA,EAAS,EAAE,IAAA,EAAM,QAAA,EAAU,aAAa,0CAAA;AAA2C,OACrF;AAAA,MACA,QAAA,EAAU,CAAC,SAAS,CAAA;AAAA,MACpB,oBAAA,EAAsB;AAAA;AACxB,GACF;AAAA,EACA;AAAA,IACE,IAAA,EAAM,eAAA;AAAA,IACN,WAAA,EACE,2dAAA;AAAA,IACF,WAAA,EAAa;AAAA,MACX,IAAA,EAAM,QAAA;AAAA,MACN,UAAA,EAAY;AAAA,QACV,SAAA;AAAA,QACA,MAAA,EAAQ;AAAA,UACN,GAAG,YAAA;AAAA,UACH,WAAA,EACE;AAAA;AACJ,OACF;AAAA,MACA,QAAA,EAAU,CAAC,WAAW,CAAA;AAAA,MACtB,oBAAA,EAAsB;AAAA;AACxB,GACF;AAAA,EACA;AAAA,IACE,IAAA,EAAM,YAAA;AAAA,IACN,WAAA,EACE,gQAAA;AAAA,IACF,WAAA,EAAa;AAAA,MACX,IAAA,EAAM,QAAA;AAAA,MACN,UAAA,EAAY,EAAE,SAAA,EAAW,MAAA,EAAQ,YAAA,EAAa;AAAA,MAC9C,QAAA,EAAU,CAAC,WAAA,EAAa,QAAQ,CAAA;AAAA,MAChC,oBAAA,EAAsB;AAAA;AACxB;AAEJ;AAGO,IAAM,gBAAA,GAAmB;AAAA,EAC9B,IAAA,EAAM,aAAA;AAAA,EACN,OAAA,EAAS,aAAA;AAAA,EACT,WAAA,EACE,iNAAA;AAAA,EACF,KAAA,EAAO;AACT","file":"tools.js","sourcesContent":["/**\n * `@zkp2p/cash/tools` - JSON-schema tool definitions of the verbs, so\n * agent hosts (peer-cli, zkp2p-mcp, any MCP server or tool-use loop) adopt\n * Peer Cash without re-deriving schemas.\n *\n * Design rules:\n * - Mutating verbs default to the **prepare path**: the tool returns unsigned\n * transactions plus readable step labels; signing stays host-side, where key\n * custody and policy live.\n * - Every input/output is plain JSON (bigints as decimal strings) - see the\n * codecs exported from the package root for lossless (de)serialization.\n * - `watch` is intentionally not a tool: agents poll `cash_order` between\n * other work instead of holding a streaming connection open.\n */\n\nexport interface CashToolDefinition {\n name: string;\n description: string;\n /** JSON Schema (draft-07 compatible) for the tool input. */\n inputSchema: Record<string, unknown>;\n}\n\nconst bigintString = {\n type: 'string',\n pattern: '^[0-9]+$',\n description: 'USDC base units (6 decimals) as a decimal string, e.g. \"1000000000\" for 1000 USDC',\n} as const;\n\nconst depositId = {\n type: 'string',\n description: 'Composite deposit id (escrow_onchainId) returned by cash_cashout - the resume key',\n} as const;\n\nexport const cashTools: CashToolDefinition[] = [\n {\n name: 'cash_capabilities',\n description:\n 'Discover what Peer Cash can do: payout platforms, oracle-priced currencies per platform, payee handle format hints, and amount bounds. Static and side-effect free - call this first.',\n inputSchema: { type: 'object', properties: {}, additionalProperties: false },\n },\n {\n name: 'cash_estimate',\n description:\n 'Estimate fiat received for a USDC amount at the live oracle market rate. No payee, no side effects, no expiry - the binding rate resolves at the oracle when a buyer fills, so this is always \"approximately\", never a committed quote.',\n inputSchema: {\n type: 'object',\n properties: {\n amount: bigintString,\n currency: {\n type: 'string',\n description: 'Fiat currency code from cash_capabilities, e.g. \"USD\"',\n },\n },\n required: ['amount', 'currency'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_cashout',\n description:\n 'Start a cash-out: registers the payee with the curator and returns UNSIGNED transactions plus same-index steps [approve, createDeposit] for the host to sign and submit (prepare path - signing stays host-side). After submission, parse the depositId from the DepositReceived event or find it via cash_orders, then track with cash_order.',\n inputSchema: {\n type: 'object',\n properties: {\n amount: bigintString,\n receive: {\n type: 'object',\n description: 'Where the fiat should arrive',\n properties: {\n platform: {\n type: 'string',\n description: 'Platform id from cash_capabilities, e.g. \"venmo\"',\n },\n currency: { type: 'string', description: 'Fiat currency code, e.g. \"USD\"' },\n payee: {\n type: 'object',\n description: 'Payee handle for the platform',\n properties: {\n offchainId: {\n type: 'string',\n description:\n 'The handle, e.g. \"@andrew\" for Venmo - see payeeHint in cash_capabilities',\n },\n },\n required: ['offchainId'],\n additionalProperties: true,\n },\n },\n required: ['platform', 'currency', 'payee'],\n additionalProperties: false,\n },\n },\n required: ['amount', 'receive'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_order',\n description:\n '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.',\n inputSchema: {\n type: 'object',\n properties: { depositId },\n required: ['depositId'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_orders',\n description:\n '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.',\n inputSchema: {\n type: 'object',\n properties: {\n owner: { type: 'string', description: 'The maker wallet address (0x...)' },\n inFlight: {\n type: 'boolean',\n description: 'Only awaiting-buyer / matched / delivering orders',\n },\n limit: { type: 'number', description: 'Max deposits to scan (default 100)' },\n },\n required: ['owner'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_buyer',\n description:\n '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?\".',\n inputSchema: {\n type: 'object',\n properties: {\n address: { type: 'string', description: 'The buyer (taker) wallet address (0x...)' },\n },\n required: ['address'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_withdraw',\n description:\n '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).',\n inputSchema: {\n type: 'object',\n properties: {\n depositId,\n amount: {\n ...bigintString,\n description:\n 'Optional partial amount (USDC base units, decimal string). Omit to close the order fully.',\n },\n },\n required: ['depositId'],\n additionalProperties: false,\n },\n },\n {\n name: 'cash_topup',\n description:\n '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.',\n inputSchema: {\n type: 'object',\n properties: { depositId, amount: bigintString },\n required: ['depositId', 'amount'],\n additionalProperties: false,\n },\n },\n];\n\n/** Manifest wrapper with versioning for host registries. */\nexport const cashToolManifest = {\n name: '@zkp2p/cash',\n version: '0.1.0-dev.0',\n description:\n 'Peer Cash - offramp-only: cash out Base USDC to fiat at the live oracle market rate (0% spread). Eight verbs; mutating tools return unsigned transactions plus step labels with ERC-8021 peer-cash attribution.',\n tools: cashTools,\n} as const;\n\nexport type CashToolName = (typeof cashTools)[number]['name'];\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zkp2p/cash",
|
|
3
|
+
"version": "0.1.0-dev.0",
|
|
4
|
+
"description": "Peer Cash - offramp-only SDK for the ZKP2P protocol: eight verbs to cash out Base USDC to fiat at the live oracle market rate.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/zkp2p/peer-cash.git"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/zkp2p/peer-cash#readme",
|
|
16
|
+
"bugs": "https://github.com/zkp2p/peer-cash/issues",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"zkp2p",
|
|
19
|
+
"offramp",
|
|
20
|
+
"usdc",
|
|
21
|
+
"base",
|
|
22
|
+
"crypto-to-fiat",
|
|
23
|
+
"payments",
|
|
24
|
+
"sdk"
|
|
25
|
+
],
|
|
26
|
+
"main": "./dist/index.cjs",
|
|
27
|
+
"module": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js",
|
|
33
|
+
"require": "./dist/index.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./react": {
|
|
36
|
+
"types": "./dist/react.d.ts",
|
|
37
|
+
"import": "./dist/react.js",
|
|
38
|
+
"require": "./dist/react.cjs"
|
|
39
|
+
},
|
|
40
|
+
"./tools": {
|
|
41
|
+
"types": "./dist/tools.d.ts",
|
|
42
|
+
"import": "./dist/tools.js",
|
|
43
|
+
"require": "./dist/tools.cjs"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"files": [
|
|
47
|
+
"dist",
|
|
48
|
+
"AGENTS.md",
|
|
49
|
+
"README.md",
|
|
50
|
+
"LICENSE"
|
|
51
|
+
],
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsup",
|
|
54
|
+
"typecheck": "tsc --noEmit",
|
|
55
|
+
"lint": "eslint src test examples",
|
|
56
|
+
"format": "prettier --write .",
|
|
57
|
+
"format:check": "prettier --check .",
|
|
58
|
+
"test": "vitest run",
|
|
59
|
+
"test:watch": "vitest",
|
|
60
|
+
"ci": "bun run typecheck && bun run lint && bun run format:check && bun run test && bun run build"
|
|
61
|
+
},
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@zkp2p/sdk": "^0.8.0",
|
|
64
|
+
"zod": "^3.24.1"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"react": ">=18",
|
|
68
|
+
"viem": "^2.21.0"
|
|
69
|
+
},
|
|
70
|
+
"peerDependenciesMeta": {
|
|
71
|
+
"react": {
|
|
72
|
+
"optional": true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@eslint/js": "^9.17.0",
|
|
77
|
+
"@types/node": "^22.10.2",
|
|
78
|
+
"@types/react": "^19.0.2",
|
|
79
|
+
"eslint": "^9.17.0",
|
|
80
|
+
"eslint-config-prettier": "^9.1.0",
|
|
81
|
+
"prettier": "^3.4.2",
|
|
82
|
+
"react": "^19.0.0",
|
|
83
|
+
"tsup": "^8.3.5",
|
|
84
|
+
"typescript": "^5.7.2",
|
|
85
|
+
"typescript-eslint": "^8.18.1",
|
|
86
|
+
"viem": "^2.21.0",
|
|
87
|
+
"vitest": "^2.1.8"
|
|
88
|
+
}
|
|
89
|
+
}
|