@dvmkit/sdk 0.3.3-rc.10 → 0.4.0-rc.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 (51) hide show
  1. package/dist/{chunk-C2AGARLM.js → chunk-2VGWYG4P.js} +5 -3
  2. package/dist/{chunk-A4CM2BD3.js → chunk-3MHE725Z.js} +1 -1
  3. package/dist/{chunk-VAMSJRJT.js → chunk-5LR6P7WN.js} +5 -3
  4. package/dist/{chunk-YYQG4R7T.js → chunk-74PUEZJ4.js} +6 -4
  5. package/dist/{chunk-MKI6OVW4.js → chunk-CZULM42S.js} +0 -51
  6. package/dist/{chunk-M4QDXD2A.js → chunk-FYRR2UEZ.js} +1 -1
  7. package/dist/{chunk-4UZN2GP5.js → chunk-GAOAYHZA.js} +209 -33
  8. package/dist/{chunk-Z4BNLUZF.js → chunk-IWQHUSMO.js} +3 -105
  9. package/dist/{chunk-4J32DTLT.js → chunk-IXR5RFK7.js} +82 -4
  10. package/dist/{chunk-2SD2W2BG.js → chunk-JH3SX3LY.js} +252 -26
  11. package/dist/{chunk-UZC4A4DM.js → chunk-K2YX2VRA.js} +2480 -206
  12. package/dist/chunk-KA6VN5FK.js +245 -0
  13. package/dist/chunk-LIRAHP7B.js +53 -0
  14. package/dist/{chunk-MG67KXU7.js → chunk-MZRJR2CW.js} +4 -2
  15. package/dist/{chunk-JDFLRNAZ.js → chunk-PB4FYZET.js} +67 -7
  16. package/dist/{chunk-BQ2NMWKE.js → chunk-PLG4XER6.js} +1 -1
  17. package/dist/{chunk-Z3EHBW2G.js → chunk-R4DQZFAL.js} +7 -5
  18. package/dist/chunk-RLTSCKRI.js +109 -0
  19. package/dist/{chunk-2KGG5ORW.js → chunk-TXX4GOUB.js} +3 -3
  20. package/dist/{chunk-YRDA7EWN.js → chunk-W2EQGDF5.js} +14 -10
  21. package/dist/{chunk-EAMZZ2B4.js → chunk-X7EZ5CLI.js} +59 -0
  22. package/dist/{chunk-7X6UDVCQ.js → chunk-Z4ZT5LNT.js} +66 -2
  23. package/dist/{credit-ledger-A35WH2TI.js → credit-ledger-MI2H7NEC.js} +3 -1
  24. package/dist/{credit-menu-0-UtJ3hh.d.ts → credit-menu-B8_p_vUz.d.ts} +133 -7
  25. package/dist/{fx-DhyT1Cjh.d.ts → fx-DuaYHvVn.d.ts} +1 -1
  26. package/dist/index.d.ts +6 -6
  27. package/dist/internal/caller.d.ts +15 -7
  28. package/dist/internal/caller.js +36 -24
  29. package/dist/internal/index.js +1 -1
  30. package/dist/internal/server.d.ts +11 -85
  31. package/dist/internal/server.js +18 -16
  32. package/dist/{job-store-D3CcZp_g.d.ts → job-store-D6Rjj5Oi.d.ts} +1 -1
  33. package/dist/{lightning-backend-BhsyrBLa.d.ts → lightning-backend-BaeCPmx7.d.ts} +1 -1
  34. package/dist/{memory-credit-ledger-2LBZVMKJ.js → memory-credit-ledger-W2BAUYJP.js} +4 -2
  35. package/dist/{mpp-setup-7CGBKNUP.js → mpp-setup-RF5FXGGV.js} +5 -1
  36. package/dist/{payout-reporter-ZMOA37GN.js → payout-reporter-3Y2U55ZX.js} +1 -1
  37. package/dist/{postgres-job-store-MSD2HZOI.js → postgres-job-store-VLXLWXUQ.js} +1 -1
  38. package/dist/{revenue-reporter-EKJOGQYR.js → revenue-reporter-MAERPYGK.js} +1 -1
  39. package/dist/server/index.d.ts +14 -10
  40. package/dist/server/index.js +54 -17
  41. package/dist/{step-cache-v2yhyhSZ.d.ts → step-cache-Bi43A0JN.d.ts} +1769 -1549
  42. package/dist/{tempo-charge-store-4WX7FPOV.js → tempo-charge-store-Q3D7KYMH.js} +1 -1
  43. package/dist/tempo-lifecycle-OTHV757Y.js +14 -0
  44. package/dist/{tempo-session-store-LCSDHB7G.js → tempo-session-store-ZRNCOX7P.js} +1 -1
  45. package/dist/{tempo-wallet-RCGBBAJH.js → tempo-wallet-32JWQZKQ.js} +4 -3
  46. package/dist/testing/index.d.ts +3 -3
  47. package/dist/{usd-Cu9G6xv2.d.ts → usd-AZPVq4eU.d.ts} +1 -1
  48. package/dist/{x402-S47Q77UE.js → x402-CEDHGZDI.js} +17 -14
  49. package/package.json +1 -1
  50. package/dist/chunk-YHN3WMMF.js +0 -122
  51. package/dist/tempo-lifecycle-TJ62A7UX.js +0 -13
