@dvmkit/sdk 0.8.0 → 0.8.1

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 (52) hide show
  1. package/dist/{chunk-5CQKSLAU.js → chunk-2U6LAASN.js} +1 -1
  2. package/dist/{chunk-6FEHRZO7.js → chunk-7PM4R4GD.js} +1 -1
  3. package/dist/{chunk-EBCLWOKF.js → chunk-AGE5XZKE.js} +1 -1
  4. package/dist/{chunk-2I3OHMTY.js → chunk-ALWVJ2RB.js} +1 -1
  5. package/dist/{chunk-ATXDKX6F.js → chunk-AVV5SYGO.js} +1 -1
  6. package/dist/{chunk-DZQYQN2X.js → chunk-BFGQG4WY.js} +7 -0
  7. package/dist/{chunk-VYP6ADCS.js → chunk-FM6QAGJC.js} +2 -2
  8. package/dist/{chunk-QPXI7YPH.js → chunk-G3MPHW5I.js} +1 -1
  9. package/dist/{chunk-I6PHA54S.js → chunk-IHQUBATH.js} +1 -1
  10. package/dist/{chunk-5K5E6ME6.js → chunk-ILBSZMJL.js} +1 -1
  11. package/dist/{chunk-BL6LRWXD.js → chunk-IOQIXRGM.js} +1 -1
  12. package/dist/{chunk-X3JEME6P.js → chunk-J5J63WDC.js} +1 -1
  13. package/dist/{chunk-GSPV3UIM.js → chunk-JIZ4ZIXX.js} +254 -72
  14. package/dist/{chunk-TFYY5APM.js → chunk-NA2KOR6G.js} +1 -1
  15. package/dist/{chunk-PRSKC7AD.js → chunk-NU5RWJ5B.js} +1 -1
  16. package/dist/{chunk-IFWUWHTW.js → chunk-OP7VCGQR.js} +1 -1
  17. package/dist/{chunk-GB5XPAA5.js → chunk-QKE5NDPF.js} +213 -38
  18. package/dist/{chunk-55NKZQOC.js → chunk-RSNC5T6C.js} +1 -1
  19. package/dist/{chunk-XXLUIXPO.js → chunk-UDJNZ3UG.js} +1 -1
  20. package/dist/{chunk-YPSJU3OH.js → chunk-UVS7MRJX.js} +2 -2
  21. package/dist/{chunk-P5WEZXJ2.js → chunk-UWGBI5WK.js} +58 -1
  22. package/dist/{chunk-RTFBVXCN.js → chunk-ZEPJF4JC.js} +1 -1
  23. package/dist/{content-retention-D2K4MKNO.d.ts → content-retention-B7ddtJ2y.d.ts} +1 -1
  24. package/dist/{credit-ledger-AOU6S34N.js → credit-ledger-KIQIE6I6.js} +3 -3
  25. package/dist/{credit-menu-C-8g2cHT.d.ts → credit-menu-BH3g9GQa.d.ts} +4 -4
  26. package/dist/{fx-Ql4nvdbh.d.ts → fx-DN26_J7o.d.ts} +1 -1
  27. package/dist/index.d.ts +5 -5
  28. package/dist/index.js +4 -4
  29. package/dist/internal/caller.d.ts +6 -6
  30. package/dist/internal/caller.js +7 -7
  31. package/dist/internal/server.d.ts +7 -7
  32. package/dist/internal/server.js +20 -20
  33. package/dist/{job-store-DCvJQUX0.d.ts → job-store-Cq21JT37.d.ts} +1 -1
  34. package/dist/{lightning-backend-CY5ML3km.d.ts → lightning-backend-S8F8nf8q.d.ts} +1 -1
  35. package/dist/{memory-credit-ledger-4HWYINKJ.js → memory-credit-ledger-ATYFAYBG.js} +4 -4
  36. package/dist/{mpp-setup-2BKTPEK6.js → mpp-setup-ZTORW3VF.js} +3 -3
  37. package/dist/{payout-reporter-HQSIIBFL.js → payout-reporter-NN6K2IVQ.js} +2 -2
  38. package/dist/{postgres-consumed-credential-store-R7DNU6CM.js → postgres-consumed-credential-store-XJTE5PCA.js} +1 -1
  39. package/dist/{postgres-job-store-6VGFL6XE.js → postgres-job-store-AR6ZJUQV.js} +2 -2
  40. package/dist/{postgres-replay-store-SY26NUCI.js → postgres-replay-store-33K33QV7.js} +2 -2
  41. package/dist/{pricing-H2RA4X2R.js → pricing-G5IN5YJE.js} +3 -3
  42. package/dist/{revenue-reporter-X52GPZ5U.js → revenue-reporter-KDUZLD5F.js} +2 -2
  43. package/dist/server/index.d.ts +10 -10
  44. package/dist/server/index.js +27 -27
  45. package/dist/{step-cache-BOWAn_BH.d.ts → step-cache-CR12EZ1Q.d.ts} +108 -4
  46. package/dist/{tempo-charge-store-NKXJ2AXE.js → tempo-charge-store-XEGJYM3G.js} +2 -2
  47. package/dist/{tempo-session-store-ZSDQIWSU.js → tempo-session-store-3WTDOO7H.js} +3 -3
  48. package/dist/testing/index.d.ts +3 -3
  49. package/dist/testing/index.js +6 -6
  50. package/dist/{usd-MAtMp3DB.d.ts → usd-s_VZ_eS7.d.ts} +1 -1
  51. package/dist/{x402-Q4S36NHQ.js → x402-HQ5GRQZU.js} +3 -3
  52. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-DZQYQN2X.js";
3
+ } from "./chunk-BFGQG4WY.js";
4
4
  import {
5
5
  withSdkInitLock
6
6
  } from "./chunk-COYKJRMM.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  emitDiagnostic,
