@dvmkit/sdk 0.7.0-rc.2 → 0.7.0-rc.4
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 +2 -0
- package/dist/{chunk-2OM2QPBE.js → chunk-3CNYUUD7.js} +1 -1
- package/dist/{chunk-A6CXKAQV.js → chunk-5WOKIGLM.js} +55 -41
- package/dist/{chunk-MON76YBJ.js → chunk-76W5MYFF.js} +1 -1
- package/dist/{chunk-I555L2WK.js → chunk-AE2ITUMA.js} +1 -1
- package/dist/{chunk-DNG4KGSC.js → chunk-ARGYJ7SB.js} +1 -1
- package/dist/{chunk-HCE4MPZ5.js → chunk-C6YFACIM.js} +1 -1
- package/dist/{chunk-TRNMTTPX.js → chunk-CYTV76CG.js} +1 -1
- package/dist/{chunk-VB5OLOZH.js → chunk-DY2MIZ6E.js} +1 -1
- package/dist/{chunk-SPYEJXI7.js → chunk-EN7VI7T5.js} +2 -2
- package/dist/{chunk-RAGX6VG7.js → chunk-H2XKINRX.js} +1 -1
- package/dist/{chunk-AQ7OX5NX.js → chunk-KIPJRLGP.js} +1 -1
- package/dist/{chunk-6STC5TCP.js → chunk-LZHBNR5C.js} +1 -1
- package/dist/{chunk-GSLS4464.js → chunk-MCIIDEXH.js} +1 -1
- package/dist/{chunk-USL7ZEXN.js → chunk-MU3UX5M4.js} +1 -1
- package/dist/{chunk-RXPHMS4C.js → chunk-O3JEEW5V.js} +1 -1
- package/dist/{chunk-72V5DTEC.js → chunk-QFRU6W34.js} +1 -1
- package/dist/{chunk-IIZQNDQU.js → chunk-RBCHIOVB.js} +1 -1
- package/dist/{chunk-H5FVVEEN.js → chunk-UEYUFBSV.js} +2 -2
- package/dist/{chunk-LAKP6FUI.js → chunk-WIQLTSJY.js} +11 -1
- package/dist/{chunk-26W6GPCD.js → chunk-WNX22IND.js} +1 -1
- package/dist/{chunk-CLIAFTUR.js → chunk-XYLF33BJ.js} +119 -20
- package/dist/{content-retention-CbnouEnh.d.ts → content-retention-ChFSSVO0.d.ts} +1 -1
- package/dist/{credit-ledger-7Z7LOCTN.js → credit-ledger-4ZIL7IX2.js} +3 -3
- package/dist/{credit-menu-BO8yJppy.d.ts → credit-menu-D7lF-100.d.ts} +8 -6
- package/dist/{fx-DSOZQ2z7.d.ts → fx-4TFUkedZ.d.ts} +10 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/internal/caller.d.ts +6 -6
- package/dist/internal/caller.js +6 -6
- package/dist/internal/server.d.ts +7 -7
- package/dist/internal/server.js +19 -19
- package/dist/{job-store-BJRlmq2Q.d.ts → job-store-DkfNE9sv.d.ts} +1 -1
- package/dist/{lightning-backend-f16-fsYK.d.ts → lightning-backend-C3Gf1XpP.d.ts} +1 -1
- package/dist/{memory-credit-ledger-3WOS74UH.js → memory-credit-ledger-HCECP6R7.js} +4 -4
- package/dist/{mpp-setup-XB4KATMU.js → mpp-setup-OL22TIDP.js} +2 -2
- package/dist/{payout-reporter-WT7XYW42.js → payout-reporter-WSLDLMKK.js} +2 -2
- package/dist/{postgres-consumed-credential-store-W7UP33AH.js → postgres-consumed-credential-store-7ONNOW37.js} +1 -1
- package/dist/{postgres-job-store-3KGUGFRD.js → postgres-job-store-36GJGQMB.js} +2 -2
- package/dist/{postgres-replay-store-CVNJJOQG.js → postgres-replay-store-JJ6XPVIU.js} +2 -2
- package/dist/{pricing-QAVZUTZR.js → pricing-FM6WVLCR.js} +3 -3
- package/dist/{revenue-reporter-7UR3W2SD.js → revenue-reporter-CAWZMYQK.js} +2 -2
- package/dist/server/index.d.ts +10 -10
- package/dist/server/index.js +25 -25
- package/dist/{step-cache-CJFiZU3n.d.ts → step-cache-DDTwd4SK.d.ts} +5 -1
- package/dist/{tempo-charge-store-GA6CED6O.js → tempo-charge-store-MVZH6CEB.js} +2 -2
- package/dist/{tempo-session-store-WZWQRITB.js → tempo-session-store-CCCG4HL7.js} +3 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/testing/index.js +5 -5
- package/dist/{usd-DmHHg0_4.d.ts → usd-DkRy9nfU.d.ts} +1 -1
- package/dist/{x402-ZU4GML7Z.js → x402-RHVRGUUI.js} +3 -3
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
diagnosticConsole
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WIQLTSJY.js";
|
|
4
4
|
|
|
5
5
|
// src/sdk/pricing/currency.ts
|
|
6
6
|
var InvalidCurrencyError = class extends Error {
|
|
@@ -144,14 +144,53 @@ var FxRateUnavailableError = class extends Error {
|
|
|
144
144
|
* the last-known rate without it. See {@link FxKnownStale}.
|
|
145
145
|
*/
|
|
146
146
|
knownStale;
|
|
147
|
-
|
|
147
|
+
sourceFailure;
|
|
148
|
+
constructor(message, copy, knownStale, sourceFailure) {
|
|
148
149
|
super(message);
|
|
149
150
|
this.name = "FxRateUnavailableError";
|
|
150
151
|
this.display = copy?.display ?? "Couldn't fetch the BTC reference rate to lock pricing";
|
|
151
152
|
this.hint = copy?.hint ?? "transient \u2014 try the quote again in a few seconds";
|
|
152
153
|
this.knownStale = knownStale;
|
|
154
|
+
this.sourceFailure = normalizeFxSourceFailure(sourceFailure);
|
|
153
155
|
}
|
|
154
156
|
};
|
|
157
|
+
var FX_SOURCE_FAILURE_CATEGORIES = /* @__PURE__ */ new Set([
|
|
158
|
+
"network_error",
|
|
159
|
+
"http_error",
|
|
160
|
+
"invalid_body",
|
|
161
|
+
"no_usable_rate",
|
|
162
|
+
"missing_currency",
|
|
163
|
+
"unknown"
|
|
164
|
+
]);
|
|
165
|
+
function normalizeFxSourceFailure(input) {
|
|
166
|
+
if (input === void 0) return void 0;
|
|
167
|
+
try {
|
|
168
|
+
if (typeof input !== "object" || input === null) return { category: "unknown" };
|
|
169
|
+
const categoryDescriptor = Object.getOwnPropertyDescriptor(input, "category");
|
|
170
|
+
const category = categoryDescriptor && "value" in categoryDescriptor ? categoryDescriptor.value : void 0;
|
|
171
|
+
if (typeof category !== "string" || !FX_SOURCE_FAILURE_CATEGORIES.has(category)) {
|
|
172
|
+
return { category: "unknown" };
|
|
173
|
+
}
|
|
174
|
+
const statusDescriptor = Object.getOwnPropertyDescriptor(input, "httpStatus");
|
|
175
|
+
const status = statusDescriptor && "value" in statusDescriptor ? statusDescriptor.value : void 0;
|
|
176
|
+
return {
|
|
177
|
+
category,
|
|
178
|
+
...category === "http_error" && typeof status === "number" && Number.isInteger(status) && status >= 100 && status <= 599 && { httpStatus: status }
|
|
179
|
+
};
|
|
180
|
+
} catch {
|
|
181
|
+
return { category: "unknown" };
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function readFxSourceFailure(error) {
|
|
185
|
+
try {
|
|
186
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, "sourceFailure");
|
|
187
|
+
if (!descriptor) return void 0;
|
|
188
|
+
if (!("value" in descriptor)) return { category: "unknown" };
|
|
189
|
+
return normalizeFxSourceFailure(descriptor.value);
|
|
190
|
+
} catch {
|
|
191
|
+
return { category: "unknown" };
|
|
192
|
+
}
|
|
193
|
+
}
|
|
155
194
|
function createFxFetcher(opts) {
|
|
156
195
|
const currencies = opts?.currencies ?? DEFAULT_FX_CURRENCIES;
|
|
157
196
|
const source = opts?.source ?? DEFAULT_FX_RATE_SOURCE;
|
|
@@ -192,7 +231,10 @@ function createFxFetcher(opts) {
|
|
|
192
231
|
}
|
|
193
232
|
}
|
|
194
233
|
throw new FxRateUnavailableError(
|
|
195
|
-
lastErr instanceof Error ? lastErr.message : String(lastErr)
|
|
234
|
+
lastErr instanceof Error ? lastErr.message : String(lastErr),
|
|
235
|
+
void 0,
|
|
236
|
+
void 0,
|
|
237
|
+
lastErr instanceof FxRateUnavailableError ? readFxSourceFailure(lastErr) : { category: "unknown" }
|
|
196
238
|
);
|
|
197
239
|
})();
|
|
198
240
|
inFlight = promise;
|
|
@@ -219,7 +261,9 @@ function fxRateFor(snapshot, currency) {
|
|
|
219
261
|
{
|
|
220
262
|
display: `The ${currency.toUpperCase()} reference rate is unavailable right now.`,
|
|
221
263
|
hint: `The rate source stopped carrying ${currency.toUpperCase()}. Retry in a minute; if it persists the source needs to be reconfigured.`
|
|
222
|
-
}
|
|
264
|
+
},
|
|
265
|
+
void 0,
|
|
266
|
+
{ category: "missing_currency" }
|
|
223
267
|
);
|
|
224
268
|
}
|
|
225
269
|
throw new UnsupportedCurrencyError(currency, Object.keys(snapshot.rates));
|
|
@@ -231,19 +275,32 @@ async function fetchOnce(source, currencies, fetchFn) {
|
|
|
231
275
|
return fetchPlatformShape(source, currencies, fetchFn);
|
|
232
276
|
}
|
|
233
277
|
async function fetchCoinGeckoShape(source, currencies, fetchFn) {
|
|
234
|
-
const res = await fetchFn
|
|
278
|
+
const res = await fetchSource(fetchFn, source);
|
|
235
279
|
if (!res.ok) {
|
|
236
|
-
throw new
|
|
280
|
+
throw new FxRateUnavailableError(
|
|
281
|
+
`fx source ${source} returned ${res.status.toString()}`,
|
|
282
|
+
void 0,
|
|
283
|
+
void 0,
|
|
284
|
+
{ category: "http_error", httpStatus: res.status }
|
|
285
|
+
);
|
|
237
286
|
}
|
|
238
|
-
const body = await res
|
|
239
|
-
const bitcoin = body
|
|
240
|
-
if (!bitcoin || typeof bitcoin !== "object") {
|
|
241
|
-
throw new
|
|
287
|
+
const body = await parseRateBody(res);
|
|
288
|
+
const bitcoin = body?.bitcoin;
|
|
289
|
+
if (!bitcoin || typeof bitcoin !== "object" || Array.isArray(bitcoin)) {
|
|
290
|
+
throw new FxRateUnavailableError(
|
|
291
|
+
`fx source ${source} returned an unparsable rate body`,
|
|
292
|
+
void 0,
|
|
293
|
+
void 0,
|
|
294
|
+
{ category: "invalid_body" }
|
|
295
|
+
);
|
|
242
296
|
}
|
|
243
|
-
return {
|
|
297
|
+
return {
|
|
298
|
+
rates: collectRates(source, bitcoin, currencies),
|
|
299
|
+
as_of: (/* @__PURE__ */ new Date()).toISOString()
|
|
300
|
+
};
|
|
244
301
|
}
|
|
245
302
|
async function fetchPlatformShape(source, currencies, fetchFn) {
|
|
246
|
-
const res = await fetchFn
|
|
303
|
+
const res = await fetchSource(fetchFn, source.url, {
|
|
247
304
|
headers: { Authorization: `Bearer ${source.token}`, Accept: "application/json" }
|
|
248
305
|
});
|
|
249
306
|
if (!res.ok) {
|
|
@@ -252,20 +309,57 @@ async function fetchPlatformShape(source, currencies, fetchFn) {
|
|
|
252
309
|
throw new FxRateUnavailableError(
|
|
253
310
|
`fx source ${source.url} refused: rate ${knownStale.staleDays.toString()}d stale` + (knownStale.thresholdDays !== void 0 ? ` (threshold ${knownStale.thresholdDays.toString()}d)` : ""),
|
|
254
311
|
void 0,
|
|
255
|
-
knownStale
|
|
312
|
+
knownStale,
|
|
313
|
+
{ category: "http_error", httpStatus: res.status }
|
|
256
314
|
);
|
|
257
315
|
}
|
|
258
|
-
throw new
|
|
316
|
+
throw new FxRateUnavailableError(
|
|
317
|
+
`fx source ${source.url} returned ${res.status.toString()}`,
|
|
318
|
+
void 0,
|
|
319
|
+
void 0,
|
|
320
|
+
{ category: "http_error", httpStatus: res.status }
|
|
321
|
+
);
|
|
259
322
|
}
|
|
260
|
-
const body = await res
|
|
261
|
-
const raw = body
|
|
262
|
-
if (!raw || typeof raw !== "object") {
|
|
263
|
-
throw new
|
|
323
|
+
const body = await parseRateBody(res);
|
|
324
|
+
const raw = body?.rates;
|
|
325
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
326
|
+
throw new FxRateUnavailableError(
|
|
327
|
+
`fx source ${source.url} returned an unparsable rate body`,
|
|
328
|
+
void 0,
|
|
329
|
+
void 0,
|
|
330
|
+
{ category: "invalid_body" }
|
|
331
|
+
);
|
|
264
332
|
}
|
|
265
333
|
const rates = collectRates(source.url, raw, currencies);
|
|
266
334
|
const as_of = typeof body.as_of === "string" ? body.as_of : (/* @__PURE__ */ new Date()).toISOString();
|
|
267
335
|
return { rates, as_of };
|
|
268
336
|
}
|
|
337
|
+
async function fetchSource(fetchFn, url, init) {
|
|
338
|
+
try {
|
|
339
|
+
return await fetchFn(url, init);
|
|
340
|
+
} catch (err) {
|
|
341
|
+
if (err instanceof FxRateUnavailableError) throw err;
|
|
342
|
+
throw new FxRateUnavailableError(
|
|
343
|
+
err instanceof Error ? err.message : String(err),
|
|
344
|
+
void 0,
|
|
345
|
+
void 0,
|
|
346
|
+
{ category: "network_error" }
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
async function parseRateBody(res) {
|
|
351
|
+
try {
|
|
352
|
+
const body = await res.json();
|
|
353
|
+
return typeof body === "object" && body !== null && !Array.isArray(body) ? body : null;
|
|
354
|
+
} catch {
|
|
355
|
+
throw new FxRateUnavailableError(
|
|
356
|
+
"fx source returned an unparsable rate body",
|
|
357
|
+
void 0,
|
|
358
|
+
void 0,
|
|
359
|
+
{ category: "invalid_body" }
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
269
363
|
function collectRates(source, raw, currencies) {
|
|
270
364
|
const rates = {};
|
|
271
365
|
for (const currency of currencies) {
|
|
@@ -274,8 +368,11 @@ function collectRates(source, raw, currencies) {
|
|
|
274
368
|
rates[currency] = value;
|
|
275
369
|
}
|
|
276
370
|
if (Object.keys(rates).length === 0) {
|
|
277
|
-
throw new
|
|
278
|
-
`fx source ${source} returned no usable rate for any of [${currencies.join(", ")}]
|
|
371
|
+
throw new FxRateUnavailableError(
|
|
372
|
+
`fx source ${source} returned no usable rate for any of [${currencies.join(", ")}]`,
|
|
373
|
+
void 0,
|
|
374
|
+
void 0,
|
|
375
|
+
{ category: "no_usable_rate" }
|
|
279
376
|
);
|
|
280
377
|
}
|
|
281
378
|
return rates;
|
|
@@ -332,6 +429,7 @@ async function parsePlatformStaleRefusal(res) {
|
|
|
332
429
|
} catch {
|
|
333
430
|
return null;
|
|
334
431
|
}
|
|
432
|
+
if (typeof body !== "object" || body === null) return null;
|
|
335
433
|
const error = body.error;
|
|
336
434
|
if (!error || typeof error !== "object") return null;
|
|
337
435
|
const { code, detail } = error;
|
|
@@ -377,6 +475,7 @@ export {
|
|
|
377
475
|
FX_CACHE_TTL_MS,
|
|
378
476
|
FX_RETRY_COUNT,
|
|
379
477
|
FxRateUnavailableError,
|
|
478
|
+
readFxSourceFailure,
|
|
380
479
|
createFxFetcher,
|
|
381
480
|
warmFxSnapshot,
|
|
382
481
|
fxRateFor,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
isDrainMethod,
|
|
11
11
|
isFundingRail,
|
|
12
12
|
x402SettlementPending
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-EN7VI7T5.js";
|
|
14
|
+
import "./chunk-CYTV76CG.js";
|
|
15
15
|
import "./chunk-BPYMEMQX.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-WIQLTSJY.js";
|
|
17
17
|
import "./chunk-COYKJRMM.js";
|
|
18
18
|
export {
|
|
19
19
|
CreditLedger,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-
|
|
2
|
-
import { cf as HostingCleanupFence, cV as HostedIntent, ai as FundingMethod, o as PaymentMethod, bN as CreditLedgerLike, a4 as Message, _ as FundingReceipt, bP as CreditSnapshot, $ as JobReceipt, S as SDKJobContext, aw as StepCache, u as ResponseContent, P as PaymentContent, a0 as MessageType, bj as X402Receipt, aE as X402Config, bi as X402ExactVersionSupport, cW as X402SettlementIntent, aa as PaymentRequirementsV2, cX as HostedFundingReservation, c2 as CreditLedgerQuerier, cY as X402SettlementCursor, bR as X402SettlementStatus, cZ as X402SettlementWriteOff, bO as X402RefundSettlementGate, c_ as X402FacilitatorAuth, c$ as X402BatchSettlementConfig, cB as PostgresX402ChannelStorage, d0 as X402PayoutObserver, bL as HostedSettlementReportObligations, br as MppxServer, ad as CashuMode, d1 as CreditDepositEnqueue, d2 as X402SettlementReconciliationReason, ap as PaymentRequirements, a2 as MppxCredential, bm as CreditDepositPayload, bQ as DrawResult, cp as CreditLedgerError, a6 as ReceiptCredit, af as DrainReceiptEvent, a7 as DrainReceipt, K as KVStore, y as SignedRequestAudience, d3 as CreditDrawReleaseEnqueue, cz as JobCostReportPayload, cA as JobTerminalReportPayload, cD as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, bW as CreditInvoiceRecord, bX as InvoiceSettlement, cj as ClientCompatibilityGate, ch as ClientCompatibility, bv as PostgresTempoSessionStore, bu as PayoutReporter, R as ResolvedCreditConfig, g as CreditView } from './step-cache-
|
|
1
|
+
import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-C3Gf1XpP.js';
|
|
2
|
+
import { cf as HostingCleanupFence, cV as HostedIntent, ai as FundingMethod, o as PaymentMethod, bN as CreditLedgerLike, a4 as Message, _ as FundingReceipt, bP as CreditSnapshot, $ as JobReceipt, S as SDKJobContext, aw as StepCache, u as ResponseContent, P as PaymentContent, a0 as MessageType, bj as X402Receipt, aE as X402Config, bi as X402ExactVersionSupport, cW as X402SettlementIntent, aa as PaymentRequirementsV2, cX as HostedFundingReservation, c2 as CreditLedgerQuerier, cY as X402SettlementCursor, bR as X402SettlementStatus, cZ as X402SettlementWriteOff, bO as X402RefundSettlementGate, c_ as X402FacilitatorAuth, c$ as X402BatchSettlementConfig, cB as PostgresX402ChannelStorage, d0 as X402PayoutObserver, bL as HostedSettlementReportObligations, br as MppxServer, ad as CashuMode, d1 as CreditDepositEnqueue, d2 as X402SettlementReconciliationReason, ap as PaymentRequirements, a2 as MppxCredential, bm as CreditDepositPayload, bQ as DrawResult, cp as CreditLedgerError, a6 as ReceiptCredit, af as DrainReceiptEvent, a7 as DrainReceipt, K as KVStore, y as SignedRequestAudience, d3 as CreditDrawReleaseEnqueue, cz as JobCostReportPayload, cA as JobTerminalReportPayload, cD as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, bW as CreditInvoiceRecord, bX as InvoiceSettlement, cj as ClientCompatibilityGate, ch as ClientCompatibility, bv as PostgresTempoSessionStore, bu as PayoutReporter, R as ResolvedCreditConfig, g as CreditView } from './step-cache-DDTwd4SK.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 { b as FxRateSnapshot, F as FxFetcher } from './fx-
|
|
6
|
+
import { d as FxSourceFailure, b as FxRateSnapshot, F as FxFetcher } from './fx-4TFUkedZ.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-DkfNE9sv.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';
|
|
@@ -882,6 +882,7 @@ type ResolvedFx = {
|
|
|
882
882
|
ok: false;
|
|
883
883
|
reason: FiatDenominationFailure;
|
|
884
884
|
detail?: string;
|
|
885
|
+
sourceFailure?: FxSourceFailure;
|
|
885
886
|
};
|
|
886
887
|
/**
|
|
887
888
|
* The result of denominating an msat amount. See {@link msatsToFiatMicro}.
|
|
@@ -903,6 +904,7 @@ type FiatDenomination = {
|
|
|
903
904
|
ok: false;
|
|
904
905
|
reason: FiatDenominationFailure;
|
|
905
906
|
detail?: string;
|
|
907
|
+
sourceFailure?: FxSourceFailure;
|
|
906
908
|
};
|
|
907
909
|
/**
|
|
908
910
|
* A live fetch failure may use lastKnown(), but a known-stale refusal never
|
|
@@ -1430,9 +1432,9 @@ interface X402SettlementEvidenceReader extends X402ExactSettlementEvidenceReader
|
|
|
1430
1432
|
declare const X402_BATCH_SETTLEMENT_NETWORK = "eip155:84532";
|
|
1431
1433
|
/** Base mainnet channel network, enabled only with an in-process relay. */
|
|
1432
1434
|
declare const X402_BATCH_SETTLEMENT_MAINNET_NETWORK = "eip155:8453";
|
|
1433
|
-
/**
|
|
1435
|
+
/** Default withdrawal grace and minimum outside Base Sepolia; seconds. */
|
|
1434
1436
|
declare const X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS = 86400;
|
|
1435
|
-
/** Default claim and transfer cadence; comfortably inside the 24-hour exit window. */
|
|
1437
|
+
/** Default claim and transfer cadence; comfortably inside the default 24-hour exit window. */
|
|
1436
1438
|
declare const X402_BATCH_AUTO_SETTLEMENT: AutoSettlementConfig;
|
|
1437
1439
|
/** Natural identity and incremental value carried by an accepted channel voucher. */
|
|
1438
1440
|
interface X402BatchFunding {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as Currency } from './step-cache-
|
|
1
|
+
import { C as Currency } from './step-cache-DDTwd4SK.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Quote-time FX snapshot. `rates` maps configured lowercase currency codes to
|
|
@@ -61,6 +61,12 @@ interface PlatformFxSource {
|
|
|
61
61
|
declare const FX_CACHE_TTL_MS = 300000;
|
|
62
62
|
/** Default retry budget per `fetch()` call before raising `fx_rate_unavailable`. */
|
|
63
63
|
declare const FX_RETRY_COUNT = 2;
|
|
64
|
+
type FxSourceFailureCategory = "network_error" | "http_error" | "invalid_body" | "no_usable_rate" | "missing_currency" | "unknown";
|
|
65
|
+
/** Observed source failure only; never provider text or an inferred root cause. */
|
|
66
|
+
interface FxSourceFailure {
|
|
67
|
+
category: FxSourceFailureCategory;
|
|
68
|
+
httpStatus?: number;
|
|
69
|
+
}
|
|
64
70
|
interface FxRateUnavailableCopy {
|
|
65
71
|
display?: string;
|
|
66
72
|
hint?: string;
|
|
@@ -109,7 +115,8 @@ declare class FxRateUnavailableError extends Error {
|
|
|
109
115
|
* the last-known rate without it. See {@link FxKnownStale}.
|
|
110
116
|
*/
|
|
111
117
|
readonly knownStale?: FxKnownStale;
|
|
112
|
-
|
|
118
|
+
readonly sourceFailure?: FxSourceFailure;
|
|
119
|
+
constructor(message?: string, copy?: FxRateUnavailableCopy, knownStale?: FxKnownStale, sourceFailure?: FxSourceFailure);
|
|
113
120
|
}
|
|
114
121
|
/**
|
|
115
122
|
* Snapshot fetcher for BTC against one or more fiat currencies. Caches
|
|
@@ -196,4 +203,4 @@ declare function fxRateFor(snapshot: FxRateSnapshot, currency: Currency): number
|
|
|
196
203
|
*/
|
|
197
204
|
declare function resolveFxSourceFromEnv(env: Record<string, string | undefined>): string | PlatformFxSource | undefined;
|
|
198
205
|
|
|
199
|
-
export { type CreateFxFetcherOpts as C, DEFAULT_FX_CURRENCIES as D, type FxFetcher as F, type PlatformFxSource as P, DEFAULT_FX_RATE_SOURCE as a, type FxRateSnapshot as b, FxRateUnavailableError as c,
|
|
206
|
+
export { type CreateFxFetcherOpts as C, DEFAULT_FX_CURRENCIES as D, type FxFetcher as F, type PlatformFxSource as P, DEFAULT_FX_RATE_SOURCE as a, type FxRateSnapshot as b, FxRateUnavailableError as c, type FxSourceFailure as d, type FxSourceFailureCategory as e, createFxFetcher as f, fxRateFor as g, FX_CACHE_TTL_MS as h, FX_RETRY_COUNT as i, resolveFxSourceFromEnv as r, warmFxSnapshot as w };
|
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 CreateSignedRequestVerifierOpts, f as CreditConfig, g as CreditView, h as DEFAULT_CREDIT_MAX, i as DEFAULT_CREDIT_MIN, j as DEFAULT_CREDIT_TTL_SECONDS, k as DEFAULT_JOB_RETENTION_DAYS, l as DVMRouteContext, I as IncomingMessage, m as InputType, n as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, o as PaymentMethod, p as PriceValue, q as ProgressContent, r as PromptOpts, Q as QuoteConfig, s as QuoteContext, t as QuoteResult, R as ResolvedCreditConfig, u as ResponseContent, S as SDKJobContext, v as SDKPaymentRequestOpts, w as SIGNED_REQUEST_AUTH_ID, x as SIGNED_REQUEST_STATEMENT_VERSION, y as SignedRequestAudience, z as SignedRequestDomain, B as SignedRequestError, E as SignedRequestFailure, F as SignedRequestReplayStore, G as SignedRequestSignOpts, H as SignedRequestStatementHeader, M as SignedRequestVerifier, U as UnsupportedCurrencyError, N as createSignedRequestVerifier, O as isZodSchema, T as signedRequestStatementHeader, V 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, P as PlatformFxSource,
|
|
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-DDTwd4SK.js';
|
|
2
|
+
export { A as ApprovalContent, b as ArtifactContent, c as CancelContent, d as CanonicalEnvelope, e as CreateSignedRequestVerifierOpts, f as CreditConfig, g as CreditView, h as DEFAULT_CREDIT_MAX, i as DEFAULT_CREDIT_MIN, j as DEFAULT_CREDIT_TTL_SECONDS, k as DEFAULT_JOB_RETENTION_DAYS, l as DVMRouteContext, I as IncomingMessage, m as InputType, n as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, o as PaymentMethod, p as PriceValue, q as ProgressContent, r as PromptOpts, Q as QuoteConfig, s as QuoteContext, t as QuoteResult, R as ResolvedCreditConfig, u as ResponseContent, S as SDKJobContext, v as SDKPaymentRequestOpts, w as SIGNED_REQUEST_AUTH_ID, x as SIGNED_REQUEST_STATEMENT_VERSION, y as SignedRequestAudience, z as SignedRequestDomain, B as SignedRequestError, E as SignedRequestFailure, F as SignedRequestReplayStore, G as SignedRequestSignOpts, H as SignedRequestStatementHeader, M as SignedRequestVerifier, U as UnsupportedCurrencyError, N as createSignedRequestVerifier, O as isZodSchema, T as signedRequestStatementHeader, V as validateCurrency } from './step-cache-DDTwd4SK.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-4TFUkedZ.js';
|
|
4
|
+
export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-DkRy9nfU.js';
|
|
5
|
+
export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-DkfNE9sv.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
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
SignedRequestError,
|
|
12
12
|
createSignedRequestVerifier
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QFRU6W34.js";
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_CREDIT_MAX,
|
|
16
16
|
DEFAULT_CREDIT_MIN,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "./chunk-UKD3R2KU.js";
|
|
24
24
|
import {
|
|
25
25
|
buildUpfront
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-MU3UX5M4.js";
|
|
27
27
|
import {
|
|
28
28
|
DEFAULT_FX_CURRENCIES,
|
|
29
29
|
DEFAULT_FX_RATE_SOURCE,
|
|
@@ -41,8 +41,8 @@ import {
|
|
|
41
41
|
roundUsd,
|
|
42
42
|
satsToFiat,
|
|
43
43
|
validateCurrency
|
|
44
|
-
} from "./chunk-
|
|
45
|
-
import "./chunk-
|
|
44
|
+
} from "./chunk-XYLF33BJ.js";
|
|
45
|
+
import "./chunk-WIQLTSJY.js";
|
|
46
46
|
|
|
47
47
|
// src/sdk/configure.ts
|
|
48
48
|
function configureDVM(config) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { L as LightningTransactionListOptions, a as LightningTransactionSnapshot, b as LightningBackend, c as LightningPayment, d as LightningWalletInfo, C as CreatedInvoice, I as InvoiceStatus } from '../lightning-backend-
|
|
2
|
-
export { A as AttestationPayload, B as BuilderIdentityKeypair, e as CheckMintHealthOptions, f as LockPubkey, M as MintAmountBounds, g as MintHealthCheckResult, h as amountBoundsVerdict, i as assertNutSupport, j as buildAttestation, k as canSwap, l as checkMintHealth, m as generateIdentity, n as hashCapabilities, o as loadIdentitySecret, p as meltAmountBounds, s as signAttestation, t as toLockPubkey, v as verifyAttestation, w as writeIdentity } from '../lightning-backend-
|
|
1
|
+
import { L as LightningTransactionListOptions, a as LightningTransactionSnapshot, b as LightningBackend, c as LightningPayment, d as LightningWalletInfo, C as CreatedInvoice, I as InvoiceStatus } from '../lightning-backend-C3Gf1XpP.js';
|
|
2
|
+
export { A as AttestationPayload, B as BuilderIdentityKeypair, e as CheckMintHealthOptions, f as LockPubkey, M as MintAmountBounds, g as MintHealthCheckResult, h as amountBoundsVerdict, i as assertNutSupport, j as buildAttestation, k as canSwap, l as checkMintHealth, m as generateIdentity, n as hashCapabilities, o as loadIdentitySecret, p as meltAmountBounds, s as signAttestation, t as toLockPubkey, v as verifyAttestation, w as writeIdentity } from '../lightning-backend-C3Gf1XpP.js';
|
|
3
3
|
import { ProofLike, MeltQuoteBolt11Response, Proof, Wallet, MintQuoteBolt11Response, MintPreview, CounterSource, CounterRange, SerializedDLEQ, OutputData, OutputDataLike } from '@cashu/cashu-ts';
|
|
4
4
|
export { g as getWallet } from '../wallet-Dwjs5n_M.js';
|
|
5
|
-
import { W as JsonValue, z as SignedRequestDomain, H as SignedRequestStatementHeader, X as X402_BATCH_SETTLEMENT_SCHEME, Y as X402_EXACT_SCHEME, _ as FundingReceipt, $ as JobReceipt$1, a0 as MessageType, a1 as X402Version, a2 as MppxCredential, y as SignedRequestAudience, a3 as PaymentRequired, a4 as Message, a5 as MppxChallenge, a6 as ReceiptCredit, a7 as DrainReceipt, C as Currency, a8 as X402Wallet, a9 as PaymentRequirementsV1, aa as PaymentRequirementsV2, L as Logger$1, K as KVStore } from '../step-cache-
|
|
6
|
-
export { ab as BuildPaymentRequirementsOpts, ac as CapabilityDescriptor, ad as CashuMode, ae as CompleteContent, af as DrainReceiptEvent, ag as ExactEvmPayload, ah as ExactEvmPayloadAuthorization, ai as FundingMethod, aj as MessageFrom, ak as PaymentPayload, al as PaymentPayloadV1, am as PaymentPayloadV2, an as PaymentRequestContent, ao as PaymentRequiredV2, ap as PaymentRequirements, aq as PromptContent, ar as RAIL_REFUNDABLE, as as ReceiptOutcome, at as ReceiptPayment, au as ResourceInfo, av as SettleResponse, aw as StepCache, ax as StepRecord, ay as TextContent, az as UnsignedDrainReceipt, aA as UnsignedFundingReceipt, aB as UnsignedJobReceipt, aC as VerifyResponse, aD as WorkingContent, aE as X402Config, aF as X402ResponseBody, aG as X402SelfRelayRpcFailureReason, aH as X402_DEFAULT_NETWORK, aI as X402_V1_VERSION, aJ as X402_VERSION, aK as buildPaymentRequiredV2, aL as buildPaymentRequirements, aM as caip2ToX402Network, aN as canonicalRequestPath, aO as canonicaliseForSigning, aP as canonicalize, aQ as chainIdFromCaip2, aR as computeResultHash, aS as decodePayment, aT as decodePaymentRequiredHeader, aU as encodePayment, aV as encodePaymentRequiredHeader, aW as encodeSettleResponseHeader, aX as exactEvmAuthorization, aY as isArtifactMessage, aZ as isCancelMessage, a_ as isCompleteMessage, a$ as isDrainReceipt, b0 as isFundingReceipt, b1 as isPaymentRequestMessage, b2 as isPromptMessage, b3 as isSignedJobReceipt, b4 as isTextMessage, b5 as isWorkingMessage, b6 as paymentRequiredV2FromV1, b7 as signDrainReceipt, b8 as signFundingReceipt, b9 as signReceipt, ba as usdcContractByCaip2, bb as usdcContractFor, bc as usdcDomainNameFor, bd as usdcDomainVersionFor, be as verifyDrainReceipt, bf as verifyFundingReceipt, bg as verifyReceipt, bh as x402NetworkToCaip2 } from '../step-cache-
|
|
5
|
+
import { W as JsonValue, z as SignedRequestDomain, H as SignedRequestStatementHeader, X as X402_BATCH_SETTLEMENT_SCHEME, Y as X402_EXACT_SCHEME, _ as FundingReceipt, $ as JobReceipt$1, a0 as MessageType, a1 as X402Version, a2 as MppxCredential, y as SignedRequestAudience, a3 as PaymentRequired, a4 as Message, a5 as MppxChallenge, a6 as ReceiptCredit, a7 as DrainReceipt, C as Currency, a8 as X402Wallet, a9 as PaymentRequirementsV1, aa as PaymentRequirementsV2, L as Logger$1, K as KVStore } from '../step-cache-DDTwd4SK.js';
|
|
6
|
+
export { ab as BuildPaymentRequirementsOpts, ac as CapabilityDescriptor, ad as CashuMode, ae as CompleteContent, af as DrainReceiptEvent, ag as ExactEvmPayload, ah as ExactEvmPayloadAuthorization, ai as FundingMethod, aj as MessageFrom, ak as PaymentPayload, al as PaymentPayloadV1, am as PaymentPayloadV2, an as PaymentRequestContent, ao as PaymentRequiredV2, ap as PaymentRequirements, aq as PromptContent, ar as RAIL_REFUNDABLE, as as ReceiptOutcome, at as ReceiptPayment, au as ResourceInfo, av as SettleResponse, aw as StepCache, ax as StepRecord, ay as TextContent, az as UnsignedDrainReceipt, aA as UnsignedFundingReceipt, aB as UnsignedJobReceipt, aC as VerifyResponse, aD as WorkingContent, aE as X402Config, aF as X402ResponseBody, aG as X402SelfRelayRpcFailureReason, aH as X402_DEFAULT_NETWORK, aI as X402_V1_VERSION, aJ as X402_VERSION, aK as buildPaymentRequiredV2, aL as buildPaymentRequirements, aM as caip2ToX402Network, aN as canonicalRequestPath, aO as canonicaliseForSigning, aP as canonicalize, aQ as chainIdFromCaip2, aR as computeResultHash, aS as decodePayment, aT as decodePaymentRequiredHeader, aU as encodePayment, aV as encodePaymentRequiredHeader, aW as encodeSettleResponseHeader, aX as exactEvmAuthorization, aY as isArtifactMessage, aZ as isCancelMessage, a_ as isCompleteMessage, a$ as isDrainReceipt, b0 as isFundingReceipt, b1 as isPaymentRequestMessage, b2 as isPromptMessage, b3 as isSignedJobReceipt, b4 as isTextMessage, b5 as isWorkingMessage, b6 as paymentRequiredV2FromV1, b7 as signDrainReceipt, b8 as signFundingReceipt, b9 as signReceipt, ba as usdcContractByCaip2, bb as usdcContractFor, bc as usdcDomainNameFor, bd as usdcDomainVersionFor, be as verifyDrainReceipt, bf as verifyFundingReceipt, bg as verifyReceipt, bh as x402NetworkToCaip2 } from '../step-cache-DDTwd4SK.js';
|
|
7
7
|
import { SimplePool } from 'nostr-tools/pool';
|
|
8
8
|
import { Session } from 'mppx/tempo';
|
|
9
9
|
import { Pool } from 'pg';
|
|
10
10
|
import { PaymentRequired as PaymentRequired$1 } from '@x402/core/types';
|
|
11
11
|
import { ClientChannelStorage, BatchSettlementClientContext, BatchSettlementEvmScheme } from '@x402/evm/batch-settlement/client';
|
|
12
|
-
export {
|
|
13
|
-
export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-
|
|
12
|
+
export { h as FX_CACHE_TTL_MS, i as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-4TFUkedZ.js';
|
|
13
|
+
export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-DkRy9nfU.js';
|
|
14
14
|
import 'hono';
|
|
15
15
|
import 'mppx';
|
|
16
16
|
import '@x402/core/server';
|
package/dist/internal/caller.js
CHANGED
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
sha256hex,
|
|
33
33
|
validateX402Env,
|
|
34
34
|
withNwcPool
|
|
35
|
-
} from "../chunk-
|
|
35
|
+
} from "../chunk-3CNYUUD7.js";
|
|
36
36
|
import {
|
|
37
37
|
MemoryKVStore
|
|
38
38
|
} from "../chunk-SDK6KDJN.js";
|
|
@@ -139,7 +139,7 @@ import {
|
|
|
139
139
|
withWalletLock,
|
|
140
140
|
writeAgentMnemonic,
|
|
141
141
|
writeIdentity
|
|
142
|
-
} from "../chunk-
|
|
142
|
+
} from "../chunk-DY2MIZ6E.js";
|
|
143
143
|
import {
|
|
144
144
|
X402_BATCH_SETTLEMENT_SCHEME,
|
|
145
145
|
X402_DEFAULT_FACILITATOR,
|
|
@@ -193,7 +193,7 @@ import {
|
|
|
193
193
|
randomTraceId,
|
|
194
194
|
setEmitter,
|
|
195
195
|
withTraceContext
|
|
196
|
-
} from "../chunk-
|
|
196
|
+
} from "../chunk-KIPJRLGP.js";
|
|
197
197
|
import {
|
|
198
198
|
redactUrl,
|
|
199
199
|
redactUrlsInText
|
|
@@ -207,11 +207,11 @@ import {
|
|
|
207
207
|
InvalidUsdPriceError,
|
|
208
208
|
parseUsdPrice,
|
|
209
209
|
warmFxSnapshot
|
|
210
|
-
} from "../chunk-
|
|
210
|
+
} from "../chunk-XYLF33BJ.js";
|
|
211
211
|
import {
|
|
212
212
|
applyRetryToPool,
|
|
213
213
|
withInitRetry
|
|
214
|
-
} from "../chunk-
|
|
214
|
+
} from "../chunk-CYTV76CG.js";
|
|
215
215
|
import {
|
|
216
216
|
DvmError,
|
|
217
217
|
X402_NETWORKS,
|
|
@@ -234,7 +234,7 @@ import {
|
|
|
234
234
|
projectDiagnosticFields,
|
|
235
235
|
projectEventName,
|
|
236
236
|
projectSpanRow
|
|
237
|
-
} from "../chunk-
|
|
237
|
+
} from "../chunk-WIQLTSJY.js";
|
|
238
238
|
|
|
239
239
|
// src/lib/budget-core.ts
|
|
240
240
|
function checkBudgetForLedger(ledger, opts) {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { FacilitatorConfig } from '@x402/core/server';
|
|
2
|
-
import { ak as PaymentPayload, a9 as PaymentRequirementsV1, aa as PaymentRequirementsV2, aE as X402Config, av as SettleResponse, aC as VerifyResponse, bi as X402ExactVersionSupport, bj as X402Receipt, bk as TransactionalPayoutHook, bl as CashuMeltCompleted } from '../step-cache-
|
|
3
|
-
export { bm as CreditDepositPayload, bn as CreditDrainPayload, bo as FundingLot, bp as LotDebit, bq as LotDepletion, br as MppxServer, bs as NON_CHANNEL_BITCOIN_RAILS, bt as NonChannelBitcoinRail, bu as PayoutReporter, bv as PostgresTempoSessionStore, bw as RevenueReporter, bx as SIGNED_ENVELOPE_FIELDS, by as SIGNED_ENVELOPE_TYPES, bz as X402TrackedChannel, bA as _testing, bB as createDefaultReplayStore, bC as depleteLots, bD as fifoOrder, bE as inKindDrawMsats, bF as isInKindDepletion, bG as isNonChannelBitcoinRail, bH as lotOwedSats, bI as netOwedSats, bJ as wrapMppx } from '../step-cache-
|
|
2
|
+
import { ak as PaymentPayload, a9 as PaymentRequirementsV1, aa as PaymentRequirementsV2, aE as X402Config, av as SettleResponse, aC as VerifyResponse, bi as X402ExactVersionSupport, bj as X402Receipt, bk as TransactionalPayoutHook, bl as CashuMeltCompleted } from '../step-cache-DDTwd4SK.js';
|
|
3
|
+
export { bm as CreditDepositPayload, bn as CreditDrainPayload, bo as FundingLot, bp as LotDebit, bq as LotDepletion, br as MppxServer, bs as NON_CHANNEL_BITCOIN_RAILS, bt as NonChannelBitcoinRail, bu as PayoutReporter, bv as PostgresTempoSessionStore, bw as RevenueReporter, bx as SIGNED_ENVELOPE_FIELDS, by as SIGNED_ENVELOPE_TYPES, bz as X402TrackedChannel, bA as _testing, bB as createDefaultReplayStore, bC as depleteLots, bD as fifoOrder, bE as inKindDrawMsats, bF as isInKindDepletion, bG as isNonChannelBitcoinRail, bH as lotOwedSats, bI as netOwedSats, bJ as wrapMppx } from '../step-cache-DDTwd4SK.js';
|
|
4
4
|
import { Hono } from 'hono';
|
|
5
5
|
import { Env, BlankSchema } from 'hono/types';
|
|
6
6
|
import { Pool } from 'pg';
|
|
7
7
|
export { Pool } from 'pg';
|
|
8
8
|
import { g as getWallet } from '../wallet-Dwjs5n_M.js';
|
|
9
|
-
import { C as ConsumedCredentialStore, L as LockPubkeyStateLoader } from '../credit-menu-
|
|
10
|
-
export { A as AccumulatorPool, a as AppEnv, b as CreditFundingReport, D as DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, F as FiatDenomination, c as FiatDenominationFailure, d as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, e as LockPubkeyPool, f as LockPubkeyState, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, g as PaymentErrorCode, h as PaymentErrorDetail, i as PaymentInfo, j as PostgresTempoChargeStore, R as ReporterBannerOpts, k as ResolvedFx, l as RevenueBootCheckOpts, S as SDKServerOpts, m as ServerJob, n as ShortPayForfeit, T as TempoChannelReport, o as TempoObserverHealth, p as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, q as VerifyIncomingSnapshot, X as X402BatchChannelObservation, r as X402FacilitatorHealth, s as X402SettlementEvidenceOutcome, t as X402SettlementRepair, u as X402SettlementRepairRefusal, v as X402SettlementRepaired, w as X402WedgedSettlement, x as X402WedgedSettlementPage, y as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, z as abortJob, B as activePubkeySet, E as applyPaymentInfoToJob, G as assertRevenueReporterReady, H as buildPaymentErrorResponse, K as clearAccumulatorForDvm, N as createDVMServer, O as creditDepositPayload, Q as derivedFundCreditId, W as devModeSkipsPaymentVerification, Y as fromJobRecord, Z as fundedMicroFor, _ as hasPaymentProof, $ as hashLockKey, a0 as implicitCreditId, a1 as initLockPubkeyTable, a2 as initWalletAccumulatorTable, a3 as insertAccumulatorRows, a4 as isDerivedCreditId, a5 as isTerminal, a6 as isYieldMessage, a7 as issueUpfrontChallenges, a8 as loadLockPubkeyState, a9 as msatsToFiatMicro, aa as paymentErrorBody, ab as pinAskFiat, ac as priceFiatMicro, ad as processIncomingPayment, ae as providerMessage, af as pruneRetired, ag as repairX402ExactSettlementEffect, ah as resolveFxSnapshot, ai as resolvePriceFiat, aj as revenueReporterBannerState, ak as rotateLockPubkey, al as seedLockPubkeyState, am as toCreditTerms, an as toJobRecord, ao as unknownRouteNotFound, ap as verifyIncomingPayment, aq as verifyTempoSessionManagementCredential, ar as verifyUpfrontPayment, as as x402RequiredUsdcMicro, at as x402SettledShare } from '../credit-menu-
|
|
11
|
-
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-
|
|
9
|
+
import { C as ConsumedCredentialStore, L as LockPubkeyStateLoader } from '../credit-menu-D7lF-100.js';
|
|
10
|
+
export { A as AccumulatorPool, a as AppEnv, b as CreditFundingReport, D as DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, F as FiatDenomination, c as FiatDenominationFailure, d as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, e as LockPubkeyPool, f as LockPubkeyState, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, g as PaymentErrorCode, h as PaymentErrorDetail, i as PaymentInfo, j as PostgresTempoChargeStore, R as ReporterBannerOpts, k as ResolvedFx, l as RevenueBootCheckOpts, S as SDKServerOpts, m as ServerJob, n as ShortPayForfeit, T as TempoChannelReport, o as TempoObserverHealth, p as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, q as VerifyIncomingSnapshot, X as X402BatchChannelObservation, r as X402FacilitatorHealth, s as X402SettlementEvidenceOutcome, t as X402SettlementRepair, u as X402SettlementRepairRefusal, v as X402SettlementRepaired, w as X402WedgedSettlement, x as X402WedgedSettlementPage, y as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, z as abortJob, B as activePubkeySet, E as applyPaymentInfoToJob, G as assertRevenueReporterReady, H as buildPaymentErrorResponse, K as clearAccumulatorForDvm, N as createDVMServer, O as creditDepositPayload, Q as derivedFundCreditId, W as devModeSkipsPaymentVerification, Y as fromJobRecord, Z as fundedMicroFor, _ as hasPaymentProof, $ as hashLockKey, a0 as implicitCreditId, a1 as initLockPubkeyTable, a2 as initWalletAccumulatorTable, a3 as insertAccumulatorRows, a4 as isDerivedCreditId, a5 as isTerminal, a6 as isYieldMessage, a7 as issueUpfrontChallenges, a8 as loadLockPubkeyState, a9 as msatsToFiatMicro, aa as paymentErrorBody, ab as pinAskFiat, ac as priceFiatMicro, ad as processIncomingPayment, ae as providerMessage, af as pruneRetired, ag as repairX402ExactSettlementEffect, ah as resolveFxSnapshot, ai as resolvePriceFiat, aj as revenueReporterBannerState, ak as rotateLockPubkey, al as seedLockPubkeyState, am as toCreditTerms, an as toJobRecord, ao as unknownRouteNotFound, ap as verifyIncomingPayment, aq as verifyTempoSessionManagementCredential, ar as verifyUpfrontPayment, as as x402RequiredUsdcMicro, at as x402SettledShare } from '../credit-menu-D7lF-100.js';
|
|
11
|
+
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-DkfNE9sv.js';
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
-
export { f as LockPubkeyStoreLockPubkey, t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-
|
|
13
|
+
export { f as LockPubkeyStoreLockPubkey, t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-C3Gf1XpP.js';
|
|
14
14
|
import 'mppx';
|
|
15
15
|
import '@x402/evm/batch-settlement/server';
|
|
16
16
|
import '@x402/core/types';
|
|
17
17
|
import 'viem';
|
|
18
18
|
import '@cashu/cashu-ts';
|
|
19
|
-
import '../fx-
|
|
19
|
+
import '../fx-4TFUkedZ.js';
|
|
20
20
|
|
|
21
21
|
declare function verifyWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<VerifyResponse>;
|
|
22
22
|
declare function settleWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<SettleResponse>;
|
package/dist/internal/server.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PostgresTempoSessionStore
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-76W5MYFF.js";
|
|
4
4
|
import {
|
|
5
5
|
verifyX402Payment
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-UEYUFBSV.js";
|
|
7
7
|
import {
|
|
8
8
|
RevenueReporter
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-MCIIDEXH.js";
|
|
10
10
|
import {
|
|
11
11
|
PayoutReporter
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-ARGYJ7SB.js";
|
|
13
13
|
import {
|
|
14
14
|
PostgresTempoChargeStore
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-O3JEEW5V.js";
|
|
16
16
|
import {
|
|
17
17
|
DEFAULT_LOCK_PUBKEY_GRACE_SECONDS,
|
|
18
18
|
MintHealthTracker,
|
|
@@ -64,28 +64,28 @@ import {
|
|
|
64
64
|
verifyUpfrontPayment,
|
|
65
65
|
x402RequiredUsdcMicro,
|
|
66
66
|
x402SettledShare
|
|
67
|
-
} from "../chunk-
|
|
67
|
+
} from "../chunk-5WOKIGLM.js";
|
|
68
68
|
import {
|
|
69
69
|
_testing,
|
|
70
70
|
wrapMppx
|
|
71
|
-
} from "../chunk-
|
|
71
|
+
} from "../chunk-C6YFACIM.js";
|
|
72
72
|
import {
|
|
73
73
|
settleWithFacilitator,
|
|
74
74
|
verifyWithFacilitator
|
|
75
|
-
} from "../chunk-
|
|
76
|
-
import "../chunk-
|
|
77
|
-
import "../chunk-
|
|
75
|
+
} from "../chunk-WNX22IND.js";
|
|
76
|
+
import "../chunk-AE2ITUMA.js";
|
|
77
|
+
import "../chunk-RBCHIOVB.js";
|
|
78
78
|
import "../chunk-YG7G4DPZ.js";
|
|
79
79
|
import {
|
|
80
80
|
SIGNED_ENVELOPE_FIELDS,
|
|
81
81
|
SIGNED_ENVELOPE_TYPES,
|
|
82
82
|
createDefaultReplayStore,
|
|
83
83
|
humanizeZodError
|
|
84
|
-
} from "../chunk-
|
|
84
|
+
} from "../chunk-QFRU6W34.js";
|
|
85
85
|
import {
|
|
86
86
|
createInstrumentedFetch,
|
|
87
87
|
isStaleJobReapable
|
|
88
|
-
} from "../chunk-
|
|
88
|
+
} from "../chunk-H2XKINRX.js";
|
|
89
89
|
import {
|
|
90
90
|
JobCancelledError,
|
|
91
91
|
abortJob,
|
|
@@ -97,14 +97,14 @@ import {
|
|
|
97
97
|
} from "../chunk-AFV77S4C.js";
|
|
98
98
|
import {
|
|
99
99
|
toLockPubkey
|
|
100
|
-
} from "../chunk-
|
|
100
|
+
} from "../chunk-DY2MIZ6E.js";
|
|
101
101
|
import "../chunk-62FI3NJF.js";
|
|
102
102
|
import "../chunk-UKD3R2KU.js";
|
|
103
|
-
import "../chunk-
|
|
103
|
+
import "../chunk-KIPJRLGP.js";
|
|
104
104
|
import "../chunk-KXWROQGK.js";
|
|
105
105
|
import "../chunk-BQJIFRAZ.js";
|
|
106
|
-
import "../chunk-
|
|
107
|
-
import "../chunk-
|
|
106
|
+
import "../chunk-MU3UX5M4.js";
|
|
107
|
+
import "../chunk-XYLF33BJ.js";
|
|
108
108
|
import {
|
|
109
109
|
NON_CHANNEL_BITCOIN_RAILS,
|
|
110
110
|
depleteLots,
|
|
@@ -114,10 +114,10 @@ import {
|
|
|
114
114
|
isNonChannelBitcoinRail,
|
|
115
115
|
lotOwedSats,
|
|
116
116
|
netOwedSats
|
|
117
|
-
} from "../chunk-
|
|
118
|
-
import "../chunk-
|
|
117
|
+
} from "../chunk-EN7VI7T5.js";
|
|
118
|
+
import "../chunk-CYTV76CG.js";
|
|
119
119
|
import "../chunk-BPYMEMQX.js";
|
|
120
|
-
import "../chunk-
|
|
120
|
+
import "../chunk-WIQLTSJY.js";
|
|
121
121
|
import "../chunk-XRLKGCAW.js";
|
|
122
122
|
import "../chunk-COYKJRMM.js";
|
|
123
123
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProofLike } from '@cashu/cashu-ts';
|
|
2
|
-
import { a4 as Message, ai as FundingMethod, _ as FundingReceipt, bP as CreditSnapshot, $ as JobReceipt, ax as StepRecord, a0 as MessageType } from './step-cache-
|
|
2
|
+
import { a4 as Message, ai as FundingMethod, _ as FundingReceipt, bP as CreditSnapshot, $ as JobReceipt, ax as StepRecord, a0 as MessageType } from './step-cache-DDTwd4SK.js';
|
|
3
3
|
|
|
4
4
|
type JobStatus = "processing" | "completed" | "failed" | "awaiting-input" | "cancelled" | "working";
|
|
5
5
|
interface JobRecord {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MemoryCreditLedger
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-AE2ITUMA.js";
|
|
4
|
+
import "./chunk-EN7VI7T5.js";
|
|
5
|
+
import "./chunk-CYTV76CG.js";
|
|
6
6
|
import "./chunk-BPYMEMQX.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-WIQLTSJY.js";
|
|
8
8
|
import "./chunk-COYKJRMM.js";
|
|
9
9
|
export {
|
|
10
10
|
MemoryCreditLedger
|
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
parseMppMethodsAllowlist,
|
|
20
20
|
resolveTempoNetwork,
|
|
21
21
|
wrapMppx
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
22
|
+
} from "./chunk-C6YFACIM.js";
|
|
23
|
+
import "./chunk-WIQLTSJY.js";
|
|
24
24
|
export {
|
|
25
25
|
MPPX_HMAC_MISMATCH_REASON,
|
|
26
26
|
TEMPO_MAINNET_CHAIN_ID,
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
PAYOUT_SNAPSHOT_INTERVAL_MS,
|
|
4
4
|
PayoutReporter,
|
|
5
5
|
PostgresX402BatchStore
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-ARGYJ7SB.js";
|
|
7
|
+
import "./chunk-WIQLTSJY.js";
|
|
8
8
|
import "./chunk-COYKJRMM.js";
|
|
9
9
|
export {
|
|
10
10
|
MemoryX402BatchStore,
|