@dvmkit/sdk 0.7.0-rc.4 → 0.7.0-rc.6

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 (51) hide show
  1. package/dist/{chunk-ARGYJ7SB.js → chunk-3VFEX2Y3.js} +35 -4
  2. package/dist/{chunk-CYTV76CG.js → chunk-6RYCZLCK.js} +1 -1
  3. package/dist/{chunk-3CNYUUD7.js → chunk-BDHJVTWA.js} +1 -1
  4. package/dist/{chunk-UEYUFBSV.js → chunk-BIZR5ORK.js} +2 -2
  5. package/dist/{chunk-O3JEEW5V.js → chunk-BQP3LU2O.js} +1 -1
  6. package/dist/{chunk-5WOKIGLM.js → chunk-CBKQK2KI.js} +30 -26
  7. package/dist/{chunk-AE2ITUMA.js → chunk-FOJKZ4E7.js} +1 -1
  8. package/dist/{chunk-WIQLTSJY.js → chunk-FXDQMJQ2.js} +18 -0
  9. package/dist/{chunk-76W5MYFF.js → chunk-GDCIHJAR.js} +1 -1
  10. package/dist/{chunk-LZHBNR5C.js → chunk-HG2CZPRJ.js} +1 -1
  11. package/dist/{chunk-RBCHIOVB.js → chunk-JUEEUV5X.js} +1 -1
  12. package/dist/{chunk-C6YFACIM.js → chunk-KYCLHWKO.js} +1 -1
  13. package/dist/{chunk-XYLF33BJ.js → chunk-LQQ6H4UB.js} +1 -1
  14. package/dist/{chunk-H2XKINRX.js → chunk-MYJOV4R4.js} +1 -1
  15. package/dist/{chunk-MU3UX5M4.js → chunk-NUPEAWRM.js} +1 -1
  16. package/dist/{chunk-DY2MIZ6E.js → chunk-QTH7CIA3.js} +1 -1
  17. package/dist/{chunk-KIPJRLGP.js → chunk-SX4WCPW7.js} +1 -1
  18. package/dist/{chunk-EN7VI7T5.js → chunk-WP7UX6RF.js} +2 -2
  19. package/dist/{chunk-QFRU6W34.js → chunk-X5RY2G3C.js} +1 -1
  20. package/dist/{chunk-WNX22IND.js → chunk-XEOTTFLH.js} +1 -1
  21. package/dist/{chunk-MCIIDEXH.js → chunk-YK54BJ2L.js} +1 -1
  22. package/dist/{content-retention-ChFSSVO0.d.ts → content-retention-BL3uao3h.d.ts} +1 -1
  23. package/dist/{credit-ledger-4ZIL7IX2.js → credit-ledger-SW4BGMNH.js} +3 -3
  24. package/dist/{credit-menu-D7lF-100.d.ts → credit-menu-DvV-IX3P.d.ts} +7 -4
  25. package/dist/{fx-4TFUkedZ.d.ts → fx-DmuqWgL-.d.ts} +1 -1
  26. package/dist/index.d.ts +5 -5
  27. package/dist/index.js +4 -4
  28. package/dist/internal/caller.d.ts +6 -6
  29. package/dist/internal/caller.js +6 -6
  30. package/dist/internal/server.d.ts +7 -7
  31. package/dist/internal/server.js +21 -21
  32. package/dist/{job-store-DkfNE9sv.d.ts → job-store-CopBPkne.d.ts} +1 -1
  33. package/dist/{lightning-backend-C3Gf1XpP.d.ts → lightning-backend-IYYVkad1.d.ts} +1 -1
  34. package/dist/{memory-credit-ledger-HCECP6R7.js → memory-credit-ledger-E4C3VQE4.js} +4 -4
  35. package/dist/{mpp-setup-OL22TIDP.js → mpp-setup-BYKGEYFA.js} +2 -2
  36. package/dist/{payout-reporter-WSLDLMKK.js → payout-reporter-3UVWPGMO.js} +6 -4
  37. package/dist/{postgres-consumed-credential-store-7ONNOW37.js → postgres-consumed-credential-store-EZ4KETWH.js} +1 -1
  38. package/dist/{postgres-job-store-36GJGQMB.js → postgres-job-store-E6AUHNKB.js} +2 -2
  39. package/dist/{postgres-replay-store-JJ6XPVIU.js → postgres-replay-store-GIYZS4LJ.js} +2 -2
  40. package/dist/{pricing-FM6WVLCR.js → pricing-DG5IJ5QF.js} +3 -3
  41. package/dist/{revenue-reporter-CAWZMYQK.js → revenue-reporter-E56J3NZK.js} +2 -2
  42. package/dist/server/index.d.ts +10 -10
  43. package/dist/server/index.js +26 -25
  44. package/dist/{step-cache-DDTwd4SK.d.ts → step-cache-MUyQVNFX.d.ts} +17 -1
  45. package/dist/{tempo-charge-store-MVZH6CEB.js → tempo-charge-store-WTBIX2JX.js} +2 -2
  46. package/dist/{tempo-session-store-CCCG4HL7.js → tempo-session-store-AWIFUAA6.js} +3 -3
  47. package/dist/testing/index.d.ts +3 -3
  48. package/dist/testing/index.js +5 -5
  49. package/dist/{usd-DkRy9nfU.d.ts → usd-Bpt6Pmr3.d.ts} +1 -1
  50. package/dist/{x402-RHVRGUUI.js → x402-BN26TQZ6.js} +3 -3
  51. package/package.json +1 -1
