@dvmkit/sdk 0.21.0 → 0.21.2
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-MWDUGMN2.js → chunk-27QB2D3Z.js} +2 -2
- package/dist/{chunk-CVN2YNMG.js → chunk-2AGADOX3.js} +1 -1
- package/dist/{chunk-5RLNRLLB.js → chunk-2HSWWHXK.js} +1 -1
- package/dist/{chunk-CXRI4N4Y.js → chunk-2RZRYMCR.js} +1 -1
- package/dist/{chunk-C65P6MGZ.js → chunk-3V6CSTWB.js} +1 -1
- package/dist/{chunk-KRX7VNBG.js → chunk-62JG4AF7.js} +1 -1
- package/dist/{chunk-A6AOE63A.js → chunk-6GZF7VDO.js} +5 -1
- package/dist/{chunk-LY2JYSJS.js → chunk-7KNFEDFW.js} +1 -1
- package/dist/{chunk-DJRTYBEE.js → chunk-B27E7JIR.js} +1 -1
- package/dist/{chunk-2PN4DKZW.js → chunk-D2MGOQIS.js} +1 -1
- package/dist/{chunk-34H4ZKBM.js → chunk-FAT57DAP.js} +1 -1
- package/dist/{chunk-7RWE6ELV.js → chunk-IUFVIIPF.js} +1 -1
- package/dist/{chunk-I5MXADJS.js → chunk-JOSNSNS7.js} +2 -2
- package/dist/{chunk-INYFUPXV.js → chunk-LSANCGLP.js} +1 -1
- package/dist/{chunk-RX6FT7XA.js → chunk-LWF4ABYF.js} +1 -1
- package/dist/{chunk-ALTE7I6C.js → chunk-MA55LUNR.js} +1 -0
- package/dist/{chunk-QTKGFG3I.js → chunk-NRE4NOCY.js} +1 -1
- package/dist/{chunk-VT3WUX6B.js → chunk-VIAMJ6GS.js} +45 -32
- package/dist/{chunk-6RJAE332.js → chunk-WWKFG6TM.js} +1 -1
- package/dist/{chunk-72A4PHLD.js → chunk-XWG54M6T.js} +1 -1
- package/dist/{chunk-QCZXKUS2.js → chunk-Y746QPX7.js} +1 -1
- package/dist/{chunk-OTNHKRHA.js → chunk-ZBOCNF56.js} +2 -2
- package/dist/{content-retention-COnj0QKi.d.ts → content-retention-efjireLM.d.ts} +1 -1
- package/dist/{credit-ledger-ZCJXJG6R.js → credit-ledger-M3EBVMOP.js} +3 -3
- package/dist/{credit-menu-BpPa43Co.d.ts → credit-menu-UOOxuxVL.d.ts} +9 -4
- package/dist/{fx-DfzQ0Lge.d.ts → fx-BtxHVj6w.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/internal/caller.d.ts +11 -6
- package/dist/internal/caller.js +8 -7
- package/dist/internal/server.d.ts +7 -7
- package/dist/internal/server.js +20 -20
- package/dist/{job-store-p45j28px.d.ts → job-store-DWVkleH3.d.ts} +1 -1
- package/dist/{lightning-backend-DO7G7VqP.d.ts → lightning-backend-CTijN35u.d.ts} +1 -1
- package/dist/{memory-credit-ledger-N4PZKTT5.js → memory-credit-ledger-WL2VKLE3.js} +4 -4
- package/dist/{mpp-setup-BLIYBORK.js → mpp-setup-DBYDXISN.js} +3 -3
- package/dist/{payout-reporter-5QAHCYIO.js → payout-reporter-D5TCIBQA.js} +2 -2
- package/dist/{postgres-consumed-credential-store-4PCJEZBD.js → postgres-consumed-credential-store-IPWPJ6V7.js} +1 -1
- package/dist/{postgres-job-store-QKN5LGAH.js → postgres-job-store-POZJNFJU.js} +2 -2
- package/dist/{postgres-replay-store-GH5AINQR.js → postgres-replay-store-JQYAKG47.js} +2 -2
- package/dist/{pricing-JJYLTTWK.js → pricing-FGPVRNTL.js} +3 -3
- package/dist/{revenue-reporter-6XARUEG6.js → revenue-reporter-QKCBYFWT.js} +2 -2
- package/dist/server/index.d.ts +10 -10
- package/dist/server/index.js +38 -29
- package/dist/{step-cache-CcCjpZm1.d.ts → step-cache-Bx_ZybWF.d.ts} +2 -1
- package/dist/{tempo-charge-store-A3CDF7D5.js → tempo-charge-store-P7ZBR3GG.js} +2 -2
- package/dist/{tempo-session-store-XJE6GIXN.js → tempo-session-store-ZVRBAMLG.js} +3 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +6 -6
- package/dist/{usd-BnAFcUai.d.ts → usd-eOAMEO12.d.ts} +1 -1
- package/dist/{x402-XLFD43RF.js → x402-44JZJQ5F.js} +3 -3
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loggers
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7KNFEDFW.js";
|
|
4
4
|
import {
|
|
5
5
|
diagnosticConsole
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-MA55LUNR.js";
|
|
7
7
|
|
|
8
8
|
// src/sdk/server/mpp-setup.ts
|
|
9
9
|
import { createHash, randomUUID } from "crypto";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "./chunk-SXL44PL5.js";
|
|
8
8
|
import {
|
|
9
9
|
diagnosticConsole
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MA55LUNR.js";
|
|
11
11
|
|
|
12
12
|
// src/sdk/server/zod-error.ts
|
|
13
13
|
function humanizeZodError(err, opts) {
|
|
@@ -106,6 +106,9 @@ var SIGNED_ENVELOPE_TYPES = {
|
|
|
106
106
|
var SIGNED_ENVELOPE_FIELDS = Object.keys(
|
|
107
107
|
SIGNED_ENVELOPE_TYPES
|
|
108
108
|
);
|
|
109
|
+
function carriesSignedEnvelope(input) {
|
|
110
|
+
return input !== null && typeof input === "object" && !Array.isArray(input) && SIGNED_ENVELOPE_FIELDS.some((field) => field in input);
|
|
111
|
+
}
|
|
109
112
|
var SignedRequestError = class extends Error {
|
|
110
113
|
constructor(message, sub_reason, issues) {
|
|
111
114
|
super(message);
|
|
@@ -371,6 +374,7 @@ export {
|
|
|
371
374
|
zodIssuesOf,
|
|
372
375
|
SIGNED_ENVELOPE_TYPES,
|
|
373
376
|
SIGNED_ENVELOPE_FIELDS,
|
|
377
|
+
carriesSignedEnvelope,
|
|
374
378
|
SignedRequestError,
|
|
375
379
|
createSignedRequestVerifier,
|
|
376
380
|
signedRequestInput,
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
} from "./chunk-5UC7TOQC.js";
|
|
11
11
|
import {
|
|
12
12
|
applyRetryToPool
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-LSANCGLP.js";
|
|
14
14
|
import {
|
|
15
15
|
x402NetworkByCaip2
|
|
16
16
|
} from "./chunk-BPYMEMQX.js";
|
|
17
17
|
import {
|
|
18
18
|
diagnosticConsole
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MA55LUNR.js";
|
|
20
20
|
|
|
21
21
|
// src/sdk/server/credit-ledger.ts
|
|
22
22
|
import { randomUUID } from "crypto";
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-XRLKGCAW.js";
|
|
6
6
|
import {
|
|
7
7
|
x402EarnedCeiling
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-62JG4AF7.js";
|
|
9
9
|
import {
|
|
10
10
|
createX402FacilitatorAuthHeaders,
|
|
11
11
|
createX402FacilitatorClient,
|
|
@@ -14,18 +14,19 @@ import {
|
|
|
14
14
|
verifyWithFacilitator,
|
|
15
15
|
withPaymentDiagnostics,
|
|
16
16
|
withPaymentStage
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3V6CSTWB.js";
|
|
18
18
|
import {
|
|
19
19
|
MemoryCreditLedger
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-B27E7JIR.js";
|
|
21
21
|
import {
|
|
22
22
|
PostgresJobStore
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-Y746QPX7.js";
|
|
24
24
|
import {
|
|
25
25
|
CASHU_MIN_LOCKTIME_SECONDS,
|
|
26
26
|
DEFAULT_CASHU_LOCK_WINDOW_SECONDS,
|
|
27
27
|
SIGNED_ENVELOPE_FIELDS,
|
|
28
28
|
SignedRequestError,
|
|
29
|
+
carriesSignedEnvelope,
|
|
29
30
|
humanizeZodError,
|
|
30
31
|
humanizeZodIssues,
|
|
31
32
|
shortestCashuLockWindowSeconds,
|
|
@@ -33,7 +34,7 @@ import {
|
|
|
33
34
|
signedRequestInput,
|
|
34
35
|
unsignedCashuLockWindowSeconds,
|
|
35
36
|
zodIssuesOf
|
|
36
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-6GZF7VDO.js";
|
|
37
38
|
import {
|
|
38
39
|
MemoryJobStore,
|
|
39
40
|
UNCAPPABLE_ASK_TOTAL,
|
|
@@ -42,7 +43,7 @@ import {
|
|
|
42
43
|
isJobRetentionStore,
|
|
43
44
|
isReceiptIssuingStore,
|
|
44
45
|
isStreamableJobStore
|
|
45
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-WWKFG6TM.js";
|
|
46
47
|
import {
|
|
47
48
|
ContentHoldError,
|
|
48
49
|
JobCancelledError,
|
|
@@ -83,7 +84,7 @@ import {
|
|
|
83
84
|
receiptPubkeyFromSecret,
|
|
84
85
|
toLockPubkey,
|
|
85
86
|
verifyChallenge
|
|
86
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-IUFVIIPF.js";
|
|
87
88
|
import {
|
|
88
89
|
X402_BATCH_SETTLEMENT_SCHEME,
|
|
89
90
|
X402_DEFAULT_FACILITATOR,
|
|
@@ -110,7 +111,7 @@ import {
|
|
|
110
111
|
} from "./chunk-SXL44PL5.js";
|
|
111
112
|
import {
|
|
112
113
|
createConsoleLogger
|
|
113
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-NRE4NOCY.js";
|
|
114
115
|
import {
|
|
115
116
|
StepCache
|
|
116
117
|
} from "./chunk-BQJIFRAZ.js";
|
|
@@ -127,7 +128,7 @@ import {
|
|
|
127
128
|
roundUsd,
|
|
128
129
|
satsToFiat,
|
|
129
130
|
validateCurrency
|
|
130
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-XWG54M6T.js";
|
|
131
132
|
import {
|
|
132
133
|
CreditLedger,
|
|
133
134
|
CreditLedgerError,
|
|
@@ -143,7 +144,7 @@ import {
|
|
|
143
144
|
isNonChannelBitcoinRail,
|
|
144
145
|
netOwedSats,
|
|
145
146
|
x402SettlementPending
|
|
146
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-JOSNSNS7.js";
|
|
147
148
|
import {
|
|
148
149
|
parseStoreValue
|
|
149
150
|
} from "./chunk-YG7G4DPZ.js";
|
|
@@ -162,7 +163,7 @@ import {
|
|
|
162
163
|
import {
|
|
163
164
|
isTransportError,
|
|
164
165
|
withPostgresRecoveryContext
|
|
165
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-LSANCGLP.js";
|
|
166
167
|
import {
|
|
167
168
|
DvmError,
|
|
168
169
|
x402NetworkByCaip2
|
|
@@ -180,17 +181,17 @@ import {
|
|
|
180
181
|
installHostedTempoCloseGuard,
|
|
181
182
|
isTempoInsufficientFundsError,
|
|
182
183
|
resolveTempoNetwork
|
|
183
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-27QB2D3Z.js";
|
|
184
185
|
import {
|
|
185
186
|
loggers,
|
|
186
187
|
pinDimension,
|
|
187
188
|
withSpan,
|
|
188
189
|
withTraceContext
|
|
189
|
-
} from "./chunk-
|
|
190
|
+
} from "./chunk-7KNFEDFW.js";
|
|
190
191
|
import {
|
|
191
192
|
createDiagnosticCapabilityAuthority,
|
|
192
193
|
diagnosticConsole
|
|
193
|
-
} from "./chunk-
|
|
194
|
+
} from "./chunk-MA55LUNR.js";
|
|
194
195
|
|
|
195
196
|
// src/sdk/server/lock-pubkey-store.ts
|
|
196
197
|
async function initLockPubkeyTable(db) {
|
|
@@ -1031,6 +1032,7 @@ function attachCreditMenu(body, menu) {
|
|
|
1031
1032
|
function toCreditTerms(menu) {
|
|
1032
1033
|
return {
|
|
1033
1034
|
...menu.balance_payment && { balance_payment: true },
|
|
1035
|
+
...menu.jit_refund_park && { jit_refund_park: true },
|
|
1034
1036
|
min_micro: menu.min_micro,
|
|
1035
1037
|
max_micro: menu.max_micro,
|
|
1036
1038
|
ttl_ms: menu.ttl_ms,
|
|
@@ -5179,7 +5181,7 @@ async function verifyUpfrontPaymentInScope(opts) {
|
|
|
5179
5181
|
x402Requirements
|
|
5180
5182
|
});
|
|
5181
5183
|
}
|
|
5182
|
-
const { verifyX402Payment } = await import("./x402-
|
|
5184
|
+
const { verifyX402Payment } = await import("./x402-44JZJQ5F.js");
|
|
5183
5185
|
const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
|
|
5184
5186
|
x402Payment,
|
|
5185
5187
|
x402Config,
|
|
@@ -6235,7 +6237,7 @@ async function verifyIncomingPaymentInScope(body, opts, snapshot) {
|
|
|
6235
6237
|
snapshot
|
|
6236
6238
|
});
|
|
6237
6239
|
}
|
|
6238
|
-
const { verifyX402Payment } = await import("./x402-
|
|
6240
|
+
const { verifyX402Payment } = await import("./x402-44JZJQ5F.js");
|
|
6239
6241
|
const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
|
|
6240
6242
|
body.content.x402_payment,
|
|
6241
6243
|
opts.x402Config,
|
|
@@ -6687,7 +6689,7 @@ async function processIncomingPaymentInScope(job, body, opts) {
|
|
|
6687
6689
|
try {
|
|
6688
6690
|
const requiredMsats = job.pendingPaymentMsats ?? 0;
|
|
6689
6691
|
const requiredUsdcMicro = job.pendingX402AmountUsdcMicro !== void 0 ? BigInt(job.pendingX402AmountUsdcMicro) : BigInt(msatsToUsdc(requiredMsats, rate));
|
|
6690
|
-
const { verifyX402Payment } = await import("./x402-
|
|
6692
|
+
const { verifyX402Payment } = await import("./x402-44JZJQ5F.js");
|
|
6691
6693
|
const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
|
|
6692
6694
|
body.content.x402_payment,
|
|
6693
6695
|
opts.x402Config,
|
|
@@ -8295,6 +8297,8 @@ function authErrorBody(err, opts = {}) {
|
|
|
8295
8297
|
const subReason = err.sub_reason === "schema_invalid" ? "signature_invalid" : err.sub_reason;
|
|
8296
8298
|
const display = (() => {
|
|
8297
8299
|
switch (subReason) {
|
|
8300
|
+
case "signature_required":
|
|
8301
|
+
return "This capability requires a signed request";
|
|
8298
8302
|
case "signature_invalid":
|
|
8299
8303
|
return "Request signature didn't match the supplied pubkey";
|
|
8300
8304
|
case "timestamp_drift":
|
|
@@ -8309,7 +8313,7 @@ function authErrorBody(err, opts = {}) {
|
|
|
8309
8313
|
error: "auth_error",
|
|
8310
8314
|
sub_reason: subReason,
|
|
8311
8315
|
display,
|
|
8312
|
-
hint: "Regenerate the request with the current timestamp + a fresh nonce; sign with secp256k1+BIP-340 Schnorr over the canonical JSON form of the input."
|
|
8316
|
+
hint: subReason === "signature_required" ? "Run `npx @dvmkit/dvm-cli init`, then use `dvm request` to sign and send the request, or implement secp256k1+BIP-340 Schnorr signing with the domain-bound envelope described at https://dvmkit.com/docs/protocol." : "Regenerate the request with the current timestamp + a fresh nonce; sign with secp256k1+BIP-340 Schnorr over the canonical JSON form of the input."
|
|
8313
8317
|
};
|
|
8314
8318
|
}
|
|
8315
8319
|
function infoSchemaUrl(requestUrl, publicOrigin) {
|
|
@@ -14342,9 +14346,7 @@ function resultHashFor(record) {
|
|
|
14342
14346
|
// src/sdk/server/unsigned-request.ts
|
|
14343
14347
|
function takesUnsignedPath(auth, body) {
|
|
14344
14348
|
if (!auth?.allowUnsignedPaid) return false;
|
|
14345
|
-
|
|
14346
|
-
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return true;
|
|
14347
|
-
return !SIGNED_ENVELOPE_FIELDS.some((field) => field in raw);
|
|
14349
|
+
return !carriesSignedEnvelope(signedRequestInput(body));
|
|
14348
14350
|
}
|
|
14349
14351
|
function carriesCreditFields(raw) {
|
|
14350
14352
|
if (raw === null || typeof raw !== "object" || Array.isArray(raw)) return false;
|
|
@@ -19037,7 +19039,15 @@ async function handleBitcoinLiability(c, opts) {
|
|
|
19037
19039
|
async function handleParkDrain(c, opts) {
|
|
19038
19040
|
const auth = await requireAuth(c, opts);
|
|
19039
19041
|
if ("response" in auth) return auth.response;
|
|
19040
|
-
|
|
19042
|
+
let body = null;
|
|
19043
|
+
try {
|
|
19044
|
+
body = await c.req.json();
|
|
19045
|
+
} catch {
|
|
19046
|
+
body = null;
|
|
19047
|
+
}
|
|
19048
|
+
const earlyEvidence = typeof body === "object" && body !== null ? parseMintEvidence(body.mint_evidence) : void 0;
|
|
19049
|
+
const accumulatorFree = earlyEvidence !== void 0 && earlyEvidence !== "invalid";
|
|
19050
|
+
if (!opts.accumulatorWired && !accumulatorFree) {
|
|
19041
19051
|
return c.json(
|
|
19042
19052
|
{
|
|
19043
19053
|
error: "accumulator_not_wired",
|
|
@@ -19046,10 +19056,7 @@ async function handleParkDrain(c, opts) {
|
|
|
19046
19056
|
503
|
|
19047
19057
|
);
|
|
19048
19058
|
}
|
|
19049
|
-
|
|
19050
|
-
try {
|
|
19051
|
-
body = await c.req.json();
|
|
19052
|
-
} catch {
|
|
19059
|
+
if (typeof body !== "object" || body === null) {
|
|
19053
19060
|
return c.json({ error: "invalid_body", message: "Request body must be JSON." }, 400);
|
|
19054
19061
|
}
|
|
19055
19062
|
const creditId = body.credit_id;
|
|
@@ -19221,7 +19228,7 @@ async function handleParkDrain(c, opts) {
|
|
|
19221
19228
|
502
|
|
19222
19229
|
);
|
|
19223
19230
|
}
|
|
19224
|
-
const consumed = await fetchRowsForMelt(opts.db, opts.dvmId, rowIds);
|
|
19231
|
+
const consumed = mintEvidence ? [] : await fetchRowsForMelt(opts.db, opts.dvmId, rowIds);
|
|
19225
19232
|
if (consumed.length !== rowIds.length) {
|
|
19226
19233
|
const found = new Set(consumed.map((r) => r.id));
|
|
19227
19234
|
return c.json(
|
|
@@ -19250,7 +19257,7 @@ async function handleParkDrain(c, opts) {
|
|
|
19250
19257
|
const client = await opts.db.connect();
|
|
19251
19258
|
try {
|
|
19252
19259
|
await client.query("BEGIN");
|
|
19253
|
-
await markRowsDrained(client, rowIds, drainId, nowMs);
|
|
19260
|
+
if (!mintEvidence) await markRowsDrained(client, rowIds, drainId, nowMs);
|
|
19254
19261
|
if (keepProofs.length > 0) {
|
|
19255
19262
|
await insertAccumulatorRows(opts.db, {
|
|
19256
19263
|
dvmId: opts.dvmId,
|
|
@@ -21864,7 +21871,7 @@ async function createDVMServer(descriptor, opts) {
|
|
|
21864
21871
|
}
|
|
21865
21872
|
}
|
|
21866
21873
|
if (!opts.onJobCompleted && platformToken && platformUrl && dvmId && opts.db) {
|
|
21867
|
-
const { RevenueReporter } = await import("./revenue-reporter-
|
|
21874
|
+
const { RevenueReporter } = await import("./revenue-reporter-QKCBYFWT.js");
|
|
21868
21875
|
const reporter = new RevenueReporter(
|
|
21869
21876
|
opts.db,
|
|
21870
21877
|
platformUrl,
|
|
@@ -21874,7 +21881,7 @@ async function createDVMServer(descriptor, opts) {
|
|
|
21874
21881
|
revenueReporter = reporter;
|
|
21875
21882
|
await reporter.init();
|
|
21876
21883
|
reporter.startRetryLoop();
|
|
21877
|
-
const { MemoryX402BatchStore, PayoutReporter } = await import("./payout-reporter-
|
|
21884
|
+
const { MemoryX402BatchStore, PayoutReporter } = await import("./payout-reporter-D5TCIBQA.js");
|
|
21878
21885
|
payoutReporter = new PayoutReporter({
|
|
21879
21886
|
dvmId,
|
|
21880
21887
|
db: opts.db,
|
|
@@ -22525,7 +22532,7 @@ var DVMServer = class {
|
|
|
22525
22532
|
this.app.post("/v1/job/:id/messages", (c) => this.handlePostMessage(c));
|
|
22526
22533
|
this.app.delete("/v1/job/:id", (c) => this.handleDeleteJob(c));
|
|
22527
22534
|
this.app.post("/v1/credit", (c) => this.handleCredit(c));
|
|
22528
|
-
if (this.
|
|
22535
|
+
if (this.adminCreditRoutesMounted()) {
|
|
22529
22536
|
const db = this.opts.db;
|
|
22530
22537
|
const dvmId = this.opts.dvmId;
|
|
22531
22538
|
const payoutReporter = this.opts.payoutReporter;
|
|
@@ -23100,6 +23107,10 @@ var DVMServer = class {
|
|
|
23100
23107
|
creditTtlMs: this.descriptor.credit ? this.descriptor.credit.ttlSeconds * 1e3 : void 0
|
|
23101
23108
|
};
|
|
23102
23109
|
}
|
|
23110
|
+
/** Builder-lock admin routes (including JIT refund park) need only these three. */
|
|
23111
|
+
adminCreditRoutesMounted() {
|
|
23112
|
+
return !!(this.opts.db && this.opts.dvmId && this.opts.lockPubkey);
|
|
23113
|
+
}
|
|
23103
23114
|
balancePaymentSupported(includeDisabled = false) {
|
|
23104
23115
|
return (includeDisabled || this.opts.env.DVMKIT_BALANCE_PAYMENTS !== "false") && !!this.descriptor.credit && !!this.opts.db && this.creditLedger instanceof CreditLedger && this.jobManager.store instanceof PostgresJobStore && !!this.authAudience && !!this.descriptor.auth;
|
|
23105
23116
|
}
|
|
@@ -23133,6 +23144,7 @@ var DVMServer = class {
|
|
|
23133
23144
|
callerPubkey
|
|
23134
23145
|
});
|
|
23135
23146
|
if (menu && this.balancePaymentSupported()) menu.balance_payment = true;
|
|
23147
|
+
if (menu && this.adminCreditRoutesMounted()) menu.jit_refund_park = true;
|
|
23136
23148
|
return menu;
|
|
23137
23149
|
}
|
|
23138
23150
|
async handleCredit(c) {
|
|
@@ -23759,7 +23771,7 @@ var DVMServer = class {
|
|
|
23759
23771
|
if (err instanceof SignedRequestError) return err;
|
|
23760
23772
|
throw err;
|
|
23761
23773
|
}
|
|
23762
|
-
return new SignedRequestError("signed request required", "
|
|
23774
|
+
return new SignedRequestError("signed request required", "signature_required");
|
|
23763
23775
|
}
|
|
23764
23776
|
/**
|
|
23765
23777
|
* On authenticated DVMs, envelope-only parse failures defer to auth
|
|
@@ -25773,6 +25785,7 @@ export {
|
|
|
25773
25785
|
toCreditView,
|
|
25774
25786
|
attachCreditMenu,
|
|
25775
25787
|
toCreditTerms,
|
|
25788
|
+
callerInputIssues,
|
|
25776
25789
|
resolvePriceFiat,
|
|
25777
25790
|
priceFiatMicro,
|
|
25778
25791
|
resolveFxSnapshot,
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createX402FacilitatorAuthHeaders,
|
|
3
3
|
settleWithFacilitator,
|
|
4
4
|
verifyWithFacilitator
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3V6CSTWB.js";
|
|
6
6
|
import {
|
|
7
7
|
buildPaymentRequirements,
|
|
8
8
|
decodePayment,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-66HGCPBU.js";
|
|
16
16
|
import {
|
|
17
17
|
diagnosticConsole
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-MA55LUNR.js";
|
|
19
19
|
|
|
20
20
|
// src/lib/x402/verify.ts
|
|
21
21
|
async function verifyX402Payment(paymentHeader, config, requiredUsdcMicro, resource, btcUsdRate, exactVersions = { v1: true, v2: true }) {
|
|
@@ -10,14 +10,14 @@ import {
|
|
|
10
10
|
isDrainMethod,
|
|
11
11
|
isFundingRail,
|
|
12
12
|
x402SettlementPending
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JOSNSNS7.js";
|
|
14
14
|
import "./chunk-YG7G4DPZ.js";
|
|
15
15
|
import "./chunk-COYKJRMM.js";
|
|
16
16
|
import "./chunk-5UC7TOQC.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-LSANCGLP.js";
|
|
18
18
|
import "./chunk-BPYMEMQX.js";
|
|
19
19
|
import "./chunk-H3GGFEE5.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-MA55LUNR.js";
|
|
21
21
|
export {
|
|
22
22
|
CreditLedger,
|
|
23
23
|
CreditLedgerError,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-
|
|
2
|
-
import { cr as HostingCleanupFence, dc as HostedIntent, an as FundingMethod, q as PaymentMethod, bX as CreditLedgerLike, a9 as Message, V as UpfrontPayment, a3 as FundingReceipt, bZ as CreditSnapshot, a4 as JobReceipt, S as SDKJobContext, aB as StepCache, x as ResponseContent, P as PaymentContent, a5 as MessageType, bs as X402Receipt, aK as X402Config, br as X402ExactVersionSupport, ap as PaymentPayload, ae as PaymentRequirementsV1, af as PaymentRequirementsV2, dd as X402SettlementIntent, de as HostedFundingReservation, bT as CreditLedgerQuerier, df as X402SettlementCursor, c1 as X402SettlementStatus, dg as X402SettlementWriteOff, bY as X402RefundSettlementGate, dh as X402FacilitatorAuth, di as X402BatchSettlementConfig, cO as PostgresX402ChannelStorage, dj as X402PayoutObserver, bV as HostedSettlementReportObligations, bv as CreditDepositPayload, bA as MppxServer, ai as CashuMode, dk as CreditDepositEnqueue, dl as X402SettlementReconciliationReason, au as PaymentRequirements, c5 as FundingRecord, a7 as MppxCredential, c0 as DrawResult, cB as CreditLedgerError, ab as ReceiptCredit, ak as DrainReceiptEvent, ac as DrainReceipt, a2 as DrawFundingReceipt, K as KVStore, E as SignedRequestAudience, dm as CreditDrawReleaseEnqueue, cM as JobCostReportPayload, cN as JobTerminalReportPayload, cQ as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, c7 as CreditInvoiceRecord, c8 as InvoiceSettlement, cv as ClientCompatibilityGate, ct as ClientCompatibility, bE as PostgresTempoSessionStore, bD as PayoutReporter, w as ResolvedCreditConfig, i as CreditView } from './step-cache-
|
|
1
|
+
import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-CTijN35u.js';
|
|
2
|
+
import { cr as HostingCleanupFence, dc as HostedIntent, an as FundingMethod, q as PaymentMethod, bX as CreditLedgerLike, a9 as Message, V as UpfrontPayment, a3 as FundingReceipt, bZ as CreditSnapshot, a4 as JobReceipt, S as SDKJobContext, aB as StepCache, x as ResponseContent, P as PaymentContent, a5 as MessageType, bs as X402Receipt, aK as X402Config, br as X402ExactVersionSupport, ap as PaymentPayload, ae as PaymentRequirementsV1, af as PaymentRequirementsV2, dd as X402SettlementIntent, de as HostedFundingReservation, bT as CreditLedgerQuerier, df as X402SettlementCursor, c1 as X402SettlementStatus, dg as X402SettlementWriteOff, bY as X402RefundSettlementGate, dh as X402FacilitatorAuth, di as X402BatchSettlementConfig, cO as PostgresX402ChannelStorage, dj as X402PayoutObserver, bV as HostedSettlementReportObligations, bv as CreditDepositPayload, bA as MppxServer, ai as CashuMode, dk as CreditDepositEnqueue, dl as X402SettlementReconciliationReason, au as PaymentRequirements, c5 as FundingRecord, a7 as MppxCredential, c0 as DrawResult, cB as CreditLedgerError, ab as ReceiptCredit, ak as DrainReceiptEvent, ac as DrainReceipt, a2 as DrawFundingReceipt, K as KVStore, E as SignedRequestAudience, dm as CreditDrawReleaseEnqueue, cM as JobCostReportPayload, cN as JobTerminalReportPayload, cQ as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, c7 as CreditInvoiceRecord, c8 as InvoiceSettlement, cv as ClientCompatibilityGate, ct as ClientCompatibility, bE as PostgresTempoSessionStore, bD as PayoutReporter, w as ResolvedCreditConfig, i as CreditView } from './step-cache-Bx_ZybWF.js';
|
|
3
3
|
import { ProofLike, SerializedDLEQ, Proof } from '@cashu/cashu-ts';
|
|
4
4
|
import { Hono, Context } from 'hono';
|
|
5
5
|
import { Pool } from 'pg';
|
|
6
|
-
import { d as FxSourceFailure, b as FxRateSnapshot, F as FxFetcher } from './fx-
|
|
6
|
+
import { d as FxSourceFailure, b as FxRateSnapshot, F as FxFetcher } from './fx-BtxHVj6w.js';
|
|
7
7
|
import { Store, Challenge } from 'mppx';
|
|
8
|
-
import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-
|
|
8
|
+
import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-DWVkleH3.js';
|
|
9
9
|
import { SettleResponse, SupportedResponse } from '@x402/core/types';
|
|
10
10
|
import { Channel, AutoSettlementConfig } from '@x402/evm/batch-settlement/server';
|
|
11
11
|
import { FacilitatorClient } from '@x402/core/server';
|
|
@@ -4754,6 +4754,11 @@ declare function unknownRouteNotFound(c: Context): Response;
|
|
|
4754
4754
|
interface CreditTerms {
|
|
4755
4755
|
/** Signed balance payments on the job messages endpoint are supported. */
|
|
4756
4756
|
balance_payment?: true;
|
|
4757
|
+
/**
|
|
4758
|
+
* The authenticated builder park-drain route accepts a validated just-in-time mint refund
|
|
4759
|
+
* even when Cashu receiving is off. Absent or false means unsupported; never infer it.
|
|
4760
|
+
*/
|
|
4761
|
+
jit_refund_park?: true;
|
|
4757
4762
|
/** Smallest funding accepted, in 1e-6 units of `currency`. */
|
|
4758
4763
|
min_micro: number;
|
|
4759
4764
|
/** Largest residual balance a caller may hold, in 1e-6 units of `currency`. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-
|
|
2
|
-
export { A as ApprovalContent, b as ArtifactContent, c as CancelContent, d as CanonicalEnvelope, e as CapabilityRate, f as CashuConfig, g as CreateSignedRequestVerifierOpts, h as CreditConfig, i as CreditView, j as DEFAULT_CREDIT_MAX, k as DEFAULT_CREDIT_MIN, l as DEFAULT_CREDIT_TTL_SECONDS, m as DEFAULT_JOB_RETENTION_DAYS, n as DVMRouteContext, I as IncomingMessage, o as InputType, p as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, q as PaymentMethod, r as PriceValue, s as ProgressContent, t as PromptOpts, Q as QuoteConfig, u as QuoteContext, v as QuoteResult, R as ResolvedCashuConfig, w as ResolvedCreditConfig, x as ResponseContent, S as SDKJobContext, y as SDKPaymentRequestOpts, z as SIGNED_REQUEST_AUTH_ID, B as SIGNED_REQUEST_STATEMENT_VERSION, E as SignedRequestAudience, F as SignedRequestDomain, G as SignedRequestError, H as SignedRequestFailure, M as SignedRequestReplayStore, N as SignedRequestSignOpts, O as SignedRequestStatementHeader, T as SignedRequestVerifier, U as UnsupportedCurrencyError, V as UpfrontPayment, W as createSignedRequestVerifier, X as isZodSchema, Y as signedRequestStatementHeader, _ as validateCurrency } from './step-cache-
|
|
3
|
-
export { C as CreateFxFetcherOpts, D as DEFAULT_FX_CURRENCIES, a as DEFAULT_FX_RATE_SOURCE, F as FxFetcher, b as FxRateSnapshot, c as FxRateUnavailableError, d as FxSourceFailure, e as FxSourceFailureCategory, P as PlatformFxSource, f as createFxFetcher, g as fxRateFor, r as resolveFxSourceFromEnv } from './fx-
|
|
4
|
-
export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-
|
|
5
|
-
export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-
|
|
1
|
+
import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-Bx_ZybWF.js';
|
|
2
|
+
export { A as ApprovalContent, b as ArtifactContent, c as CancelContent, d as CanonicalEnvelope, e as CapabilityRate, f as CashuConfig, g as CreateSignedRequestVerifierOpts, h as CreditConfig, i as CreditView, j as DEFAULT_CREDIT_MAX, k as DEFAULT_CREDIT_MIN, l as DEFAULT_CREDIT_TTL_SECONDS, m as DEFAULT_JOB_RETENTION_DAYS, n as DVMRouteContext, I as IncomingMessage, o as InputType, p as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, q as PaymentMethod, r as PriceValue, s as ProgressContent, t as PromptOpts, Q as QuoteConfig, u as QuoteContext, v as QuoteResult, R as ResolvedCashuConfig, w as ResolvedCreditConfig, x as ResponseContent, S as SDKJobContext, y as SDKPaymentRequestOpts, z as SIGNED_REQUEST_AUTH_ID, B as SIGNED_REQUEST_STATEMENT_VERSION, E as SignedRequestAudience, F as SignedRequestDomain, G as SignedRequestError, H as SignedRequestFailure, M as SignedRequestReplayStore, N as SignedRequestSignOpts, O as SignedRequestStatementHeader, T as SignedRequestVerifier, U as UnsupportedCurrencyError, V as UpfrontPayment, W as createSignedRequestVerifier, X as isZodSchema, Y as signedRequestStatementHeader, _ as validateCurrency } from './step-cache-Bx_ZybWF.js';
|
|
3
|
+
export { C as CreateFxFetcherOpts, D as DEFAULT_FX_CURRENCIES, a as DEFAULT_FX_RATE_SOURCE, F as FxFetcher, b as FxRateSnapshot, c as FxRateUnavailableError, d as FxSourceFailure, e as FxSourceFailureCategory, P as PlatformFxSource, f as createFxFetcher, g as fxRateFor, r as resolveFxSourceFromEnv } from './fx-BtxHVj6w.js';
|
|
4
|
+
export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-eOAMEO12.js';
|
|
5
|
+
export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-DWVkleH3.js';
|
|
6
6
|
export { P as PinnedFetch, S as SSRFError, a as SSRFGuardOpts, b as SSRFReason, c as SSRFResolver, d as assertSafeUrl, e as createPinnedFetch } from './ssrf-dMooihtY.js';
|
|
7
7
|
export { z } from 'zod';
|
|
8
8
|
import 'hono';
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
SignedRequestError,
|
|
12
12
|
createSignedRequestVerifier,
|
|
13
13
|
resolveCashuConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6GZF7VDO.js";
|
|
15
15
|
import {
|
|
16
16
|
DEFAULT_CREDIT_MAX,
|
|
17
17
|
DEFAULT_CREDIT_MIN,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "./chunk-SXL44PL5.js";
|
|
25
25
|
import {
|
|
26
26
|
buildUpfront
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-LWF4ABYF.js";
|
|
28
28
|
import {
|
|
29
29
|
DEFAULT_FX_CURRENCIES,
|
|
30
30
|
DEFAULT_FX_RATE_SOURCE,
|
|
@@ -42,9 +42,9 @@ import {
|
|
|
42
42
|
roundUsd,
|
|
43
43
|
satsToFiat,
|
|
44
44
|
validateCurrency
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-XWG54M6T.js";
|
|
46
46
|
import "./chunk-H3GGFEE5.js";
|
|
47
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-MA55LUNR.js";
|
|
48
48
|
|
|
49
49
|
// src/sdk/configure.ts
|
|
50
50
|
function configureDVM(config) {
|