@dvmkit/sdk 0.17.1 → 0.18.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.
Files changed (26) hide show
  1. package/dist/{chunk-C5XNZLZ7.js → chunk-AYEBQDAZ.js} +1 -1
  2. package/dist/{chunk-B5MPLDRC.js → chunk-B6T3FEVX.js} +1 -1
  3. package/dist/{chunk-EIDRCGTY.js → chunk-IKMRT7O5.js} +40 -13
  4. package/dist/{chunk-ORBWKYDE.js → chunk-JQ2Z3MIC.js} +1 -1
  5. package/dist/{chunk-5CCQEAQV.js → chunk-MXESSBXF.js} +47 -0
  6. package/dist/{chunk-YRQMDRI4.js → chunk-QNAYENWA.js} +62 -19
  7. package/dist/{content-retention-B_hOQS36.d.ts → content-retention-Cxn-umvR.d.ts} +1 -1
  8. package/dist/{credit-ledger-5HMJ6VUX.js → credit-ledger-SBLDJCLE.js} +2 -2
  9. package/dist/{credit-menu-D-h0zJCZ.d.ts → credit-menu-CYjp3FA3.d.ts} +14 -4
  10. package/dist/{fx-CpqQaIfg.d.ts → fx-D2w3wCvY.d.ts} +1 -1
  11. package/dist/index.d.ts +5 -5
  12. package/dist/index.js +4 -2
  13. package/dist/internal/caller.d.ts +12 -8
  14. package/dist/internal/caller.js +1 -1
  15. package/dist/internal/server.d.ts +7 -7
  16. package/dist/internal/server.js +6 -6
  17. package/dist/{job-store-CgXT79tS.d.ts → job-store-Ci2ihiVr.d.ts} +1 -1
  18. package/dist/{lightning-backend-B1hRUIOb.d.ts → lightning-backend-DMBY7PaJ.d.ts} +1 -1
  19. package/dist/{memory-credit-ledger-ME6FH462.js → memory-credit-ledger-DMIGIH2H.js} +3 -3
  20. package/dist/server/index.d.ts +10 -10
  21. package/dist/server/index.js +8 -8
  22. package/dist/{step-cache-Bezn-_ZL.d.ts → step-cache-B_18RAPb.d.ts} +42 -1
  23. package/dist/{tempo-session-store-EWBE5HJM.js → tempo-session-store-N3TFZ26X.js} +2 -2
  24. package/dist/testing/index.d.ts +3 -3
  25. package/dist/{usd-CJwU3-A4.d.ts → usd-ROzdYbbm.d.ts} +1 -1
  26. package/package.json +1 -1
@@ -18,7 +18,7 @@ import {
18
18
  refundAssetDelta,
19
19
  refundRequest,
20
20
  x402SettlementPending
21
- } from "./chunk-B5MPLDRC.js";
21
+ } from "./chunk-B6T3FEVX.js";
22
22
 
23
23
  // src/sdk/server/memory-credit-ledger.ts
24
24
  import { randomUUID } from "crypto";
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-5UC7TOQC.js";
11
11
  import {
12
12
  applyRetryToPool
13
- } from "./chunk-EIDRCGTY.js";
13
+ } from "./chunk-IKMRT7O5.js";
14
14
  import {
15
15
  x402NetworkByCaip2
16
16
  } from "./chunk-BPYMEMQX.js";
@@ -5,6 +5,7 @@ import {
5
5
  // src/lib/pg-retry.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
7
7
  var postgresRecovery = new AsyncLocalStorage();
8
+ var queryingPool = new AsyncLocalStorage();
8
9
  function withPostgresRecoveryContext(context, operation) {
9
10
  return postgresRecovery.run(context, operation);
10
11
  }
@@ -46,18 +47,39 @@ function applyRetryToPool(pool, label = "pg-pool") {
46
47
  });
47
48
  const p = pool;
48
49
  const origQuery = p.query.bind(pool);
49
- p.query = (...args) => withTransportRecovery(pool, label, "pool.query", () => origQuery(...args));
50
- const origConnect = p.connect.bind(pool);
51
- p.connect = async (...args) => {
52
- const client = await withTransportRecovery(
53
- pool,
54
- label,
55
- "pool.connect",
56
- () => origConnect(...args)
50
+ p.query = (...args) => withTransportRecovery(
51
+ pool,
52
+ label,
53
+ "pool.query",
54
+ () => queryingPool.run(pool, () => origQuery(...args))
55
+ );
56
+ const origConnect = pool.connect.bind(pool);
57
+ pool.connect = ((callback) => {
58
+ if (queryingPool.getStore() === pool) {
59
+ return queryingPool.exit(() => callback ? origConnect(callback) : origConnect());
60
+ }
61
+ const pending = withTransportRecovery(pool, label, "pool.connect", async () => {
62
+ const client = await origConnect();
63
+ guardCheckedOutClient(client, label);
64
+ const remainingMs = (postgresRecovery.getStore()?.deadlineMs ?? Infinity) - Date.now();
65
+ const probe = {
66
+ text: "SELECT 1",
67
+ query_timeout: Math.max(1, Math.min(connectionTimeoutMs(pool), remainingMs))
68
+ };
69
+ try {
70
+ await client.query(probe);
71
+ return client;
72
+ } catch (error) {
73
+ client.release(asError(error));
74
+ throw error;
75
+ }
76
+ });
77
+ if (!callback) return pending;
78
+ void pending.then(
79
+ (client) => callback(void 0, client, client.release),
80
+ (error) => callback(asError(error), void 0, () => void 0)
57
81
  );
58
- guardCheckedOutClient(client, label);
59
- return client;
60
- };
82
+ });
61
83
  }
