@dvmkit/dvm-cli 0.4.1 → 0.5.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 +8 -0
- package/dist/{chunk-24VB7FR7.js → chunk-3YE43JJR.js} +4 -4
- package/dist/{chunk-SKKZ4OAA.js → chunk-4KINCBHL.js} +53 -56
- package/dist/{chunk-XN4YSEO6.js → chunk-EE2MREOM.js} +152 -93
- package/dist/chunk-ERJFRCJO.js +150 -0
- package/dist/chunk-FL2ICZW5.js +383 -0
- package/dist/chunk-FSYEZERJ.js +1667 -0
- package/dist/{chunk-V2BE4E5V.js → chunk-ID5G54HJ.js} +223 -73
- package/dist/{chunk-4NWEJTAW.js → chunk-MJ4X4BEW.js} +7953 -8036
- package/dist/{chunk-Z75N4GTG.js → chunk-QICJRKB7.js} +23557 -16012
- package/dist/{chunk-ECEM3ZAS.js → chunk-R55XNXAR.js} +53 -185
- package/dist/{chunk-R4MSO2GX.js → chunk-SHZMNEXE.js} +65 -24
- package/dist/chunk-TZWZTS37.js +1517 -0
- package/dist/{chunk-VY277ROG.js → chunk-VOO5IAK7.js} +600 -97
- package/dist/{chunk-2VVVWBQA.js → chunk-WTM2EICO.js} +2 -352
- package/dist/chunk-XHOFQ3OS.js +717 -0
- package/dist/{chunk-YLWATJ7F.js → chunk-Z4CZUMUT.js} +937 -1599
- package/dist/{client-OWIOFBKS.js → client-RYDA62DU.js} +11 -8
- package/dist/{dist-2G3QBGID.js → dist-GKCEIY2A.js} +7 -4
- package/dist/dvm.js +478 -70
- package/dist/{internal-OBEYRHMV.js → internal-INUTGTXQ.js} +56 -33
- package/dist/{payout-reporter-RG6XNGPI-KNY74HLM.js → payout-reporter-3Y2U55ZX-CMKACKA3.js} +2 -2
- package/dist/{pocket-refill-NXTJIVB5.js → pocket-refill-K5T4LZF6.js} +18 -14
- package/dist/{revenue-reporter-ASZ7SHHH-ISAMJDZQ.js → revenue-reporter-MAERPYGK-CCPZXGFA.js} +2 -2
- package/dist/tempo-AXTE4ZEA.js +34 -0
- package/dist/{tempo-lifecycle-DFIXQ54Q-LNXPKWK5.js → tempo-lifecycle-ZBBLFBMH-HWI4PLYP.js} +11 -7
- package/dist/{tempo-wallet-4QKSV65O-J6ZZQAD7.js → tempo-wallet-B5XXV3YH-SRQBMYFV.js} +2 -2
- package/dist/{x402-5H27DCBE-UEQQQ5UY.js → x402-R6HPBY5D-VMSW7Z32.js} +3 -3
- package/package.json +2 -2
- package/skills/dvm/calling.md +2 -0
- package/skills/dvm/credit.md +2 -0
- package/dist/chunk-3SWX5BQP.js +0 -66
|
@@ -2,175 +2,35 @@
|
|
|
2
2
|
import { createRequire as __dvmCreateRequire } from "node:module";
|
|
3
3
|
const require = __dvmCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
|
-
Assets_exports,
|
|
6
|
-
Assets_exports2,
|
|
7
|
-
AuthorizationConfigSchema,
|
|
8
|
-
AuthorizationPayloadSchema,
|
|
9
|
-
Chains_exports,
|
|
10
|
-
ChargePayloadSchema,
|
|
11
|
-
ChargeRequestInputSchema,
|
|
12
|
-
ChargeRequestSchema,
|
|
13
|
-
ExactEip3009PayloadSchema,
|
|
14
|
-
ExactPayloadSchema,
|
|
15
|
-
ExactPermit2PayloadSchema,
|
|
16
|
-
ExactTransferSchema,
|
|
17
|
-
ExtensionSchema,
|
|
18
|
-
ExtensionsSchema,
|
|
19
|
-
Header_exports,
|
|
20
5
|
Headers,
|
|
21
|
-
MethodDetailsSchema,
|
|
22
|
-
Methods_exports,
|
|
23
|
-
PaymentPayloadSchema,
|
|
24
|
-
PaymentRequiredSchema,
|
|
25
|
-
PaymentRequirementsSchema,
|
|
26
|
-
ResourceInfoSchema,
|
|
27
|
-
SettleResponseSchema,
|
|
28
|
-
Types_exports,
|
|
29
|
-
Types_exports2,
|
|
30
|
-
VerifyResponseSchema,
|
|
31
|
-
assetTransferMethods,
|
|
32
|
-
authorizationDomain,
|
|
33
|
-
authorizationTypes,
|
|
34
|
-
challengeHash,
|
|
35
|
-
charge,
|
|
36
|
-
chargeIntent,
|
|
37
|
-
constantTimeEqual,
|
|
38
|
-
credentialTypes,
|
|
39
6
|
datetime,
|
|
40
|
-
eip3009,
|
|
41
|
-
evmNetworkPrefix,
|
|
42
|
-
evmNetworkPrefix2,
|
|
43
|
-
exactIntent,
|
|
44
7
|
literal,
|
|
45
8
|
looseObject,
|
|
46
|
-
networkOf,
|
|
47
9
|
object,
|
|
48
10
|
optional,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
paymentRequiredHeader,
|
|
52
|
-
paymentResponseHeader,
|
|
53
|
-
paymentSignatureHeader,
|
|
54
|
-
schemes,
|
|
55
|
-
string,
|
|
56
|
-
syntheticChallengeIdPrefix,
|
|
57
|
-
toPaymentRequirements,
|
|
58
|
-
toSource,
|
|
59
|
-
versions
|
|
60
|
-
} from "./chunk-2VVVWBQA.js";
|
|
11
|
+
string
|
|
12
|
+
} from "./chunk-WTM2EICO.js";
|
|
61
13
|
import {
|
|
62
14
|
Base64_exports
|
|
63
15
|
} from "./chunk-EZHT2RLJ.js";
|
|
64
16
|
import {
|
|
65
|
-
Hash_exports
|
|
66
|
-
} from "./chunk-LH3QPVN6.js";
|
|
67
|
-
import {
|
|
68
|
-
Bytes_exports,
|
|
69
17
|
Json_exports
|
|
70
18
|
} from "./chunk-F55NNH2F.js";
|
|
71
19
|
import {
|
|
72
20
|
__export
|
|
73
21
|
} from "./chunk-IYHTITNZ.js";
|
|
74
22
|
|
|
75
|
-
// node_modules/mppx/dist/BodyDigest.js
|
|
76
|
-
var BodyDigest_exports = {};
|
|
77
|
-
__export(BodyDigest_exports, {
|
|
78
|
-
compute: () => compute,
|
|
79
|
-
verify: () => verify
|
|
80
|
-
});
|
|
81
|
-
function compute(body) {
|
|
82
|
-
const str = typeof body === "object" ? JSON.stringify(body) : body;
|
|
83
|
-
const bytes = Bytes_exports.fromString(str);
|
|
84
|
-
const hash = Hash_exports.sha256(bytes, { as: "Bytes" });
|
|
85
|
-
const base64 = Base64_exports.fromBytes(hash);
|
|
86
|
-
return `sha-256=${base64}`;
|
|
87
|
-
}
|
|
88
|
-
function verify(digest, body) {
|
|
89
|
-
return constantTimeEqual(compute(body), digest);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// node_modules/mppx/dist/evm/index.js
|
|
93
|
-
var evm_exports = {};
|
|
94
|
-
__export(evm_exports, {
|
|
95
|
-
Assets: () => Assets_exports2,
|
|
96
|
-
AuthorizationConfigSchema: () => AuthorizationConfigSchema,
|
|
97
|
-
AuthorizationPayloadSchema: () => AuthorizationPayloadSchema,
|
|
98
|
-
Chains: () => Chains_exports,
|
|
99
|
-
ChargePayloadSchema: () => ChargePayloadSchema,
|
|
100
|
-
ChargeRequestInputSchema: () => ChargeRequestInputSchema,
|
|
101
|
-
ChargeRequestSchema: () => ChargeRequestSchema,
|
|
102
|
-
MethodDetailsSchema: () => MethodDetailsSchema,
|
|
103
|
-
Methods: () => Methods_exports,
|
|
104
|
-
Types: () => Types_exports2,
|
|
105
|
-
assets: () => Assets_exports2,
|
|
106
|
-
authorizationDomain: () => authorizationDomain,
|
|
107
|
-
authorizationTypes: () => authorizationTypes,
|
|
108
|
-
chains: () => Chains_exports,
|
|
109
|
-
challengeHash: () => challengeHash,
|
|
110
|
-
charge: () => charge,
|
|
111
|
-
chargeIntent: () => chargeIntent,
|
|
112
|
-
credentialTypes: () => credentialTypes,
|
|
113
|
-
eip3009: () => eip3009,
|
|
114
|
-
evmNetworkPrefix: () => evmNetworkPrefix2,
|
|
115
|
-
networkOf: () => networkOf,
|
|
116
|
-
paymentMethod: () => paymentMethod2,
|
|
117
|
-
toSource: () => toSource
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
// node_modules/mppx/dist/Receipt.js
|
|
121
|
-
var Receipt_exports = {};
|
|
122
|
-
__export(Receipt_exports, {
|
|
123
|
-
Schema: () => Schema,
|
|
124
|
-
deserialize: () => deserialize,
|
|
125
|
-
from: () => from,
|
|
126
|
-
fromResponse: () => fromResponse,
|
|
127
|
-
serialize: () => serialize
|
|
128
|
-
});
|
|
129
|
-
var shape = {
|
|
130
|
-
/** Payment method used (e.g., "tempo", "stripe"). */
|
|
131
|
-
method: string(),
|
|
132
|
-
/** Method-specific reference (e.g., transaction hash). */
|
|
133
|
-
reference: string(),
|
|
134
|
-
/** Optional external reference ID echoed from the credential payload. */
|
|
135
|
-
externalId: optional(string()),
|
|
136
|
-
/** Optional server-issued subscription identifier for recurring payments. */
|
|
137
|
-
subscriptionId: optional(string()),
|
|
138
|
-
/** Payment status. Always "success" — failures use 402 + Problem Details. */
|
|
139
|
-
status: literal("success"),
|
|
140
|
-
/** RFC 3339 settlement timestamp. */
|
|
141
|
-
timestamp: datetime()
|
|
142
|
-
};
|
|
143
|
-
var BaseSchema = object(shape);
|
|
144
|
-
var Schema = looseObject(shape);
|
|
145
|
-
function deserialize(encoded) {
|
|
146
|
-
const json = Base64_exports.toString(encoded);
|
|
147
|
-
return from(JSON.parse(json));
|
|
148
|
-
}
|
|
149
|
-
function from(parameters) {
|
|
150
|
-
return Schema.parse(parameters);
|
|
151
|
-
}
|
|
152
|
-
function serialize(receipt) {
|
|
153
|
-
const json = JSON.stringify(receipt);
|
|
154
|
-
return Base64_exports.fromString(json, { pad: false, url: true });
|
|
155
|
-
}
|
|
156
|
-
function fromResponse(response) {
|
|
157
|
-
const header = response.headers.get(Headers.paymentReceipt);
|
|
158
|
-
if (!header)
|
|
159
|
-
throw new Error(`Missing ${Headers.paymentReceipt} header.`);
|
|
160
|
-
return deserialize(header);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
23
|
// node_modules/mppx/dist/Store.js
|
|
164
24
|
var Store_exports = {};
|
|
165
25
|
__export(Store_exports, {
|
|
166
26
|
cloudflare: () => cloudflare,
|
|
167
|
-
from: () =>
|
|
27
|
+
from: () => from,
|
|
168
28
|
memory: () => memory,
|
|
169
29
|
redis: () => redis,
|
|
170
30
|
upstash: () => upstash
|
|
171
31
|
});
|
|
172
32
|
var keyPrefixCache = /* @__PURE__ */ new WeakMap();
|
|
173
|
-
function
|
|
33
|
+
function from(store, options) {
|
|
174
34
|
return withKeyPrefix(store, options?.keyPrefix);
|
|
175
35
|
}
|
|
176
36
|
function withKeyPrefix(store, keyPrefix = "") {
|
|
@@ -181,7 +41,7 @@ function withKeyPrefix(store, keyPrefix = "") {
|
|
|
181
41
|
return cached;
|
|
182
42
|
const backing = store;
|
|
183
43
|
const prefixedKey = (key) => `${keyPrefix}${key}`;
|
|
184
|
-
const prefixed =
|
|
44
|
+
const prefixed = from({
|
|
185
45
|
async get(key) {
|
|
186
46
|
return backing.get(prefixedKey(key));
|
|
187
47
|
},
|
|
@@ -218,7 +78,7 @@ function wrapJsonUpdate(update) {
|
|
|
218
78
|
};
|
|
219
79
|
}
|
|
220
80
|
function cloudflare(kv, options) {
|
|
221
|
-
return
|
|
81
|
+
return from({
|
|
222
82
|
async get(key) {
|
|
223
83
|
const raw = await kv.get(key);
|
|
224
84
|
if (raw == null)
|
|
@@ -236,7 +96,7 @@ function cloudflare(kv, options) {
|
|
|
236
96
|
}
|
|
237
97
|
function memory(options) {
|
|
238
98
|
const store = /* @__PURE__ */ new Map();
|
|
239
|
-
return
|
|
99
|
+
return from({
|
|
240
100
|
async get(key) {
|
|
241
101
|
const raw = store.get(key);
|
|
242
102
|
if (raw === void 0)
|
|
@@ -261,7 +121,7 @@ function memory(options) {
|
|
|
261
121
|
}, options);
|
|
262
122
|
}
|
|
263
123
|
function redis(client, options) {
|
|
264
|
-
return
|
|
124
|
+
return from({
|
|
265
125
|
async get(key) {
|
|
266
126
|
const raw = await client.get(key);
|
|
267
127
|
if (raw == null)
|
|
@@ -278,7 +138,7 @@ function redis(client, options) {
|
|
|
278
138
|
}, options);
|
|
279
139
|
}
|
|
280
140
|
function upstash(redis2, options) {
|
|
281
|
-
return
|
|
141
|
+
return from({
|
|
282
142
|
async get(key) {
|
|
283
143
|
return await redis2.get(key);
|
|
284
144
|
},
|
|
@@ -294,46 +154,54 @@ function upstash(redis2, options) {
|
|
|
294
154
|
}, options);
|
|
295
155
|
}
|
|
296
156
|
|
|
297
|
-
// node_modules/mppx/dist/
|
|
298
|
-
var
|
|
299
|
-
__export(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
ExtensionSchema: () => ExtensionSchema,
|
|
306
|
-
ExtensionsSchema: () => ExtensionsSchema,
|
|
307
|
-
Header: () => Header_exports,
|
|
308
|
-
PaymentPayloadSchema: () => PaymentPayloadSchema,
|
|
309
|
-
PaymentRequiredSchema: () => PaymentRequiredSchema,
|
|
310
|
-
PaymentRequirementsSchema: () => PaymentRequirementsSchema,
|
|
311
|
-
ResourceInfoSchema: () => ResourceInfoSchema,
|
|
312
|
-
SettleResponseSchema: () => SettleResponseSchema,
|
|
313
|
-
Types: () => Types_exports,
|
|
314
|
-
VerifyResponseSchema: () => VerifyResponseSchema,
|
|
315
|
-
assetTransferMethods: () => assetTransferMethods,
|
|
316
|
-
assets: () => Assets_exports,
|
|
317
|
-
evmNetworkPrefix: () => evmNetworkPrefix,
|
|
318
|
-
exactIntent: () => exactIntent,
|
|
319
|
-
paymentMethod: () => paymentMethod,
|
|
320
|
-
paymentRequiredHeader: () => paymentRequiredHeader,
|
|
321
|
-
paymentResponseHeader: () => paymentResponseHeader,
|
|
322
|
-
paymentSignatureHeader: () => paymentSignatureHeader,
|
|
323
|
-
schemes: () => schemes,
|
|
324
|
-
syntheticChallengeIdPrefix: () => syntheticChallengeIdPrefix,
|
|
325
|
-
toPaymentRequirements: () => toPaymentRequirements,
|
|
326
|
-
versions: () => versions
|
|
157
|
+
// node_modules/mppx/dist/Receipt.js
|
|
158
|
+
var Receipt_exports = {};
|
|
159
|
+
__export(Receipt_exports, {
|
|
160
|
+
Schema: () => Schema,
|
|
161
|
+
deserialize: () => deserialize,
|
|
162
|
+
from: () => from2,
|
|
163
|
+
fromResponse: () => fromResponse,
|
|
164
|
+
serialize: () => serialize
|
|
327
165
|
});
|
|
166
|
+
var shape = {
|
|
167
|
+
/** Payment method used (e.g., "tempo", "stripe"). */
|
|
168
|
+
method: string(),
|
|
169
|
+
/** Method-specific reference (e.g., transaction hash). */
|
|
170
|
+
reference: string(),
|
|
171
|
+
/** Optional external reference ID echoed from the credential payload. */
|
|
172
|
+
externalId: optional(string()),
|
|
173
|
+
/** Optional server-issued subscription identifier for recurring payments. */
|
|
174
|
+
subscriptionId: optional(string()),
|
|
175
|
+
/** Payment status. Always "success" — failures use 402 + Problem Details. */
|
|
176
|
+
status: literal("success"),
|
|
177
|
+
/** RFC 3339 settlement timestamp. */
|
|
178
|
+
timestamp: datetime()
|
|
179
|
+
};
|
|
180
|
+
var BaseSchema = object(shape);
|
|
181
|
+
var Schema = looseObject(shape);
|
|
182
|
+
function deserialize(encoded) {
|
|
183
|
+
const json = Base64_exports.toString(encoded);
|
|
184
|
+
return from2(JSON.parse(json));
|
|
185
|
+
}
|
|
186
|
+
function from2(parameters) {
|
|
187
|
+
return Schema.parse(parameters);
|
|
188
|
+
}
|
|
189
|
+
function serialize(receipt) {
|
|
190
|
+
const json = JSON.stringify(receipt);
|
|
191
|
+
return Base64_exports.fromString(json, { pad: false, url: true });
|
|
192
|
+
}
|
|
193
|
+
function fromResponse(response) {
|
|
194
|
+
const header = response.headers.get(Headers.paymentReceipt);
|
|
195
|
+
if (!header)
|
|
196
|
+
throw new Error(`Missing ${Headers.paymentReceipt} header.`);
|
|
197
|
+
return deserialize(header);
|
|
198
|
+
}
|
|
328
199
|
|
|
329
200
|
export {
|
|
330
|
-
|
|
201
|
+
from,
|
|
331
202
|
memory,
|
|
332
203
|
Store_exports,
|
|
333
|
-
|
|
204
|
+
from2,
|
|
334
205
|
serialize,
|
|
335
|
-
Receipt_exports
|
|
336
|
-
BodyDigest_exports,
|
|
337
|
-
evm_exports,
|
|
338
|
-
x402_exports
|
|
206
|
+
Receipt_exports
|
|
339
207
|
};
|
|
@@ -8,13 +8,12 @@ import {
|
|
|
8
8
|
formatUsd,
|
|
9
9
|
fundingReachableAt,
|
|
10
10
|
getLastKnownBtcRate,
|
|
11
|
-
info,
|
|
12
11
|
listCredits,
|
|
13
12
|
maxAdvertisedMicro,
|
|
14
13
|
msatsToUsdc,
|
|
15
14
|
usdcToMsats,
|
|
16
15
|
withinAdvertisedTolerance
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VOO5IAK7.js";
|
|
18
17
|
import {
|
|
19
18
|
DvmError,
|
|
20
19
|
X402_CHANNELS_FILE,
|
|
@@ -28,14 +27,13 @@ import {
|
|
|
28
27
|
resolveRpcHttpTransportOptions,
|
|
29
28
|
resolveRpcOverride,
|
|
30
29
|
updateConfig
|
|
31
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-4KINCBHL.js";
|
|
32
31
|
import {
|
|
33
32
|
__export,
|
|
34
33
|
__toESM
|
|
35
34
|
} from "./chunk-IYHTITNZ.js";
|
|
36
35
|
|
|
37
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
38
|
-
var X402_DEFAULT_FACILITATOR = "https://x402.org/facilitator";
|
|
36
|
+
// node_modules/@dvmkit/sdk/dist/chunk-RLTSCKRI.js
|
|
39
37
|
var X402_NETWORKS = [
|
|
40
38
|
{
|
|
41
39
|
caip2: "eip155:8453",
|
|
@@ -130,6 +128,9 @@ function x402SupportedNetworksHint() {
|
|
|
130
128
|
}
|
|
131
129
|
var BY_CAIP2 = new Map(X402_NETWORKS.map((n) => [n.caip2, n]));
|
|
132
130
|
var BY_SLUG = new Map(X402_NETWORKS.map((n) => [n.slug, n]));
|
|
131
|
+
|
|
132
|
+
// node_modules/@dvmkit/sdk/dist/chunk-IWQHUSMO.js
|
|
133
|
+
var X402_DEFAULT_FACILITATOR = "https://x402.org/facilitator";
|
|
133
134
|
var X402_VERSION = 2;
|
|
134
135
|
var X402_V1_VERSION = 1;
|
|
135
136
|
var X402_DEFAULT_NETWORK = "eip155:8453";
|
|
@@ -327,8 +328,9 @@ function isOptionalRecord(value) {
|
|
|
327
328
|
return value === void 0 || value === null || isRecord(value);
|
|
328
329
|
}
|
|
329
330
|
|
|
330
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
331
|
+
// node_modules/@dvmkit/sdk/dist/chunk-LE74UEV7.js
|
|
331
332
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
333
|
+
import { writeSync } from "fs";
|
|
332
334
|
import { AsyncLocalStorage } from "async_hooks";
|
|
333
335
|
import { existsSync, readFileSync, renameSync, writeFileSync } from "fs";
|
|
334
336
|
import { randomBytes } from "crypto";
|
|
@@ -351,6 +353,39 @@ function x402WrongAssetHint(asset) {
|
|
|
351
353
|
const wrongToken = asset.confusable ? `Another dollar on ${asset.networkLabel} \u2014 ${asset.confusable}, the legacy bridged dollar, or any other stablecoin \u2014 is a different contract and will never show up here, however much of it your wallet says you hold.` : `Another dollar on ${asset.networkLabel} is a different contract and will never show up here, however much of it your wallet says you hold.`;
|
|
352
354
|
return `This rail reads only ${asset.label} (${asset.address}) on ${asset.networkLabel}. ${wrongToken} USDC on a different chain is invisible here too \u2014 this wallet reads ${asset.networkLabel} alone. If you funded the wrong one, swap it to ${asset.label} on ${asset.networkLabel}, or bridge the funds across to ${asset.networkLabel}; either way they land where this rail can spend them.`;
|
|
353
355
|
}
|
|
356
|
+
var _traceId = null;
|
|
357
|
+
function setOutputTraceId(id) {
|
|
358
|
+
_traceId = id;
|
|
359
|
+
}
|
|
360
|
+
function getOutputTraceId() {
|
|
361
|
+
return _traceId;
|
|
362
|
+
}
|
|
363
|
+
function json(data) {
|
|
364
|
+
const out = _traceId !== null && typeof data === "object" && data !== null && !Array.isArray(data) && !("trace_id" in data) ? { trace_id: _traceId, ...data } : data;
|
|
365
|
+
writeAllSync(1, JSON.stringify(out) + "\n");
|
|
366
|
+
}
|
|
367
|
+
function info(msg) {
|
|
368
|
+
writeAllSync(2, msg + "\n");
|
|
369
|
+
}
|
|
370
|
+
function raw(msg) {
|
|
371
|
+
writeAllSync(1, msg + "\n");
|
|
372
|
+
}
|
|
373
|
+
function progress(event) {
|
|
374
|
+
writeAllSync(2, JSON.stringify(event) + "\n");
|
|
375
|
+
}
|
|
376
|
+
function writeAllSync(fd, text) {
|
|
377
|
+
const buf = Buffer.from(text, "utf8");
|
|
378
|
+
let offset = 0;
|
|
379
|
+
while (offset < buf.length) {
|
|
380
|
+
try {
|
|
381
|
+
offset += writeSync(fd, buf, offset, buf.length - offset);
|
|
382
|
+
} catch (err) {
|
|
383
|
+
const code = err.code;
|
|
384
|
+
if (code === "EAGAIN" || code === "EINTR") continue;
|
|
385
|
+
throw err;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
354
389
|
async function resolveBtcUsdRate(purpose) {
|
|
355
390
|
try {
|
|
356
391
|
return { rate: await fetchBtcUsdRate(), stale: false };
|
|
@@ -465,7 +500,7 @@ function x402PendingFundingJson(entry) {
|
|
|
465
500
|
amount_micro: entry.amountMicro,
|
|
466
501
|
// What the ERC-3009 authorization can still pull, which is the figure a
|
|
467
502
|
// `--force` retirement is really deciding about: a deposit's authorized
|
|
468
|
-
// value can exceed the amount funded
|
|
503
|
+
// value can exceed the amount funded, so `amount_micro` alone
|
|
469
504
|
// understates it. Null on a voucher-only payload, which authorizes no
|
|
470
505
|
// deposit at all.
|
|
471
506
|
deposit_micro: entry.depositMicro ?? null,
|
|
@@ -518,7 +553,7 @@ var DvmX402ChannelStorage = class {
|
|
|
518
553
|
/**
|
|
519
554
|
* Upstream's ordinary write. Its chain-recovery paths are authoritative and
|
|
520
555
|
* clear the unreconciled stamp. DVM-response paths scope this same write to
|
|
521
|
-
* persist their weaker provenance atomically with the balance
|
|
556
|
+
* persist their weaker provenance atomically with the balance.
|
|
522
557
|
*/
|
|
523
558
|
set(key, context) {
|
|
524
559
|
return fromSynchronousStore(() => {
|
|
@@ -541,7 +576,7 @@ var DvmX402ChannelStorage = class {
|
|
|
541
576
|
}
|
|
542
577
|
/**
|
|
543
578
|
* Write a context whose `balance` carries a deposit this machine added on its
|
|
544
|
-
* own authority, and stamp the record as unreconciled
|
|
579
|
+
* own authority, and stamp the record as unreconciled.
|
|
545
580
|
*
|
|
546
581
|
* Separate from {@link set} because the two differ in exactly one thing that
|
|
547
582
|
* matters later: where the figure came from. Nothing else about the write
|
|
@@ -554,7 +589,7 @@ var DvmX402ChannelStorage = class {
|
|
|
554
589
|
}
|
|
555
590
|
/**
|
|
556
591
|
* Write a context whose `balance` is byte-for-byte the one already stored,
|
|
557
|
-
* leaving the unreconciled stamp exactly as it found it
|
|
592
|
+
* leaving the unreconciled stamp exactly as it found it.
|
|
558
593
|
*
|
|
559
594
|
* The replay acknowledgement's idempotent second pass is what needs this: it
|
|
560
595
|
* restates a cumulative base without adding to the balance, so it observes
|
|
@@ -569,7 +604,7 @@ var DvmX402ChannelStorage = class {
|
|
|
569
604
|
}
|
|
570
605
|
/**
|
|
571
606
|
* Seed upstream's cooperative-refund probe without changing the acknowledged
|
|
572
|
-
* base. Records written before
|
|
607
|
+
* base. Records written before have only the upstream context, so
|
|
573
608
|
* `hold` adopts its acknowledged value rather than losing that base to the
|
|
574
609
|
* chain floor this seeds. The seed itself is a `channels()` read, so it is
|
|
575
610
|
* `observed` and settles the unreconciled question like any other.
|
|
@@ -871,18 +906,18 @@ function ensureX402ChannelFile() {
|
|
|
871
906
|
function loadFile() {
|
|
872
907
|
if (!existsSync(X402_CHANNELS_FILE)) return { ...EMPTY, channels: {}, pending: [], exact: [] };
|
|
873
908
|
try {
|
|
874
|
-
const
|
|
875
|
-
if (
|
|
909
|
+
const raw2 = JSON.parse(readFileSync(X402_CHANNELS_FILE, "utf8"));
|
|
910
|
+
if (raw2.version !== 1 || !raw2.channels || typeof raw2.channels !== "object" || Array.isArray(raw2.channels) || !Array.isArray(raw2.pending)) {
|
|
876
911
|
throw new Error("unsupported x402 channel store shape");
|
|
877
912
|
}
|
|
878
913
|
return {
|
|
879
914
|
version: 1,
|
|
880
|
-
channels:
|
|
881
|
-
pending:
|
|
915
|
+
channels: raw2.channels,
|
|
916
|
+
pending: raw2.pending,
|
|
882
917
|
// Tolerated rather than required, unlike its two siblings: every file
|
|
883
|
-
// written before
|
|
918
|
+
// written before lacks the key, and failing closed on it would
|
|
884
919
|
// read as a corrupt journal on a store that is perfectly intact.
|
|
885
|
-
exact: Array.isArray(
|
|
920
|
+
exact: Array.isArray(raw2.exact) ? raw2.exact : []
|
|
886
921
|
};
|
|
887
922
|
} catch (cause) {
|
|
888
923
|
throw new DvmError(
|
|
@@ -1026,7 +1061,7 @@ async function getX402Balance(wallet) {
|
|
|
1026
1061
|
usdc: Number(balance) / 1e6,
|
|
1027
1062
|
network: w.network,
|
|
1028
1063
|
tokenAddress: spec.usdc,
|
|
1029
|
-
//
|
|
1064
|
+
// redacted here rather than at a display surface, so the clear
|
|
1030
1065
|
// endpoint never leaves this function on the success path either.
|
|
1031
1066
|
rpcUrlRedacted: rpcUrl ? redactUrl(rpcUrl) : void 0,
|
|
1032
1067
|
rpcSource
|
|
@@ -1270,7 +1305,7 @@ function buildNoopLoggers() {
|
|
|
1270
1305
|
};
|
|
1271
1306
|
}
|
|
1272
1307
|
|
|
1273
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
1308
|
+
// node_modules/@dvmkit/sdk/dist/chunk-PLG4XER6.js
|
|
1274
1309
|
import { createPrivateKey, randomBytes as randomBytes2 } from "crypto";
|
|
1275
1310
|
|
|
1276
1311
|
// node_modules/@x402/core/node_modules/zod/v3/external.js
|
|
@@ -1539,8 +1574,8 @@ var ZodIssueCode = util.arrayToEnum([
|
|
|
1539
1574
|
"not_finite"
|
|
1540
1575
|
]);
|
|
1541
1576
|
var quotelessJson = (obj) => {
|
|
1542
|
-
const
|
|
1543
|
-
return
|
|
1577
|
+
const json2 = JSON.stringify(obj, null, 2);
|
|
1578
|
+
return json2.replace(/"([^"]+)":/g, "$1:");
|
|
1544
1579
|
};
|
|
1545
1580
|
var ZodError = class _ZodError extends Error {
|
|
1546
1581
|
get errors() {
|
|
@@ -8761,7 +8796,7 @@ var SignJWT = class {
|
|
|
8761
8796
|
}
|
|
8762
8797
|
};
|
|
8763
8798
|
|
|
8764
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
8799
|
+
// node_modules/@dvmkit/sdk/dist/chunk-PLG4XER6.js
|
|
8765
8800
|
var AUTH_HEADER_TTL_MS = 6e4;
|
|
8766
8801
|
var AUTH_TOKEN_TTL_SECONDS = 120;
|
|
8767
8802
|
var FACILITATOR_PATHS = {
|
|
@@ -8903,7 +8938,7 @@ function isRecord2(value) {
|
|
|
8903
8938
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8904
8939
|
}
|
|
8905
8940
|
|
|
8906
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
8941
|
+
// node_modules/@dvmkit/sdk/dist/chunk-7ZUKL4IV.js
|
|
8907
8942
|
async function verifyX402Payment(paymentHeader, config, requiredUsdcMicro, resource, btcUsdRate, exactVersions = { v1: true, v2: true }) {
|
|
8908
8943
|
return callerLoggers.x402.span(
|
|
8909
8944
|
"x402.verify_payment",
|
|
@@ -8970,7 +9005,6 @@ async function verifyX402Payment(paymentHeader, config, requiredUsdcMicro, resou
|
|
|
8970
9005
|
}
|
|
8971
9006
|
|
|
8972
9007
|
export {
|
|
8973
|
-
X402_DEFAULT_FACILITATOR,
|
|
8974
9008
|
X402_NETWORKS,
|
|
8975
9009
|
x402NetworkByCaip2,
|
|
8976
9010
|
x402NetworkBySlug,
|
|
@@ -8978,6 +9012,7 @@ export {
|
|
|
8978
9012
|
x402NetworkListForCopy,
|
|
8979
9013
|
assertSupportedX402Network,
|
|
8980
9014
|
x402SupportedNetworksHint,
|
|
9015
|
+
X402_DEFAULT_FACILITATOR,
|
|
8981
9016
|
X402_VERSION,
|
|
8982
9017
|
X402_V1_VERSION,
|
|
8983
9018
|
X402_DEFAULT_NETWORK,
|
|
@@ -9001,6 +9036,12 @@ export {
|
|
|
9001
9036
|
encodeSettleResponseHeader,
|
|
9002
9037
|
resolveX402Asset,
|
|
9003
9038
|
x402WrongAssetHint,
|
|
9039
|
+
setOutputTraceId,
|
|
9040
|
+
getOutputTraceId,
|
|
9041
|
+
json,
|
|
9042
|
+
info,
|
|
9043
|
+
raw,
|
|
9044
|
+
progress,
|
|
9004
9045
|
resolveBtcUsdRate,
|
|
9005
9046
|
tryResolveBtcUsdRate,
|
|
9006
9047
|
staleRateNotice,
|