3
3
  projectDiagnosticFields
4
- } from "./chunk-DZQYQN2X.js";
4
+ } from "./chunk-BFGQG4WY.js";
5
5
 
6
6
  // src/sdk/logger.ts
7
7
  function createConsoleLogger(_jobId) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  loggers
3
- } from "./chunk-BL6LRWXD.js";
3
+ } from "./chunk-IOQIXRGM.js";
4
4
  import {
5
5
  diagnosticConsole
6
- } from "./chunk-DZQYQN2X.js";
6
+ } from "./chunk-BFGQG4WY.js";
7
7
 
8
8
  // src/sdk/server/mpp-setup.ts
9
9
  import { createHash, randomUUID } from "crypto";
@@ -557,7 +557,7 @@ function buildMppMethods(opts, env) {
557
557
  chainId: opts.tempoSession.chainId ?? chainId,
558
558
  ...opts.tempoSession.getClient && { getClient: opts.tempoSession.getClient },
559
559
  ...opts.tempoSession.onSessionSettlement && {
560
- onSessionSettlement: opts.tempoSession.onSessionSettlement
560
+ onSessionSettlement: claimingCloseSettlement(opts.tempoSession)
561
561
  }
562
562
  })
563
563
  ));
@@ -566,6 +566,29 @@ function buildMppMethods(opts, env) {
566
566
  if (methods.length === 0 || !tempoConfiguration) return void 0;
567
567
  return { methods, tempoConfiguration };
568
568
  }
569
+ function claimingCloseSettlement(session) {
570
+ const callback = session.onSessionSettlement;
571
+ const store = session.store;
572
+ if (session.hostedObligations || !store.getClose || !store.claimCloseReference) return callback;
573
+ return async (context) => {
574
+ if (context.trigger === "close") {
575
+ const intent = await store.getClose(context.channelId);
576
+ if (intent) {
577
+ let claimed = true;
578
+ try {
579
+ claimed = (await store.claimCloseReference(
580
+ context.channelId,
581
+ intent.drainId,
582
+ context.txHash
583
+ )).claimed;
584
+ } catch {
585
+ }
586
+ if (!claimed) return;
587
+ }
588
+ }
589
+ await callback(context);
590
+ };
591
+ }
569
592
  function withAuthenticationOnlyValidation(method) {
570
593
  if (method.validate) return method;
571
594
  const validate = async ({ credential, request }) => ({
@@ -641,30 +664,55 @@ var DEFAULT_TEMPO_SESSION_CHAIN_OPS = {
641
664
  channelId
642
665
  )
643
666
  ),
644
- findChannelClose: async (client, channelId, escrowContract, notBeforeMs) => {
645
- const { getBlock, getBlockNumber, getLogs } = await import("viem/actions");
646
- const event = TempoSession.Precompile.escrowAbi.find(
647
- (item) => item.type === "event" && item.name === "ChannelClosed"
648
- );
649
- if (!event || event.type !== "event") throw new Error("Tempo escrow ABI has no ChannelClosed event");
650
- let toBlock = await getBlockNumber(client);
667
+ findChannelClose: async (client, channelId, escrowContract, notBeforeMs, startBlock) => {
668
+ const { getBlock, getBlockNumber, getLogs, getTransaction } = await import("viem/actions");
669
+ const eventNamed = (name) => {
670
+ const event = TempoSession.Precompile.escrowAbi.find(
671
+ (item) => item.type === "event" && item.name === name
672
+ );
673
+ if (!event || event.type !== "event") throw new Error(`Tempo escrow ABI has no ${name} event`);
674
+ return event;
675
+ };
676
+ const closedEvent = eventNamed("ChannelClosed");
677
+ const requestedEvent = eventNamed("CloseRequested");
678
+ const cancelledEvent = eventNamed("CloseRequestCancelled");
679
+ const beforeBound = async (blockNumber) => Number((await getBlock(client, { blockNumber })).timestamp) * 1e3 < notBeforeMs - TEMPO_CLOSE_LOG_SLACK_MS;
680
+ if (startBlock !== void 0 && await beforeBound(startBlock)) {
681
+ return { outcome: "none", stoppedAt: startBlock };
682
+ }
683
+ let toBlock = startBlock ?? await getBlockNumber(client);
651
684
  for (let window = 0; window < TEMPO_CLOSE_LOG_MAX_WINDOWS; window += 1) {
652
685
  const fromBlock = toBlock >= TEMPO_CLOSE_LOG_WINDOW ? toBlock - TEMPO_CLOSE_LOG_WINDOW + 1n : 0n;
653
- const logs = await getLogs(client, {
654
- address: escrowContract,
655
- event,
656
- args: { channelId },
657
- fromBlock,
658
- toBlock
659
- });
660
- const closed = logs.find((log) => log.transactionHash);
661
- if (closed?.transactionHash) return closed.transactionHash;
662
- if (fromBlock === 0n) return null;
663
- const start = await getBlock(client, { blockNumber: fromBlock });
664
- if (Number(start.timestamp) * 1e3 < notBeforeMs - TEMPO_CLOSE_LOG_SLACK_MS) return null;
686
+ const range = { address: escrowContract, args: { channelId }, fromBlock, toBlock };
687
+ const [closed, requested, cancelled] = await Promise.all([
688
+ getLogs(client, { ...range, event: closedEvent }),
689
+ getLogs(client, { ...range, event: requestedEvent }),
690
+ getLogs(client, { ...range, event: cancelledEvent })
691
+ ]);
692
+ const newest = [
693
+ ...closed.map((log) => ({ log, kind: "closed" })),
694
+ ...requested.map((log) => ({ log, kind: "requested" })),
695
+ ...cancelled.map((log) => ({ log, kind: "cancelled" }))
696
+ ].filter(({ log }) => log.transactionHash && log.blockNumber !== null).sort((left, right) => left.log.blockNumber === right.log.blockNumber ? Number(right.log.logIndex ?? 0) - Number(left.log.logIndex ?? 0) : right.log.blockNumber > left.log.blockNumber ? 1 : -1)[0];
697
+ if (newest?.kind === "closed") {
698
+ const transaction = await getTransaction(client, {
699
+ hash: newest.log.transactionHash
700
+ });
701
+ return { outcome: "closed", txHash: newest.log.transactionHash, sender: transaction.from };
702
+ }
703
+ if (newest?.kind === "requested") {
704
+ const graceEnd = newest.log.args.closeGraceEnd;
705
+ const head = await getBlock(client, { blockTag: "latest" });
706
+ if (graceEnd === void 0 || head.timestamp < graceEnd) return { outcome: "none" };
707
+ return { outcome: "exit_requested" };
708
+ }
709
+ if (newest) return { outcome: "none", stoppedAt: 0n };
710
+ if (fromBlock === 0n || await beforeBound(fromBlock)) {
711
+ return { outcome: "none", stoppedAt: fromBlock };
712
+ }
665
713
  toBlock = fromBlock - 1n;
666
714
  }
667
- throw new Error(`Tempo close search for channel ${channelId} exceeded its block budget`);
715
+ return { outcome: "paused", resumeAt: toBlock };
668
716
  }
669
717
  };
670
718
  function attachTempoSessionRuntime(mppx, config, chainOpOverrides = {}) {
@@ -1103,6 +1151,7 @@ function attachTempoSessionRuntime(mppx, config, chainOpOverrides = {}) {
1103
1151
  }
1104
1152
  }
1105
1153
  }
1154
+ await reconcileUnsubmittedCloses();
1106
1155
  return { scanned: rows.length, closeRequested, settled, inFlight };
1107
1156
  };