62
84
  function withPostgresTransactionRecovery(pool, label, operation, callback) {
63
85
  return withTransportRecovery(pool, label, operation, async () => {
@@ -79,8 +101,9 @@ function withPostgresTransactionRecovery(pool, label, operation, callback) {
79
101
  }
80
102
  async function withTransportRecovery(pool, label, operation, callback) {
81
103
  const context = postgresRecovery.getStore();
82
- const maxAttempts = context?.drainPool ? hostPoolSize(pool) + 1 : 2;
104
+ const maxAttempts = context?.drainPool === false ? 2 : hostPoolSize(pool) + 1;
83
105
  const startedAt = Date.now();
106
+ const deadlineMs = context?.deadlineMs ?? startedAt + connectionTimeoutMs(pool);
84
107
  let firstError;
85
108
  for (let attempt = 1; ; attempt += 1) {
86
109
  try {
@@ -101,7 +124,7 @@ async function withTransportRecovery(pool, label, operation, callback) {
101
124
  if (!isTransportError(error)) throw error;
102
125
  firstError ??= asError(error);
103
126
  const elapsedMs = Date.now() - startedAt;
104
- if (attempt >= maxAttempts || context !== void 0 && Date.now() >= context.deadlineMs) {
127
+ if (attempt >= maxAttempts || Date.now() >= deadlineMs) {
105
128
  logTransportRecovery({
106
129
  context,
107
130
  label,
@@ -116,6 +139,10 @@ async function withTransportRecovery(pool, label, operation, callback) {
116
139
  }
117
140
  }
118
141
  }
142
+ function connectionTimeoutMs(pool) {
143
+ const configured = pool.options.connectionTimeoutMillis;
144
+ return typeof configured === "number" && Number.isFinite(configured) && configured > 0 ? configured : 1e4;
145
+ }
119
146
  function hostPoolSize(pool) {
120
147
  const configured = pool.options.max;
121
148
  return typeof configured === "number" && Number.isSafeInteger(configured) && configured > 0 ? configured : 10;
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-COYKJRMM.js";
8
8
  import {
9
9
  withPostgresTransactionRecovery
10
- } from "./chunk-EIDRCGTY.js";
10
+ } from "./chunk-IKMRT7O5.js";
11
11
 
12
12
  // src/sdk/server/tempo-session-store.ts
13
13
  import { AsyncLocalStorage } from "async_hooks";
@@ -314,7 +314,54 @@ function createDefaultReplayStore() {
314
314
  }
315
315
  var SATURATION_WARN_INTERVAL_SECONDS = 60;
316
316
 
317
+ // src/sdk/cashu-locktime.ts
318
+ var CASHU_MIN_LOCKTIME_SECONDS = 604800;
319
+ var CASHU_LOCKTIME_RESUME_MARGIN_SECONDS = 86400;
320
+ var CASHU_LOCKTIME_FLOOR_MINIMUM_SECONDS = 3600;
321
+ var CASHU_SIGNED_LOCKTIME_FLOOR_MINIMUM_SECONDS = CASHU_LOCKTIME_RESUME_MARGIN_SECONDS + CASHU_LOCKTIME_FLOOR_MINIMUM_SECONDS;
322
+ var DEFAULT_CASHU_LOCK_WINDOW_SECONDS = CASHU_MIN_LOCKTIME_SECONDS - CASHU_LOCKTIME_RESUME_MARGIN_SECONDS;
323
+ function signedCashuLockWindowSeconds(cashu) {
324
+ return (cashu?.minLocktimeSeconds ?? CASHU_MIN_LOCKTIME_SECONDS) - CASHU_LOCKTIME_RESUME_MARGIN_SECONDS;
325
+ }
326
+ function unsignedCashuLockWindowSeconds(cashu) {
327
+ return cashu?.unsignedMinLocktimeSeconds ?? DEFAULT_CASHU_LOCK_WINDOW_SECONDS;
328
+ }
329
+ function shortestCashuLockWindowSeconds(cashu, servesUnsigned) {
330
+ const signed = signedCashuLockWindowSeconds(cashu);
331
+ return servesUnsigned ? Math.min(signed, unsignedCashuLockWindowSeconds(cashu)) : signed;
332
+ }
333
+ function resolveCashuConfig(cashu) {
334
+ if (cashu === void 0) return void 0;
335
+ if (typeof cashu !== "object" || cashu === null || Array.isArray(cashu)) {
336
+ throw new Error(`configureDVM: cashu must be an object of refund-locktime floors; received ${JSON.stringify(cashu)}`);
337
+ }
338
+ const minLocktimeSeconds = validFloor(cashu.minLocktimeSeconds, "minLocktimeSeconds", CASHU_SIGNED_LOCKTIME_FLOOR_MINIMUM_SECONDS) ?? CASHU_MIN_LOCKTIME_SECONDS;
339
+ const unsignedMinLocktimeSeconds = validFloor(cashu.unsignedMinLocktimeSeconds, "unsignedMinLocktimeSeconds", CASHU_LOCKTIME_FLOOR_MINIMUM_SECONDS) ?? minLocktimeSeconds - CASHU_LOCKTIME_RESUME_MARGIN_SECONDS;
340
+ const signedWindow = minLocktimeSeconds - CASHU_LOCKTIME_RESUME_MARGIN_SECONDS;
341
+ if (unsignedMinLocktimeSeconds > signedWindow) {
342
+ throw new Error(
343
+ `configureDVM: cashu.unsignedMinLocktimeSeconds (${unsignedMinLocktimeSeconds}) must not exceed cashu.minLocktimeSeconds less 86400 (${signedWindow}); a payer without a signature can take the signed floor instead by sending X-Cashu-Request-Id`
344
+ );
345
+ }
346
+ return { minLocktimeSeconds, unsignedMinLocktimeSeconds };
347
+ }
348
+ function validFloor(value, field, minimum) {
349
+ if (value === void 0) return void 0;
350
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < minimum) {
351
+ throw new Error(
352
+ `configureDVM: cashu.${field} must be a whole number of seconds, at least ${minimum}; received ${JSON.stringify(value)}`
353
+ );
354
+ }
355
+ return value;
356
+ }
357
+
317
358
  export {
359
+ CASHU_MIN_LOCKTIME_SECONDS,
360
+ DEFAULT_CASHU_LOCK_WINDOW_SECONDS,
361
+ signedCashuLockWindowSeconds,
362
+ unsignedCashuLockWindowSeconds,
363
+ shortestCashuLockWindowSeconds,
364
+ resolveCashuConfig,
318
365
  humanizeZodError,
319
366
  humanizeZodIssues,
320
367
  zodIssuesOf,
@@ -17,18 +17,23 @@ import {
17
17
  } from "./chunk-3KRFFLAT.js";
18
18
  import {
19
19
  MemoryCreditLedger
20
- } from "./chunk-C5XNZLZ7.js";
20
+ } from "./chunk-AYEBQDAZ.js";
21
21
  import {
22
22
  PostgresJobStore
23
23
  } from "./chunk-A6EY4K46.js";
24
24
  import {
25
+ CASHU_MIN_LOCKTIME_SECONDS,
26
+ DEFAULT_CASHU_LOCK_WINDOW_SECONDS,
25
27
  SIGNED_ENVELOPE_FIELDS,
26
28
  SignedRequestError,
27
29
  humanizeZodError,
28
30
  humanizeZodIssues,
31
+ shortestCashuLockWindowSeconds,
32
+ signedCashuLockWindowSeconds,
29
33
  signedRequestInput,
34
+ unsignedCashuLockWindowSeconds,
30
35
  zodIssuesOf
31
- } from "./chunk-5CCQEAQV.js";
36
+ } from "./chunk-MXESSBXF.js";
32
37
  import {
33
38
  MemoryJobStore,
34
39
  UNCAPPABLE_ASK_TOTAL,
@@ -138,7 +143,7 @@ import {
138
143
  isNonChannelBitcoinRail,
139
144
  netOwedSats,
140
145
  x402SettlementPending
141
- } from "./chunk-B5MPLDRC.js";
146
+ } from "./chunk-B6T3FEVX.js";
142
147
  import {
143
148
  parseStoreValue
144
149
  } from "./chunk-YG7G4DPZ.js";
@@ -156,7 +161,7 @@ import {
156
161
  } from "./chunk-5UC7TOQC.js";
157
162
  import {
158
163
  withPostgresRecoveryContext
159
- } from "./chunk-EIDRCGTY.js";
164
+ } from "./chunk-IKMRT7O5.js";
160
165
  import {
161
166
  DvmError,
162
167
  x402NetworkByCaip2
@@ -3443,11 +3448,9 @@ function valueCashuFunding(wallet, proofs) {
3443
3448
  netMsats: netSats.multiplyBy(1e3).toNumber()
3444
3449
  };
3445
3450
  }
3446
- var CASHU_MIN_LOCKTIME_SECONDS = 604800;
3447
- var CASHU_LOCKTIME_RESUME_MARGIN_SECONDS = 86400;
3448
3451
  var P2PK_TAG_KEYS = /* @__PURE__ */ new Set(["locktime", "refund", "pubkeys", "n_sigs", "sigflag", "n_sigs_refund"]);
3449
3452
  var SINGLE_VALUE_TAG_KEYS = /* @__PURE__ */ new Set(["locktime", "n_sigs", "sigflag", "n_sigs_refund"]);
3450
- function assessCashuLock(secret, lockPubkeys, nowSec) {
3453
+ function assessCashuLock(secret, lockPubkeys, nowSec, floorSec = nowSec + DEFAULT_CASHU_LOCK_WINDOW_SECONDS) {
3451
3454
  try {
3452
3455
  parseP2PKSecret(secret);
3453
3456
  if (getSecretKind(secret) !== "P2PK") throw new Error("not P2PK");
@@ -3518,10 +3521,9 @@ function assessCashuLock(secret, lockPubkeys, nowSec) {
3518
3521
  if (locktimeValue !== void 0) {
3519
3522
  const locktime = /^(0|[1-9][0-9]*)$/.test(locktimeValue) ? Number(locktimeValue) : NaN;
3520
3523
  if (!Number.isSafeInteger(locktime)) return notExclusive(`Proof's locktime ${locktimeValue} is not a unix-seconds integer.`);
3521
- const floor = nowSec + CASHU_MIN_LOCKTIME_SECONDS - CASHU_LOCKTIME_RESUME_MARGIN_SECONDS;
3522
- if (locktime < floor) {
3524
+ if (locktime < floorSec) {
3523
3525
  return notExclusive(
3524
- `Proof locktime ${locktime} is earlier than the accepted floor ${floor} (unix seconds).`,
3526
+ `Proof locktime ${locktime} is earlier than the accepted floor ${floorSec} (unix seconds).`,
3525
3527
  true
3526
3528
  );
3527
3529
  }
@@ -3592,11 +3594,12 @@ async function acceptAccumulatorPayment(opts) {
3592
3594
  requestId
3593
3595
  };
3594
3596
  const nowSec = Math.floor(Date.now() / 1e3);
3597
+ const floorSec = nowSec + opts.lockWindowSeconds;
3595
3598
  const tExpireMsByIndex = [];
3596
3599
  const matchedLockPubkeyByIndex = [];
3597
3600
  let belowFloorMessage;
3598
3601
  for (const p of proofs) {
3599
- const lock = assessCashuLock(p.secret, accepted, nowSec);
3602
+ const lock = assessCashuLock(p.secret, accepted, nowSec, floorSec);
3600
3603
  if (lock.kind === "rejected") {
3601
3604
  if (!lock.locktimeBelowFloor) return { kind: "rejected", code: lock.code, message: lock.message };
3602
3605
  belowFloorMessage ??= lock.message;
@@ -3957,7 +3960,12 @@ async function verifyUpfrontPaymentInScope(opts) {
3957
3960
  };
3958
3961
  }
3959
3962
  if (cashuAccumulatorReady(opts)) {
3960
- return verifyAccumulatorReceipt(opts, mints, requiredMsats, ledgerCtx);
3963
+ return verifyAccumulatorReceipt(
3964
+ { ...opts, cashuLockWindowSeconds: lockWindowOrDefault(opts.cashuLockWindowSeconds) },
3965
+ mints,
3966
+ requiredMsats,
3967
+ ledgerCtx
3968
+ );
3961
3969
  }
3962
3970
  return {
3963
3971
  paidMsats: 0,
@@ -4715,6 +4723,8 @@ async function verifyTempoSessionManagementCredential(args) {
4715
4723
  }
4716
4724
  };
4717
4725
  }
4726
+ var LOCK_SHAPE_HINT = "Lock a fresh token with data set to cashu.lock_pubkeys[0] from /v1/info as a 33-byte compressed hex key. Use only the locktime, refund, pubkeys, n_sigs, sigflag and n_sigs_refund tags, each once and with a value: pubkeys may list only other cashu.lock_pubkeys entries, n_sigs must be 1, sigflag SIG_INPUTS, refund keys compressed and distinct, n_sigs_refund at most the number of refund keys";
4727
+ var UNSIGNED_LOCK_REFUSAL_HINT = `${LOCK_SHAPE_HINT}, and any locktime at least cashu.unsigned_min_locktime seconds in the future.`;
4718
4728
  var PAYMENT_ERROR_COPY = {
4719
4729
  payment_invalid: {
4720
4730
  display: "The payment couldn't be verified, so the request wasn't accepted. Nothing was charged.",
@@ -4978,7 +4988,7 @@ var PAYMENT_ERROR_COPY = {
4978
4988
  },
4979
4989
  lock_not_exclusive: {
4980
4990
  display: "The payment token's lock would let a key other than this service's spend it, so it wasn't accepted. Nothing was charged.",
4981
- hint: "Lock a fresh token with data set to cashu.lock_pubkeys[0] from /v1/info as a 33-byte compressed hex key. Use only the locktime, refund, pubkeys, n_sigs, sigflag and n_sigs_refund tags, each once and with a value: pubkeys may list only other cashu.lock_pubkeys entries, n_sigs must be 1, sigflag SIG_INPUTS, refund keys compressed and distinct, n_sigs_refund at most the number of refund keys, and any locktime at least cashu.min_locktime minus 24 hours in the future.",
4991
+ hint: `${LOCK_SHAPE_HINT}, and any locktime at least cashu.min_locktime minus 24 hours in the future.`,
4982
4992
  retryable: false
4983
4993
  },
4984
4994
  proof_not_unspent: {
@@ -5110,7 +5120,8 @@ async function verifyIncomingPaymentInScope(body, opts, snapshot) {
5110
5120
  dvmId: opts.dvmId,
5111
5121
  lockPubkeys: opts.lockPubkeys,
5112
5122
  requestId,
5113
- mintHealthTracker: opts.mintHealthTracker
5123
+ mintHealthTracker: opts.mintHealthTracker,
5124
+ cashuLockWindowSeconds: lockWindowOrDefault(opts.cashuLockWindowSeconds)
5114
5125
  },
5115
5126
  mints,
5116
5127
  snapshot.pendingPaymentMsats,
@@ -5588,7 +5599,8 @@ async function processIncomingPaymentInScope(job, body, opts) {
5588
5599
  dvmId: opts.dvmId,
5589
5600
  lockPubkeys: opts.lockPubkeys,
5590
5601
  requestId,
5591
- mintHealthTracker: opts.mintHealthTracker
5602
+ mintHealthTracker: opts.mintHealthTracker,
5603
+ cashuLockWindowSeconds: lockWindowOrDefault(opts.cashuLockWindowSeconds)
5592
5604
  },
5593
5605
  mints,
5594
5606
  job.pendingPaymentMsats
@@ -5744,6 +5756,9 @@ function creditPendingPayment(job) {
5744
5756
  job.pendingPaymentMsats = void 0;
5745
5757
  }
5746
5758
  }
5759
+ function lockWindowOrDefault(seconds) {
5760
+ return seconds ?? DEFAULT_CASHU_LOCK_WINDOW_SECONDS;
5761
+ }
5747
5762
  function cashuAccumulatorReady(opts) {
5748
5763
  return opts.cashuMode === "p2pk-accumulator" && Boolean(opts.accumulatorDb || opts.disposableCashu) && Boolean(opts.dvmId) && (opts.lockPubkeys?.length ?? 0) > 0;
5749
5764
  }
@@ -5856,6 +5871,7 @@ async function verifyAccumulatorReceipt(opts, mints, requiredMsats, ledgerCtx) {
5856
5871
  } : void 0,
5857
5872
  dvmId,
5858
5873
  lockPubkeys,
5874
+ lockWindowSeconds: opts.cashuLockWindowSeconds,
5859
5875
  beforeCommit,
5860
5876
  withCommitTx
5861
5877
  });
@@ -5884,6 +5900,7 @@ async function verifyAccumulatorReceipt(opts, mints, requiredMsats, ledgerCtx) {
5884
5900
  ...headerless && result.code === "replay_rejected" && {
5885
5901
  hint: "These proofs already paid for an earlier request. Resend them with that request's exact body to fetch its job; a new request needs new proofs."
5886
5902
  },
5903
+ ...result.code === "lock_not_exclusive" && opts.cashuLockRefusalHint !== void 0 && { hint: opts.cashuLockRefusalHint },
5887
5904
  extra: { mints }
5888
5905
  }),
5889
5906
  status,
@@ -13552,6 +13569,9 @@ async function getKeysetFinalExpiry(mintUrl, keysetId) {
13552
13569
  // src/sdk/server/wallet-accumulator-monitor.ts
13553
13570
  var DEFAULT_TICK_INTERVAL_MS = 3e4;
13554
13571
  var EXPIRING_SOON_THRESHOLD_MS = 36 * 60 * 60 * 1e3;
13572
+ function expiringSoonThresholdMs(shortestLockWindowSeconds) {
13573
+ return Math.min(EXPIRING_SOON_THRESHOLD_MS, Math.max(0, shortestLockWindowSeconds) * 500);
13574
+ }
13555
13575
  function startAccumulatorMonitor(opts) {
13556
13576
  const tickMs = opts.tickIntervalMs ?? DEFAULT_TICK_INTERVAL_MS;
13557
13577
  const now = opts.now ?? (() => Date.now());
@@ -13567,7 +13587,8 @@ function startAccumulatorMonitor(opts) {
13567
13587
  ...opts,
13568
13588
  now,
13569
13589
  lockKey,
13570
- graceSeconds: opts.lockPubkeyGraceSeconds ?? DEFAULT_LOCK_PUBKEY_GRACE_SECONDS
13590
+ graceSeconds: opts.lockPubkeyGraceSeconds ?? DEFAULT_LOCK_PUBKEY_GRACE_SECONDS,
13591
+ expiringSoonThresholdMs: opts.expiringSoonThresholdMs ?? EXPIRING_SOON_THRESHOLD_MS
13571
13592
  });
13572
13593
  } catch (_err) {
13573
13594
  diagnosticConsole.error(
@@ -13655,7 +13676,7 @@ async function emitExpiryEvents(opts, db, activeState) {
13655
13676
  const delta = batch.oldestTExpire - now;
13656
13677
  if (delta < 0) {
13657
13678
  emitExpired(opts.dvmId, batch, -delta);
13658
- } else if (delta < EXPIRING_SOON_THRESHOLD_MS) {
13679
+ } else if (delta < opts.expiringSoonThresholdMs) {
13659
13680
  emitExpiringSoon(opts.dvmId, batch, delta);
13660
13681
  }
13661
13682
  }
@@ -13868,9 +13889,14 @@ var JobManager = class {
13868
13889
  }
13869
13890
  if (opts.cashuMode === "p2pk-accumulator" && opts.db && opts.dvmId) {
13870
13891
  try {
13892
+ const shortestWindow = shortestCashuLockWindowSeconds(
13893
+ descriptor.cashu,
13894
+ !descriptor.auth || descriptor.auth.allowUnsignedPaid === true
13895
+ );
13871
13896
  this.accumulatorMonitor = startAccumulatorMonitor({
13872
13897
  pool: opts.db,
13873
- dvmId: opts.dvmId
13898
+ dvmId: opts.dvmId,
13899
+ expiringSoonThresholdMs: expiringSoonThresholdMs(shortestWindow)
13874
13900
  });
13875
13901
  } catch (_err) {
13876
13902
  diagnosticConsole.error(
@@ -15676,6 +15702,7 @@ var JobManager = class {
15676
15702
  disposableCashu: this.opts.disposableCashu,
15677
15703
  dvmId: this.opts.dvmId,
15678
15704
  lockPubkeys: extra?.lockPubkeys,
15705
+ cashuLockWindowSeconds: signedCashuLockWindowSeconds(this.descriptor.cashu),
15679
15706
  mintHealthTracker: extra?.mintHealthTracker,
15680
15707
  fxFetcher: this.opts.fxFetcher,
15681
15708
  // the ledger leg — a mid-job payment is a top-up that funds
@@ -22516,6 +22543,7 @@ var DVMServer = class {
22516
22543
  disposableCashu: this.opts.disposableCashu,
22517
22544
  dvmId: this.opts.dvmId,
22518
22545
  lockPubkeys,
22546
+ cashuLockWindowSeconds: signedCashuLockWindowSeconds(this.descriptor.cashu),
22519
22547
  requestId: c.req.header("X-Cashu-Request-Id"),
22520
22548
  mintHealthTracker: this.mintHealthTracker,
22521
22549
  fxFetcher: this.fxFetcher,
@@ -22763,7 +22791,10 @@ var DVMServer = class {
22763
22791
  mints,
22764
22792
  lock_pubkeys: activePubkeySet(active),
22765
22793
  lock_pubkey_grace_seconds: this.graceSeconds(),
22766
- min_locktime: CASHU_MIN_LOCKTIME_SECONDS,
22794
+ min_locktime: this.descriptor.cashu?.minLocktimeSeconds ?? CASHU_MIN_LOCKTIME_SECONDS,
22795
+ ...this.unsignedFloorAdvertised() && {
22796
+ unsigned_min_locktime: unsignedCashuLockWindowSeconds(this.descriptor.cashu)
22797
+ },
22767
22798
  canonical_id: this.opts.canonicalDvmId ?? this.opts.dvmId ?? null
22768
22799
  };
22769
22800
  }
@@ -23121,6 +23152,14 @@ var DVMServer = class {
23121
23152
  402
23122
23153
  );
23123
23154
  }
23155
+ /**
23156
+ * Whether `/v1/info` names the unsigned refund-locktime floor. Only a DVM
23157
+ * that configures its floors and serves unsigned paid calls does, so a DVM
23158
+ * on the defaults advertises exactly what it did before the option existed.
23159
+ */
23160
+ unsignedFloorAdvertised() {
23161
+ return this.descriptor.cashu !== void 0 && (!this.descriptor.auth || this.descriptor.auth.allowUnsignedPaid === true);
23162
+ }
23124
23163
  /** Whether this DVM takes Cashu, the only rail an unsigned payer may use. */
23125
23164
  unsignedCashuOffered() {
23126
23165
  return (this.opts.mints?.length ?? 0) > 0 && this.resolvePaymentMethods().includes("cashu");
@@ -23562,6 +23601,10 @@ var DVMServer = class {
23562
23601
  mints: this.advertisedMints(),
23563
23602
  previousRequiredMsats: this.previousPriceMsats(cap, dynamicUpfront, pricedAt)
23564
23603
  };
23604
+ if (!railOpts.requestId) {
23605
+ railOpts.cashuLockWindowSeconds = unsignedCashuLockWindowSeconds(this.descriptor.cashu);
23606
+ if (this.unsignedFloorAdvertised()) railOpts.cashuLockRefusalHint = UNSIGNED_LOCK_REFUSAL_HINT;
23607
+ }
23565
23608
  }
23566
23609
  hostingPaymentMayHaveLanded = Boolean(
23567
23610
  creditEnvelope || railOpts.cashuToken || railOpts.x402Payment || railOpts.mppCredential
@@ -1,4 +1,4 @@
1
- import { b as JobStore, J as JobRecord } from './job-store-CgXT79tS.js';
1
+ import { b as JobStore, J as JobRecord } from './job-store-Ci2ihiVr.js';
2
2
 
3
3
  /** Authenticated caller metadata; omitted fields on older services mean unknown. */
4
4
  interface JobContentMetadata {
@@ -10,11 +10,11 @@ import {
10
10
  isDrainMethod,
11
11
  isFundingRail,
12
12
  x402SettlementPending
13
- } from "./chunk-B5MPLDRC.js";
13
+ } from "./chunk-B6T3FEVX.js";
14
14
  import "./chunk-YG7G4DPZ.js";
15
15
  import "./chunk-COYKJRMM.js";
16
16
  import "./chunk-5UC7TOQC.js";
17
- import "./chunk-EIDRCGTY.js";
17
+ import "./chunk-IKMRT7O5.js";
18
18
  import "./chunk-BPYMEMQX.js";
19
19
  import "./chunk-H3GGFEE5.js";
20
20
  import "./chunk-ALTE7I6C.js";
@@ -1,11 +1,11 @@
1
- import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-B1hRUIOb.js';
2
- import { cp as HostingCleanupFence, da as HostedIntent, al as FundingMethod, p as PaymentMethod, bV as CreditLedgerLike, a7 as Message, O as UpfrontPayment, a1 as FundingReceipt, bX as CreditSnapshot, a2 as JobReceipt, S as SDKJobContext, az as StepCache, v as ResponseContent, P as PaymentContent, a3 as MessageType, bq as X402Receipt, aI as X402Config, bp as X402ExactVersionSupport, db as X402SettlementIntent, ad as PaymentRequirementsV2, dc as HostedFundingReservation, bR as CreditLedgerQuerier, dd as X402SettlementCursor, b$ as X402SettlementStatus, de as X402SettlementWriteOff, bW as X402RefundSettlementGate, df as X402FacilitatorAuth, dg as X402BatchSettlementConfig, cM as PostgresX402ChannelStorage, dh as X402PayoutObserver, bT as HostedSettlementReportObligations, bt as CreditDepositPayload, by as MppxServer, ag as CashuMode, di as CreditDepositEnqueue, dj as X402SettlementReconciliationReason, as as PaymentRequirements, c3 as FundingRecord, a5 as MppxCredential, b_ as DrawResult, cz as CreditLedgerError, a9 as ReceiptCredit, ai as DrainReceiptEvent, aa as DrainReceipt, a0 as DrawFundingReceipt, K as KVStore, z as SignedRequestAudience, dk as CreditDrawReleaseEnqueue, cK as JobCostReportPayload, cL as JobTerminalReportPayload, cO as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, c5 as CreditInvoiceRecord, c6 as InvoiceSettlement, ct as ClientCompatibilityGate, cr as ClientCompatibility, bC as PostgresTempoSessionStore, bB as PayoutReporter, R as ResolvedCreditConfig, h as CreditView } from './step-cache-Bezn-_ZL.js';
1
+ import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-DMBY7PaJ.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, dd as X402SettlementIntent, af as PaymentRequirementsV2, 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-B_18RAPb.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-CpqQaIfg.js';
6
+ import { d as FxSourceFailure, b as FxRateSnapshot, F as FxFetcher } from './fx-D2w3wCvY.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-CgXT79tS.js';
8
+ import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-Ci2ihiVr.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';
@@ -1966,6 +1966,14 @@ interface UpfrontPaymentOpts {
1966
1966
  lockPubkeys?: LockPubkey[];
1967
1967
  /** UUIDv4 from `X-Cashu-Request-Id` header. */
1968
1968
  requestId?: string;
1969
+ /**
1970
+ * Enforced refund-locktime window; see
1971
+ * {@link AccumulatorReceiveOpts.lockWindowSeconds}. The SDK host always
1972
+ * sets it; a direct caller that omits it gets the default window.
1973
+ */
1974
+ cashuLockWindowSeconds?: number;
1975
+ /** Replaces the `lock_not_exclusive` hint when the floor that applied is not the signed one. */
1976
+ cashuLockRefusalHint?: string;
1969
1977
  /**
1970
1978
  * Per-call Cashu the NUT-24 way, for a `POST /v1/job` the payer could pay
1971
1979
  * without signing. The unpaid 402 then carries the `X-Cashu` payment request
@@ -2335,6 +2343,8 @@ interface IncomingPaymentOpts {
2335
2343
  dvmId?: string;
2336
2344
  /** Active NUT-11 P2PK lock pubkeys (current + retired-in-grace). */
2337
2345
  lockPubkeys?: LockPubkey[];
2346
+ /** Enforced refund-locktime window. Mirrors {@link UpfrontPaymentOpts.cashuLockWindowSeconds}. */
2347
+ cashuLockWindowSeconds?: number;
2338
2348
  /** Runtime mint-health tracker. */
2339
2349
  mintHealthTracker?: MintHealthTracker;
2340
2350
  /**
@@ -1,4 +1,4 @@
1
- import { C as Currency } from './step-cache-Bezn-_ZL.js';
1
+ import { C as Currency } from './step-cache-B_18RAPb.js';
2
2
 
3
3
  /**
4
4
  * Quote-time FX snapshot. `rates` maps configured lowercase currency codes to
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-Bezn-_ZL.js';
2
- export { A as ApprovalContent, b as ArtifactContent, c as CancelContent, d as CanonicalEnvelope, e as CapabilityRate, f as CreateSignedRequestVerifierOpts, g as CreditConfig, h as CreditView, i as DEFAULT_CREDIT_MAX, j as DEFAULT_CREDIT_MIN, k as DEFAULT_CREDIT_TTL_SECONDS, l as DEFAULT_JOB_RETENTION_DAYS, m as DVMRouteContext, I as IncomingMessage, n as InputType, o as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, p as PaymentMethod, q as PriceValue, r as ProgressContent, s as PromptOpts, Q as QuoteConfig, t as QuoteContext, u as QuoteResult, R as ResolvedCreditConfig, v as ResponseContent, S as SDKJobContext, w as SDKPaymentRequestOpts, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, z as SignedRequestAudience, B as SignedRequestDomain, E as SignedRequestError, F as SignedRequestFailure, G as SignedRequestReplayStore, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, U as UnsupportedCurrencyError, O as UpfrontPayment, T as createSignedRequestVerifier, V as isZodSchema, W as signedRequestStatementHeader, X as validateCurrency } from './step-cache-Bezn-_ZL.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-CpqQaIfg.js';
4
- export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-CJwU3-A4.js';
5
- export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-CgXT79tS.js';
1
+ import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-B_18RAPb.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-B_18RAPb.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-D2w3wCvY.js';
4
+ export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-ROzdYbbm.js';
5
+ export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-Ci2ihiVr.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
@@ -9,8 +9,9 @@ import {
9
9
  } from "./chunk-A262WVYX.js";
10
10
  import {
11
11
  SignedRequestError,
12
- createSignedRequestVerifier
13
- } from "./chunk-5CCQEAQV.js";
12
+ createSignedRequestVerifier,
13
+ resolveCashuConfig
14
+ } from "./chunk-MXESSBXF.js";
14
15
  import {
15
16
  DEFAULT_CREDIT_MAX,
16
17
  DEFAULT_CREDIT_MIN,
@@ -69,6 +70,7 @@ function configureDVM(config) {
69
70
  x402: config.x402,
70
71
  mpp: config.mpp,
71
72
  credit: resolveCreditConfig(config.credit),
73
+ cashu: resolveCashuConfig(config.cashu),
72
74
  auth: config.auth
73
75
  };
74
76
  CONFIGURED_DVM_DESCRIPTORS.add(descriptor);
@@ -1,7 +1,7 @@
1
- import { Y as JsonValue, B as SignedRequestDomain, M as SignedRequestStatementHeader, _ as X402_BATCH_SETTLEMENT_SCHEME, $ as X402_EXACT_SCHEME, a0 as DrawFundingReceipt, a1 as FundingReceipt, a2 as JobReceipt$1, O as UpfrontPayment, a3 as MessageType, a4 as X402Version, a5 as MppxCredential, z as SignedRequestAudience, a6 as PaymentRequired, a7 as Message, a8 as MppxChallenge, a9 as ReceiptCredit, aa as DrainReceipt, C as Currency, ab as X402Wallet, ac as PaymentRequirementsV1, ad as PaymentRequirementsV2, L as Logger$1, K as KVStore } from '../step-cache-Bezn-_ZL.js';
2
- export { ae as BuildPaymentRequirementsOpts, af as CapabilityDescriptor, ag as CashuMode, ah as CompleteContent, ai as DrainReceiptEvent, aj as ExactEvmPayload, ak as ExactEvmPayloadAuthorization, al as FundingMethod, am as MessageFrom, an as PaymentPayload, ao as PaymentPayloadV1, ap as PaymentPayloadV2, aq as PaymentRequestContent, ar as PaymentRequiredV2, as as PaymentRequirements, at as PromptContent, au as RAIL_REFUNDABLE, av as ReceiptOutcome, aw as ReceiptPayment, ax as ResourceInfo, ay as SettleResponse, az as StepCache, aA as StepRecord, aB as TextContent, aC as UnsignedDrainReceipt, aD as UnsignedDrawFundingReceipt, aE as UnsignedFundingReceipt, aF as UnsignedJobReceipt, aG as VerifyResponse, aH as WorkingContent, aI as X402Config, aJ as X402ResponseBody, aK as X402SelfRelayRpcFailureReason, aL as X402_DEFAULT_NETWORK, aM as X402_V1_VERSION, aN as X402_VERSION, aO as buildPaymentRequiredV2, aP as buildPaymentRequirements, aQ as caip2ToX402Network, aR as canonicalRequestPath, aS as canonicaliseForSigning, aT as canonicalize, aU as chainIdFromCaip2, aV as computeResultHash, aW as decodePayment, aX as decodePaymentRequiredHeader, aY as encodePayment, aZ as encodePaymentRequiredHeader, a_ as encodeSettleResponseHeader, a$ as exactEvmAuthorization, b0 as isArtifactMessage, b1 as isCancelMessage, b2 as isCompleteMessage, b3 as isDrainReceipt, b4 as isDrawFundingReceipt, b5 as isFundingReceipt, b6 as isPaymentRequestMessage, b7 as isPromptMessage, b8 as isSignedJobReceipt, b9 as isTextMessage, ba as isWorkingMessage, bb as paymentRequiredV2FromV1, bc as signDrainReceipt, bd as signDrawFundingReceipt, be as signFundingReceipt, bf as signReceipt, bg as usdcContractByCaip2, bh as usdcContractFor, bi as usdcDomainNameFor, bj as usdcDomainVersionFor, bk as verifyDrainReceipt, bl as verifyDrawFundingReceipt, bm as verifyFundingReceipt, bn as verifyReceipt, bo as x402NetworkToCaip2 } from '../step-cache-Bezn-_ZL.js';
3
- 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-B1hRUIOb.js';
4
- 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-B1hRUIOb.js';
1
+ import { $ as JsonValue, F as SignedRequestDomain, O as SignedRequestStatementHeader, a0 as X402_BATCH_SETTLEMENT_SCHEME, a1 as X402_EXACT_SCHEME, a2 as DrawFundingReceipt, a3 as FundingReceipt, a4 as JobReceipt$1, V as UpfrontPayment, a5 as MessageType, a6 as X402Version, a7 as MppxCredential, E as SignedRequestAudience, a8 as PaymentRequired, a9 as Message, aa as MppxChallenge, ab as ReceiptCredit, ac as DrainReceipt, C as Currency, ad as X402Wallet, ae as PaymentRequirementsV1, af as PaymentRequirementsV2, L as Logger$1, K as KVStore } from '../step-cache-B_18RAPb.js';
2
+ export { ag as BuildPaymentRequirementsOpts, ah as CapabilityDescriptor, ai as CashuMode, aj as CompleteContent, ak as DrainReceiptEvent, al as ExactEvmPayload, am as ExactEvmPayloadAuthorization, an as FundingMethod, ao as MessageFrom, ap as PaymentPayload, aq as PaymentPayloadV1, ar as PaymentPayloadV2, as as PaymentRequestContent, at as PaymentRequiredV2, au as PaymentRequirements, av as PromptContent, aw as RAIL_REFUNDABLE, ax as ReceiptOutcome, ay as ReceiptPayment, az as ResourceInfo, aA as SettleResponse, aB as StepCache, aC as StepRecord, aD as TextContent, aE as UnsignedDrainReceipt, aF as UnsignedDrawFundingReceipt, aG as UnsignedFundingReceipt, aH as UnsignedJobReceipt, aI as VerifyResponse, aJ as WorkingContent, aK as X402Config, aL as X402ResponseBody, aM as X402SelfRelayRpcFailureReason, aN as X402_DEFAULT_NETWORK, aO as X402_V1_VERSION, aP as X402_VERSION, aQ as buildPaymentRequiredV2, aR as buildPaymentRequirements, aS as caip2ToX402Network, aT as canonicalRequestPath, aU as canonicaliseForSigning, aV as canonicalize, aW as chainIdFromCaip2, aX as computeResultHash, aY as decodePayment, aZ as decodePaymentRequiredHeader, a_ as encodePayment, a$ as encodePaymentRequiredHeader, b0 as encodeSettleResponseHeader, b1 as exactEvmAuthorization, b2 as isArtifactMessage, b3 as isCancelMessage, b4 as isCompleteMessage, b5 as isDrainReceipt, b6 as isDrawFundingReceipt, b7 as isFundingReceipt, b8 as isPaymentRequestMessage, b9 as isPromptMessage, ba as isSignedJobReceipt, bb as isTextMessage, bc as isWorkingMessage, bd as paymentRequiredV2FromV1, be as signDrainReceipt, bf as signDrawFundingReceipt, bg as signFundingReceipt, bh as signReceipt, bi as usdcContractByCaip2, bj as usdcContractFor, bk as usdcDomainNameFor, bl as usdcDomainVersionFor, bm as verifyDrainReceipt, bn as verifyDrawFundingReceipt, bo as verifyFundingReceipt, bp as verifyReceipt, bq as x402NetworkToCaip2 } from '../step-cache-B_18RAPb.js';
3
+ 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-DMBY7PaJ.js';
4
+ 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-DMBY7PaJ.js';
5
5
  import { ProofLike, MeltQuoteBolt11Response, Proof, Wallet, MintQuoteBolt11Response, MintPreview, CounterSource, CounterRange, SerializedDLEQ, OutputData, OutputDataLike } from '@cashu/cashu-ts';
6
6
  export { g as getWallet } from '../wallet-Dwjs5n_M.js';
7
7
  import { SimplePool } from 'nostr-tools/pool';
@@ -9,8 +9,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 { h as FX_CACHE_TTL_MS, i as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-CpqQaIfg.js';
13
- export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-CJwU3-A4.js';
12
+ export { h as FX_CACHE_TTL_MS, i as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-D2w3wCvY.js';
13
+ export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-ROzdYbbm.js';
14
14
  import 'hono';
15
15
  import 'mppx';
16
16
  import '@x402/core/server';
@@ -1635,6 +1635,8 @@ interface V1InfoResponse {
1635
1635
  lock_pubkeys: string[];
1636
1636
  lock_pubkey_grace_seconds: number;
1637
1637
  min_locktime: number;
1638
+ /** Refund-locktime floor, in seconds, for an unsigned paid call; present only when the DVM configures one. */
1639
+ unsigned_min_locktime?: number;
1638
1640
  canonical_id: string | null;
1639
1641
  };
1640
1642
  }
@@ -1718,6 +1720,7 @@ interface ProviderInfo {
1718
1720
  mints: string[];
1719
1721
  lock_pubkeys: string[];
1720
1722
  min_locktime: number;
1723
+ unsigned_min_locktime?: number;
1721
1724
  canonical_id: string | null;
1722
1725
  };
1723
1726
  /** Git SHA the deployed image was built from. `"unknown"` when baked-in SHA is absent. */
@@ -3950,8 +3953,9 @@ declare function withinAdvertisedTolerance(advertisedMicro: bigint, localMicro:
3950
3953
  declare function withInitRetry(fn: () => Promise<void>, label: string, delays?: number[]): Promise<void>;
3951
3954
  /** Patches pool.query and pool.connect in-place to retry transport errors.
3952
3955
  * Idempotent — safe to call multiple times on the same pool instance.
3953
- * Ordinary work retries once; a bounded recovery context may replace every
3954
- * socket in the configured pool during a money-protection request.
3956
+ * Recovery may replace every socket in the configured pool. The connection
3957
+ * timeout bounds how long ordinary work starts retries; a request context can
3958
+ * supply its own deadline.
3955
3959
  * Registers pool.on("error") to prevent idle-client eviction errors from crashing the process,
3956
3960
  * and attaches an 'error' guard to every checked-out client for the same reason (see
3957
3961
  * {@link guardCheckedOutClient}). */
@@ -211,7 +211,7 @@ import {
211
211
  import {
212
212
  applyRetryToPool,
213
213
  withInitRetry
214
- } from "../chunk-EIDRCGTY.js";
214
+ } from "../chunk-IKMRT7O5.js";
215
215
  import {
216
216
  DvmError,
217
217
  X402_NETWORKS,
@@ -1,22 +1,22 @@
1
1
  import { FacilitatorConfig } from '@x402/core/server';
2
- import { an as PaymentPayload, ac as PaymentRequirementsV1, ad as PaymentRequirementsV2, aI as X402Config, ay as SettleResponse, aG as VerifyResponse, bp as X402ExactVersionSupport, bq as X402Receipt, br as TransactionalPayoutHook, bs as CashuMeltCompleted } from '../step-cache-Bezn-_ZL.js';
3
- export { bt as CreditDepositPayload, bu as CreditDrainPayload, bv as FundingLot, bw as LotDebit, bx as LotDepletion, by as MppxServer, bz as NON_CHANNEL_BITCOIN_RAILS, bA as NonChannelBitcoinRail, bB as PayoutReporter, bC as PostgresTempoSessionStore, bD as RevenueReporter, bE as SIGNED_ENVELOPE_FIELDS, bF as SIGNED_ENVELOPE_TYPES, bG as X402TrackedChannel, bH as _testing, bI as createDefaultReplayStore, bJ as depleteLots, bK as fifoOrder, bL as inKindDrawMsats, bM as isInKindDepletion, bN as isNonChannelBitcoinRail, bO as lotOwedSats, bP as netOwedSats, bQ as wrapMppx } from '../step-cache-Bezn-_ZL.js';
2
+ import { ap as PaymentPayload, ae as PaymentRequirementsV1, af as PaymentRequirementsV2, aK as X402Config, aA as SettleResponse, aI as VerifyResponse, br as X402ExactVersionSupport, bs as X402Receipt, bt as TransactionalPayoutHook, bu as CashuMeltCompleted } from '../step-cache-B_18RAPb.js';
3
+ export { bv as CreditDepositPayload, bw as CreditDrainPayload, bx as FundingLot, by as LotDebit, bz as LotDepletion, bA as MppxServer, bB as NON_CHANNEL_BITCOIN_RAILS, bC as NonChannelBitcoinRail, bD as PayoutReporter, bE as PostgresTempoSessionStore, bF as RevenueReporter, bG as SIGNED_ENVELOPE_FIELDS, bH as SIGNED_ENVELOPE_TYPES, bI as X402TrackedChannel, bJ as _testing, bK as createDefaultReplayStore, bL as depleteLots, bM as fifoOrder, bN as inKindDrawMsats, bO as isInKindDepletion, bP as isNonChannelBitcoinRail, bQ as lotOwedSats, bR as netOwedSats, bS as wrapMppx } from '../step-cache-B_18RAPb.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-D-h0zJCZ.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-D-h0zJCZ.js';
11
- export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-CgXT79tS.js';
9
+ import { C as ConsumedCredentialStore, L as LockPubkeyStateLoader } from '../credit-menu-CYjp3FA3.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-CYjp3FA3.js';
11
+ export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-Ci2ihiVr.js';
12
12
  import { z } from 'zod';
13
- export { f as LockPubkeyStoreLockPubkey, t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-B1hRUIOb.js';
13
+ export { f as LockPubkeyStoreLockPubkey, t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-DMBY7PaJ.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-CpqQaIfg.js';
19
+ import '../fx-D2w3wCvY.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>;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PostgresTempoSessionStore
3
- } from "../chunk-ORBWKYDE.js";
3
+ } from "../chunk-JQ2Z3MIC.js";
4
4
  import {
5
5
  verifyX402Payment
6
6
  } from "../chunk-VKFR5PCW.js";
@@ -61,7 +61,7 @@ import {
61
61
  verifyUpfrontPayment,
62
62
  x402RequiredUsdcMicro,
63
63
  x402SettledShare
64
- } from "../chunk-YRQMDRI4.js";
64
+ } from "../chunk-QNAYENWA.js";
65
65
  import "../chunk-XRLKGCAW.js";
66
66
  import {
67
67
  PayoutReporter
@@ -70,14 +70,14 @@ import {
70
70
  settleWithFacilitator,
71
71
  verifyWithFacilitator
72
72
  } from "../chunk-3KRFFLAT.js";
73
- import "../chunk-C5XNZLZ7.js";
73
+ import "../chunk-AYEBQDAZ.js";
74
74
  import "../chunk-A6EY4K46.js";
75
75
  import {
76
76
  SIGNED_ENVELOPE_FIELDS,
77
77
  SIGNED_ENVELOPE_TYPES,
78
78
  createDefaultReplayStore,
79
79
  humanizeZodError
80
- } from "../chunk-5CCQEAQV.js";
80
+ } from "../chunk-MXESSBXF.js";
81
81
  import {
82
82
  createInstrumentedFetch,
83
83
  isStaleJobReapable
@@ -110,11 +110,11 @@ import {
110
110
  isNonChannelBitcoinRail,
111
111
  lotOwedSats,
112
112
  netOwedSats
113
- } from "../chunk-B5MPLDRC.js";
113
+ } from "../chunk-B6T3FEVX.js";
114
114
  import "../chunk-YG7G4DPZ.js";
115
115
  import "../chunk-COYKJRMM.js";
116
116
  import "../chunk-5UC7TOQC.js";
117
- import "../chunk-EIDRCGTY.js";
117
+ import "../chunk-IKMRT7O5.js";
118
118
  import "../chunk-BPYMEMQX.js";
119
119
  import "../chunk-H3GGFEE5.js";
120
120
  import {
@@ -1,4 +1,4 @@
1
- import { a7 as Message, O as UpfrontPayment, al as FundingMethod, a1 as FundingReceipt, bX as CreditSnapshot, a2 as JobReceipt, aA as StepRecord, a3 as MessageType } from './step-cache-Bezn-_ZL.js';
1
+ import { a9 as Message, V as UpfrontPayment, an as FundingMethod, a3 as FundingReceipt, bZ as CreditSnapshot, a4 as JobReceipt, aC as StepRecord, a5 as MessageType } from './step-cache-B_18RAPb.js';
2
2
  import { ProofLike } from '@cashu/cashu-ts';
3
3
 
4
4
  type JobStatus = "processing" | "completed" | "failed" | "awaiting-input" | "cancelled" | "working";
@@ -1,4 +1,4 @@
1
- import { Y as JsonValue } from './step-cache-Bezn-_ZL.js';
1
+ import { $ as JsonValue } from './step-cache-B_18RAPb.js';
2
2
 
3
3
  declare const lockPubkeyBrand: unique symbol;
4
4
  /**
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  MemoryCreditLedger
3
- } from "./chunk-C5XNZLZ7.js";
4
- import "./chunk-B5MPLDRC.js";
3
+ } from "./chunk-AYEBQDAZ.js";
4
+ import "./chunk-B6T3FEVX.js";
5
5
  import "./chunk-YG7G4DPZ.js";
6
6
  import "./chunk-COYKJRMM.js";
7
7
  import "./chunk-5UC7TOQC.js";
8
- import "./chunk-EIDRCGTY.js";
8
+ import "./chunk-IKMRT7O5.js";
9
9
  import "./chunk-BPYMEMQX.js";
10
10
  import "./chunk-H3GGFEE5.js";
11
11
  import "./chunk-ALTE7I6C.js";
@@ -1,15 +1,15 @@
1
- import { ag as CashuMode, bR as CreditLedgerQuerier, bS as CreditDrainEnqueue, bT as HostedSettlementReportObligations, R as ResolvedCreditConfig, bU as DVMAuthScheme, B as SignedRequestDomain, bV as CreditLedgerLike, bW as X402RefundSettlementGate, bX as CreditSnapshot, bY as CreditDrawRefundArgs, bZ as CreditDrawRefundResult, b_ as DrawResult, b$ as X402SettlementStatus, c0 as X402UnresolvedRefund, c1 as GrownDrawResult, c2 as DrawResolution, c3 as FundingRecord, c4 as CreditFundingEvidence, c5 as CreditInvoiceRecord, c6 as InvoiceSettlement, c7 as BlockedInvoiceCursor, c8 as InvoiceReconciliation, c9 as InvoiceWriteOff, ca as DrawRecord, cb as StalePendingDrawCursor, cc as TempoCreditLossEvidence, cd as TempoCreditLoss, ce as X402CreditLossEvidence, cf as X402CreditLoss, cg as DrainMethod, ch as DrainRequestResult, ci as BitcoinDepositLiability, bv as FundingLot, cj as CreditDrainRecord, ck as ChannelDrainCursor, cl as DrainWriteOff, cm as DrainTransitionResult, cn as DrainReleaseResult, co as DrainFulfilment, cp as HostingCleanupFence, aA as StepRecord, a2 as JobReceipt, a7 as Message, K as KVStore, G as SignedRequestReplayStore, Z as ZodLike, a as DVMDescriptor } from '../step-cache-Bezn-_ZL.js';
2
- export { cq as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, cr as ClientCompatibility, cs as ClientCompatibilityEnv, ct as ClientCompatibilityGate, cu as ClientCompatibilityRequirement, cv as ClientSemVer, f as CreateSignedRequestVerifierOpts, cw as CreditFundingBasis, cx as CreditInvoiceStatus, cy as CreditLedger, cz as CreditLedgerError, cA as CreditLedgerErrorCode, cB as CreditLedgerErrorDetails, cC as CreditLedgerPool, cD as CreditStatus, cE as DRAIN_DELIVERY_RESERVE_SATS, cF as DVM_PROTOCOL_VERSION, cG as DrainConflictReason, cH as DrawRailValue, cI as DrawStatus, cJ as HostedTempoCloseReportWriteOff, cK as JobCostReportPayload, cL as JobTerminalReportPayload, cM as PostgresX402ChannelStorage, cN as ReplayStoreBackend, cO as RevenueSkippedNoRailPayload, cP as RevenueSkippedNoRailReason, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, cQ as Secp256k1AuthOpts, z as SignedRequestAudience, E as SignedRequestError, F as SignedRequestFailure, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, cR as TempoDrainDecision, cS as TempoDrainDecisionArgs, cT as TempoDrainDecisionResult, cU as TempoDrainHoldReason, O as UpfrontPayment, cV as X402ChannelStorageOpts, cW as X402RelayLockHolder, cX as X402RelaySubmissionLock, cY as X402RelaySubmissionLockError, cZ as allocateDrawValue, c_ as clientCompatibilityAttributes, c$ as clientCompatibilityMiddleware, d0 as clientUpgradeRequired, T as createSignedRequestVerifier, d1 as parseClientCapabilities, d2 as parseClientCompatibility, d3 as parseDvmClient, d4 as parseProtocolVersion, d5 as requireClientCompatibility, d6 as retryHostedTempoCloseReport, d7 as secp256k1Auth, d8 as signedRequestInput, W as signedRequestStatementHeader, d9 as writeOffHostedTempoCloseReport } from '../step-cache-Bezn-_ZL.js';
1
+ import { ai as CashuMode, bT as CreditLedgerQuerier, bU as CreditDrainEnqueue, bV as HostedSettlementReportObligations, w as ResolvedCreditConfig, bW as DVMAuthScheme, F as SignedRequestDomain, bX as CreditLedgerLike, bY as X402RefundSettlementGate, bZ as CreditSnapshot, b_ as CreditDrawRefundArgs, b$ as CreditDrawRefundResult, c0 as DrawResult, c1 as X402SettlementStatus, c2 as X402UnresolvedRefund, c3 as GrownDrawResult, c4 as DrawResolution, c5 as FundingRecord, c6 as CreditFundingEvidence, c7 as CreditInvoiceRecord, c8 as InvoiceSettlement, c9 as BlockedInvoiceCursor, ca as InvoiceReconciliation, cb as InvoiceWriteOff, cc as DrawRecord, cd as StalePendingDrawCursor, ce as TempoCreditLossEvidence, cf as TempoCreditLoss, cg as X402CreditLossEvidence, ch as X402CreditLoss, ci as DrainMethod, cj as DrainRequestResult, ck as BitcoinDepositLiability, bx as FundingLot, cl as CreditDrainRecord, cm as ChannelDrainCursor, cn as DrainWriteOff, co as DrainTransitionResult, cp as DrainReleaseResult, cq as DrainFulfilment, cr as HostingCleanupFence, aC as StepRecord, a4 as JobReceipt, a9 as Message, K as KVStore, M as SignedRequestReplayStore, Z as ZodLike, a as DVMDescriptor } from '../step-cache-B_18RAPb.js';
2
+ export { cs as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, ct as ClientCompatibility, cu as ClientCompatibilityEnv, cv as ClientCompatibilityGate, cw as ClientCompatibilityRequirement, cx as ClientSemVer, g as CreateSignedRequestVerifierOpts, cy as CreditFundingBasis, cz as CreditInvoiceStatus, cA as CreditLedger, cB as CreditLedgerError, cC as CreditLedgerErrorCode, cD as CreditLedgerErrorDetails, cE as CreditLedgerPool, cF as CreditStatus, cG as DRAIN_DELIVERY_RESERVE_SATS, cH as DVM_PROTOCOL_VERSION, cI as DrainConflictReason, cJ as DrawRailValue, cK as DrawStatus, cL as HostedTempoCloseReportWriteOff, cM as JobCostReportPayload, cN as JobTerminalReportPayload, cO as PostgresX402ChannelStorage, cP as ReplayStoreBackend, cQ as RevenueSkippedNoRailPayload, cR as RevenueSkippedNoRailReason, z as SIGNED_REQUEST_AUTH_ID, B as SIGNED_REQUEST_STATEMENT_VERSION, cS as Secp256k1AuthOpts, E as SignedRequestAudience, G as SignedRequestError, H as SignedRequestFailure, N as SignedRequestSignOpts, O as SignedRequestStatementHeader, T as SignedRequestVerifier, cT as TempoDrainDecision, cU as TempoDrainDecisionArgs, cV as TempoDrainDecisionResult, cW as TempoDrainHoldReason, V as UpfrontPayment, cX as X402ChannelStorageOpts, cY as X402RelayLockHolder, cZ as X402RelaySubmissionLock, c_ as X402RelaySubmissionLockError, c$ as allocateDrawValue, d0 as clientCompatibilityAttributes, d1 as clientCompatibilityMiddleware, d2 as clientUpgradeRequired, W as createSignedRequestVerifier, d3 as parseClientCapabilities, d4 as parseClientCompatibility, d5 as parseDvmClient, d6 as parseProtocolVersion, d7 as requireClientCompatibility, d8 as retryHostedTempoCloseReport, d9 as secp256k1Auth, da as signedRequestInput, Y as signedRequestStatementHeader, db as writeOffHostedTempoCloseReport } from '../step-cache-B_18RAPb.js';
3
3
  import { Pool } from 'pg';
4
- import { au as CreditMenu, a as AppEnv, U as UpfrontPaymentOpts, i as PaymentInfo, av as ReceiptIssuer, aw as LightningReceive, ax as TempoSettlementReadiness, ay as DVMHostOpts, az as DVMServeResult, L as LockPubkeyStateLoader, C as ConsumedCredentialStore } from '../credit-menu-D-h0zJCZ.js';
5
- export { aA as BuildCreditMenuArgs, aB as BuilderIdentity, aC as CREDIT_ENVELOPE_KEYS, aD as CreateX402BatchSettlementServerOpts, aE as CreditEnvelope, aF as CreditEnvelopeError, aG as CreditFundCommitment, aH as CreditTerms, aI as DEFAULT_INVOICE_TTL_SECONDS, aJ as DVMHost, aK as HostingClosureCommand, aL as HostingClosureEvidence, aM as HostingControlCommand, aN as HostingControlConfig, aO as HostingControlStatus, aP as JobManager, aQ as JobManagerOpts, aR as LightningReceiveConfig, aS as MIN_INVOICE_TTL_SECONDS, aT as MemoryConsumedCredentialStore, aU as MemoryConsumedCredentialStoreOpts, aV as MemoryProcessedPaymentStore, aW as MemoryX402ExactSettlementStore, aX as MountOpts, aY as OwnerDisplay, aZ as PaidJobCompletion, a_ as PaymentMode, a$ as PlatformReporterOpts, b0 as PostgresProcessedPaymentStore, b1 as PostgresX402ExactSettlementStore, b2 as PriceFiat, b3 as ProcessedPaymentQuerier, b4 as ProcessedPaymentRail, b5 as ProcessedPaymentRecord, b6 as ProcessedPaymentReplayError, b7 as ProcessedPaymentStore, b8 as X402BatchAcceptance, b9 as X402BatchFunding, ba as X402BatchRefusal, bb as X402BatchSettlementServer, bc as X402ExactAcceptance, bd as X402ExactIntentConflictError, be as X402ExactSettlementAttempt, bf as X402ExactSettlementChainEvidence, bg as X402ExactSettlementEffect, bh as X402ExactSettlementEvidenceMissingError, bi as X402ExactSettlementEvidenceReader, bj as X402ExactSettlementIntent, bk as X402ExactSettlementNotReadyError, bl as X402ExactSettlementServer, bm as X402ExactSettlementServerOpts, bn as X402ExactSettlementStatus, bo as X402ExactSettlementStore, bp as X402SettlementChainEvidence, bq as X402SettlementEvidenceReader, br as X402SettlementSubmissionError, bs as X402_BATCH_AUTO_SETTLEMENT, bt as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bu as X402_BATCH_SETTLEMENT_NETWORK, bv as attachCreditMenu, bw as buildCreditMenu, bx as createDVMHost, by as createX402BatchSettlementServer, bz as creditEnvelopeIgnoreFields, bA as drawSettlementRef, bB as extractCreditEnvelope, bC as fundingCommitment, bD as selectPrimaryCredit, bE as signHostingClosure, bF as signHostingControl, bG as stripCreditEnvelope, bH as toCreditView } from '../credit-menu-D-h0zJCZ.js';
4
+ import { au as CreditMenu, a as AppEnv, U as UpfrontPaymentOpts, i as PaymentInfo, av as ReceiptIssuer, aw as LightningReceive, ax as TempoSettlementReadiness, ay as DVMHostOpts, az as DVMServeResult, L as LockPubkeyStateLoader, C as ConsumedCredentialStore } from '../credit-menu-CYjp3FA3.js';
5
+ export { aA as BuildCreditMenuArgs, aB as BuilderIdentity, aC as CREDIT_ENVELOPE_KEYS, aD as CreateX402BatchSettlementServerOpts, aE as CreditEnvelope, aF as CreditEnvelopeError, aG as CreditFundCommitment, aH as CreditTerms, aI as DEFAULT_INVOICE_TTL_SECONDS, aJ as DVMHost, aK as HostingClosureCommand, aL as HostingClosureEvidence, aM as HostingControlCommand, aN as HostingControlConfig, aO as HostingControlStatus, aP as JobManager, aQ as JobManagerOpts, aR as LightningReceiveConfig, aS as MIN_INVOICE_TTL_SECONDS, aT as MemoryConsumedCredentialStore, aU as MemoryConsumedCredentialStoreOpts, aV as MemoryProcessedPaymentStore, aW as MemoryX402ExactSettlementStore, aX as MountOpts, aY as OwnerDisplay, aZ as PaidJobCompletion, a_ as PaymentMode, a$ as PlatformReporterOpts, b0 as PostgresProcessedPaymentStore, b1 as PostgresX402ExactSettlementStore, b2 as PriceFiat, b3 as ProcessedPaymentQuerier, b4 as ProcessedPaymentRail, b5 as ProcessedPaymentRecord, b6 as ProcessedPaymentReplayError, b7 as ProcessedPaymentStore, b8 as X402BatchAcceptance, b9 as X402BatchFunding, ba as X402BatchRefusal, bb as X402BatchSettlementServer, bc as X402ExactAcceptance, bd as X402ExactIntentConflictError, be as X402ExactSettlementAttempt, bf as X402ExactSettlementChainEvidence, bg as X402ExactSettlementEffect, bh as X402ExactSettlementEvidenceMissingError, bi as X402ExactSettlementEvidenceReader, bj as X402ExactSettlementIntent, bk as X402ExactSettlementNotReadyError, bl as X402ExactSettlementServer, bm as X402ExactSettlementServerOpts, bn as X402ExactSettlementStatus, bo as X402ExactSettlementStore, bp as X402SettlementChainEvidence, bq as X402SettlementEvidenceReader, br as X402SettlementSubmissionError, bs as X402_BATCH_AUTO_SETTLEMENT, bt as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bu as X402_BATCH_SETTLEMENT_NETWORK, bv as attachCreditMenu, bw as buildCreditMenu, bx as createDVMHost, by as createX402BatchSettlementServer, bz as creditEnvelopeIgnoreFields, bA as drawSettlementRef, bB as extractCreditEnvelope, bC as fundingCommitment, bD as selectPrimaryCredit, bE as signHostingClosure, bF as signHostingControl, bG as stripCreditEnvelope, bH as toCreditView } from '../credit-menu-CYjp3FA3.js';
6
6
  import { Context, Hono } from 'hono';
7
7
  import { z } from 'zod';
8
- import { F as FxFetcher } from '../fx-CpqQaIfg.js';
9
- import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters, b as JobStore } from '../job-store-CgXT79tS.js';
10
- export { a as JobStatus, h as isStreamableJobStore } from '../job-store-CgXT79tS.js';
11
- import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-B_hOQS36.js';
12
- export { b as ContentHold, c as ContentHoldError, d as ContentHoldEvent, e as ContentHoldStore, f as ContentHoldsResponse, J as JobContentMetadata, g as baselineContentExpiry, h as contentMetadata, i as isContentHoldStore } from '../content-retention-B_hOQS36.js';
8
+ import { F as FxFetcher } from '../fx-D2w3wCvY.js';
9
+ import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters, b as JobStore } from '../job-store-Ci2ihiVr.js';
10
+ export { a as JobStatus, h as isStreamableJobStore } from '../job-store-Ci2ihiVr.js';
11
+ import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-Cxn-umvR.js';
12
+ export { b as ContentHold, c as ContentHoldError, d as ContentHoldEvent, e as ContentHoldStore, f as ContentHoldsResponse, J as JobContentMetadata, g as baselineContentExpiry, h as contentMetadata, i as isContentHoldStore } from '../content-retention-Cxn-umvR.js';
13
13
  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';
14
14
  import { Env, BlankSchema } from 'hono/types';
15
15
  import 'mppx';
@@ -17,7 +17,7 @@ import '@x402/core/server';
17
17
  import '@x402/evm/batch-settlement/server';
18
18
  import '@x402/core/types';
19
19
  import 'viem';
20
- import '../lightning-backend-B1hRUIOb.js';
20
+ import '../lightning-backend-DMBY7PaJ.js';
21
21
  import '@cashu/cashu-ts';
22
22
 
23
23
  /** Default lifetime of a per-call implicit credit: 90 days before the ledger refuses new draws. */
@@ -82,7 +82,7 @@ import {
82
82
  toCreditView,
83
83
  unknownRouteNotFound,
84
84
  writeOffHostedTempoCloseReport
85
- } from "../chunk-YRQMDRI4.js";
85
+ } from "../chunk-QNAYENWA.js";
86
86
  import {
87
87
  MemoryProcessedPaymentStore,
88
88
  PostgresProcessedPaymentStore,
@@ -92,7 +92,7 @@ import "../chunk-KRX7VNBG.js";
92
92
  import "../chunk-3KRFFLAT.js";
93
93
  import {
94
94
  MemoryCreditLedger
95
- } from "../chunk-C5XNZLZ7.js";
95
+ } from "../chunk-AYEBQDAZ.js";
96
96
  import {
97
97
  PostgresJobStore
98
98
  } from "../chunk-A6EY4K46.js";
@@ -101,7 +101,7 @@ import {
101
101
  createDefaultReplayStore,
102
102
  createSignedRequestVerifier,
103
103
  signedRequestInput
104
- } from "../chunk-5CCQEAQV.js";
104
+ } from "../chunk-MXESSBXF.js";
105
105
  import {
106
106
  isStreamableJobStore
107
107
  } from "../chunk-Y6JJDOGO.js";
@@ -139,7 +139,7 @@ import {
139
139
  PostgresX402ChannelStorage,
140
140
  X402RelaySubmissionLockError,
141
141
  allocateDrawValue
142
- } from "../chunk-B5MPLDRC.js";
142
+ } from "../chunk-B6T3FEVX.js";
143
143
  import "../chunk-YG7G4DPZ.js";
144
144
  import {
145
145
  SDK_INIT_ADVISORY_LOCK,
@@ -148,7 +148,7 @@ import {
148
148
  import "../chunk-5UC7TOQC.js";
149
149
  import {
150
150
  applyRetryToPool
151
- } from "../chunk-EIDRCGTY.js";
151
+ } from "../chunk-IKMRT7O5.js";
152
152
  import {
153
153
  assertSupportedX402Network
154
154
  } from "../chunk-BPYMEMQX.js";
@@ -1310,7 +1310,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1310
1310
  { createPublicClient, createWalletClient, erc20Abi, http },
1311
1311
  { tempo: tempoMainnet, tempoModerato }
1312
1312
  ] = await Promise.all([
1313
- import("../tempo-session-store-EWBE5HJM.js"),
1313
+ import("../tempo-session-store-N3TFZ26X.js"),
1314
1314
  import("viem/accounts"),
1315
1315
  import("viem"),
1316
1316
  import("viem/chains")
@@ -1507,7 +1507,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1507
1507
  sharedPgConsumedStore = consumedStore;
1508
1508
  }
1509
1509
  if (pgPool) {
1510
- const { CreditLedger: CreditLedger2 } = await import("../credit-ledger-5HMJ6VUX.js");
1510
+ const { CreditLedger: CreditLedger2 } = await import("../credit-ledger-SBLDJCLE.js");
1511
1511
  const pgLedger = new CreditLedger2(pgPool, tempoSessionStore);
1512
1512
  pendingInits.push(pgLedger.init());
1513
1513
  creditLedger = pgLedger;
@@ -1516,7 +1516,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1516
1516
  pendingInits.push(pgProcessed.init());
1517
1517
  processedPayments = pgProcessed;
1518
1518
  } else {
1519
- const { MemoryCreditLedger: MemoryCreditLedger2 } = await import("../memory-credit-ledger-ME6FH462.js");
1519
+ const { MemoryCreditLedger: MemoryCreditLedger2 } = await import("../memory-credit-ledger-DMIGIH2H.js");
1520
1520
  creditLedger = disposableCashu?.ledger ?? new MemoryCreditLedger2();
1521
1521
  const { MemoryProcessedPaymentStore: MemoryProcessedPaymentStore2 } = await import("../processed-payment-store-GKMAWOM3.js");
1522
1522
  processedPayments = new MemoryProcessedPaymentStore2();
@@ -6002,6 +6002,43 @@ interface ResolvedCreditConfig {
6002
6002
  /** Whether Tempo `charge` and x402 `exact` may fund prepaid credit. */
6003
6003
  allowOneShotStablecoin: boolean;
6004
6004
  }
6005
+ /**
6006
+ * Refund-locktime floors for Cashu payments. A payer may lock proofs with a
6007
+ * NUT-11 `locktime`; the DVM refuses one that passes before the proofs can be
6008
+ * melted. Shortening a floor below its default is safe only when the builder
6009
+ * melts more often than the floor: once a proof's locktime passes, an
6010
+ * unmelted proof can be spent by the payer's refund key or, when the proof
6011
+ * names no refund key, by anyone holding it.
6012
+ */
6013
+ interface CashuConfig {
6014
+ /**
6015
+ * Shortest refund `locktime`, in seconds from now, a signed caller must
6016
+ * use. Advertised as `cashu.min_locktime` on `/v1/info`; the DVM enforces it
6017
+ * less 24 hours so a caller resuming an unacknowledged payment still
6018
+ * clears it. Default 604800 (7 days). A whole number of at least 90000
6019
+ * (25 hours), so the enforced floor is always at least an hour away.
6020
+ */
6021
+ minLocktimeSeconds?: number;
6022
+ /**
6023
+ * Shortest refund `locktime`, in seconds from receipt, for an unsigned
6024
+ * `POST /v1/job` payment sent without `X-Cashu-Request-Id` (a NUT-24
6025
+ * wallet) to a DVM without auth or one built with
6026
+ * `secp256k1Auth({ allowUnsignedPaid: true })`. Such a wallet cannot be
6027
+ * told this floor and locks to its own default, so it is enforced exactly,
6028
+ * with no resume margin, and advertised as `cashu.unsigned_min_locktime`.
6029
+ * A payment carrying `X-Cashu-Request-Id` takes the signed floor. Default
6030
+ * `minLocktimeSeconds` less 24 hours (518400 when that is unset). A whole
6031
+ * number of at least 3600, and no more than `minLocktimeSeconds` less 24
6032
+ * hours: an unsigned payer can send `X-Cashu-Request-Id` to take the signed
6033
+ * floor instead, so a longer unsigned floor would protect nothing.
6034
+ */
6035
+ unsignedMinLocktimeSeconds?: number;
6036
+ }
6037
+ /** A {@link CashuConfig} with both floors filled from their defaults. */
6038
+ interface ResolvedCashuConfig {
6039
+ minLocktimeSeconds: number;
6040
+ unsignedMinLocktimeSeconds: number;
6041
+ }
6005
6042
  /** Platform default for {@link CreditConfig.min} — a dust floor below which rail fees dominate. */
6006
6043
  declare const DEFAULT_CREDIT_MIN: PriceValue;
6007
6044
  /**
@@ -6241,6 +6278,8 @@ interface DVMConfig<State = Record<string, unknown>, InputSchema extends ZodLike
6241
6278
  * omitting it leaves callers on per-call payment. See {@link CreditConfig}.
6242
6279
  */
6243
6280
  credit?: CreditConfig;
6281
+ /** Cashu refund-locktime floors. See {@link CashuConfig}. */
6282
+ cashu?: CashuConfig;
6244
6283
  /**
6245
6284
  * Register DVM-scoped non-protocol routes on the descriptor's Hono sub-app
6246
6285
  * Invoked once per `host.mount(dvm)` against the sub-app that
@@ -6330,6 +6369,8 @@ interface DVMDescriptor<State = Record<string, unknown>, InputSchema extends Zod
6330
6369
  * `credit` block — the presence check IS the opt-in gate.
6331
6370
  */
6332
6371
  readonly credit?: ResolvedCreditConfig;
6372
+ /** Cashu refund-locktime floors, present iff `configureDVM` was given a `cashu` block. */
6373
+ readonly cashu?: ResolvedCashuConfig;
6333
6374
  /**
6334
6375
  * Descriptor-level auth scheme. Set when `configureDVM` was
6335
6376
  * called with `auth: secp256k1Auth(...)` — the SDK fires this on
@@ -6362,4 +6403,4 @@ declare class StepCache {
6362
6403
  static deserialize(records: StepRecord[]): StepCache;
6363
6404
  }
6364
6405
 
6365
- export { X402_EXACT_SCHEME as $, type ApprovalContent as A, type SignedRequestDomain as B, type Currency as C, type DVMConfig as D, SignedRequestError as E, type SignedRequestFailure as F, type SignedRequestReplayStore as G, type SignedRequestSignOpts as H, type IncomingMessage as I, type JobCost as J, type KVStore as K, type Logger as L, type SignedRequestStatementHeader as M, type SignedRequestVerifier as N, type UpfrontPayment as O, type PaymentContent as P, type QuoteConfig as Q, type ResolvedCreditConfig as R, type SDKJobContext as S, createSignedRequestVerifier as T, UnsupportedCurrencyError as U, isZodSchema as V, signedRequestStatementHeader as W, validateCurrency as X, type JsonValue as Y, type ZodLike as Z, X402_BATCH_SETTLEMENT_SCHEME as _, type DVMDescriptor as a, exactEvmAuthorization as a$, type DrawFundingReceipt as a0, type FundingReceipt as a1, type JobReceipt as a2, type MessageType as a3, type X402Version as a4, type MppxCredential as a5, type PaymentRequired as a6, type Message as a7, type MppxChallenge as a8, type ReceiptCredit as a9, type StepRecord as aA, type TextContent as aB, type UnsignedDrainReceipt as aC, type UnsignedDrawFundingReceipt as aD, type UnsignedFundingReceipt as aE, type UnsignedJobReceipt as aF, type VerifyResponse as aG, type WorkingContent as aH, type X402Config$1 as aI, type X402ResponseBody as aJ, type X402SelfRelayRpcFailureReason as aK, X402_DEFAULT_NETWORK as aL, X402_V1_VERSION as aM, X402_VERSION as aN, buildPaymentRequiredV2 as aO, buildPaymentRequirements as aP, caip2ToX402Network as aQ, canonicalRequestPath as aR, canonicaliseForSigning as aS, canonicalize as aT, chainIdFromCaip2 as aU, computeResultHash as aV, decodePayment as aW, decodePaymentRequiredHeader as aX, encodePayment as aY, encodePaymentRequiredHeader as aZ, encodeSettleResponseHeader as a_, type DrainReceipt as aa, type X402Wallet as ab, type PaymentRequirementsV1 as ac, type PaymentRequirementsV2 as ad, type BuildPaymentRequirementsOpts as ae, type CapabilityDescriptor as af, type CashuMode as ag, type CompleteContent as ah, type DrainReceiptEvent as ai, type ExactEvmPayload as aj, type ExactEvmPayloadAuthorization as ak, type FundingMethod as al, type MessageFrom as am, type PaymentPayload as an, type PaymentPayloadV1 as ao, type PaymentPayloadV2 as ap, type PaymentRequestContent as aq, type PaymentRequiredV2 as ar, type PaymentRequirements as as, type PromptContent as at, RAIL_REFUNDABLE as au, type ReceiptOutcome as av, type ReceiptPayment as aw, type ResourceInfo as ax, type SettleResponse as ay, StepCache as az, type ArtifactContent as b, type X402SettlementStatus as b$, isArtifactMessage as b0, isCancelMessage as b1, isCompleteMessage as b2, isDrainReceipt as b3, isDrawFundingReceipt as b4, isFundingReceipt as b5, isPaymentRequestMessage as b6, isPromptMessage as b7, isSignedJobReceipt as b8, isTextMessage as b9, type NonChannelBitcoinRail as bA, PayoutReporter as bB, PostgresTempoSessionStore as bC, RevenueReporter as bD, SIGNED_ENVELOPE_FIELDS as bE, SIGNED_ENVELOPE_TYPES as bF, type X402TrackedChannel as bG, _testing as bH, createDefaultReplayStore as bI, depleteLots as bJ, fifoOrder as bK, inKindDrawMsats as bL, isInKindDepletion as bM, isNonChannelBitcoinRail as bN, lotOwedSats as bO, netOwedSats as bP, wrapMppx as bQ, type CreditLedgerQuerier as bR, type CreditDrainEnqueue as bS, HostedSettlementReportObligations as bT, type DVMAuthScheme as bU, type CreditLedgerLike as bV, type X402RefundSettlementGate as bW, type CreditSnapshot as bX, type CreditDrawRefundArgs as bY, type CreditDrawRefundResult as bZ, type DrawResult as b_, isWorkingMessage as ba, paymentRequiredV2FromV1 as bb, signDrainReceipt as bc, signDrawFundingReceipt as bd, signFundingReceipt as be, signReceipt as bf, usdcContractByCaip2 as bg, usdcContractFor as bh, usdcDomainNameFor as bi, usdcDomainVersionFor as bj, verifyDrainReceipt as bk, verifyDrawFundingReceipt as bl, verifyFundingReceipt as bm, verifyReceipt as bn, x402NetworkToCaip2 as bo, type X402ExactVersionSupport as bp, type X402Receipt as bq, type TransactionalPayoutHook as br, type CashuMeltCompleted as bs, type CreditDepositPayload as bt, type CreditDrainPayload as bu, type FundingLot as bv, type LotDebit as bw, type LotDepletion as bx, type MppxServer as by, NON_CHANNEL_BITCOIN_RAILS as bz, type CancelContent as c, clientCompatibilityMiddleware as c$, type X402UnresolvedRefund as c0, type GrownDrawResult as c1, type DrawResolution as c2, type FundingRecord as c3, type CreditFundingEvidence as c4, type CreditInvoiceRecord as c5, type InvoiceSettlement as c6, type BlockedInvoiceCursor as c7, type InvoiceReconciliation as c8, type InvoiceWriteOff as c9, type CreditLedgerErrorCode as cA, type CreditLedgerErrorDetails as cB, type CreditLedgerPool as cC, type CreditStatus as cD, DRAIN_DELIVERY_RESERVE_SATS as cE, DVM_PROTOCOL_VERSION as cF, type DrainConflictReason as cG, type DrawRailValue as cH, type DrawStatus as cI, type HostedTempoCloseReportWriteOff as cJ, type JobCostReportPayload as cK, type JobTerminalReportPayload as cL, PostgresX402ChannelStorage as cM, type ReplayStoreBackend as cN, type RevenueSkippedNoRailPayload as cO, type RevenueSkippedNoRailReason as cP, type Secp256k1AuthOpts as cQ, type TempoDrainDecision as cR, type TempoDrainDecisionArgs as cS, type TempoDrainDecisionResult as cT, type TempoDrainHoldReason as cU, type X402ChannelStorageOpts as cV, type X402RelayLockHolder as cW, type X402RelaySubmissionLock as cX, X402RelaySubmissionLockError as cY, allocateDrawValue as cZ, clientCompatibilityAttributes as c_, type DrawRecord as ca, type StalePendingDrawCursor as cb, type TempoCreditLossEvidence as cc, type TempoCreditLoss as cd, type X402CreditLossEvidence as ce, type X402CreditLoss as cf, type DrainMethod as cg, type DrainRequestResult as ch, type BitcoinDepositLiability as ci, type CreditDrainRecord as cj, type ChannelDrainCursor as ck, type DrainWriteOff as cl, type DrainTransitionResult as cm, type DrainReleaseResult as cn, type DrainFulfilment as co, HostingCleanupFence as cp, CLIENT_COMPATIBILITY_HEADERS as cq, type ClientCompatibility as cr, type ClientCompatibilityEnv as cs, type ClientCompatibilityGate as ct, type ClientCompatibilityRequirement as cu, type ClientSemVer as cv, type CreditFundingBasis as cw, type CreditInvoiceStatus as cx, CreditLedger as cy, CreditLedgerError as cz, type CanonicalEnvelope as d, clientUpgradeRequired as d0, parseClientCapabilities as d1, parseClientCompatibility as d2, parseDvmClient as d3, parseProtocolVersion as d4, requireClientCompatibility as d5, retryHostedTempoCloseReport as d6, secp256k1Auth as d7, signedRequestInput as d8, writeOffHostedTempoCloseReport as d9, type HostedIntent as da, type X402SettlementIntent as db, type HostedFundingReservation as dc, type X402SettlementCursor as dd, type X402SettlementWriteOff as de, type X402FacilitatorAuth as df, type X402BatchSettlementConfig as dg, type X402PayoutObserver as dh, type CreditDepositEnqueue as di, type X402SettlementReconciliationReason as dj, type CreditDrawReleaseEnqueue as dk, type CapabilityRate as e, type CreateSignedRequestVerifierOpts as f, type CreditConfig as g, type CreditView as h, DEFAULT_CREDIT_MAX as i, DEFAULT_CREDIT_MIN as j, DEFAULT_CREDIT_TTL_SECONDS as k, DEFAULT_JOB_RETENTION_DAYS as l, type DVMRouteContext as m, type InputType as n, InvalidCurrencyError as o, type PaymentMethod as p, type PriceValue as q, type ProgressContent as r, type PromptOpts as s, type QuoteContext as t, type QuoteResult as u, type ResponseContent as v, type SDKPaymentRequestOpts as w, SIGNED_REQUEST_AUTH_ID as x, SIGNED_REQUEST_STATEMENT_VERSION as y, type SignedRequestAudience as z };
6406
+ export { type JsonValue as $, type ApprovalContent as A, SIGNED_REQUEST_STATEMENT_VERSION as B, type Currency as C, type DVMConfig as D, type SignedRequestAudience as E, type SignedRequestDomain as F, SignedRequestError as G, type SignedRequestFailure as H, type IncomingMessage as I, type JobCost as J, type KVStore as K, type Logger as L, type SignedRequestReplayStore as M, type SignedRequestSignOpts as N, type SignedRequestStatementHeader as O, type PaymentContent as P, type QuoteConfig as Q, type ResolvedCashuConfig as R, type SDKJobContext as S, type SignedRequestVerifier as T, UnsupportedCurrencyError as U, type UpfrontPayment as V, createSignedRequestVerifier as W, isZodSchema as X, signedRequestStatementHeader as Y, type ZodLike as Z, validateCurrency as _, type DVMDescriptor as a, encodePaymentRequiredHeader as a$, X402_BATCH_SETTLEMENT_SCHEME as a0, X402_EXACT_SCHEME as a1, type DrawFundingReceipt as a2, type FundingReceipt as a3, type JobReceipt as a4, type MessageType as a5, type X402Version as a6, type MppxCredential as a7, type PaymentRequired as a8, type Message as a9, type SettleResponse as aA, StepCache as aB, type StepRecord as aC, type TextContent as aD, type UnsignedDrainReceipt as aE, type UnsignedDrawFundingReceipt as aF, type UnsignedFundingReceipt as aG, type UnsignedJobReceipt as aH, type VerifyResponse as aI, type WorkingContent as aJ, type X402Config$1 as aK, type X402ResponseBody as aL, type X402SelfRelayRpcFailureReason as aM, X402_DEFAULT_NETWORK as aN, X402_V1_VERSION as aO, X402_VERSION as aP, buildPaymentRequiredV2 as aQ, buildPaymentRequirements as aR, caip2ToX402Network as aS, canonicalRequestPath as aT, canonicaliseForSigning as aU, canonicalize as aV, chainIdFromCaip2 as aW, computeResultHash as aX, decodePayment as aY, decodePaymentRequiredHeader as aZ, encodePayment as a_, type MppxChallenge as aa, type ReceiptCredit as ab, type DrainReceipt as ac, type X402Wallet as ad, type PaymentRequirementsV1 as ae, type PaymentRequirementsV2 as af, type BuildPaymentRequirementsOpts as ag, type CapabilityDescriptor as ah, type CashuMode as ai, type CompleteContent as aj, type DrainReceiptEvent as ak, type ExactEvmPayload as al, type ExactEvmPayloadAuthorization as am, type FundingMethod as an, type MessageFrom as ao, type PaymentPayload as ap, type PaymentPayloadV1 as aq, type PaymentPayloadV2 as ar, type PaymentRequestContent as as, type PaymentRequiredV2 as at, type PaymentRequirements as au, type PromptContent as av, RAIL_REFUNDABLE as aw, type ReceiptOutcome as ax, type ReceiptPayment as ay, type ResourceInfo as az, type ArtifactContent as b, type CreditDrawRefundResult as b$, encodeSettleResponseHeader as b0, exactEvmAuthorization as b1, isArtifactMessage as b2, isCancelMessage as b3, isCompleteMessage as b4, isDrainReceipt as b5, isDrawFundingReceipt as b6, isFundingReceipt as b7, isPaymentRequestMessage as b8, isPromptMessage as b9, type MppxServer as bA, NON_CHANNEL_BITCOIN_RAILS as bB, type NonChannelBitcoinRail as bC, PayoutReporter as bD, PostgresTempoSessionStore as bE, RevenueReporter as bF, SIGNED_ENVELOPE_FIELDS as bG, SIGNED_ENVELOPE_TYPES as bH, type X402TrackedChannel as bI, _testing as bJ, createDefaultReplayStore as bK, depleteLots as bL, fifoOrder as bM, inKindDrawMsats as bN, isInKindDepletion as bO, isNonChannelBitcoinRail as bP, lotOwedSats as bQ, netOwedSats as bR, wrapMppx as bS, type CreditLedgerQuerier as bT, type CreditDrainEnqueue as bU, HostedSettlementReportObligations as bV, type DVMAuthScheme as bW, type CreditLedgerLike as bX, type X402RefundSettlementGate as bY, type CreditSnapshot as bZ, type CreditDrawRefundArgs as b_, isSignedJobReceipt as ba, isTextMessage as bb, isWorkingMessage as bc, paymentRequiredV2FromV1 as bd, signDrainReceipt as be, signDrawFundingReceipt as bf, signFundingReceipt as bg, signReceipt as bh, usdcContractByCaip2 as bi, usdcContractFor as bj, usdcDomainNameFor as bk, usdcDomainVersionFor as bl, verifyDrainReceipt as bm, verifyDrawFundingReceipt as bn, verifyFundingReceipt as bo, verifyReceipt as bp, x402NetworkToCaip2 as bq, type X402ExactVersionSupport as br, type X402Receipt as bs, type TransactionalPayoutHook as bt, type CashuMeltCompleted as bu, type CreditDepositPayload as bv, type CreditDrainPayload as bw, type FundingLot as bx, type LotDebit as by, type LotDepletion as bz, type CancelContent as c, allocateDrawValue as c$, type DrawResult as c0, type X402SettlementStatus as c1, type X402UnresolvedRefund as c2, type GrownDrawResult as c3, type DrawResolution as c4, type FundingRecord as c5, type CreditFundingEvidence as c6, type CreditInvoiceRecord as c7, type InvoiceSettlement as c8, type BlockedInvoiceCursor as c9, CreditLedger as cA, CreditLedgerError as cB, type CreditLedgerErrorCode as cC, type CreditLedgerErrorDetails as cD, type CreditLedgerPool as cE, type CreditStatus as cF, DRAIN_DELIVERY_RESERVE_SATS as cG, DVM_PROTOCOL_VERSION as cH, type DrainConflictReason as cI, type DrawRailValue as cJ, type DrawStatus as cK, type HostedTempoCloseReportWriteOff as cL, type JobCostReportPayload as cM, type JobTerminalReportPayload as cN, PostgresX402ChannelStorage as cO, type ReplayStoreBackend as cP, type RevenueSkippedNoRailPayload as cQ, type RevenueSkippedNoRailReason as cR, type Secp256k1AuthOpts as cS, type TempoDrainDecision as cT, type TempoDrainDecisionArgs as cU, type TempoDrainDecisionResult as cV, type TempoDrainHoldReason as cW, type X402ChannelStorageOpts as cX, type X402RelayLockHolder as cY, type X402RelaySubmissionLock as cZ, X402RelaySubmissionLockError as c_, type InvoiceReconciliation as ca, type InvoiceWriteOff as cb, type DrawRecord as cc, type StalePendingDrawCursor as cd, type TempoCreditLossEvidence as ce, type TempoCreditLoss as cf, type X402CreditLossEvidence as cg, type X402CreditLoss as ch, type DrainMethod as ci, type DrainRequestResult as cj, type BitcoinDepositLiability as ck, type CreditDrainRecord as cl, type ChannelDrainCursor as cm, type DrainWriteOff as cn, type DrainTransitionResult as co, type DrainReleaseResult as cp, type DrainFulfilment as cq, HostingCleanupFence as cr, CLIENT_COMPATIBILITY_HEADERS as cs, type ClientCompatibility as ct, type ClientCompatibilityEnv as cu, type ClientCompatibilityGate as cv, type ClientCompatibilityRequirement as cw, type ClientSemVer as cx, type CreditFundingBasis as cy, type CreditInvoiceStatus as cz, type CanonicalEnvelope as d, clientCompatibilityAttributes as d0, clientCompatibilityMiddleware as d1, clientUpgradeRequired as d2, parseClientCapabilities as d3, parseClientCompatibility as d4, parseDvmClient as d5, parseProtocolVersion as d6, requireClientCompatibility as d7, retryHostedTempoCloseReport as d8, secp256k1Auth as d9, signedRequestInput as da, writeOffHostedTempoCloseReport as db, type HostedIntent as dc, type X402SettlementIntent as dd, type HostedFundingReservation as de, type X402SettlementCursor as df, type X402SettlementWriteOff as dg, type X402FacilitatorAuth as dh, type X402BatchSettlementConfig as di, type X402PayoutObserver as dj, type CreditDepositEnqueue as dk, type X402SettlementReconciliationReason as dl, type CreditDrawReleaseEnqueue as dm, type CapabilityRate as e, type CashuConfig as f, type CreateSignedRequestVerifierOpts as g, type CreditConfig as h, type CreditView as i, DEFAULT_CREDIT_MAX as j, DEFAULT_CREDIT_MIN as k, DEFAULT_CREDIT_TTL_SECONDS as l, DEFAULT_JOB_RETENTION_DAYS as m, type DVMRouteContext as n, type InputType as o, InvalidCurrencyError as p, type PaymentMethod as q, type PriceValue as r, type ProgressContent as s, type PromptOpts as t, type QuoteContext as u, type QuoteResult as v, type ResolvedCreditConfig as w, type ResponseContent as x, type SDKPaymentRequestOpts as y, SIGNED_REQUEST_AUTH_ID as z };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  PostgresTempoSessionStore,
3
3
  assertMonotonicTransition
4
- } from "./chunk-ORBWKYDE.js";
4
+ } from "./chunk-JQ2Z3MIC.js";
5
5
  import "./chunk-YG7G4DPZ.js";
6
6
  import "./chunk-COYKJRMM.js";
7
- import "./chunk-EIDRCGTY.js";
7
+ import "./chunk-IKMRT7O5.js";
8
8
  import "./chunk-ALTE7I6C.js";
9
9
  export {
10
10
  PostgresTempoSessionStore,
@@ -1,6 +1,6 @@
1
- import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-B_hOQS36.js';
2
- import { a2 as JobReceipt, a7 as Message, a3 as MessageType, K as KVStore, L as Logger, v as ResponseContent, P as PaymentContent, S as SDKJobContext } from '../step-cache-Bezn-_ZL.js';
3
- import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters } from '../job-store-CgXT79tS.js';
1
+ import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-Cxn-umvR.js';
2
+ import { a4 as JobReceipt, a9 as Message, a5 as MessageType, K as KVStore, L as Logger, x as ResponseContent, P as PaymentContent, S as SDKJobContext } from '../step-cache-B_18RAPb.js';
3
+ import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters } from '../job-store-Ci2ihiVr.js';
4
4
  import 'hono';
5
5
  import 'mppx';
6
6
  import '@x402/core/server';
@@ -1,4 +1,4 @@
1
- import { C as Currency } from './step-cache-Bezn-_ZL.js';
1
+ import { C as Currency } from './step-cache-B_18RAPb.js';
2
2
 
3
3
  /**
4
4
  * Thrown by `fiatToSatsCeil` / `satsToFiat` when the supplied `ratePerBtc` is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvmkit/sdk",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "description": "SDK for building Digital Vending Machines: pay-per-use HTTPS services AI agents can find, pay, and call with no account or API key",
5
5
  "author": "DVM Technologies Ltd",
6
6
  "keywords": [