@@ -4,28 +4,25 @@ import {
4
4
  listCredits,
5
5
  maxAdvertisedMicro,
6
6
  withinAdvertisedTolerance
7
- } from "./chunk-C2AGARLM.js";
7
+ } from "./chunk-2VGWYG4P.js";
8
8
  import {
9
9
  authorizeProtectedRemoval,
10
10
  isValidEvmPrivateKey,
11
11
  loadConfig,
12
12
  updateConfig
13
- } from "./chunk-MG67KXU7.js";
13
+ } from "./chunk-MZRJR2CW.js";
14
14
  import {
15
15
  X402_DEFAULT_NETWORK,
16
16
  X402_V1_VERSION,
17
17
  X402_VERSION,
18
- assertSupportedX402Network,
19
18
  buildPaymentRequirements,
20
19
  chainIdFromCaip2,
21
20
  encodePayment,
22
21
  usdcContractFor,
23
22
  usdcDomainNameFor,
24
23
  usdcDomainVersionFor,
25
- x402NetworkByCaip2,
26
- x402NetworkToCaip2,
27
- x402SupportedNetworksHint
28
- } from "./chunk-Z4BNLUZF.js";
24
+ x402NetworkToCaip2
25
+ } from "./chunk-IWQHUSMO.js";
29
26
  import {
30
27
  costAnchor,
31
28
  fetchBtcUsdRate,
@@ -34,18 +31,25 @@ import {
34
31
  getLastKnownBtcRate,
35
32
  msatsToUsdc,
36
33
  usdcToMsats
37
- } from "./chunk-A4CM2BD3.js";
34
+ } from "./chunk-3MHE725Z.js";
38
35
  import {
39
- DvmError,
40
36
  X402_CHANNELS_FILE,
41
37
  ensureConfigDir,
42
38
  resolveRpcHttpTransportOptions,
43
39
  resolveRpcOverride
44
- } from "./chunk-MKI6OVW4.js";
40
+ } from "./chunk-CZULM42S.js";
45
41
  import {
46
42
  redactUrl,
47
43
  redactUrlsInText
48
44
  } from "./chunk-FUJ36YDV.js";
45
+ import {
46
+ assertSupportedX402Network,
47
+ x402NetworkByCaip2,
48
+ x402SupportedNetworksHint
49
+ } from "./chunk-RLTSCKRI.js";
50
+ import {
51
+ DvmError
52
+ } from "./chunk-LIRAHP7B.js";
49
53
 
50
54
  // src/lib/x402/asset.ts