@@ -1,12 +1,24 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-WIQLTSJY.js";
3
+ } from "./chunk-FXDQMJQ2.js";
4
4
  import {
5
5
  withSdkInitLock
6
6
  } from "./chunk-COYKJRMM.js";
7
7
 
8
8
  // src/sdk/server/payout-reporter.ts
9
9
  import { createHash, randomUUID } from "crypto";
10
+ async function x402EarnedCeiling(channel, earnedNative) {
11
+ let earned;
12
+ try {
13
+ earned = await earnedNative(channel.channelId.toLowerCase());
14
+ } catch (error) {
15
+ return { kind: "unresolved", error };
16
+ }
17
+ if (earned === void 0) return { kind: "unbound" };
18
+ const charged = BigInt(channel.chargedCumulativeAmount);
19
+ const wanted = BigInt(earned);
20
+ return { kind: "ceiling", ceiling: wanted < charged ? wanted : charged };
21
+ }
10
22
  var MemoryX402BatchStore = class {
11
23
  batches = /* @__PURE__ */ new Map();
12
24
  get(scope) {
@@ -719,7 +731,8 @@ var PayoutReporter = class {
719
731
  }
720
732
  /**
721
733
  * x402: the open batch (claimed, not yet transferred) plus every channel's
722
- * unclaimed voucher value; wedged when the settle keeps failing, and the
734
+ * earned value not yet claimed — a channel whose earned figure cannot be
735
+ * read contributes nothing; wedged when the settle keeps failing, and the
723
736
  * refund settlements stuck between chain and ledger beside it.
724
737
  */
725
738
  async snapshotX402() {
@@ -751,12 +764,29 @@ var PayoutReporter = class {
751
764
  }
752
765
  const unclaimed = [];
753
766
  for (const channel of await ctx.storage.list()) {
754
- const owed = BigInt(channel.chargedCumulativeAmount) - BigInt(channel.totalClaimed);
767
+ const claimed = BigInt(channel.totalClaimed);
768
+ if (BigInt(channel.chargedCumulativeAmount) <= claimed) continue;
769
+ let resolved;
770
+ try {
771
+ resolved = await x402EarnedCeiling(channel, ctx.earnedNative);
772
+ } catch (err) {
773
+ resolved = { kind: "unresolved", error: err };
774
+ }
775
+ if (resolved.kind === "unresolved") {
776
+ warn("payout_pending_snapshot_failed", {
777
+ rail: "x402",
778
+ "channel.id": channel.channelId,
779
+ error: message(resolved.error)
780
+ });
781
+ continue;
782
+ }
783
+ if (resolved.kind === "unbound") continue;
784
+ const owed = resolved.ceiling - claimed;
755
785
  if (owed > 0n) {
756
786
  unclaimed.push({
757
787
  id: channel.channelId,
758
788
  native: Number(owed),
759
- label: "unclaimed vouchers"
789
+ label: "earned, awaiting claim"
760
790
  });
761
791
  }
762
792
  }
@@ -902,6 +932,7 @@ function warn(level, fields) {
902
932
  }
903
933
 
904
934
  export {
935
+ x402EarnedCeiling,
905
936
  MemoryX402BatchStore,
906
937
  PostgresX402BatchStore,
907
938
  PAYOUT_SNAPSHOT_INTERVAL_MS,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-WIQLTSJY.js";
3
+ } from "./chunk-FXDQMJQ2.js";
4
4
 
5
5
  // src/lib/pg-retry.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  diagnosticConsole,
6
6
  projectSpanRow
7
- } from "./chunk-WIQLTSJY.js";
7
+ } from "./chunk-FXDQMJQ2.js";
8
8
 
9
9
  // src/lib/x402/env.ts
10
10
  import { isAddress } from "viem";
@@ -2,7 +2,7 @@ import {
2
2
  createX402FacilitatorAuthHeaders,
3
3
  settleWithFacilitator,
4
4
  verifyWithFacilitator
5
- } from "./chunk-WNX22IND.js";
5
+ } from "./chunk-XEOTTFLH.js";
6
6
  import {
7
7
  buildPaymentRequirements,
8
8
  decodePayment,
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-KXWROQGK.js";
16
16
  import {
17
17
  diagnosticConsole
18
- } from "./chunk-WIQLTSJY.js";
18
+ } from "./chunk-FXDQMJQ2.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
  diagnosticConsole