1108
1157
  const recoverTempoSessionClose = async (channelId, drainId) => {
@@ -1110,7 +1159,8 @@ function attachTempoSessionRuntime(mppx, config, chainOpOverrides = {}) {
1110
1159
  const intent = await store.getClose(channelId);
1111
1160
  if (intent?.drainId !== drainId) return null;
1112
1161
  if (intent.reference) return intent.reference;
1113
- const current = readTempoSessionState(await store.get(channelId));
1162
+ const stored = await store.get(channelId);
1163
+ const current = readTempoSessionState(stored);
1114
1164
  if (!current) throw new Error(`Tempo session channel ${channelId} not found`);
1115
1165
  let finalized = current.finalized;
1116
1166
  if (!finalized) {
@@ -1125,23 +1175,32 @@ function attachTempoSessionRuntime(mppx, config, chainOpOverrides = {}) {
1125
1175
  }
1126
1176
  if (!finalized) return null;
1127
1177
  const pending = await config.hostedObligations?.pendingTempoClose(channelId, drainId);
1178
+ const selfHostedReport = !config.hostedObligations && !!config.onSessionSettlement && !!store.claimCloseReference && !!store.getCloseRecovery;
1128
1179
  let reference = pending?.txHash ?? void 0;
1129
- if (pending && !reference) {
1130
- const client = await getClient({ chainId: current.chainId });
1131
- const txHash = await chainOps.findChannelClose(
1132
- client,
1133
- current.channelId,
1134
- current.escrowContract,
1135
- pending.reservedAtMs
1136
- );
1137
- if (txHash) {
1138
- await config.hostedObligations.recordSubmitted(pending.id, txHash);
1139
- reference = txHash;
1140
- } else {
1180
+ if (pending && !reference || selfHostedReport) {
1181
+ const recovery = await store.getCloseRecovery?.(channelId);
1182
+ const notBeforeMs = pending?.reservedAtMs ?? recovery?.updatedAtMs;
1183
+ if (notBeforeMs === void 0) throw new Error(`Tempo session close intent ${channelId} not found`);
1184
+ const obligations = config.hostedObligations;
1185
+ const found = await findFinalizedClose(current, stored, drainId, notBeforeMs, pending ? {
1186
+ from: pending.searchBefore,
1187
+ save: (resumeAt) => obligations.recordTempoCloseSearch(pending.id, resumeAt)
1188
+ } : {
1189
+ from: recovery?.searchBefore ?? null,
1190
+ save: (resumeAt) => store.recordCloseSearch?.(channelId, drainId, resumeAt)
1191
+ });
1192
+ if (pending) {
1193
+ reference = await settleUnsubmittedClose(current.channelId, drainId, pending.id, found);
1194
+ } else if (found.outcome === "ours") {
1195
+ const claimed = await store.claimCloseReference(channelId, drainId, found.txHash);
1196
+ if (claimed.claimed) {
1197
+ await reportRecoveredClose(current, found.txHash, recovery?.settledBeforeClose ?? null);
1198
+ }
1199
+ return claimed.reference;
1200
+ } else if (found.outcome === "none") {
1141
1201
  loggers.tempo.warn("tempo_session_close_recovery_unmatched", {
1142
1202
  channel_id: current.channelId,
1143
- drain_id: drainId,
1144
- obligation_id: pending.id
1203
+ drain_id: drainId
1145
1204
  });
1146
1205
  }
1147
1206
  }
@@ -1152,6 +1211,113 @@ function attachTempoSessionRuntime(mppx, config, chainOpOverrides = {}) {
1152
1211
  );
1153
1212
  return recovered.reference;
1154
1213
  };
1214
+ const findFinalizedClose = async (current, stored, drainId, notBeforeMs, cursor) => {
1215
+ const client = await getClient({ chainId: current.chainId });
1216
+ const search = await chainOps.findChannelClose(
1217
+ client,
1218
+ current.channelId,
1219
+ current.escrowContract,
1220
+ notBeforeMs,
1221
+ cursor.from ?? void 0
1222
+ );
1223
+ if (search.outcome === "paused") {
1224
+ await cursor.save(search.resumeAt);
1225
+ loggers.tempo.warn("tempo_session_close_recovery_search_paused", {
1226
+ channel_id: current.channelId,
1227
+ drain_id: drainId,
1228
+ resume_block: search.resumeAt.toString()
1229
+ });
1230
+ throw new Error(`Tempo close search for channel ${current.channelId} continues on the next poll`);
1231
+ }
1232
+ if (search.outcome === "closed") {
1233
+ return cooperativeCloseSenders(stored, config.account.address).has(search.sender.toLowerCase()) ? { outcome: "ours", txHash: search.txHash } : { outcome: "exit" };
1234
+ }
1235
+ if (search.outcome === "exit_requested") return { outcome: "exit" };
1236
+ if (search.stoppedAt !== void 0) await cursor.save(search.stoppedAt);
1237
+ return { outcome: "none" };
1238
+ };
1239
+ const settleUnsubmittedClose = async (channelId, drainId, obligationId, found) => {
1240
+ const obligations = config.hostedObligations;
1241
+ if (found.outcome === "ours") {
1242
+ await obligations.recordSubmitted(obligationId, found.txHash);
1243
+ return found.txHash;
1244
+ }
1245
+ if (found.outcome === "exit") {
1246
+ if (await obligations.resolveTempoCloseExit(obligationId)) {
1247
+ loggers.tempo.warn("tempo_session_close_exit_resolved", {
1248
+ channel_id: channelId,
1249
+ drain_id: drainId,
1250
+ obligation_id: obligationId
1251
+ });
1252
+ }
1253
+ return void 0;
1254
+ }
1255
+ loggers.tempo.warn("tempo_session_close_recovery_unmatched", {
1256
+ channel_id: channelId,
1257
+ drain_id: drainId,
1258
+ obligation_id: obligationId
1259
+ });
1260
+ return void 0;
1261
+ };
1262
+ const reconcileUnsubmittedCloses = async () => {
1263
+ const obligations = config.hostedObligations;
1264
+ if (!obligations) return;
1265
+ for (const row of await obligations.unsubmittedTempoCloses()) {
1266
+ try {
1267
+ const stored = await store.get(row.channelId);
1268
+ const current = readTempoSessionState(stored);
1269
+ if (!current) continue;
1270
+ if (!current.finalized) {
1271
+ const client = await getClient({ chainId: current.chainId });
1272
+ const [chainState] = await chainOps.getChannelStatesBatch(
1273
+ client,
1274
+ [current.channelId],
1275
+ current.escrowContract
1276
+ );
1277
+ await terminalizeLostBacking(current, chainState);
1278
+ if (!await writeBackChainState(current, chainState)) continue;
1279
+ }
1280
+ const found = await findFinalizedClose(current, stored, row.drainId, row.reservedAtMs, {
1281
+ from: row.searchBefore,
1282
+ save: (resumeAt) => obligations.recordTempoCloseSearch(row.id, resumeAt)
1283
+ });
1284
+ await settleUnsubmittedClose(current.channelId, row.drainId, row.id, found);
1285
+ } catch (error) {
1286
+ loggers.tempo.warn("tempo_session_close_reconcile_failed", {
1287
+ channel_id: row.channelId,
1288
+ drain_id: row.drainId,
1289
+ obligation_id: row.id,
1290
+ error: error instanceof Error ? error.message : String(error)
1291
+ });
1292
+ }
1293
+ }
1294
+ };
1295
+ const reportRecoveredClose = async (channel, txHash, settledBeforeClose) => {
1296
+ const client = await getClient({ chainId: channel.chainId });
1297
+ const { settledToPayee } = await chainOps.readChannelClose(client, channel.channelId, txHash);
1298
+ if (settledBeforeClose === null || settledToPayee < settledBeforeClose) {
1299
+ loggers.tempo.warn("tempo_session_close_settlement_unreported", {
1300
+ channel_id: channel.channelId,
1301
+ tx_hash: txHash
1302
+ });
1303
+ return;
1304
+ }
1305
+ try {
1306
+ await config.onSessionSettlement({
1307
+ txHash,
1308
+ channelId: channel.channelId,
1309
+ trigger: "close",
1310
+ amount: settledToPayee,
1311
+ delta: settledToPayee - settledBeforeClose
1312
+ });
1313
+ } catch (error) {
1314
+ loggers.tempo.warn("tempo_session_close_settlement_callback_failed", {
1315
+ channel_id: channel.channelId,
1316
+ tx_hash: txHash,
1317
+ error: error instanceof Error ? error.message : String(error)
1318
+ });
1319
+ }
1320
+ };
1155
1321
  const getClose = store.getClose?.bind(store) ?? (() => Promise.resolve(null));
1156
1322
  const beginClose = store.beginClose?.bind(store);
1157
1323
  const withCloseIntent = store.withCloseIntent?.bind(store);
@@ -1160,6 +1326,7 @@ function attachTempoSessionRuntime(mppx, config, chainOpOverrides = {}) {
1160
1326
  const confirmClose = store.confirmClose?.bind(store);
1161
1327
  return Object.assign(mppx, {
1162
1328
  sweepTempoSessions,
1329
+ ...config?.hostedObligations && { reconcileTempoSessionCloses: reconcileUnsubmittedCloses },
1163
1330
  ...beginClose && {
1164
1331
  beginTempoSessionClose: async (channelId, drainId) => {
1165
1332
  await beginClose(channelId, drainId);
@@ -1179,6 +1346,14 @@ function attachTempoSessionRuntime(mppx, config, chainOpOverrides = {}) {
1179
1346
  }
1180
1347
  });
1181
1348
  }
1349
+ function cooperativeCloseSenders(stored, fallback) {
1350
+ const record = stored && typeof stored === "object" ? stored : {};
1351
+ const descriptor = record.descriptor && typeof record.descriptor === "object" ? record.descriptor : {};
1352
+ const senders = new Set(
1353
+ [record.operator, record.payee, descriptor.operator, descriptor.payee].filter((value) => typeof value === "string" && HEX_ADDRESS_RE.test(value)).map((value) => value.toLowerCase())
1354
+ );
1355
+ return senders.size > 0 ? senders : /* @__PURE__ */ new Set([fallback.toLowerCase()]);
1356
+ }
1182
1357
  function readTempoSessionState(value) {
1183
1358
  if (!value || typeof value !== "object") return void 0;
1184
1359
  const state = value;
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  diagnosticConsole,
6
6
  projectSpanRow
7
- } from "./chunk-DZQYQN2X.js";
7
+ } from "./chunk-BFGQG4WY.js";
8
8
 
9
9
  // src/lib/x402/env.ts
10
10
  import { isAddress } from "viem";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  validateCurrency
3
- } from "./chunk-5CQKSLAU.js";
3
+ } from "./chunk-2U6LAASN.js";
4
4
 
5
5
  // src/sdk/pricing/upfront.ts
6
6
  function buildUpfront(input) {
@@ -2,7 +2,7 @@ import {
2
2
  createX402FacilitatorAuthHeaders,
3
3
  settleWithFacilitator,
4
4
  verifyWithFacilitator
5
- } from "./chunk-ATXDKX6F.js";
5
+ } from "./chunk-AVV5SYGO.js";
6
6
  import {
7
7
  buildPaymentRequirements,
8
8
  decodePayment,
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-66HGCPBU.js";
16
16
  import {
17
17
  diagnosticConsole
18
- } from "./chunk-DZQYQN2X.js";
18
+ } from "./chunk-BFGQG4WY.js";
19
19
 
20
20
  // src/lib/x402/verify.ts
21
21
  async function verifyX402Payment(paymentHeader, config, requiredUsdcMicro, resource, btcUsdRate, exactVersions = { v1: true, v2: true }) {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-YG7G4DPZ.js";
5
5
  import {
6
6
  withPostgresTransactionRecovery
7
- } from "./chunk-6FEHRZO7.js";
7
+ } from "./chunk-7PM4R4GD.js";
8
8
  import {
9
9
  withSdkInitLock
10
10
  } from "./chunk-COYKJRMM.js";
@@ -69,6 +69,11 @@ var PostgresTempoSessionStore = class {
69
69
  `ALTER TABLE mpp_tempo_close_intents
70
70
  ADD COLUMN IF NOT EXISTS forecast_pending BOOLEAN NOT NULL DEFAULT FALSE`
71
71
  );
72
+ await this.pool.query(
73
+ `ALTER TABLE mpp_tempo_close_intents
74
+ ADD COLUMN IF NOT EXISTS close_search_before BIGINT,
75
+ ADD COLUMN IF NOT EXISTS settled_before_close NUMERIC(78,0)`
76
+ );
72
77
  });
73
78
  }