51
55
  function resolveX402Asset(network = X402_DEFAULT_NETWORK) {
@@ -17,9 +17,16 @@ var PostgresTempoSessionStore = class {
17
17
  this.update = this.update.bind(this);
18
18
  }
19
19
  pool;
20
+ hostingCleanupFence;
21
+ useHostingCleanupFence(fence) {
22
+ this.hostingCleanupFence = fence;
23
+ }
20
24
  acceptance = new AsyncLocalStorage();
21
25
  async init() {
22
26
  await withSdkInitLock(this.pool, async () => {
27
+ const before = await this.pool.query(
28
+ "SELECT to_regclass('mpp_tempo_channels') IS NOT NULL AS existed"
29
+ );
23
30
  await this.pool.query(`
24
31
  CREATE TABLE IF NOT EXISTS mpp_tempo_channels (
25
32
  channel_key TEXT PRIMARY KEY,
@@ -31,6 +38,24 @@ var PostgresTempoSessionStore = class {
31
38
  `CREATE INDEX IF NOT EXISTS idx_mpp_tempo_channels_updated
32
39
  ON mpp_tempo_channels(updated_at)`
33
40
  );
41
+ await this.pool.query(`
42
+ CREATE TABLE IF NOT EXISTS mpp_tempo_channel_tombstones (
43
+ channel_key TEXT PRIMARY KEY,
44
+ state_json TEXT NOT NULL,
45
+ deleted_at_ms BIGINT NOT NULL
46
+ )
47
+ `);
48
+ await this.pool.query(`
49
+ CREATE TABLE IF NOT EXISTS mpp_tempo_channel_history (
50
+ singleton BOOLEAN PRIMARY KEY CHECK (singleton),
51
+ complete BOOLEAN NOT NULL
52
+ )
53
+ `);
54
+ await this.pool.query(
55
+ `INSERT INTO mpp_tempo_channel_history (singleton,complete) VALUES (TRUE,$1)
56
+ ON CONFLICT (singleton) DO NOTHING`,
57
+ [!before.rows[0].existed]
58
+ );
34
59
  await this.pool.query(`
35
60
  CREATE TABLE IF NOT EXISTS mpp_tempo_close_intents (
36
61
  channel_id TEXT PRIMARY KEY,
@@ -75,6 +100,17 @@ var PostgresTempoSessionStore = class {
75
100
  }
76
101
  /** Compose voucher acceptance and its ledger mutation under the channel-row lock. */
77
102
  async withVoucherAcceptance(voucher, commit, operation) {
103
+ if (this.hostingCleanupFence) {
104
+ if (!voucher.hostingFunding) throw new Error("Hosted Tempo voucher has no original funding admission");
105
+ const reservation = voucher.hostingFunding;
106
+ await this.hostingCleanupFence.withNewIntent({
107
+ admissionId: reservation.admissionId,
108
+ creditId: reservation.creditId,
109
+ fundId: reservation.fundId,
110
+ callerPubkey: reservation.callerPubkey,
111
+ fundingCommitment: reservation.commitment
112
+ }, (tx) => this.hostingCleanupFence.assertFundingReservation(tx, reservation));
113
+ }
78
114
  const context = {
79
115
  commit,
80
116
  channelId: voucher.channelId.toLowerCase(),
@@ -365,6 +401,16 @@ var PostgresTempoSessionStore = class {
365
401
  };
366
402
  }
367
403
  assertMonotonicTransition(current, value);
404
+ if (current === null) {
405
+ const prior = await client.query(
406
+ "SELECT state_json FROM mpp_tempo_channel_tombstones WHERE channel_key=$1 FOR UPDATE",
407
+ [key]
408
+ );
409
+ if (prior.rows[0]) assertMonotonicTransition(parseStoreValue(prior.rows[0].state_json), value);
410
+ }
411
+ if (!acceptance && this.hostingCleanupFence && (current === null || (asBigInt(value.highestVoucherAmount) ?? 0n) > (isRecord(current) ? asBigInt(current.highestVoucherAmount) ?? 0n : 0n))) {
412
+ await this.hostingCleanupFence.assertNewIntent(client);
413
+ }
368
414
  await client.query(
369
415
  `INSERT INTO mpp_tempo_channels (channel_key, state_json, updated_at)
370
416
  VALUES ($1, $2, $3)
@@ -382,6 +428,19 @@ var PostgresTempoSessionStore = class {
382
428
  });
383
429
  }
384
430
  } else if (change.op === "delete") {
431
+ if (current !== null) {
432
+ const prior = await client.query(
433
+ "SELECT state_json FROM mpp_tempo_channel_tombstones WHERE channel_key=$1 FOR UPDATE",
434
+ [key]
435
+ );
436
+ if (prior.rows[0]) assertMonotonicTransition(parseStoreValue(prior.rows[0].state_json), current);
437
+ await client.query(
438
+ `INSERT INTO mpp_tempo_channel_tombstones (channel_key,state_json,deleted_at_ms)
439
+ VALUES ($1,$2,$3) ON CONFLICT (channel_key) DO UPDATE
440
+ SET state_json=EXCLUDED.state_json,deleted_at_ms=EXCLUDED.deleted_at_ms`,
441
+ [key, rows[0].state_json, Date.now()]
442
+ );
443
+ }
385
444
  await client.query(`DELETE FROM mpp_tempo_channels WHERE channel_key = $1`, [key]);
386
445
  }
387
446
  return change.result;
@@ -38,14 +38,16 @@ var PLATFORM_REPORT_TABLE_COLUMNS = [
38
38
  ];
39
39
  var RevenueReporter = class _RevenueReporter {
40
40
  // 24h of failed retries
41
- constructor(db, platformUrl, platformToken) {
41
+ constructor(db, platformUrl, platformToken, hostedObligations) {
42
42
  this.db = db;
43
43
  this.platformUrl = platformUrl;
44
44
  this.platformToken = platformToken;
45
+ this.hostedObligations = hostedObligations;
45
46
  }
46
47
  db;
47
48
  platformUrl;
48
49
  platformToken;
50
+ hostedObligations;
49
51
  retryTimer = null;
50
52
  static RETRY_INTERVAL_MS = 3e4;
51
53
  static MAX_BACKOFF_MS = 3e5;
@@ -188,8 +190,44 @@ var RevenueReporter = class _RevenueReporter {
188
190
  * loop redelivers freely.
189
191
  */
190
192
  async enqueuePayout(payload, tx) {
193
+ if (this.hostedObligations && (payload.rail === "x402" || payload.rail === "tempo") && await this.hostedObligations.hasCompleteHistory(tx ?? this.db)) {
194
+ throw new Error("Hosted channel payout requires its original settlement obligation");
195
+ }
191
196
  await this.insertPending(tx ?? this.db, "payout", payload);
192
197
  }
198
+ async enqueueHostedPayout(payload, obligationIds, tx) {
199
+ if (!this.hostedObligations || payload.rail !== "x402" && payload.rail !== "tempo") {
200
+ throw new Error("Hosted channel payout has no managed obligation recorder");
201
+ }
202
+ const enqueue = async (query) => {
203
+ if (await this.hostedObligations.hasOriginalReport(
204
+ obligationIds,
205
+ payload.payoutId,
206
+ payload,
207
+ query
208
+ )) return;
209
+ const reportId = await this.insertPending(query, "payout", payload);
210
+ await this.hostedObligations.queueReport(
211
+ obligationIds,
212
+ payload.payoutId,
213
+ reportId,
214
+ payload,
215
+ query
216
+ );
217
+ };
218
+ if (tx) return enqueue(tx);
219
+ const client = await this.db.connect();
220
+ try {
221
+ await client.query("BEGIN");
222
+ await enqueue(client);
223
+ await client.query("COMMIT");
224
+ } catch (error) {
225
+ await client.query("ROLLBACK").catch(() => void 0);
226
+ throw error;
227
+ } finally {
228
+ client.release();
229
+ }
230
+ }
193
231
  /**
194
232
  * Report one landed payout on its own and try to deliver it at once — the
195
233
  * live Tempo settlement, which has no dvmkit transaction to join. Durable
@@ -518,6 +556,12 @@ var RevenueReporter = class _RevenueReporter {
518
556
  }
519
557
  }
520
558
  async enqueue(kind, payload, label) {
559
+ if (kind === "payout" && this.hostedObligations) {
560
+ const rail = payload.rail;
561
+ if ((rail === "x402" || rail === "tempo") && await this.hostedObligations.hasCompleteHistory()) {
562
+ throw new Error("Hosted channel payout requires its original settlement obligation");
563
+ }
564
+ }
521
565
  const id = await this.insertPending(this.db, kind, payload);
522
566
  void this.attemptDelivery(id, payload, kind, label).catch(() => {
523
567
  });
@@ -532,6 +576,9 @@ var RevenueReporter = class _RevenueReporter {
532
576
  return id;
533
577
  }
534
578
  async attemptDelivery(id, payload, kind, label) {
579
+ if (kind === "payout" && this.hostedObligations && (payload.rail === "x402" || payload.rail === "tempo")) {
580
+ await this.hostedObligations.assertReportReady(id, payload);
581
+ }
535
582
  const url = `${this.platformUrl}${ENDPOINTS[kind]}`;
536
583
  let res;
537
584
  try {
@@ -552,7 +599,24 @@ var RevenueReporter = class _RevenueReporter {
552
599
  throw err;
553
600
  }
554
601
  if (res.ok) {
555
- await this.db.query(`DELETE FROM ${PENDING_DVM_REPORTS_TABLE} WHERE id = $1`, [id]);
602
+ if (this.hostedObligations && kind === "payout") {
603
+ const client = await this.db.connect();
604
+ try {
605
+ await client.query("BEGIN");
606
+ const rail = payload.rail;
607
+ const requireLinked = (rail === "x402" || rail === "tempo") && await this.hostedObligations.hasCompleteHistory(client);
608
+ await this.hostedObligations.acknowledgeDelivered(id, client, requireLinked);
609
+ await client.query(`DELETE FROM ${PENDING_DVM_REPORTS_TABLE} WHERE id = $1`, [id]);
610
+ await client.query("COMMIT");
611
+ } catch (error) {
612
+ await client.query("ROLLBACK").catch(() => void 0);
613
+ throw error;
614
+ } finally {
615
+ client.release();
616
+ }
617
+ } else {
618
+ await this.db.query(`DELETE FROM ${PENDING_DVM_REPORTS_TABLE} WHERE id = $1`, [id]);
619
+ }
556
620
  diagnosticConsole.log(`[revenue-reporter] reported ${kind} ${label}`);
557
621
  return;
558
622
  }
@@ -10,9 +10,11 @@ import {
10
10
  isDrainMethod,
11
11
  isFundingRail,
12
12
  x402SettlementPending
13
- } from "./chunk-2SD2W2BG.js";
13
+ } from "./chunk-JH3SX3LY.js";
14
14
  import "./chunk-COYKJRMM.js";
15
15
  import "./chunk-P6QON7ER.js";
16
+ import "./chunk-RLTSCKRI.js";
17
+ import "./chunk-LIRAHP7B.js";
16
18
  import "./chunk-ETXDTUJO.js";
17
19
  export {
18
20
  CreditLedger,
@@ -1,15 +1,93 @@
1
- import { ah as FundingMethod, o as PaymentMethod, bM as CreditLedgerLike, a1 as Message, X as FundingReceipt, bO as CreditSnapshot, Y as JobReceipt, S as SDKJobContext, aw as StepCache, u as ResponseContent, P as PaymentContent, a2 as MessageType, bj as X402Receipt, aE as X402Config, bi as X402ExactVersionSupport, cT as X402SettlementIntent, aq as PaymentRequirementsV2, c1 as CreditLedgerQuerier, cU as X402SettlementCursor, bQ as X402SettlementStatus, cV as X402SettlementWriteOff, bN as X402RefundSettlementGate, cW as X402FacilitatorAuth, cX as X402BatchSettlementConfig, cz as PostgresX402ChannelStorage, cY as X402PayoutObserver, br as MppxServer, ab as CashuMode, cZ as CreditDepositEnqueue, c_ as X402SettlementReconciliationReason, ao as PaymentRequirements, a0 as MppxCredential, bm as CreditDepositPayload, bP as DrawResult, cn as CreditLedgerError, a6 as ReceiptCredit, ae as DrainReceiptEvent, ad as DrainReceipt, K as KVStore, y as SignedRequestAudience, c$ as CreditDrawReleaseEnqueue, cx as JobCostReportPayload, cy as JobTerminalReportPayload, cB as RevenueSkippedNoRailPayload, Z as ZodLike, a as DVMDescriptor, bV as CreditInvoiceRecord, bW as InvoiceSettlement, ch as ClientCompatibilityGate, cf as ClientCompatibility, bu as PayoutReporter, R as ResolvedCreditConfig, g as CreditView } from './step-cache-v2yhyhSZ.js';
1
+ import { cf as HostingCleanupFence, cV as HostedIntent, ah as FundingMethod, o as PaymentMethod, bN as CreditLedgerLike, a1 as Message, X as FundingReceipt, bP as CreditSnapshot, Y as JobReceipt, S as SDKJobContext, aw as StepCache, u as ResponseContent, P as PaymentContent, a2 as MessageType, bj as X402Receipt, aE as X402Config, bi as X402ExactVersionSupport, cW as X402SettlementIntent, aq 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, ab as CashuMode, d1 as CreditDepositEnqueue, d2 as X402SettlementReconciliationReason, ao as PaymentRequirements, a0 as MppxCredential, bm as CreditDepositPayload, bQ as DrawResult, cp as CreditLedgerError, a6 as ReceiptCredit, ae as DrainReceiptEvent, ad 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-Bi43A0JN.js';
2
2
  import { ProofLike, SerializedDLEQ, Proof } from '@cashu/cashu-ts';
3
3
  import { Hono, Context } from 'hono';
4
4
  import { Pool } from 'pg';
5
- import { b as FxRateSnapshot, F as FxFetcher } from './fx-DhyT1Cjh.js';
6
- import { g as LockPubkey, f as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-BhsyrBLa.js';
7
- import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-D3CcZp_g.js';
8
- import { Challenge } from 'mppx';
5
+ import { b as FxRateSnapshot, F as FxFetcher } from './fx-DuaYHvVn.js';
6
+ import { Store, Challenge } from 'mppx';
7
+ import { g as LockPubkey, f as CheckMintHealthOptions, b as LightningBackend, A as AttestationPayload } from './lightning-backend-BaeCPmx7.js';
8
+ import { T as TopUpCapUnenforcedReason, A as AppendOutgoingOptions, J as JobRecord, b as JobStore } from './job-store-D6Rjj5Oi.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';
12
12
 
13
+ interface PostgresTempoChargeStoreOpts {
14
+ /** Table name. Defaults to `"mpp_tempo_charge_replays"`. Must match `/^[a-zA-Z_][a-zA-Z0-9_]*$/`. */
15
+ tableName?: string;
16
+ /**
17
+ * How long a row survives its last write, in milliseconds. Defaults to one
18
+ * hour — see the class doc for why that is both generous and safe.
19
+ */
20
+ retentionMs?: number;
21
+ /**
22
+ * Probability (per write) of firing a fire-and-forget GC sweep that deletes
23
+ * expired rows. Defaults to 0.01 — every ~100 writes runs one DELETE. Set to
24
+ * 0 to disable GC entirely (rely on an external sweeper).
25
+ */
26
+ gcSampleRate?: number;
27
+ /** Clock source (ms). Defaults to `Date.now`. Test seam for deterministic TTL. */
28
+ now?: () => number;
29
+ }
30
+ /**
31
+ * Postgres implementation of the atomic store mppx's `tempo.charge` uses for
32
+ * replay protection.
33
+ *
34
+ * mppx refuses a charge credential whose transaction hash it has already taken
35
+ * (`markHashUsed`), and refuses a zero-dollar proof credential whose challenge
36
+ * id it has already taken — but only against the store it is handed. Omitting
37
+ * one leaves it on `Store.memory()`: per-process, lost on restart, invisible to
38
+ * sibling machines. A replayed credential then reaches a broadcast the chain
39
+ * rejects instead of the cheap `Transaction hash has already been used`.
40
+ *
41
+ * {@link PostgresTempoSessionStore} cannot serve this keyspace — its `update`
42
+ * asserts a monotonic *channel-state object*, and a replay marker is the number
43
+ * `Date.now()`. Values here are deliberately opaque JSON: mppx writes a number
44
+ * for a replay marker and a `SponsorBudget.State` object for the fee-sponsor
45
+ * budget, which shares this store unprefixed so aggregate in-flight fee
46
+ * exposure is sponsor-wide rather than per-process.
47
+ *
48
+ * **Retention is ours — mppx has no TTL at any layer of `Store`.** Every row
49
+ * carries an `expires_at` refreshed on each write, swept by a sampled in-line
50
+ * DELETE. The window is uniform rather than per-keyspace because it is safe for
51
+ * both kinds of row: a replay marker guards a credential whose transaction is
52
+ * settleable for about twenty-five seconds and whose challenge expires in
53
+ * minutes, and a sponsor-budget reservation is bounded by that same expiring
54
+ * nonce (plus a thirty-second lease while it is `prepared`), so an hour-idle
55
+ * budget row holds only reservations `SponsorBudget.reconcile` would release on
56
+ * sight. Sweeping such a row is equivalent to reconciling it, and the next
57
+ * reservation recreates it. The hosted fence pins mppx's charge key forms;
58
+ * a version that changes those forms must update the reservation derivation.
59
+ *
60
+ * `expires_at` is a GC marker only: reads do not filter on it, so protection
61
+ * lapses when a row is swept and never before.
62
+ */
63
+ declare class PostgresTempoChargeStore implements Store.AtomicStore {
64
+ private hostingCleanupFence?;
65
+ useHostingCleanupFence(fence: HostingCleanupFence): void;
66
+ reserveHostedCharge(serializedCredential: string, intent: HostedIntent): Promise<void>;
67
+ completeHostedCharge(challengeId: string): Promise<void>;
68
+ private readonly pool;
69
+ private readonly tableName;
70
+ private readonly retentionMs;
71
+ private readonly gcSampleRate;
72
+ private readonly now;
73
+ constructor(pool: Pool, opts?: PostgresTempoChargeStoreOpts);
74
+ /** Run the CREATE TABLE migration. Idempotent — safe to call repeatedly. */
75
+ init(): Promise<void>;
76
+ /** Read one stored value, or `null` when absent — mppx's miss sentinel. */
77
+ get(key: string): Promise<unknown>;
78
+ put(key: string, value: unknown): Promise<void>;
79
+ /** Delete one stored value — mppx's compensating release on a failed broadcast. */
80
+ delete(key: string): Promise<void>;
81
+ /**
82
+ * Advisory locking covers the absent-row first write before the row lock.
83
+ * Both competing presentations of one credential and the shared sponsor
84
+ * budget need this serialization. The transaction contains no chain call.
85
+ */
86
+ update<result>(key: string, fn: (current: unknown) => Store.Change<unknown, result>): Promise<result>;
87
+ private createTables;
88
+ private maybeSweep;
89
+ }
90
+
13
91
  interface WalletAccumulatorRow {
14
92
  id: string;
15
93
  dvmId: string;
@@ -201,8 +279,36 @@ interface HostingControlCommand {
201
279
  }
202
280
  /** Ordered JSON arrays are the versioned wire signing contract. */
203
281
  declare function signHostingControl(secret: string, command: HostingControlCommand): string;
282
+ interface HostingClosureCommand {
283
+ version: 3;
284
+ action: "close" | "certificate";
285
+ scope: string;
286
+ dvmId: string;
287
+ generation: number;
288
+ operationId: string;
289
+ timestampMs: number;
290
+ nonce: string;
291
+ }
292
+ declare function signHostingClosure(secret: string, command: HostingClosureCommand): string;
293
+ interface HostingClosureEvidence {
294
+ dvmId: string;
295
+ scope: string;
296
+ instanceId: string;
297
+ bootEpoch: number;
298
+ generation: number;
299
+ operationId: string;
300
+ cutoffTxid: string;
301
+ closedAtMs: number;
302
+ complete: boolean;
303
+ eligible: boolean;
304
+ reasons: string[];
305
+ liabilities: {
306
+ currency: string;
307
+ amountMicro: string;
308
+ }[];
309
+ }
204
310
  interface HostingControlStatus {
205
- state: "accepting" | "draining";
311
+ state: "accepting" | "draining" | "closed";
206
312
  generation: number;
207
313
  deadlineMs: number | null;
208
314
  leaseExpiresAtMs: number | null;
@@ -965,6 +1071,8 @@ interface X402ExactSettlementEffect {
965
1071
  callerId: string;
966
1072
  dvmId: string;
967
1073
  jobId?: string;
1074
+ hostingAdmissionId?: string;
1075
+ hostingPaymentSeq?: number;
968
1076
  /** Upfront job request bound to this payment; omitted for credit-only and mid-job effects. */
969
1077
  jobAdmission?: {
970
1078
  requestFingerprint: string;
@@ -1058,6 +1166,8 @@ interface X402ExactSettlementStore {
1058
1166
  }
1059
1167
  declare class PostgresX402ExactSettlementStore implements X402ExactSettlementStore {
1060
1168
  private readonly pool;
1169
+ private hostingCleanupFence?;
1170
+ useHostingCleanupFence(fence: HostingCleanupFence): void;
1061
1171
  constructor(pool: Pick<Pool, "query" | "connect">);
1062
1172
  init(): Promise<void>;
1063
1173
  prepare(intent: Omit<X402ExactSettlementIntent, "status" | "createdAt" | "updatedAt" | "resolvedAt">): Promise<X402ExactSettlementIntent>;
@@ -1436,6 +1546,7 @@ interface X402BatchSettlementServer {
1436
1546
  * figure, since this one is read before the channel lock is taken.
1437
1547
  */
1438
1548
  refundBoundNative?: number;
1549
+ hostingFunding?: HostedFundingReservation;
1439
1550
  commit: (funding: X402BatchFunding, tx?: CreditLedgerQuerier) => Promise<T>;
1440
1551
  complete?: (settlement: SettleResponse, committed: T, tx?: CreditLedgerQuerier) => Promise<T>;
1441
1552
  } & ({
@@ -1528,6 +1639,8 @@ interface CreateX402BatchSettlementServerOpts {
1528
1639
  * builder surface, and not part of the extractable SDK contract.
1529
1640
  */
1530
1641
  payout?: X402PayoutObserver;
1642
+ /** Server-installed managed-host settlement recorder. */
1643
+ hostedObligations?: HostedSettlementReportObligations;
1531
1644
  }
1532
1645
  /**
1533
1646
  * Initialize upstream's scheme and channel manager against dvmkit storage.
@@ -1670,6 +1783,9 @@ interface TempoChannelReport {
1670
1783
  payee?: string;
1671
1784
  }
1672
1785
  interface UpfrontPaymentOpts {
1786
+ /** Server-created hosted admission that predates rail side effects. */
1787
+ hostingAdmissionId?: string;
1788
+ hostingPaymentArtifactHash?: string;
1673
1789
  cashuToken?: string;
1674
1790
  requiredMsats?: number;
1675
1791
  mints?: string[];
@@ -2003,6 +2119,8 @@ declare function verifyTempoSessionManagementCredential(args: {
2003
2119
  resourcePath: string;
2004
2120
  action: "close" | "topUp" | "open";
2005
2121
  expectedChannelId?: string;
2122
+ /** Hosted close only: authenticate the credential without a rail write before reserving its effect. */
2123
+ preflightBeforeBound?: boolean;
2006
2124
  /**
2007
2125
  * Runs once the credential is decoded and bound to `expectedChannelId`, and
2008
2126
  * before anything broadcasts.
@@ -2063,6 +2181,8 @@ declare function paymentErrorBody(code: PaymentErrorCode, opts: {
2063
2181
  */
2064
2182
  declare function buildPaymentErrorResponse(body: Record<string, unknown>, challenges?: Challenge.Challenge[], x402Requirements?: PaymentRequirements[], status?: number, x402V2Requirements?: PaymentRequirementsV2[], x402V2Resource?: string, x402ExactVersions?: X402ExactVersionSupport, x402ErrorCode?: string): Response;
2065
2183
  interface IncomingPaymentOpts {
2184
+ /** Durable pending-verification message sequence written before this rail is touched. */
2185
+ hostingPaymentSeq?: number;
2066
2186
  mints?: string[];
2067
2187
  x402Config?: X402Config;
2068
2188
  /** Declared DVM pricing currency. x402 is accepted only when this is USD. */
@@ -4097,6 +4217,12 @@ interface SDKServerOpts {
4097
4217
  db?: Pool;
4098
4218
  /** Enables authenticated, durable hosting admission and bounded drain. Requires Postgres and dvmId. */
4099
4219
  hostingControl?: HostingControlConfig;
4220
+ /** Internal host wiring: shared ledger rows cannot certify one of several mounts. */
4221
+ hostingCleanupSingleMount?: boolean;
4222
+ /** Internal host wiring: every configured rail uses SDK-owned durable stores. */
4223
+ hostingCleanupKnownRailStores?: boolean;
4224
+ hostingTempoSessionStore?: PostgresTempoSessionStore;
4225
+ hostingTempoChargeStore?: PostgresTempoChargeStore;
4100
4226
  /**
4101
4227
  * Host strict-mode flag. Reporter readiness follows hosted context regardless
4102
4228
  * of this value.
@@ -4413,4 +4539,4 @@ declare function attachCreditMenu(body: Record<string, unknown>, menu: CreditMen
4413
4539
  */
4414
4540
  declare function toCreditTerms(menu: CreditMenu): CreditTerms;
4415
4541
 
4416
- export { isTerminal as $, type AccumulatorPool as A, buildPaymentErrorResponse as B, type ConsumedCredentialStore as C, clearAccumulatorForDvm as D, createDVMServer as E, type FiatDenomination as F, creditDepositPayload as G, derivedFundCreditId as H, type IncomingPaymentOpts as I, JobCancelledError as J, devModeSkipsPaymentVerification as K, fromJobRecord as L, MintHealthTracker as M, fundedMicroFor as N, hasPaymentProof as O, PAYMENT_PROOF_KEYS as P, hashLockKey as Q, type ReporterBannerOpts as R, type SDKServerOpts as S, type TempoChannelReport as T, type UpfrontPaymentOpts as U, type VerifiedIncomingPayment as V, implicitCreditId as W, type X402BatchChannelObservation as X, initWalletAccumulatorTable as Y, insertAccumulatorRows as Z, isDerivedCreditId as _, type AccumulatorQuerier as a, type X402BatchSettlementServer as a$, isYieldMessage as a0, issueUpfrontChallenges as a1, msatsToFiatMicro as a2, paymentErrorBody as a3, pinAskFiat as a4, priceFiatMicro as a5, processIncomingPayment as a6, providerMessage as a7, repairX402ExactSettlementEffect as a8, resolveFxSnapshot as a9, type HostingControlCommand as aA, type HostingControlConfig as aB, type HostingControlStatus as aC, JobManager as aD, type JobManagerOpts as aE, type LightningReceiveConfig as aF, MIN_INVOICE_TTL_SECONDS as aG, MemoryConsumedCredentialStore as aH, type MemoryConsumedCredentialStoreOpts as aI, MemoryProcessedPaymentStore as aJ, MemoryX402ExactSettlementStore as aK, type MountOpts as aL, type OwnerDisplay as aM, type PaidJobCompletion as aN, type PaymentMode as aO, type PlatformReporterOpts as aP, PostgresProcessedPaymentStore as aQ, PostgresX402ExactSettlementStore as aR, type PriceFiat as aS, type ProcessedPaymentQuerier as aT, type ProcessedPaymentRail as aU, type ProcessedPaymentRecord as aV, ProcessedPaymentReplayError as aW, type ProcessedPaymentStore as aX, type X402BatchAcceptance as aY, type X402BatchFunding as aZ, type X402BatchRefusal as a_, resolvePriceFiat as aa, revenueReporterBannerState as ab, toCreditTerms as ac, toJobRecord as ad, unknownRouteNotFound as ae, verifyIncomingPayment as af, verifyTempoSessionManagementCredential as ag, verifyUpfrontPayment as ah, x402RequiredUsdcMicro as ai, x402SettledShare as aj, type CreditMenu as ak, ReceiptIssuer as al, LightningReceive as am, TempoSettlementReadiness as an, type DVMHostOpts as ao, type DVMServeResult as ap, type BuildCreditMenuArgs as aq, type BuilderIdentity as ar, CREDIT_ENVELOPE_KEYS as as, type CreateX402BatchSettlementServerOpts as at, type CreditEnvelope as au, CreditEnvelopeError as av, type CreditFundCommitment as aw, type CreditTerms as ax, DEFAULT_INVOICE_TTL_SECONDS as ay, type DVMHost as az, type AppEnv as b, type X402ExactAcceptance as b0, X402ExactIntentConflictError as b1, type X402ExactSettlementAttempt as b2, type X402ExactSettlementChainEvidence as b3, type X402ExactSettlementEffect as b4, X402ExactSettlementEvidenceMissingError as b5, type X402ExactSettlementEvidenceReader as b6, type X402ExactSettlementIntent as b7, X402ExactSettlementNotReadyError as b8, X402ExactSettlementServer as b9, type X402ExactSettlementServerOpts as ba, type X402ExactSettlementStatus as bb, type X402ExactSettlementStore as bc, type X402SettlementChainEvidence as bd, type X402SettlementEvidenceReader as be, X402SettlementSubmissionError as bf, X402_BATCH_AUTO_SETTLEMENT as bg, X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS as bh, X402_BATCH_SETTLEMENT_NETWORK as bi, attachCreditMenu as bj, buildCreditMenu as bk, createDVMHost as bl, createX402BatchSettlementServer as bm, creditEnvelopeIgnoreFields as bn, drawSettlementRef as bo, extractCreditEnvelope as bp, fundingCommitment as bq, selectPrimaryCredit as br, signHostingControl as bs, stripCreditEnvelope as bt, toCreditView as bu, type CreditFundingReport as c, type FiatDenominationFailure as d, type FundOnlyRequest as e, type PaymentErrorCode as f, type PaymentErrorDetail as g, type PaymentInfo as h, type ResolvedFx as i, type RevenueBootCheckOpts as j, type ServerJob as k, type ShortPayForfeit as l, type TempoObserverHealth as m, TempoSessionChannelMismatchError as n, type VerifyIncomingSnapshot as o, X402FacilitatorHealth as p, type X402SettlementEvidenceOutcome as q, type X402SettlementRepair as r, type X402SettlementRepairRefusal as s, type X402SettlementRepaired as t, type X402WedgedSettlement as u, type X402WedgedSettlementPage as v, X402_BATCH_SETTLEMENT_MAINNET_NETWORK as w, abortJob as x, applyPaymentInfoToJob as y, assertRevenueReporterReady as z };
4542
+ export { isDerivedCreditId as $, type AccumulatorPool as A, assertRevenueReporterReady as B, type ConsumedCredentialStore as C, buildPaymentErrorResponse as D, clearAccumulatorForDvm as E, type FiatDenomination as F, createDVMServer as G, creditDepositPayload as H, type IncomingPaymentOpts as I, JobCancelledError as J, derivedFundCreditId as K, devModeSkipsPaymentVerification as L, MintHealthTracker as M, fromJobRecord as N, fundedMicroFor as O, PAYMENT_PROOF_KEYS as P, hasPaymentProof as Q, type ReporterBannerOpts as R, type SDKServerOpts as S, type TempoChannelReport as T, type UpfrontPaymentOpts as U, type VerifiedIncomingPayment as V, hashLockKey as W, type X402BatchChannelObservation as X, implicitCreditId as Y, initWalletAccumulatorTable as Z, insertAccumulatorRows as _, type AccumulatorQuerier as a, type X402BatchAcceptance as a$, isTerminal as a0, isYieldMessage as a1, issueUpfrontChallenges as a2, msatsToFiatMicro as a3, paymentErrorBody as a4, pinAskFiat as a5, priceFiatMicro as a6, processIncomingPayment as a7, providerMessage as a8, repairX402ExactSettlementEffect as a9, type DVMHost as aA, type HostingClosureCommand as aB, type HostingClosureEvidence as aC, type HostingControlCommand as aD, type HostingControlConfig as aE, type HostingControlStatus as aF, JobManager as aG, type JobManagerOpts as aH, type LightningReceiveConfig as aI, MIN_INVOICE_TTL_SECONDS as aJ, MemoryConsumedCredentialStore as aK, type MemoryConsumedCredentialStoreOpts as aL, MemoryProcessedPaymentStore as aM, MemoryX402ExactSettlementStore as aN, type MountOpts as aO, type OwnerDisplay as aP, type PaidJobCompletion as aQ, type PaymentMode as aR, type PlatformReporterOpts as aS, PostgresProcessedPaymentStore as aT, PostgresX402ExactSettlementStore as aU, type PriceFiat as aV, type ProcessedPaymentQuerier as aW, type ProcessedPaymentRail as aX, type ProcessedPaymentRecord as aY, ProcessedPaymentReplayError as aZ, type ProcessedPaymentStore as a_, resolveFxSnapshot as aa, resolvePriceFiat as ab, revenueReporterBannerState as ac, toCreditTerms as ad, toJobRecord as ae, unknownRouteNotFound as af, verifyIncomingPayment as ag, verifyTempoSessionManagementCredential as ah, verifyUpfrontPayment as ai, x402RequiredUsdcMicro as aj, x402SettledShare as ak, type CreditMenu as al, ReceiptIssuer as am, LightningReceive as an, TempoSettlementReadiness as ao, type DVMHostOpts as ap, type DVMServeResult as aq, type BuildCreditMenuArgs as ar, type BuilderIdentity as as, CREDIT_ENVELOPE_KEYS as at, type CreateX402BatchSettlementServerOpts as au, type CreditEnvelope as av, CreditEnvelopeError as aw, type CreditFundCommitment as ax, type CreditTerms as ay, DEFAULT_INVOICE_TTL_SECONDS as az, type AppEnv as b, type X402BatchFunding as b0, type X402BatchRefusal as b1, type X402BatchSettlementServer as b2, type X402ExactAcceptance as b3, X402ExactIntentConflictError as b4, type X402ExactSettlementAttempt as b5, type X402ExactSettlementChainEvidence as b6, type X402ExactSettlementEffect as b7, X402ExactSettlementEvidenceMissingError as b8, type X402ExactSettlementEvidenceReader as b9, type X402ExactSettlementIntent as ba, X402ExactSettlementNotReadyError as bb, X402ExactSettlementServer as bc, type X402ExactSettlementServerOpts as bd, type X402ExactSettlementStatus as be, type X402ExactSettlementStore as bf, type X402SettlementChainEvidence as bg, type X402SettlementEvidenceReader as bh, X402SettlementSubmissionError as bi, X402_BATCH_AUTO_SETTLEMENT as bj, X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS as bk, X402_BATCH_SETTLEMENT_NETWORK as bl, attachCreditMenu as bm, buildCreditMenu as bn, createDVMHost as bo, createX402BatchSettlementServer as bp, creditEnvelopeIgnoreFields as bq, drawSettlementRef as br, extractCreditEnvelope as bs, fundingCommitment as bt, selectPrimaryCredit as bu, signHostingClosure as bv, signHostingControl as bw, stripCreditEnvelope as bx, toCreditView as by, type CreditFundingReport as c, type FiatDenominationFailure as d, type FundOnlyRequest as e, type PaymentErrorCode as f, type PaymentErrorDetail as g, type PaymentInfo as h, PostgresTempoChargeStore as i, type ResolvedFx as j, type RevenueBootCheckOpts as k, type ServerJob as l, type ShortPayForfeit as m, type TempoObserverHealth as n, TempoSessionChannelMismatchError as o, type VerifyIncomingSnapshot as p, X402FacilitatorHealth as q, type X402SettlementEvidenceOutcome as r, type X402SettlementRepair as s, type X402SettlementRepairRefusal as t, type X402SettlementRepaired as u, type X402WedgedSettlement as v, type X402WedgedSettlementPage as w, X402_BATCH_SETTLEMENT_MAINNET_NETWORK as x, abortJob as y, applyPaymentInfoToJob as z };
@@ -1,4 +1,4 @@
1
- import { C as Currency } from './step-cache-v2yhyhSZ.js';
1
+ import { C as Currency } from './step-cache-Bi43A0JN.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,17 +1,17 @@
1
- import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-v2yhyhSZ.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-v2yhyhSZ.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, P as PlatformFxSource, d as createFxFetcher, f as fxRateFor, r as resolveFxSourceFromEnv } from './fx-DhyT1Cjh.js';
4
- export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-Cu9G6xv2.js';
5
- export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-D3CcZp_g.js';
1
+ import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './step-cache-Bi43A0JN.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-Bi43A0JN.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, P as PlatformFxSource, d as createFxFetcher, f as fxRateFor, r as resolveFxSourceFromEnv } from './fx-DuaYHvVn.js';
4
+ export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-AZPVq4eU.js';
5
+ export { J as JobRecord, a as JobStatus, b as JobStore } from './job-store-D6Rjj5Oi.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';
9
9
  import 'mppx';
10
10
  import '@x402/core/server';
11
11
  import '@x402/evm/batch-settlement/server';
12
- import 'viem';
13
12
  import 'pg';
14
13
  import '@x402/core/types';
14
+ import 'viem';
15
15
  import '@cashu/cashu-ts';
16
16
 
17
17
  /**