7
- } from "./chunk-WIQLTSJY.js";
7
+ } from "./chunk-FXDQMJQ2.js";
8
8
  import {
9
9
  withSdkInitLock
10
10
  } from "./chunk-COYKJRMM.js";
@@ -7,7 +7,10 @@ import {
7
7
  installHostedTempoCloseGuard,
8
8
  isTempoInsufficientFundsError,
9
9
  resolveTempoNetwork
10
- } from "./chunk-C6YFACIM.js";
10
+ } from "./chunk-KYCLHWKO.js";
11
+ import {
12
+ x402EarnedCeiling
13
+ } from "./chunk-3VFEX2Y3.js";
11
14
  import {
12
15
  createX402FacilitatorAuthHeaders,
13
16
  createX402FacilitatorClient,
@@ -16,13 +19,13 @@ import {
16
19
  verifyWithFacilitator,
17
20
  withPaymentDiagnostics,
18
21
  withPaymentStage
19
- } from "./chunk-WNX22IND.js";
22
+ } from "./chunk-XEOTTFLH.js";
20
23
  import {
21
24
  MemoryCreditLedger
22
- } from "./chunk-AE2ITUMA.js";
25
+ } from "./chunk-FOJKZ4E7.js";
23
26
  import {
24
27
  PostgresJobStore
25
- } from "./chunk-RBCHIOVB.js";
28
+ } from "./chunk-JUEEUV5X.js";
26
29
  import {
27
30
  parseStoreValue
28
31
  } from "./chunk-YG7G4DPZ.js";
@@ -33,7 +36,7 @@ import {
33
36
  humanizeZodIssues,
34
37
  signedRequestInput,
35
38
  zodIssuesOf
36
- } from "./chunk-QFRU6W34.js";
39
+ } from "./chunk-X5RY2G3C.js";
37
40
  import {
38
41
  MemoryJobStore,
39
42
  UNCAPPABLE_ASK_TOTAL,
@@ -42,7 +45,7 @@ import {
42
45
  isJobRetentionStore,
43
46
  isReceiptIssuingStore,
44
47
  isStreamableJobStore
45
- } from "./chunk-H2XKINRX.js";
48
+ } from "./chunk-MYJOV4R4.js";
46
49
  import {
47
50
  ContentHoldError,
48
51
  JobCancelledError,
@@ -80,7 +83,7 @@ import {
80
83
  signReceipt,
81
84
  toLockPubkey,
82
85
  verifyChallenge
83
- } from "./chunk-DY2MIZ6E.js";
86
+ } from "./chunk-QTH7CIA3.js";
84
87
  import {
85
88
  X402_BATCH_SETTLEMENT_SCHEME,
86
89
  X402_DEFAULT_FACILITATOR,
@@ -112,7 +115,7 @@ import {
112
115
  pinDimension,
113
116
  withSpan,
114
117
  withTraceContext
115
- } from "./chunk-KIPJRLGP.js";
118
+ } from "./chunk-SX4WCPW7.js";
116
119
  import {
117
120
  StepCache
118
121
  } from "./chunk-BQJIFRAZ.js";