74
79
  async get(key) {
@@ -273,6 +278,17 @@ var PostgresTempoSessionStore = class {
273
278
  if (rows[0].forecast_pending !== false) {
274
279
  throw new Error(`Tempo session drain ${drainId} refund forecast is still pending`);
275
280
  }
281
+ const channel = await tx.query(
282
+ "SELECT state_json FROM mpp_tempo_channels WHERE channel_key = $1",
283
+ [channelId.toLowerCase()]
284
+ );
285
+ const state = channel.rows[0] ? parseStoreValue(channel.rows[0].state_json) : null;
286
+ const settled = state?.settledOnChain;
287
+ await tx.query(
288
+ `UPDATE mpp_tempo_close_intents SET settled_before_close = $3
289
+ WHERE channel_id = $1 AND drain_id = $2`,
290
+ [channelId.toLowerCase(), drainId, typeof settled === "bigint" ? settled.toString() : null]
291
+ );
276
292
  return record;
277
293
  });
278
294
  }
@@ -357,6 +373,47 @@ var PostgresTempoSessionStore = class {
357
373
  if (!rows[0]) throw new Error(`Tempo session close intent not found`);
358
374
  return closeRecord(rows[0]);
359
375
  }
376
+ /** Set a close's reference only if none is set, reporting whether this call set it. */
377
+ async claimCloseReference(channelId, drainId, reference) {
378
+ const { rows } = await this.pool.query(
379
+ `UPDATE mpp_tempo_close_intents
380
+ SET reference = $3, updated_at = $4
381
+ WHERE channel_id = $1 AND drain_id = $2 AND forecast_pending = FALSE
382
+ AND reference IS NULL
383
+ RETURNING reference`,
384
+ [channelId.toLowerCase(), drainId, reference, Date.now()]
385
+ );
386
+ if (rows[0]) return { reference: rows[0].reference, claimed: true };
387
+ const current = await this.getClose(channelId);
388
+ if (current?.drainId !== drainId || current.reference === null) {
389
+ throw new Error(`Tempo session close intent not found`);
390
+ }
391
+ return { reference: current.reference, claimed: false };
392
+ }
393
+ async getCloseRecovery(channelId) {
394
+ const { rows } = await this.pool.query(
395
+ `SELECT updated_at, close_search_before, settled_before_close
396
+ FROM mpp_tempo_close_intents
397
+ WHERE channel_id = $1`,
398
+ [channelId.toLowerCase()]
399
+ );
400
+ const row = rows[0];
401
+ if (!row) return null;
402
+ return {
403
+ updatedAtMs: Number(row.updated_at),
404
+ searchBefore: row.close_search_before === null ? null : BigInt(row.close_search_before),
405
+ settledBeforeClose: row.settled_before_close === null ? null : BigInt(row.settled_before_close)
406
+ };
407
+ }
408
+ /** Record where a paused close search resumes; the cursor only moves back. */
409
+ async recordCloseSearch(channelId, drainId, resumeAt) {
410
+ await this.pool.query(
411
+ `UPDATE mpp_tempo_close_intents
412
+ SET close_search_before = LEAST(COALESCE(close_search_before, $3), $3)
413
+ WHERE channel_id = $1 AND drain_id = $2`,
414
+ [channelId.toLowerCase(), drainId, resumeAt.toString()]
415
+ );
416
+ }
360
417
  async runCloseIntentTransaction(channelId, drainId, operation) {
361
418
  return this.transaction("tempo_session.close_intent", async (client) => {
362
419
  const record = await this.writeCloseIntent(client, channelId, drainId);
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-BPYMEMQX.js";
10
10
  import {
11
11
  diagnosticConsole
12
- } from "./chunk-DZQYQN2X.js";
12
+ } from "./chunk-BFGQG4WY.js";
13
13
 
14
14
  // src/lib/cashu/lock-pubkey.ts
15
15
  function toLockPubkey(raw) {
@@ -1,4 +1,4 @@
1
- import { b as JobStore, J as JobRecord } from './job-store-DCvJQUX0.js';
1
+ import { b as JobStore, J as JobRecord } from './job-store-Cq21JT37.js';
2
2
 
3
3
  /** Authenticated caller metadata; omitted fields on older services mean unknown. */
4
4
  interface JobContentMetadata {
@@ -10,10 +10,10 @@ import {
10
10
  isDrainMethod,
11
11
  isFundingRail,
12
12
  x402SettlementPending
13
- } from "./chunk-VYP6ADCS.js";
14
- import "./chunk-6FEHRZO7.js";
13
+ } from "./chunk-FM6QAGJC.js";
14
+ import "./chunk-7PM4R4GD.js";
15
15
  import "./chunk-BPYMEMQX.js";
16
- import "./chunk-DZQYQN2X.js";
16
+ import "./chunk-BFGQG4WY.js";
17
17
  import "./chunk-COYKJRMM.js";
18
18
  export {
19
19
  CreditLedger,
@@ -1,11 +1,11 @@
1
- import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-CY5ML3km.js';
2
- import { cg as HostingCleanupFence, cW as HostedIntent, aj as FundingMethod, p as PaymentMethod, bO as CreditLedgerLike, a5 as Message, $ as FundingReceipt, bQ as CreditSnapshot, a0 as JobReceipt, S as SDKJobContext, ax as StepCache, v as ResponseContent, P as PaymentContent, a1 as MessageType, bk as X402Receipt, aF as X402Config, bj as X402ExactVersionSupport, cX as X402SettlementIntent, ab as PaymentRequirementsV2, cY as HostedFundingReservation, c3 as CreditLedgerQuerier, cZ as X402SettlementCursor, bS as X402SettlementStatus, c_ as X402SettlementWriteOff, bP as X402RefundSettlementGate, c$ as X402FacilitatorAuth, d0 as X402BatchSettlementConfig, cC as PostgresX402ChannelStorage, d1 as X402PayoutObserver, bM as HostedSettlementReportObligations, bn as CreditDepositPayload, bs as MppxServer, ae as CashuMode, d2 as CreditDepositEnqueue, d3 as X402SettlementReconciliationReason, aq as PaymentRequirements, a3 as MppxCredential, bR as DrawResult, cq as CreditLedgerError, a7 as ReceiptCredit, ag as DrainReceiptEvent, a8 as DrainReceipt, K as KVStore, z as SignedRequestAudience, d4 as CreditDrawReleaseEnqueue, cA as JobCostReportPayload, cB as JobTerminalReportPayload, cE as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, bX as CreditInvoiceRecord, bY as InvoiceSettlement, ck as ClientCompatibilityGate, ci as ClientCompatibility, bw as PostgresTempoSessionStore, bv as PayoutReporter, R as ResolvedCreditConfig, h as CreditView } from './step-cache-BOWAn_BH.js';
1
+ import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-S8F8nf8q.js';
2
+ import { cg as HostingCleanupFence, cW as HostedIntent, aj as FundingMethod, p as PaymentMethod, bO as CreditLedgerLike, a5 as Message, $ as FundingReceipt, bQ as CreditSnapshot, a0 as JobReceipt, S as SDKJobContext, ax as StepCache, v as ResponseContent, P as PaymentContent, a1 as MessageType, bk as X402Receipt, aF as X402Config, bj as X402ExactVersionSupport, cX as X402SettlementIntent, ab as PaymentRequirementsV2, cY as HostedFundingReservation, c3 as CreditLedgerQuerier, cZ as X402SettlementCursor, bS as X402SettlementStatus, c_ as X402SettlementWriteOff, bP as X402RefundSettlementGate, c$ as X402FacilitatorAuth, d0 as X402BatchSettlementConfig, cC as PostgresX402ChannelStorage, d1 as X402PayoutObserver, bM as HostedSettlementReportObligations, bn as CreditDepositPayload, bs as MppxServer, ae as CashuMode, d2 as CreditDepositEnqueue, d3 as X402SettlementReconciliationReason, aq as PaymentRequirements, a3 as MppxCredential, bR as DrawResult, cq as CreditLedgerError, a7 as ReceiptCredit, ag as DrainReceiptEvent, a8 as DrainReceipt, K as KVStore, z as SignedRequestAudience, d4 as CreditDrawReleaseEnqueue, cA as JobCostReportPayload, cB as JobTerminalReportPayload, cE as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, bX as CreditInvoiceRecord, bY as InvoiceSettlement, ck as ClientCompatibilityGate, ci as ClientCompatibility, bw as PostgresTempoSessionStore, bv as PayoutReporter, R as ResolvedCreditConfig, h as CreditView } from './step-cache-CR12EZ1Q.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-Ql4nvdbh.js';
6
+ import { d as FxSourceFailure, b as FxRateSnapshot, F as FxFetcher } from './fx-DN26_J7o.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-DCvJQUX0.js';
8
+ import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-Cq21JT37.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';
@@ -1,4 +1,4 @@
1
- import { C as Currency } from './step-cache-BOWAn_BH.js';
1
+ import { C as Currency } from './step-cache-CR12EZ1Q.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-BOWAn_BH.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 createSignedRequestVerifier, T as isZodSchema, V as signedRequestStatementHeader, W as validateCurrency } from './step-cache-BOWAn_BH.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-Ql4nvdbh.js';
4
- export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-MAtMp3DB.js';
5
- export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-DCvJQUX0.js';
1
+ import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-CR12EZ1Q.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 createSignedRequestVerifier, T as isZodSchema, V as signedRequestStatementHeader, W as validateCurrency } from './step-cache-CR12EZ1Q.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-DN26_J7o.js';
4
+ export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-s_VZ_eS7.js';
5
+ export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-Cq21JT37.js';
6
6
  export { P as PinnedFetch, S as SSRFError, a as SSRFGuardOpts, b as SSRFReason, c as SSRFResolver, d as assertSafeUrl, e as createPinnedFetch } from './ssrf-dMooihtY.js';
7
7
  export { z } from 'zod';
8
8
  import 'hono';
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  SignedRequestError,
12
12
  createSignedRequestVerifier
13
- } from "./chunk-5K5E6ME6.js";
13
+ } from "./chunk-ILBSZMJL.js";
14
14
  import {
15
15
  DEFAULT_CREDIT_MAX,
16
16
  DEFAULT_CREDIT_MIN,
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-UKD3R2KU.js";
24
24
  import {
25
25
  buildUpfront
26
- } from "./chunk-XXLUIXPO.js";
26
+ } from "./chunk-UDJNZ3UG.js";
27
27
  import {
28
28
  DEFAULT_FX_CURRENCIES,
29
29
  DEFAULT_FX_RATE_SOURCE,
@@ -41,8 +41,8 @@ import {
41
41
  roundUsd,
42
42
  satsToFiat,
43
43
  validateCurrency
44
- } from "./chunk-5CQKSLAU.js";
45
- import "./chunk-DZQYQN2X.js";
44
+ } from "./chunk-2U6LAASN.js";
45
+ import "./chunk-BFGQG4WY.js";
46
46
 
47
47
  // src/sdk/configure.ts
48
48
  function configureDVM(config) {
@@ -1,16 +1,16 @@
1
- import { L as LightningTransactionListOptions, a as LightningTransactionSnapshot, b as LightningBackend, c as LightningPayment, d as LightningWalletInfo, C as CreatedInvoice, I as InvoiceStatus } from '../lightning-backend-CY5ML3km.js';
2
- export { A as AttestationPayload, B as BuilderIdentityKeypair, e as CheckMintHealthOptions, f as LockPubkey, M as MintAmountBounds, g as MintHealthCheckResult, h as amountBoundsVerdict, i as assertNutSupport, j as buildAttestation, k as canSwap, l as checkMintHealth, m as generateIdentity, n as hashCapabilities, o as loadIdentitySecret, p as meltAmountBounds, s as signAttestation, t as toLockPubkey, v as verifyAttestation, w as writeIdentity } from '../lightning-backend-CY5ML3km.js';
1
+ import { L as LightningTransactionListOptions, a as LightningTransactionSnapshot, b as LightningBackend, c as LightningPayment, d as LightningWalletInfo, C as CreatedInvoice, I as InvoiceStatus } from '../lightning-backend-S8F8nf8q.js';
2
+ export { A as AttestationPayload, B as BuilderIdentityKeypair, e as CheckMintHealthOptions, f as LockPubkey, M as MintAmountBounds, g as MintHealthCheckResult, h as amountBoundsVerdict, i as assertNutSupport, j as buildAttestation, k as canSwap, l as checkMintHealth, m as generateIdentity, n as hashCapabilities, o as loadIdentitySecret, p as meltAmountBounds, s as signAttestation, t as toLockPubkey, v as verifyAttestation, w as writeIdentity } from '../lightning-backend-S8F8nf8q.js';
3
3
  import { ProofLike, MeltQuoteBolt11Response, Proof, Wallet, MintQuoteBolt11Response, MintPreview, CounterSource, CounterRange, SerializedDLEQ, OutputData, OutputDataLike } from '@cashu/cashu-ts';
4
4
  export { g as getWallet } from '../wallet-Dwjs5n_M.js';
5
- import { X as JsonValue, B as SignedRequestDomain, M as SignedRequestStatementHeader, Y as X402_BATCH_SETTLEMENT_SCHEME, _ as X402_EXACT_SCHEME, $ as FundingReceipt, a0 as JobReceipt$1, a1 as MessageType, a2 as X402Version, a3 as MppxCredential, z as SignedRequestAudience, a4 as PaymentRequired, a5 as Message, a6 as MppxChallenge, a7 as ReceiptCredit, a8 as DrainReceipt, C as Currency, a9 as X402Wallet, aa as PaymentRequirementsV1, ab as PaymentRequirementsV2, L as Logger$1, K as KVStore } from '../step-cache-BOWAn_BH.js';
6
- export { ac as BuildPaymentRequirementsOpts, ad as CapabilityDescriptor, ae as CashuMode, af as CompleteContent, ag as DrainReceiptEvent, ah as ExactEvmPayload, ai as ExactEvmPayloadAuthorization, aj as FundingMethod, ak as MessageFrom, al as PaymentPayload, am as PaymentPayloadV1, an as PaymentPayloadV2, ao as PaymentRequestContent, ap as PaymentRequiredV2, aq as PaymentRequirements, ar as PromptContent, as as RAIL_REFUNDABLE, at as ReceiptOutcome, au as ReceiptPayment, av as ResourceInfo, aw as SettleResponse, ax as StepCache, ay as StepRecord, az as TextContent, aA as UnsignedDrainReceipt, aB as UnsignedFundingReceipt, aC as UnsignedJobReceipt, aD as VerifyResponse, aE as WorkingContent, aF as X402Config, aG as X402ResponseBody, aH as X402SelfRelayRpcFailureReason, aI as X402_DEFAULT_NETWORK, aJ as X402_V1_VERSION, aK as X402_VERSION, aL as buildPaymentRequiredV2, aM as buildPaymentRequirements, aN as caip2ToX402Network, aO as canonicalRequestPath, aP as canonicaliseForSigning, aQ as canonicalize, aR as chainIdFromCaip2, aS as computeResultHash, aT as decodePayment, aU as decodePaymentRequiredHeader, aV as encodePayment, aW as encodePaymentRequiredHeader, aX as encodeSettleResponseHeader, aY as exactEvmAuthorization, aZ as isArtifactMessage, a_ as isCancelMessage, a$ as isCompleteMessage, b0 as isDrainReceipt, b1 as isFundingReceipt, b2 as isPaymentRequestMessage, b3 as isPromptMessage, b4 as isSignedJobReceipt, b5 as isTextMessage, b6 as isWorkingMessage, b7 as paymentRequiredV2FromV1, b8 as signDrainReceipt, b9 as signFundingReceipt, ba as signReceipt, bb as usdcContractByCaip2, bc as usdcContractFor, bd as usdcDomainNameFor, be as usdcDomainVersionFor, bf as verifyDrainReceipt, bg as verifyFundingReceipt, bh as verifyReceipt, bi as x402NetworkToCaip2 } from '../step-cache-BOWAn_BH.js';
5
+ import { X as JsonValue, B as SignedRequestDomain, M as SignedRequestStatementHeader, Y as X402_BATCH_SETTLEMENT_SCHEME, _ as X402_EXACT_SCHEME, $ as FundingReceipt, a0 as JobReceipt$1, a1 as MessageType, a2 as X402Version, a3 as MppxCredential, z as SignedRequestAudience, a4 as PaymentRequired, a5 as Message, a6 as MppxChallenge, a7 as ReceiptCredit, a8 as DrainReceipt, C as Currency, a9 as X402Wallet, aa as PaymentRequirementsV1, ab as PaymentRequirementsV2, L as Logger$1, K as KVStore } from '../step-cache-CR12EZ1Q.js';
6
+ export { ac as BuildPaymentRequirementsOpts, ad as CapabilityDescriptor, ae as CashuMode, af as CompleteContent, ag as DrainReceiptEvent, ah as ExactEvmPayload, ai as ExactEvmPayloadAuthorization, aj as FundingMethod, ak as MessageFrom, al as PaymentPayload, am as PaymentPayloadV1, an as PaymentPayloadV2, ao as PaymentRequestContent, ap as PaymentRequiredV2, aq as PaymentRequirements, ar as PromptContent, as as RAIL_REFUNDABLE, at as ReceiptOutcome, au as ReceiptPayment, av as ResourceInfo, aw as SettleResponse, ax as StepCache, ay as StepRecord, az as TextContent, aA as UnsignedDrainReceipt, aB as UnsignedFundingReceipt, aC as UnsignedJobReceipt, aD as VerifyResponse, aE as WorkingContent, aF as X402Config, aG as X402ResponseBody, aH as X402SelfRelayRpcFailureReason, aI as X402_DEFAULT_NETWORK, aJ as X402_V1_VERSION, aK as X402_VERSION, aL as buildPaymentRequiredV2, aM as buildPaymentRequirements, aN as caip2ToX402Network, aO as canonicalRequestPath, aP as canonicaliseForSigning, aQ as canonicalize, aR as chainIdFromCaip2, aS as computeResultHash, aT as decodePayment, aU as decodePaymentRequiredHeader, aV as encodePayment, aW as encodePaymentRequiredHeader, aX as encodeSettleResponseHeader, aY as exactEvmAuthorization, aZ as isArtifactMessage, a_ as isCancelMessage, a$ as isCompleteMessage, b0 as isDrainReceipt, b1 as isFundingReceipt, b2 as isPaymentRequestMessage, b3 as isPromptMessage, b4 as isSignedJobReceipt, b5 as isTextMessage, b6 as isWorkingMessage, b7 as paymentRequiredV2FromV1, b8 as signDrainReceipt, b9 as signFundingReceipt, ba as signReceipt, bb as usdcContractByCaip2, bc as usdcContractFor, bd as usdcDomainNameFor, be as usdcDomainVersionFor, bf as verifyDrainReceipt, bg as verifyFundingReceipt, bh as verifyReceipt, bi as x402NetworkToCaip2 } from '../step-cache-CR12EZ1Q.js';
7
7
  import { SimplePool } from 'nostr-tools/pool';
8
8
  import { Session } from 'mppx/tempo';
9
9
  import { Pool } from 'pg';
10
10
  import { PaymentRequired as PaymentRequired$1 } from '@x402/core/types';
11
11
  import { ClientChannelStorage, BatchSettlementClientContext, BatchSettlementEvmScheme } from '@x402/evm/batch-settlement/client';
12
- export { h as FX_CACHE_TTL_MS, i as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-Ql4nvdbh.js';
13
- export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-MAtMp3DB.js';
12
+ export { h as FX_CACHE_TTL_MS, i as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-DN26_J7o.js';
13
+ export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-s_VZ_eS7.js';
14
14
  import 'hono';
15
15
  import 'mppx';
16
16
  import '@x402/core/server';