@dvmkit/dvm-cli 0.12.1 → 0.13.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/dist/{chunk-GHNF2I5C.js → chunk-C2BJETRG.js} +56 -54
- package/dist/{chunk-6EYBCGGD.js → chunk-C2EZ3VY2.js} +2 -2
- package/dist/{chunk-K562SFVD.js → chunk-CCF4QONY.js} +2 -2
- package/dist/{chunk-MMXHV3KC.js → chunk-GWLOO5XD.js} +2 -2
- package/dist/{chunk-7N3HQJKE.js → chunk-I2C3YEUN.js} +4 -4
- package/dist/{chunk-GEZVSJDM.js → chunk-KQQALLOL.js} +3 -3
- package/dist/{chunk-WPTJM5A7.js → chunk-NLUOHCX2.js} +1214 -85
- package/dist/{chunk-3R2GM6AD.js → chunk-PS4AUWK3.js} +2 -2
- package/dist/{chunk-RMYEB2WG.js → chunk-RPM5XEVS.js} +2 -2
- package/dist/{chunk-MBSCP52L.js → chunk-SEJWBDGY.js} +31255 -11304
- package/dist/{chunk-HWWW7JEM.js → chunk-ZDWZT6NA.js} +3 -3
- package/dist/{chunk-UVFFMKU4.js → chunk-ZV57FFIL.js} +68 -4
- package/dist/{client-V7KAPCAG.js → client-6JRGRKFQ.js} +6 -6
- package/dist/dvm.js +3867 -1510
- package/dist/{internal-ZZHCUKOM.js → internal-KPPGYK5N.js} +5 -5
- package/dist/{lifecycle-XGNIMPTB.js → lifecycle-7YRNRLDQ.js} +6 -6
- package/dist/{payout-reporter-DDQ7FGRC-OKICJCC2.js → payout-reporter-KTLBNJJ7-WDT6M4GN.js} +2 -2
- package/dist/{pocket-refill-Z4YT7CHW.js → pocket-refill-E2QVQDME.js} +10 -10
- package/dist/{revenue-reporter-RIEHBKRA-75BDPVVX.js → revenue-reporter-FD3GDQZS-COUBEUDN.js} +2 -2
- package/dist/{tempo-lifecycle-LGGBDCKK.js → tempo-lifecycle-EOP5IHJT.js} +8 -8
- package/dist/{tempo-wallet-PLFC443A.js → tempo-wallet-4A5M3FVO.js} +7 -7
- package/dist/{wallet-UJ7EJNQA.js → wallet-LASVQ72F.js} +7 -7
- package/dist/{x402-AY6P5KV4-SIZF7YNW.js → x402-MFBRORHG-34VE7EWO.js} +2 -2
- package/package.json +2 -2
- package/skills/dvm/credit.md +8 -0
|
@@ -3,7 +3,7 @@ import { createRequire as __dvmCreateRequire } from "node:module";
|
|
|
3
3
|
const require = __dvmCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
diagnosticConsole
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZV57FFIL.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
9
|
} from "./chunk-IYHTITNZ.js";
|
|
@@ -149,15 +149,56 @@ function x402SupportedNetworksHint() {
|
|
|
149
149
|
var BY_CAIP2 = new Map(X402_NETWORKS.map((n) => [n.caip2, n]));
|
|
150
150
|
var BY_SLUG = new Map(X402_NETWORKS.map((n) => [n.slug, n]));
|
|
151
151
|
|
|
152
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
152
|
+
// node_modules/@dvmkit/sdk/dist/chunk-LABJSMSJ.js
|
|
153
|
+
function msatsToUsd(msats, rate) {
|
|
154
|
+
return msats / 1e11 * rate;
|
|
155
|
+
}
|
|
156
|
+
function usdToMsats(usd, rate) {
|
|
157
|
+
return Math.round(usd / rate * 1e11);
|
|
158
|
+
}
|
|
159
|
+
function msatsToUsdCents(msats, btcPriceUsd) {
|
|
160
|
+
const usd = msatsToUsd(msats, btcPriceUsd);
|
|
161
|
+
return Math.round(usd * 100);
|
|
162
|
+
}
|
|
163
|
+
function msatsToUsdc(msats, btcUsdRate) {
|
|
164
|
+
if (!Number.isSafeInteger(msats) || msats < 0) {
|
|
165
|
+
throw new RangeError("msats must be a non-negative safe integer");
|
|
166
|
+
}
|
|
167
|
+
if (!Number.isFinite(btcUsdRate) || btcUsdRate <= 0) {
|
|
168
|
+
throw new RangeError("BTC/USD rate must be finite and positive");
|
|
169
|
+
}
|
|
170
|
+
const [mantissa, exponent = "0"] = btcUsdRate.toString().split("e");
|
|
171
|
+
const decimalPlaces = mantissa.split(".")[1]?.length ?? 0;
|
|
172
|
+
const shift = Number(exponent) - decimalPlaces;
|
|
173
|
+
let numerator = BigInt(msats) * BigInt(mantissa.replace(".", ""));
|
|
174
|
+
let denominator = 100000n;
|
|
175
|
+
if (shift > 0) numerator *= 10n ** BigInt(shift);
|
|
176
|
+
else if (shift < 0) denominator *= 10n ** BigInt(-shift);
|
|
177
|
+
const micro = (numerator + denominator - 1n) / denominator;
|
|
178
|
+
if (micro > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
179
|
+
throw new RangeError("USDC micro-unit amount exceeds the safe integer range");
|
|
180
|
+
}
|
|
181
|
+
return Number(micro);
|
|
182
|
+
}
|
|
183
|
+
function usdcToMsats(usdc, btcUsdRate) {
|
|
184
|
+
return usdToMsats(usdc, btcUsdRate);
|
|
185
|
+
}
|
|
186
|
+
function msatsToMicro(msats, btcRate) {
|
|
187
|
+
return Math.round(msatsToUsd(msats, btcRate) * 1e6);
|
|
188
|
+
}
|
|
189
|
+
function microToSats(micro, btcRate) {
|
|
190
|
+
return Math.ceil(usdToMsats(micro / 1e6, btcRate) / 1e3);
|
|
191
|
+
}
|
|
153
192
|
var X402_DEFAULT_FACILITATOR = "https://x402.org/facilitator";
|
|
154
193
|
var X402_VERSION = 2;
|
|
155
194
|
var X402_V1_VERSION = 1;
|
|
195
|
+
var DEFAULT_MAX_TIMEOUT_SECONDS = 60;
|
|
156
196
|
var X402_DEFAULT_NETWORK = "eip155:8453";
|
|
157
197
|
var X402_EXACT_SCHEME = "exact";
|
|
158
198
|
var X402_BATCH_SETTLEMENT_SCHEME = "batch-settlement";
|
|
159
199
|
function buildPaymentRequirements(opts) {
|
|
160
200
|
const { x402Config, requiredUsdcMicro, resource, description, mimeType } = opts;
|
|
201
|
+
const maxTimeoutSeconds = opts.maxTimeoutSeconds ?? DEFAULT_MAX_TIMEOUT_SECONDS;
|
|
161
202
|
const version = opts.version ?? X402_VERSION;
|
|
162
203
|
const network = version === X402_V1_VERSION ? caip2ToX402Network(x402Config.network) : x402Config.network;
|
|
163
204
|
const usdcContract = usdcContractByCaip2(x402Config.network);
|
|
@@ -171,7 +212,7 @@ function buildPaymentRequirements(opts) {
|
|
|
171
212
|
amount: requiredUsdcMicro.toString(),
|
|
172
213
|
payTo: x402Config.payTo,
|
|
173
214
|
asset,
|
|
174
|
-
maxTimeoutSeconds
|
|
215
|
+
maxTimeoutSeconds,
|
|
175
216
|
extra
|
|
176
217
|
};
|
|
177
218
|
}
|
|
@@ -184,7 +225,7 @@ function buildPaymentRequirements(opts) {
|
|
|
184
225
|
mimeType: mimeType ?? "application/json",
|
|
185
226
|
payTo: x402Config.payTo,
|
|
186
227
|
asset,
|
|
187
|
-
maxTimeoutSeconds
|
|
228
|
+
maxTimeoutSeconds,
|
|
188
229
|
...Object.keys(extra).length > 0 ? { extra } : {}
|
|
189
230
|
};
|
|
190
231
|
}
|
|
@@ -347,45 +388,6 @@ function isRecord(value) {
|
|
|
347
388
|
function isOptionalRecord(value) {
|
|
348
389
|
return value === void 0 || value === null || isRecord(value);
|
|
349
390
|
}
|
|
350
|
-
function msatsToUsd(msats, rate) {
|
|
351
|
-
return msats / 1e11 * rate;
|
|
352
|
-
}
|
|
353
|
-
function usdToMsats(usd, rate) {
|
|
354
|
-
return Math.round(usd / rate * 1e11);
|
|
355
|
-
}
|
|
356
|
-
function msatsToUsdCents(msats, btcPriceUsd) {
|
|
357
|
-
const usd = msatsToUsd(msats, btcPriceUsd);
|
|
358
|
-
return Math.round(usd * 100);
|
|
359
|
-
}
|
|
360
|
-
function msatsToUsdc(msats, btcUsdRate) {
|
|
361
|
-
if (!Number.isSafeInteger(msats) || msats < 0) {
|
|
362
|
-
throw new RangeError("msats must be a non-negative safe integer");
|
|
363
|
-
}
|
|
364
|
-
if (!Number.isFinite(btcUsdRate) || btcUsdRate <= 0) {
|
|
365
|
-
throw new RangeError("BTC/USD rate must be finite and positive");
|
|
366
|
-
}
|
|
367
|
-
const [mantissa, exponent = "0"] = btcUsdRate.toString().split("e");
|
|
368
|
-
const decimalPlaces = mantissa.split(".")[1]?.length ?? 0;
|
|
369
|
-
const shift = Number(exponent) - decimalPlaces;
|
|
370
|
-
let numerator = BigInt(msats) * BigInt(mantissa.replace(".", ""));
|
|
371
|
-
let denominator = 100000n;
|
|
372
|
-
if (shift > 0) numerator *= 10n ** BigInt(shift);
|
|
373
|
-
else if (shift < 0) denominator *= 10n ** BigInt(-shift);
|
|
374
|
-
const micro = (numerator + denominator - 1n) / denominator;
|
|
375
|
-
if (micro > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
376
|
-
throw new RangeError("USDC micro-unit amount exceeds the safe integer range");
|
|
377
|
-
}
|
|
378
|
-
return Number(micro);
|
|
379
|
-
}
|
|
380
|
-
function usdcToMsats(usdc, btcUsdRate) {
|
|
381
|
-
return usdToMsats(usdc, btcUsdRate);
|
|
382
|
-
}
|
|
383
|
-
function msatsToMicro(msats, btcRate) {
|
|
384
|
-
return Math.round(msatsToUsd(msats, btcRate) * 1e6);
|
|
385
|
-
}
|
|
386
|
-
function microToSats(micro, btcRate) {
|
|
387
|
-
return Math.ceil(usdToMsats(micro / 1e6, btcRate) / 1e3);
|
|
388
|
-
}
|
|
389
391
|
function resolveRpcOverride(envValue, bundled) {
|
|
390
392
|
const override = envValue?.trim() ?? "";
|
|
391
393
|
return override.length > 0 ? { url: override, source: "override" } : { url: bundled, source: "bundled" };
|
|
@@ -2992,7 +2994,7 @@ var schnorr = /* @__PURE__ */ (() => {
|
|
|
2992
2994
|
};
|
|
2993
2995
|
})();
|
|
2994
2996
|
|
|
2995
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
2997
|
+
// node_modules/@dvmkit/sdk/dist/chunk-XB644VN3.js
|
|
2996
2998
|
function resolveX402Asset(network = X402_DEFAULT_NETWORK) {
|
|
2997
2999
|
const spec = x402NetworkByCaip2(network);
|
|
2998
3000
|
if (!spec) return null;
|
|
@@ -3105,7 +3107,7 @@ function buildNoopLoggers() {
|
|
|
3105
3107
|
};
|
|
3106
3108
|
}
|
|
3107
3109
|
|
|
3108
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
3110
|
+
// node_modules/@dvmkit/sdk/dist/chunk-3DGIRHP2.js
|
|
3109
3111
|
import { AsyncLocalStorage } from "async_hooks";
|
|
3110
3112
|
import { createPrivateKey, randomBytes as randomBytes2 } from "crypto";
|
|
3111
3113
|
|
|
@@ -10597,7 +10599,7 @@ var SignJWT = class {
|
|
|
10597
10599
|
}
|
|
10598
10600
|
};
|
|
10599
10601
|
|
|
10600
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
10602
|
+
// node_modules/@dvmkit/sdk/dist/chunk-3DGIRHP2.js
|
|
10601
10603
|
var scopes = new AsyncLocalStorage();
|
|
10602
10604
|
function withPaymentDiagnostics(fn) {
|
|
10603
10605
|
return scopes.run({}, fn);
|
|
@@ -10772,7 +10774,7 @@ function logRejected(stage) {
|
|
|
10772
10774
|
});
|
|
10773
10775
|
}
|
|
10774
10776
|
|
|
10775
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
10777
|
+
// node_modules/@dvmkit/sdk/dist/chunk-GDZXGB43.js
|
|
10776
10778
|
async function verifyX402Payment(paymentHeader, config, requiredUsdcMicro, resource, btcUsdRate, exactVersions = { v1: true, v2: true }) {
|
|
10777
10779
|
return callerLoggers.x402.span(
|
|
10778
10780
|
"x402.verify_payment",
|
|
@@ -10860,6 +10862,13 @@ export {
|
|
|
10860
10862
|
x402NetworkListForCopy,
|
|
10861
10863
|
assertSupportedX402Network,
|
|
10862
10864
|
x402SupportedNetworksHint,
|
|
10865
|
+
msatsToUsd,
|
|
10866
|
+
usdToMsats,
|
|
10867
|
+
msatsToUsdCents,
|
|
10868
|
+
msatsToUsdc,
|
|
10869
|
+
usdcToMsats,
|
|
10870
|
+
msatsToMicro,
|
|
10871
|
+
microToSats,
|
|
10863
10872
|
X402_DEFAULT_FACILITATOR,
|
|
10864
10873
|
X402_VERSION,
|
|
10865
10874
|
X402_V1_VERSION,
|
|
@@ -10882,13 +10891,6 @@ export {
|
|
|
10882
10891
|
decodePaymentRequiredHeader,
|
|
10883
10892
|
exactEvmAuthorization,
|
|
10884
10893
|
encodeSettleResponseHeader,
|
|
10885
|
-
msatsToUsd,
|
|
10886
|
-
usdToMsats,
|
|
10887
|
-
msatsToUsdCents,
|
|
10888
|
-
msatsToUsdc,
|
|
10889
|
-
usdcToMsats,
|
|
10890
|
-
msatsToMicro,
|
|
10891
|
-
microToSats,
|
|
10892
10894
|
resolveRpcOverride,
|
|
10893
10895
|
resolveRpcHttpTransportOptions,
|
|
10894
10896
|
redactUrl,
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
formatUsdcMicrounits,
|
|
6
6
|
listX402Channels,
|
|
7
7
|
readX402ChannelGuardFacts
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SEJWBDGY.js";
|
|
9
9
|
import {
|
|
10
10
|
DvmError
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-C2BJETRG.js";
|
|
12
12
|
|
|
13
13
|
// src/lib/x402/lifecycle.ts
|
|
14
14
|
async function assertX402WalletIdle(wallet, intent) {
|
|
@@ -6,9 +6,9 @@ import {
|
|
|
6
6
|
} from "./chunk-R2DSAZBO.js";
|
|
7
7
|
import {
|
|
8
8
|
diagnosticConsole
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZV57FFIL.js";
|
|
10
10
|
|
|
11
|
-
// node_modules/@dvmkit/sdk/dist/chunk-
|
|
11
|
+
// node_modules/@dvmkit/sdk/dist/chunk-QMKGYIBM.js
|
|
12
12
|
import { randomUUID } from "crypto";
|
|
13
13
|
var ENDPOINTS = {
|
|
14
14
|
job_terminal: "/_internal/job-terminal",
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
CONFIG_PINNED_FILE,
|
|
9
9
|
ensureConfigDir,
|
|
10
10
|
require_proper_lockfile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SEJWBDGY.js";
|
|
12
12
|
import {
|
|
13
13
|
DvmError
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-C2BJETRG.js";
|
|
15
15
|
import {
|
|
16
16
|
__toESM
|
|
17
17
|
} from "./chunk-IYHTITNZ.js";
|
|
@@ -4,14 +4,14 @@ const require = __dvmCreateRequire(import.meta.url);
|
|
|
4
4
|
import {
|
|
5
5
|
loadConfig,
|
|
6
6
|
updateConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GWLOO5XD.js";
|
|
8
8
|
import {
|
|
9
9
|
tempoAccountFromConfig,
|
|
10
10
|
tryResolveTempoAsset
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SEJWBDGY.js";
|
|
12
12
|
import {
|
|
13
13
|
DvmError
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-C2BJETRG.js";
|
|
15
15
|
|
|
16
16
|
// src/lib/payment-rails/tempo-wallet.ts
|
|
17
17
|
function tempoBalanceCheckHint(token) {
|
|
@@ -46,7 +46,7 @@ async function generateTempoKey(opts = {}) {
|
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
if (existing && opts.force) {
|
|
49
|
-
const { assertTempoWalletIdle } = await import("./tempo-lifecycle-
|
|
49
|
+
const { assertTempoWalletIdle } = await import("./tempo-lifecycle-EOP5IHJT.js");
|
|
50
50
|
await assertTempoWalletIdle("replace");
|
|
51
51
|
}
|
|
52
52
|
const { privateKeyToAccount, generatePrivateKey } = await import("./accounts-2WZE4N5F.js");
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
authorizeProtectedRemoval,
|
|
6
6
|
loadConfig,
|
|
7
7
|
updateConfig
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GWLOO5XD.js";
|
|
9
9
|
import {
|
|
10
10
|
withX402ChannelLock,
|
|
11
11
|
x402WalletFromConfig
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SEJWBDGY.js";
|
|
13
13
|
import {
|
|
14
14
|
DvmError,
|
|
15
15
|
X402_DEFAULT_NETWORK,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
ensureAddress,
|
|
18
18
|
isValidEvmPrivateKey,
|
|
19
19
|
x402NetworkByCaip2
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-C2BJETRG.js";
|
|
21
21
|
|
|
22
22
|
// src/lib/x402/networks.ts
|
|
23
23
|
function x402NetworkLabel(network) {
|