@@ -129,7 +132,7 @@ import {
129
132
  roundUsd,
130
133
  satsToFiat,
131
134
  validateCurrency
132
- } from "./chunk-XYLF33BJ.js";
135
+ } from "./chunk-LQQ6H4UB.js";
133
136
  import {
134
137
  CreditLedger,
135
138
  CreditLedgerError,
@@ -145,10 +148,10 @@ import {
145
148
  isNonChannelBitcoinRail,
146
149
  netOwedSats,
147
150
  x402SettlementPending
148
- } from "./chunk-EN7VI7T5.js";
151
+ } from "./chunk-WP7UX6RF.js";
149
152
  import {
150
153
  withPostgresRecoveryContext
151
- } from "./chunk-CYTV76CG.js";
154
+ } from "./chunk-6RYCZLCK.js";
152
155
  import {
153
156
  DvmError,
154
157
  x402NetworkByCaip2
@@ -156,7 +159,7 @@ import {
156
159
  import {
157
160
  createDiagnosticCapabilityAuthority,
158
161
  diagnosticConsole
159
- } from "./chunk-WIQLTSJY.js";
162
+ } from "./chunk-FXDQMJQ2.js";
160
163
  import {
161
164
  MemoryProcessedPaymentStore,
162
165
  PostgresProcessedPaymentStore,
@@ -2078,6 +2081,7 @@ async function createX402BatchSettlementServer(opts) {
2078
2081
  payTo: opts.payTo,
2079
2082
  network: opts.network,
2080
2083
  storage,
2084
+ earnedNative: opts.earnedNative,
2081
2085
  settleIntervalMs: (settlementConfig.settleIntervalSecs ?? X402_BATCH_AUTO_SETTLEMENT.settleIntervalSecs ?? 300) * 1e3,
2082
2086
  ...postgres ? { listWedgedRefunds: () => listWedgedRefunds(postgres) } : {}
2083
2087
  });
@@ -2832,22 +2836,19 @@ function claimCeilingSelector(earnedNative) {
2832
2836
  const charged = BigInt(channel.chargedCumulativeAmount);
2833
2837
  const claimed = BigInt(channel.totalClaimed);
2834
2838
  if (charged <= claimed) continue;
2835
- let earned;
2836
- try {
2837
- earned = await earnedNative(channel.channelId.toLowerCase());
2838
- } catch (error) {
2839
+ const resolved = await x402EarnedCeiling(channel, earnedNative);
2840
+ if (resolved.kind === "unresolved") {
2839
2841
  loggers.x402.warn("x402_claim_ceiling_unresolved", {
2840
2842
  "channel.id": channel.channelId,
2841
- error: error instanceof Error ? error.message : String(error)
2843
+ error: resolved.error instanceof Error ? resolved.error.message : String(resolved.error)
2842
2844
  });
2843
2845
  continue;
2844
2846
  }
2845
- if (earned === void 0) {
2847
+ if (resolved.kind === "unbound") {
2846
2848
  loggers.x402.warn("x402_claim_ceiling_unbound", { "channel.id": channel.channelId });
2847
2849
  continue;
2848
2850
  }
2849
- const wanted = BigInt(earned);
2850
- const ceiling = wanted < charged ? wanted : charged;
2851
+ const { ceiling } = resolved;
2851
2852
  if (ceiling <= claimed) continue;
2852
2853
  selected.push({ ...channel, chargedCumulativeAmount: ceiling.toString() });
2853
2854
  }
@@ -3874,7 +3875,7 @@ async function verifyUpfrontPaymentInScope(opts) {
3874
3875
  x402Requirements
3875
3876
  });
3876
3877
  }
3877
- const { verifyX402Payment } = await import("./x402-RHVRGUUI.js");
3878
+ const { verifyX402Payment } = await import("./x402-BN26TQZ6.js");
3878
3879
  const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
3879
3880
  x402Payment,
3880
3881
  x402Config,
@@ -4862,7 +4863,7 @@ async function verifyIncomingPaymentInScope(body, opts, snapshot) {
4862
4863
  snapshot
4863
4864
  });
4864
4865
  }
4865
- const { verifyX402Payment } = await import("./x402-RHVRGUUI.js");
4866
+ const { verifyX402Payment } = await import("./x402-BN26TQZ6.js");
4866
4867
  const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
4867
4868
  body.content.x402_payment,
4868
4869
  opts.x402Config,
