@daski/pay 0.3.0 → 0.4.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/README.md +18 -11
- package/dist/bin/daski.js +26 -11
- package/dist/bin/daski.js.map +1 -1
- package/dist/chain/reader.d.ts +92 -0
- package/dist/chain/reader.d.ts.map +1 -0
- package/dist/chain/reader.js +130 -0
- package/dist/chain/reader.js.map +1 -0
- package/dist/commands/approval.js +2 -2
- package/dist/commands/approval.js.map +1 -1
- package/dist/commands/buy.d.ts +0 -1
- package/dist/commands/buy.d.ts.map +1 -1
- package/dist/commands/buy.js +15 -22
- package/dist/commands/buy.js.map +1 -1
- package/dist/commands/confirmation.d.ts +322 -4
- package/dist/commands/confirmation.d.ts.map +1 -1
- package/dist/commands/confirmation.js +771 -60
- package/dist/commands/confirmation.js.map +1 -1
- package/dist/commands/doctor.d.ts +20 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +204 -59
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/order.d.ts +37 -6
- package/dist/commands/order.d.ts.map +1 -1
- package/dist/commands/order.js +181 -103
- package/dist/commands/order.js.map +1 -1
- package/dist/commands/signPayment.d.ts +2 -2
- package/dist/commands/signPayment.d.ts.map +1 -1
- package/dist/commands/signPayment.js +10 -5
- package/dist/commands/signPayment.js.map +1 -1
- package/dist/commands/wallet.d.ts +3 -0
- package/dist/commands/wallet.d.ts.map +1 -1
- package/dist/commands/wallet.js +72 -16
- package/dist/commands/wallet.js.map +1 -1
- package/dist/config.d.ts +10 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +41 -1
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +28 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +72 -3
- package/dist/context.js.map +1 -1
- package/dist/gateway/client.d.ts +20 -17
- package/dist/gateway/client.d.ts.map +1 -1
- package/dist/gateway/client.js +62 -43
- package/dist/gateway/client.js.map +1 -1
- package/dist/gateway/lifecycle.d.ts +4 -1
- package/dist/gateway/lifecycle.d.ts.map +1 -1
- package/dist/gateway/lifecycle.js +10 -5
- package/dist/gateway/lifecycle.js.map +1 -1
- package/dist/gateway/metadata.d.ts +66 -0
- package/dist/gateway/metadata.d.ts.map +1 -0
- package/dist/gateway/metadata.js +152 -0
- package/dist/gateway/metadata.js.map +1 -0
- package/dist/gateway/purchase.d.ts +51 -67
- package/dist/gateway/purchase.d.ts.map +1 -1
- package/dist/gateway/purchase.js +153 -125
- package/dist/gateway/purchase.js.map +1 -1
- package/dist/host.d.ts +41 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +112 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +12 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/signers/circleAgent.d.ts +37 -0
- package/dist/signers/circleAgent.d.ts.map +1 -0
- package/dist/signers/circleAgent.js +244 -0
- package/dist/signers/circleAgent.js.map +1 -0
- package/dist/signers/contract.d.ts +34 -0
- package/dist/signers/contract.d.ts.map +1 -0
- package/dist/signers/contract.js +47 -0
- package/dist/signers/contract.js.map +1 -0
- package/dist/signers/index.d.ts +16 -7
- package/dist/signers/index.d.ts.map +1 -1
- package/dist/signers/index.js +7 -3
- package/dist/signers/index.js.map +1 -1
- package/dist/signers/local.d.ts +5 -1
- package/dist/signers/local.d.ts.map +1 -1
- package/dist/signers/local.js +16 -3
- package/dist/signers/local.js.map +1 -1
- package/dist/signers/selfTest.d.ts +32 -12
- package/dist/signers/selfTest.d.ts.map +1 -1
- package/dist/signers/selfTest.js +85 -12
- package/dist/signers/selfTest.js.map +1 -1
- package/dist/signers/signature.d.ts +10 -0
- package/dist/signers/signature.d.ts.map +1 -0
- package/dist/signers/signature.js +11 -0
- package/dist/signers/signature.js.map +1 -0
- package/dist/store/keystore.d.ts +48 -6
- package/dist/store/keystore.d.ts.map +1 -1
- package/dist/store/keystore.js +414 -110
- package/dist/store/keystore.js.map +1 -1
- package/dist/store/lock.d.ts +59 -0
- package/dist/store/lock.d.ts.map +1 -0
- package/dist/store/lock.js +269 -0
- package/dist/store/lock.js.map +1 -0
- package/dist/store/orders.d.ts +49 -9
- package/dist/store/orders.d.ts.map +1 -1
- package/dist/store/orders.js +173 -37
- package/dist/store/orders.js.map +1 -1
- package/package.json +2 -2
package/dist/store/orders.js
CHANGED
|
@@ -10,27 +10,133 @@
|
|
|
10
10
|
* the signature goes out, so an interrupted buy can be looked up instead of
|
|
11
11
|
* re-signed.
|
|
12
12
|
*/
|
|
13
|
-
import {
|
|
13
|
+
import { randomBytes } from "node:crypto";
|
|
14
|
+
import { closeSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, rmSync, writeSync, } from "node:fs";
|
|
14
15
|
import { dirname } from "node:path";
|
|
16
|
+
import { CliError } from "../cli/errors.js";
|
|
15
17
|
import { ordersPath } from "../paths.js";
|
|
18
|
+
import { withFileLock, withFileLockSync } from "./lock.js";
|
|
19
|
+
const DOC = "https://github.com/daski-io/buyer/blob/main/docs/config.md";
|
|
20
|
+
function storeUnreadable(path, reason) {
|
|
21
|
+
return new CliError({
|
|
22
|
+
code: "DASKI_ORDER_STORE_UNREADABLE",
|
|
23
|
+
message: `The order store ${path} exists but cannot be read: ${reason}.`,
|
|
24
|
+
remediation: "An unreadable order store is never treated as empty: it holds recorded intents, order " +
|
|
25
|
+
"handles, budgets, and pending confirmation journals, and writing over it would lose them. " +
|
|
26
|
+
`Repair ${path}, or move it aside and rebuild it with daski order import --json, then re-run. ` +
|
|
27
|
+
`See ${DOC}`,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/** The fields every command reads before it can trust a record; the amount feeds the budget total. */
|
|
31
|
+
function isOrderRecord(value) {
|
|
32
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
33
|
+
return false;
|
|
34
|
+
const record = value;
|
|
35
|
+
return typeof record.intentId === "string" && typeof record.profile === "string" &&
|
|
36
|
+
typeof record.state === "string" && typeof record.amount === "string" && /^\d+$/.test(record.amount);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Reads the store. A missing file (or a missing state directory) is an empty
|
|
40
|
+
* ledger; anything else that stops the file being read, parsed, or trusted is
|
|
41
|
+
* `DASKI_ORDER_STORE_UNREADABLE`. Every write path reads first, so an
|
|
42
|
+
* unreadable store is refused before a temporary file could be renamed over it.
|
|
43
|
+
*/
|
|
16
44
|
function read() {
|
|
45
|
+
const path = ordersPath();
|
|
46
|
+
let raw;
|
|
47
|
+
try {
|
|
48
|
+
raw = readFileSync(path, "utf8");
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
if (error.code === "ENOENT")
|
|
52
|
+
return { version: 1, orders: [] };
|
|
53
|
+
throw storeUnreadable(path, error.message);
|
|
54
|
+
}
|
|
55
|
+
let parsed;
|
|
56
|
+
try {
|
|
57
|
+
parsed = JSON.parse(raw);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw storeUnreadable(path, `not valid JSON (${error.message})`);
|
|
61
|
+
}
|
|
62
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
63
|
+
throw storeUnreadable(path, "the document is not an object");
|
|
64
|
+
}
|
|
65
|
+
const file = parsed;
|
|
66
|
+
if (file.version !== 1)
|
|
67
|
+
throw storeUnreadable(path, `unsupported version ${String(file.version)}`);
|
|
68
|
+
if (!Array.isArray(file.orders))
|
|
69
|
+
throw storeUnreadable(path, "orders is not an array");
|
|
70
|
+
file.orders.forEach((order, index) => {
|
|
71
|
+
if (!isOrderRecord(order))
|
|
72
|
+
throw storeUnreadable(path, `order ${index} is malformed`);
|
|
73
|
+
});
|
|
74
|
+
return file;
|
|
75
|
+
}
|
|
76
|
+
/** How long a whole-file update waits for another process's update. */
|
|
77
|
+
const STORE_LOCK_WAIT_MS = 10_000;
|
|
78
|
+
/**
|
|
79
|
+
* Every read-modify-write of the whole file runs under one store-wide lock:
|
|
80
|
+
* the file holds every order, so two commands updating different orders
|
|
81
|
+
* would otherwise read the same version and the later rename would drop the
|
|
82
|
+
* earlier order's update. The rename only protects against truncation.
|
|
83
|
+
*/
|
|
84
|
+
function withStoreLock(run) {
|
|
85
|
+
const lock = `${ordersPath()}.lock`;
|
|
86
|
+
return withFileLockSync(lock, {
|
|
87
|
+
waitMs: STORE_LOCK_WAIT_MS,
|
|
88
|
+
locked: (reason) => new CliError({
|
|
89
|
+
code: "DASKI_ORDER_STORE_LOCKED",
|
|
90
|
+
message: reason === "orphaned"
|
|
91
|
+
? "A daski process died while recovering the order store lock."
|
|
92
|
+
: "Another daski command is updating the order store.",
|
|
93
|
+
remediation: reason === "orphaned"
|
|
94
|
+
? `If no daski process is running, remove ${lock} and ${lock}.reclaim, then re-run.`
|
|
95
|
+
: "Wait for it to finish, then re-run. If no daski process is running, remove the " +
|
|
96
|
+
"stale orders.json.lock file.",
|
|
97
|
+
}),
|
|
98
|
+
}, run);
|
|
99
|
+
}
|
|
100
|
+
function fsyncDirectory(directory) {
|
|
101
|
+
// Windows cannot open a directory handle for fsync; the rename is still atomic there.
|
|
102
|
+
if (process.platform === "win32")
|
|
103
|
+
return;
|
|
104
|
+
const fd = openSync(directory, "r");
|
|
17
105
|
try {
|
|
18
|
-
|
|
19
|
-
if (parsed.version !== 1 || !Array.isArray(parsed.orders))
|
|
20
|
-
throw new Error("shape");
|
|
21
|
-
return parsed;
|
|
106
|
+
fsyncSync(fd);
|
|
22
107
|
}
|
|
23
|
-
|
|
24
|
-
|
|
108
|
+
finally {
|
|
109
|
+
closeSync(fd);
|
|
25
110
|
}
|
|
26
111
|
}
|
|
27
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Replaces the store atomically: an owner-only temporary file beside the
|
|
114
|
+
* target, flushed, renamed over the target, then the directory flushed. A
|
|
115
|
+
* crash or power loss at any point leaves either the previous file or the
|
|
116
|
+
* new one, never a truncated mixture and never a rename that was not yet
|
|
117
|
+
* durable.
|
|
118
|
+
*/
|
|
28
119
|
function write(file) {
|
|
29
120
|
const path = ordersPath();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
121
|
+
const directory = dirname(path);
|
|
122
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
123
|
+
const temporary = `${path}.${process.pid}.${randomBytes(4).toString("hex")}.tmp`;
|
|
124
|
+
const fd = openSync(temporary, "wx", 0o600);
|
|
125
|
+
try {
|
|
126
|
+
writeSync(fd, `${JSON.stringify(file, null, 2)}\n`);
|
|
127
|
+
fsyncSync(fd);
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
closeSync(fd);
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
renameSync(temporary, path);
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
rmSync(temporary, { force: true });
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
fsyncDirectory(directory);
|
|
34
140
|
}
|
|
35
141
|
export function listOrders(profile) {
|
|
36
142
|
const orders = read().orders;
|
|
@@ -45,33 +151,63 @@ export function findByIntent(intentId) {
|
|
|
45
151
|
}
|
|
46
152
|
/** Inserts or updates by intent id. The intent id is the stable key. */
|
|
47
153
|
export function upsertOrder(record) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
154
|
+
return withStoreLock(() => {
|
|
155
|
+
const file = read();
|
|
156
|
+
const now = new Date().toISOString();
|
|
157
|
+
const index = file.orders.findIndex((order) => order.intentId === record.intentId);
|
|
158
|
+
const merged = { ...record, updatedAt: now };
|
|
159
|
+
if (index >= 0) {
|
|
160
|
+
merged.createdAt = file.orders[index].createdAt;
|
|
161
|
+
file.orders[index] = merged;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
file.orders.push(merged);
|
|
165
|
+
}
|
|
166
|
+
write(file);
|
|
167
|
+
return merged;
|
|
168
|
+
});
|
|
61
169
|
}
|
|
62
170
|
export function updateOrder(intentId, changes) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
171
|
+
return withStoreLock(() => {
|
|
172
|
+
const file = read();
|
|
173
|
+
const index = file.orders.findIndex((order) => order.intentId === intentId);
|
|
174
|
+
if (index < 0)
|
|
175
|
+
return undefined;
|
|
176
|
+
const merged = {
|
|
177
|
+
...file.orders[index],
|
|
178
|
+
...changes,
|
|
179
|
+
updatedAt: new Date().toISOString(),
|
|
180
|
+
};
|
|
181
|
+
file.orders[index] = merged;
|
|
182
|
+
write(file);
|
|
183
|
+
return merged;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/** How long a command waits for another live process's work on the same order. */
|
|
187
|
+
const ORDER_LOCK_WAIT_MS = 10_000;
|
|
188
|
+
/**
|
|
189
|
+
* Serializes one order's confirmation journal across processes. The
|
|
190
|
+
* read-check-write of a preparation spans gateway and chain calls; without
|
|
191
|
+
* the lock two preparations both find nothing pending and the later write
|
|
192
|
+
* drops the earlier validated call's tracking. The lock is reclaimed only
|
|
193
|
+
* when its owner is gone, never by age: the owner may be waiting on a person.
|
|
194
|
+
*/
|
|
195
|
+
export function withOrderLock(intentId, run) {
|
|
196
|
+
const name = intentId.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
197
|
+
const lock = `${ordersPath()}.${name}.lock`;
|
|
198
|
+
return withFileLock(lock, {
|
|
199
|
+
waitMs: ORDER_LOCK_WAIT_MS,
|
|
200
|
+
locked: (reason) => new CliError({
|
|
201
|
+
code: "DASKI_ORDER_LOCKED",
|
|
202
|
+
message: reason === "orphaned"
|
|
203
|
+
? "A daski process died while recovering this order's lock."
|
|
204
|
+
: "Another daski command is updating this order's confirmation record.",
|
|
205
|
+
remediation: reason === "orphaned"
|
|
206
|
+
? `If no daski process is running, remove ${lock} and ${lock}.reclaim, then re-run.`
|
|
207
|
+
: "Wait for it to finish, then re-run. If no daski process is running, remove the " +
|
|
208
|
+
"stale .lock file next to orders.json.",
|
|
209
|
+
}),
|
|
210
|
+
}, run);
|
|
75
211
|
}
|
|
76
212
|
/** States under which no USDC was authorized, or the gateway says none settled. */
|
|
77
213
|
const UNSPENT_STATES = new Set(["INTENT_RECORDED", "NOT_SETTLED"]);
|
package/dist/store/orders.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../../src/store/orders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"orders.js","sourceRoot":"","sources":["../../src/store/orders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,GACvF,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAwF3D,MAAM,GAAG,GAAG,4DAA4D,CAAC;AAEzE,SAAS,eAAe,CAAC,IAAY,EAAE,MAAc;IACnD,OAAO,IAAI,QAAQ,CAAC;QAClB,IAAI,EAAE,8BAA8B;QACpC,OAAO,EAAE,mBAAmB,IAAI,+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,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAClC,yEAAyE;IACzE,2EAA2E;IAC3E,OAAO,UAAU,CAAC,SAAS,GAAG,UAAU,GAAG,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACzE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daski/pay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "The Daski buyer bridge CLI. Server proposes, the bridge validates and recomputes, the wallet signs, the gateway never sees the key.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"prepublishOnly": "npm run build"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@daski/x402-scheme": "0.
|
|
47
|
+
"@daski/x402-scheme": "0.4.0",
|
|
48
48
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
49
49
|
"@x402/core": "2.24.0",
|
|
50
50
|
"viem": "2.21.55"
|