@@ -5293,7 +5294,7 @@ async function processIncomingPaymentInScope(job, body, opts) {
5293
5294
  try {
5294
5295
  const requiredMsats = job.pendingPaymentMsats ?? 0;
5295
5296
  const requiredUsdcMicro = job.pendingX402AmountUsdcMicro !== void 0 ? BigInt(job.pendingX402AmountUsdcMicro) : BigInt(msatsToUsdc(requiredMsats, rate));
5296
- const { verifyX402Payment } = await import("./x402-RHVRGUUI.js");
5297
+ const { verifyX402Payment } = await import("./x402-BN26TQZ6.js");
5297
5298
  const receipt = await withPaymentStage("verifier_broadcast", () => verifyX402Payment(
5298
5299
  body.content.x402_payment,
5299
5300
  opts.x402Config,
@@ -5940,9 +5941,11 @@ async function fundAndDrawInScope(ctx, funding, tx) {
5940
5941
  throw new Error("deposit outbox enqueue requires the rail's open transaction and a DVM id");
5941
5942
  }
5942
5943
  const commitDeposit = async (result, credit) => {
5944
+ const instrument = credit.rail ? storedCreditBinding(credit).instrument : void 0;
5943
5945
  const report = {
5944
5946
  ...deposit,
5945
- callerPubkey: credit.callerPubkey
5947
+ callerPubkey: credit.callerPubkey,
5948
+ ...instrument && { instrument }
5946
5949
  };
5947
5950
  if (createsDepositLiability && enqueue && tx) {
5948
5951
  await enqueue(tx, creditDepositPayload(ctx.dvmId, report));
@@ -6124,6 +6127,7 @@ function creditDepositPayload(dvmId, funding) {
6124
6127
  creditCurrency: funding.currency,
6125
6128
  fundedAt: funding.fundedAt,
6126
6129
  expiryMs: funding.expiryMs,
6130
+ ...funding.instrument && { instrument: funding.instrument },
6127
6131
  // label a session-funded deposit as one, whether or not the chain
6128
6132
  // binding below could be read. `rail: "tempo"` alone does not say — a
6129
6133
  // `tempo/charge` one-shot funds a credit with no channel at all — so this is
@@ -19530,7 +19534,7 @@ async function createDVMServer(descriptor, opts) {
19530
19534
  }
19531
19535
  }
19532
19536
  if (!opts.onJobCompleted && platformToken && platformUrl && dvmId && opts.db) {
19533
- const { RevenueReporter } = await import("./revenue-reporter-CAWZMYQK.js");
19537
+ const { RevenueReporter } = await import("./revenue-reporter-E56J3NZK.js");
19534
19538
  const reporter = new RevenueReporter(
19535
19539
  opts.db,
19536
19540
  platformUrl,
@@ -19540,7 +19544,7 @@ async function createDVMServer(descriptor, opts) {
19540
19544
  revenueReporter = reporter;
19541
19545
  await reporter.init();
19542
19546
  reporter.startRetryLoop();
19543
- const { MemoryX402BatchStore, PayoutReporter } = await import("./payout-reporter-WSLDLMKK.js");
19547
+ const { MemoryX402BatchStore, PayoutReporter } = await import("./payout-reporter-3UVWPGMO.js");
19544
19548
  payoutReporter = new PayoutReporter({
19545
19549
  dvmId,
19546
19550
  db: opts.db,
@@ -15,7 +15,7 @@ import {
15
15
  lotOwedSats,
16
16
  netOwedSats,
17
17
  x402SettlementPending
18
- } from "./chunk-EN7VI7T5.js";
18
+ } from "./chunk-WP7UX6RF.js";
19
19
 
20
20
  // src/sdk/server/memory-credit-ledger.ts
21
21
  import { randomUUID } from "crypto";
@@ -337,6 +337,9 @@ var diagnostic_catalogue_v1_default = {
337
337
  "revenue_skipped_unsettled_draw",
338
338
  "rollback",
339
339
  "router.proxy",
340
+ "sanctions_ip_data_incomplete",
341
+ "sanctions_ip_data_load_failed",
342
+ "sanctions_ip_data_stale",
340
343
  "scrape_cache_touch_failed",
341
344
  "scrape_cache_write_failed",
342
345
  "scrape_card_segmentation_failed",
@@ -825,6 +828,7 @@ var diagnostic_catalogue_v1_default = {
825
828
  "quota_exceeded",
826
829
  "rate_limited",
827
830
  "rate_limited_by_target",
831
+ "region_unavailable",
828
832
  "replay_detected",
829
833
  "request_integrity_failed",
830
834
  "retry_hardened",
@@ -1052,6 +1056,17 @@ var diagnostic_catalogue_v1_default = {
1052
1056
  paymentPhases: [
1053
1057
  "upfront",
1054
1058
  "mid-job"
1059
+ ],
1060
+ sanctionsRegions: [
1061
+ "BY",
1062
+ "CU",
1063
+ "IR",
1064
+ "KP",
1065
+ "RU",
1066
+ "UA-09",
1067
+ "UA-14",
1068
+ "UA-40",
1069
+ "UA-43"
1055
1070
  ]
1056
1071
  };
1057
1072
 
@@ -1089,6 +1104,7 @@ var CLIENT_PROTOCOL_VERSIONS = new Set(
1089
1104
  diagnostic_catalogue_v1_default.clientProtocolVersions
1090
1105
  );
1091
1106
  var CLIENT_VERSION_FIELDS = new Set(diagnostic_catalogue_v1_default.clientVersionFields);
1107
+ var SANCTIONS_REGIONS = new Set(diagnostic_catalogue_v1_default.sanctionsRegions);
1092
1108
  var SPAN_ID_RE = /^(?!0{16}$)[0-9a-f]{16}$/;
1093
1109
  var TRACE_ID_RE = /^(?!0{32}$)[0-9a-f]{32}$/;
1094
1110
  var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -1317,6 +1333,8 @@ function projectField(key, value, dataset, authority, identityAuthority) {
1317
1333
  return typeof value === "string" && STRIPE_EVENT_RE.test(value) ? value : void 0;
1318
1334
  if (key === "reject_reason")
1319
1335
  return value === "scanner_probe" ? value : void 0;
1336
+ if (key === "sanctions_region")
1337
+ return typeof value === "string" && SANCTIONS_REGIONS.has(value) ? value : void 0;
1320
1338
  return void 0;
1321
1339
  }
1322
1340
  function projectService(value) {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-YG7G4DPZ.js";
5
5
  import {
6
6
  withPostgresTransactionRecovery
7
- } from "./chunk-CYTV76CG.js";
7
+ } from "./chunk-6RYCZLCK.js";
8
8
  import {
9
9
  withSdkInitLock
10
10
  } from "./chunk-COYKJRMM.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-WIQLTSJY.js";
3
+ } from "./chunk-FXDQMJQ2.js";
4
4
  import {
5
5
  withSdkInitLock
6
6
  } from "./chunk-COYKJRMM.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-AFV77S4C.js";
5
5
  import {
6
6
  diagnosticConsole
7
- } from "./chunk-WIQLTSJY.js";
7
+ } from "./chunk-FXDQMJQ2.js";
8
8
  import {
9
9
  withSdkInitLock
10
10
  } from "./chunk-COYKJRMM.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-WIQLTSJY.js";
3
+ } from "./chunk-FXDQMJQ2.js";
4
4
 
5
5
  // src/sdk/server/mpp-setup.ts
6
6
  import { createHash, randomUUID } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-WIQLTSJY.js";
3
+ } from "./chunk-FXDQMJQ2.js";
4
4
 
5
5
  // src/sdk/pricing/currency.ts
6
6
  var InvalidCurrencyError = class extends Error {
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-AFV77S4C.js";
6
6
  import {
7
7
  loggers
8
- } from "./chunk-KIPJRLGP.js";
8
+ } from "./chunk-SX4WCPW7.js";
9
9
  import {
10
10
  redactUrl
11
11
  } from "./chunk-KXWROQGK.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  validateCurrency
3
- } from "./chunk-XYLF33BJ.js";
3
+ } from "./chunk-LQQ6H4UB.js";
4
4
 
5
5
  // src/sdk/pricing/upfront.ts
6
6
  function buildUpfront(input) {
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-BPYMEMQX.js";
10
10
  import {
11
11
  diagnosticConsole
12
- } from "./chunk-WIQLTSJY.js";
12
+ } from "./chunk-FXDQMJQ2.js";
13
13
 
14
14
  // src/lib/cashu/lock-pubkey.ts
15
15
  function toLockPubkey(raw) {
@@ -8,7 +8,7 @@ import {
8
8
  extendDiagnosticIdentityAuthority,
9
9
  projectDiagnosticFields,
10
10
  projectSpanRow
11
- } from "./chunk-WIQLTSJY.js";
11
+ } from "./chunk-FXDQMJQ2.js";
12
12
 
13
13
  // src/sdk/logger.ts
14
14
  function createConsoleLogger(_jobId) {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  applyRetryToPool
3
- } from "./chunk-CYTV76CG.js";
3
+ } from "./chunk-6RYCZLCK.js";
4
4
  import {
5
5
  x402NetworkByCaip2
6
6
  } from "./chunk-BPYMEMQX.js";
7
7
  import {
8
8
  diagnosticConsole
9
- } from "./chunk-WIQLTSJY.js";
9
+ } from "./chunk-FXDQMJQ2.js";
10
10
  import {
11
11
  withSdkInitLock
12
12
  } from "./chunk-COYKJRMM.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-UKD3R2KU.js";
8
8
  import {
9
9
  diagnosticConsole
10
- } from "./chunk-WIQLTSJY.js";
10
+ } from "./chunk-FXDQMJQ2.js";
11
11
 
12
12
  // src/sdk/server/zod-error.ts
13
13
  function humanizeZodError(err, opts) {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-KXWROQGK.js";
7
7
  import {
8
8
  diagnosticConsole
9
- } from "./chunk-WIQLTSJY.js";
9
+ } from "./chunk-FXDQMJQ2.js";
10
10
 
11
11
  // src/observability/payment-diagnostics.ts
12
12
  import { AsyncLocalStorage } from "async_hooks";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  diagnosticConsole
3
- } from "./chunk-WIQLTSJY.js";
3
+ } from "./chunk-FXDQMJQ2.js";
4
4
  import {
5
5
  withSdkInitLock
6
6
  } from "./chunk-COYKJRMM.js";
@@ -1,4 +1,4 @@
1
- import { b as JobStore, J as JobRecord } from './job-store-DkfNE9sv.js';
1
+ import { b as JobStore, J as JobRecord } from './job-store-CopBPkne.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-EN7VI7T5.js";
14
- import "./chunk-CYTV76CG.js";
13
+ } from "./chunk-WP7UX6RF.js";
14
+ import "./chunk-6RYCZLCK.js";
15
15
  import "./chunk-BPYMEMQX.js";
16
- import "./chunk-WIQLTSJY.js";
16
+ import "./chunk-FXDQMJQ2.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-C3Gf1XpP.js';
2
- import { cf as HostingCleanupFence, cV as HostedIntent, ai as FundingMethod, o as PaymentMethod, bN as CreditLedgerLike, a4 as Message, _ as FundingReceipt, bP as CreditSnapshot, $ as JobReceipt, S as SDKJobContext, aw as StepCache, u as ResponseContent, P as PaymentContent, a0 as MessageType, bj as X402Receipt, aE as X402Config, bi as X402ExactVersionSupport, cW as X402SettlementIntent, aa as PaymentRequirementsV2, cX as HostedFundingReservation, c2 as CreditLedgerQuerier, cY as X402SettlementCursor, bR as X402SettlementStatus, cZ as X402SettlementWriteOff, bO as X402RefundSettlementGate, c_ as X402FacilitatorAuth, c$ as X402BatchSettlementConfig, cB as PostgresX402ChannelStorage, d0 as X402PayoutObserver, bL as HostedSettlementReportObligations, br as MppxServer, ad as CashuMode, d1 as CreditDepositEnqueue, d2 as X402SettlementReconciliationReason, ap as PaymentRequirements, a2 as MppxCredential, bm as CreditDepositPayload, bQ as DrawResult, cp as CreditLedgerError, a6 as ReceiptCredit, af as DrainReceiptEvent, a7 as DrainReceipt, K as KVStore, y as SignedRequestAudience, d3 as CreditDrawReleaseEnqueue, cz as JobCostReportPayload, cA as JobTerminalReportPayload, cD as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, bW as CreditInvoiceRecord, bX as InvoiceSettlement, cj as ClientCompatibilityGate, ch as ClientCompatibility, bv as PostgresTempoSessionStore, bu as PayoutReporter, R as ResolvedCreditConfig, g as CreditView } from './step-cache-DDTwd4SK.js';
1
+ import { f as LockPubkey, e as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-IYYVkad1.js';
2
+ import { cf as HostingCleanupFence, cV as HostedIntent, ai as FundingMethod, o as PaymentMethod, bN as CreditLedgerLike, a4 as Message, _ as FundingReceipt, bP as CreditSnapshot, $ as JobReceipt, S as SDKJobContext, aw as StepCache, u as ResponseContent, P as PaymentContent, a0 as MessageType, bj as X402Receipt, aE as X402Config, bi as X402ExactVersionSupport, cW as X402SettlementIntent, aa as PaymentRequirementsV2, cX as HostedFundingReservation, c2 as CreditLedgerQuerier, cY as X402SettlementCursor, bR as X402SettlementStatus, cZ as X402SettlementWriteOff, bO as X402RefundSettlementGate, c_ as X402FacilitatorAuth, c$ as X402BatchSettlementConfig, cB as PostgresX402ChannelStorage, d0 as X402PayoutObserver, bL as HostedSettlementReportObligations, bm as CreditDepositPayload, br as MppxServer, ad as CashuMode, d1 as CreditDepositEnqueue, d2 as X402SettlementReconciliationReason, ap as PaymentRequirements, a2 as MppxCredential, bQ as DrawResult, cp as CreditLedgerError, a6 as ReceiptCredit, af as DrainReceiptEvent, a7 as DrainReceipt, K as KVStore, y as SignedRequestAudience, d3 as CreditDrawReleaseEnqueue, cz as JobCostReportPayload, cA as JobTerminalReportPayload, cD as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, bW as CreditInvoiceRecord, bX as InvoiceSettlement, cj as ClientCompatibilityGate, ch as ClientCompatibility, bv as PostgresTempoSessionStore, bu as PayoutReporter, R as ResolvedCreditConfig, g as CreditView } from './step-cache-MUyQVNFX.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-4TFUkedZ.js';
6
+ import { d as FxSourceFailure, b as FxRateSnapshot, F as FxFetcher } from './fx-DmuqWgL-.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-DkfNE9sv.js';
8
+ import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-CopBPkne.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';
@@ -1859,6 +1859,8 @@ interface CreditFundingReport {
1859
1859
  fundedAt: number;
1860
1860
  /** Current credit expiry after this funding committed (epoch ms). */
1861
1861
  expiryMs: number;
1862
+ /** The funded credit's stored instrument; absent for Cashu. */
1863
+ instrument?: CreditInstrument;
1862
1864
  /** TIP-1034 voucher identity, present only for session-funded credit. */
1863
1865
  tempoSession?: {
1864
1866
  channelId: string;
@@ -2504,6 +2506,7 @@ declare function repairX402ExactSettlementEffect(args: {
2504
2506
  enqueueCreditDeposit?: CreditDepositEnqueue;
2505
2507
  tx?: CreditLedgerQuerier;
2506
2508
  }): Promise<CommittedFunding | undefined>;
2509
+ type CreditInstrument = NonNullable<CreditDepositPayload["instrument"]>;
2507
2510
 
2508
2511
  interface ReceiptIssuerOpts {
2509
2512
  /** 32-byte hex receipt secret — `DVMKIT_RECEIPT_KEY`, or an ephemeral dev key. */
@@ -1,4 +1,4 @@
1
- import { C as Currency } from './step-cache-DDTwd4SK.js';
1
+ import { C as Currency } from './step-cache-MUyQVNFX.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-DDTwd4SK.js';
2
- export { A as ApprovalContent, b as ArtifactContent, c as CancelContent, d as CanonicalEnvelope, e as CreateSignedRequestVerifierOpts, f as CreditConfig, g as CreditView, h as DEFAULT_CREDIT_MAX, i as DEFAULT_CREDIT_MIN, j as DEFAULT_CREDIT_TTL_SECONDS, k as DEFAULT_JOB_RETENTION_DAYS, l as DVMRouteContext, I as IncomingMessage, m as InputType, n as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, o as PaymentMethod, p as PriceValue, q as ProgressContent, r as PromptOpts, Q as QuoteConfig, s as QuoteContext, t as QuoteResult, R as ResolvedCreditConfig, u as ResponseContent, S as SDKJobContext, v as SDKPaymentRequestOpts, w as SIGNED_REQUEST_AUTH_ID, x as SIGNED_REQUEST_STATEMENT_VERSION, y as SignedRequestAudience, z as SignedRequestDomain, B as SignedRequestError, E as SignedRequestFailure, F as SignedRequestReplayStore, G as SignedRequestSignOpts, H as SignedRequestStatementHeader, M as SignedRequestVerifier, U as UnsupportedCurrencyError, N as createSignedRequestVerifier, O as isZodSchema, T as signedRequestStatementHeader, V as validateCurrency } from './step-cache-DDTwd4SK.js';
3
- export { C as CreateFxFetcherOpts, D as DEFAULT_FX_CURRENCIES, a as DEFAULT_FX_RATE_SOURCE, F as FxFetcher, b as FxRateSnapshot, c as FxRateUnavailableError, d as FxSourceFailure, e as FxSourceFailureCategory, P as PlatformFxSource, f as createFxFetcher, g as fxRateFor, r as resolveFxSourceFromEnv } from './fx-4TFUkedZ.js';
4
- export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-DkRy9nfU.js';
5
- export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-DkfNE9sv.js';
1
+ import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-MUyQVNFX.js';
2
+ export { A as ApprovalContent, b as ArtifactContent, c as CancelContent, d as CanonicalEnvelope, e as CreateSignedRequestVerifierOpts, f as CreditConfig, g as CreditView, h as DEFAULT_CREDIT_MAX, i as DEFAULT_CREDIT_MIN, j as DEFAULT_CREDIT_TTL_SECONDS, k as DEFAULT_JOB_RETENTION_DAYS, l as DVMRouteContext, I as IncomingMessage, m as InputType, n as InvalidCurrencyError, J as JobCost, K as KVStore, L as Logger, P as PaymentContent, o as PaymentMethod, p as PriceValue, q as ProgressContent, r as PromptOpts, Q as QuoteConfig, s as QuoteContext, t as QuoteResult, R as ResolvedCreditConfig, u as ResponseContent, S as SDKJobContext, v as SDKPaymentRequestOpts, w as SIGNED_REQUEST_AUTH_ID, x as SIGNED_REQUEST_STATEMENT_VERSION, y as SignedRequestAudience, z as SignedRequestDomain, B as SignedRequestError, E as SignedRequestFailure, F as SignedRequestReplayStore, G as SignedRequestSignOpts, H as SignedRequestStatementHeader, M as SignedRequestVerifier, U as UnsupportedCurrencyError, N as createSignedRequestVerifier, O as isZodSchema, T as signedRequestStatementHeader, V as validateCurrency } from './step-cache-MUyQVNFX.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-DmuqWgL-.js';
4
+ export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-Bpt6Pmr3.js';
5
+ export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-CopBPkne.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-QFRU6W34.js";
13
+ } from "./chunk-X5RY2G3C.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-MU3UX5M4.js";
26
+ } from "./chunk-NUPEAWRM.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-XYLF33BJ.js";
45
- import "./chunk-WIQLTSJY.js";
44
+ } from "./chunk-LQQ6H4UB.js";
45
+ import "./chunk-FXDQMJQ2.js";
46
46
 
47
47
  // src/sdk/configure.ts
48
48
  function configureDVM(config) {