@dvmkit/sdk 0.8.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{chunk-ILBSZMJL.js → chunk-2XQLL6N6.js} +1 -1
  2. package/dist/{chunk-UVS7MRJX.js → chunk-3Q6FTZDB.js} +2 -2
  3. package/dist/{chunk-OP7VCGQR.js → chunk-3R7NQA3Z.js} +1 -1
  4. package/dist/{chunk-RSNC5T6C.js → chunk-AJ6UHXUA.js} +1 -1
  5. package/dist/{chunk-ALWVJ2RB.js → chunk-EWZFANHJ.js} +3 -3
  6. package/dist/{chunk-J5J63WDC.js → chunk-FFXXGCVG.js} +3 -3
  7. package/dist/{chunk-UDJNZ3UG.js → chunk-JNECYURT.js} +1 -1
  8. package/dist/{chunk-IHQUBATH.js → chunk-KFCEXCZM.js} +3 -3
  9. package/dist/{chunk-NA2KOR6G.js → chunk-LDIPVPKI.js} +3 -3
  10. package/dist/{chunk-IOQIXRGM.js → chunk-M3T5JYDJ.js} +15 -8
  11. package/dist/{chunk-UWGBI5WK.js → chunk-MB6R4XPZ.js} +3 -3
  12. package/dist/{chunk-7PM4R4GD.js → chunk-MMGSYMIC.js} +1 -1
  13. package/dist/{chunk-QKE5NDPF.js → chunk-MU3IE434.js} +348 -80
  14. package/dist/{chunk-BFGQG4WY.js → chunk-QGNXYVBO.js} +52 -12
  15. package/dist/{chunk-JIZ4ZIXX.js → chunk-QNKK7SPY.js} +652 -245
  16. package/dist/{chunk-FM6QAGJC.js → chunk-STJBBVNL.js} +24 -8
  17. package/dist/{chunk-NU5RWJ5B.js → chunk-VMHYGKWT.js} +3 -3
  18. package/dist/{chunk-AVV5SYGO.js → chunk-VTHYQCDB.js} +1 -1
  19. package/dist/{chunk-ZEPJF4JC.js → chunk-VUGEEMLT.js} +4 -4
  20. package/dist/{chunk-2U6LAASN.js → chunk-W3VGCNG6.js} +1 -1
  21. package/dist/{chunk-G3MPHW5I.js → chunk-Y6DO5WSO.js} +3 -3
  22. package/dist/{chunk-AGE5XZKE.js → chunk-YOSZIWC3.js} +17 -4
  23. package/dist/{content-retention-B7ddtJ2y.d.ts → content-retention-CrILCNxk.d.ts} +1 -1
  24. package/dist/{credit-ledger-KIQIE6I6.js → credit-ledger-4PZNAMDT.js} +4 -4
  25. package/dist/{credit-menu-BH3g9GQa.d.ts → credit-menu-VwX_6KM7.d.ts} +4 -4
  26. package/dist/{fx-DN26_J7o.d.ts → fx-BM5h4o5S.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 +7 -7
  30. package/dist/internal/caller.js +16 -16
  31. package/dist/internal/server.d.ts +7 -7
  32. package/dist/internal/server.js +26 -26
  33. package/dist/{job-store-Cq21JT37.d.ts → job-store-92v8e1LQ.d.ts} +1 -1
  34. package/dist/{lightning-backend-S8F8nf8q.d.ts → lightning-backend-9oky_wJi.d.ts} +1 -1
  35. package/dist/{memory-credit-ledger-ATYFAYBG.js → memory-credit-ledger-RP7DT5IY.js} +5 -5
  36. package/dist/{mpp-setup-ZTORW3VF.js → mpp-setup-FURD45LI.js} +5 -3
  37. package/dist/{payout-reporter-NN6K2IVQ.js → payout-reporter-HVJ6WUF3.js} +2 -2
  38. package/dist/{postgres-consumed-credential-store-XJTE5PCA.js → postgres-consumed-credential-store-WO6OCFXZ.js} +3 -3
  39. package/dist/{postgres-job-store-AR6ZJUQV.js → postgres-job-store-FSRUPYH2.js} +2 -2
  40. package/dist/{postgres-replay-store-33K33QV7.js → postgres-replay-store-XXJSA457.js} +2 -2
  41. package/dist/{pricing-G5IN5YJE.js → pricing-X4XU5HXY.js} +3 -3
  42. package/dist/{revenue-reporter-KDUZLD5F.js → revenue-reporter-EV3K5L6B.js} +2 -2
  43. package/dist/server/index.d.ts +78 -11
  44. package/dist/server/index.js +87 -45
  45. package/dist/{step-cache-CR12EZ1Q.d.ts → step-cache--7yA5Ihr.d.ts} +99 -12
  46. package/dist/{tempo-charge-store-XEGJYM3G.js → tempo-charge-store-5JOIYUIH.js} +2 -2
  47. package/dist/{tempo-session-store-3WTDOO7H.js → tempo-session-store-S6QMLQUA.js} +3 -3
  48. package/dist/testing/index.d.ts +3 -3
  49. package/dist/testing/index.js +7 -7
  50. package/dist/{usd-s_VZ_eS7.d.ts → usd-C7lvLvLk.d.ts} +1 -1
  51. package/dist/{x402-HQ5GRQZU.js → x402-EN5LSOVM.js} +4 -4
  52. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- import {
2
- diagnosticConsole
3
- } from "./chunk-BFGQG4WY.js";
4
1
  import {
5
2
  withSdkInitLock
6
3
  } from "./chunk-COYKJRMM.js";
4
+ import {
5
+ diagnosticConsole
6
+ } from "./chunk-QGNXYVBO.js";
7
7
 
8
8
  // src/sdk/server/postgres-consumed-credential-store.ts
9
9
  var DEFAULT_TABLE_NAME = "consumed_credentials";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  PostgresJobStore
3
- } from "./chunk-G3MPHW5I.js";
3
+ } from "./chunk-Y6DO5WSO.js";
4
4
  import "./chunk-AFV77S4C.js";
5
5
  import "./chunk-BQJIFRAZ.js";
6
- import "./chunk-BFGQG4WY.js";
7
6
  import "./chunk-COYKJRMM.js";
7
+ import "./chunk-QGNXYVBO.js";
8
8
  export {
9
9
  PostgresJobStore
10
10
  };
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  PostgresReplayStore
3
- } from "./chunk-ALWVJ2RB.js";
4
- import "./chunk-BFGQG4WY.js";
3
+ } from "./chunk-EWZFANHJ.js";
5
4
  import "./chunk-COYKJRMM.js";
5
+ import "./chunk-QGNXYVBO.js";
6
6
  export {
7
7
  PostgresReplayStore
8
8
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  buildUpfront
3
- } from "./chunk-UDJNZ3UG.js";
3
+ } from "./chunk-JNECYURT.js";
4
4
  import {
5
5
  DEFAULT_FX_CURRENCIES,
6
6
  DEFAULT_FX_RATE_SOURCE,
@@ -22,8 +22,8 @@ import {
22
22
  satsToFiat,
23
23
  validateCurrency,
24
24
  warmFxSnapshot
25
- } from "./chunk-2U6LAASN.js";
26
- import "./chunk-BFGQG4WY.js";
25
+ } from "./chunk-W3VGCNG6.js";
26
+ import "./chunk-QGNXYVBO.js";
27
27
  export {
28
28
  DEFAULT_FX_CURRENCIES,
29
29
  DEFAULT_FX_RATE_SOURCE,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  RevenueReporter
3
- } from "./chunk-NU5RWJ5B.js";
4
- import "./chunk-BFGQG4WY.js";
3
+ } from "./chunk-VMHYGKWT.js";
5
4
  import "./chunk-COYKJRMM.js";
5
+ import "./chunk-QGNXYVBO.js";
6
6
  export {
7
7
  RevenueReporter
8
8
  };
@@ -1,15 +1,15 @@
1
- import { ae as CashuMode, bL as CreditDrainEnqueue, bM as HostedSettlementReportObligations, R as ResolvedCreditConfig, bN as DVMAuthScheme, B as SignedRequestDomain, bO as CreditLedgerLike, bP as X402RefundSettlementGate, bQ as CreditSnapshot, bR as DrawResult, bS as X402SettlementStatus, bT as X402UnresolvedRefund, bU as GrownDrawResult, bV as DrawResolution, bW as FundingRecord, $ as FundingReceipt, bX as CreditInvoiceRecord, bY as InvoiceSettlement, bZ as BlockedInvoiceCursor, b_ as InvoiceReconciliation, b$ as InvoiceWriteOff, c0 as DrawRecord, c1 as StalePendingDrawCursor, c2 as TempoCreditLossEvidence, c3 as CreditLedgerQuerier, c4 as TempoCreditLoss, c5 as X402CreditLossEvidence, c6 as X402CreditLoss, c7 as DrainMethod, c8 as DrainRequestResult, c9 as BitcoinDepositLiability, bp as FundingLot, ca as CreditDrainRecord, cb as ChannelDrainCursor, cc as DrainWriteOff, cd as DrainReleaseResult, ce as DrainFulfilment, cf as DrainTransitionResult, cg as HostingCleanupFence, a0 as JobReceipt, a5 as Message, K as KVStore, G as SignedRequestReplayStore, Z as ZodLike, a as DVMDescriptor } from '../step-cache-CR12EZ1Q.js';
2
- export { ch as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, ci as ClientCompatibility, cj as ClientCompatibilityEnv, ck as ClientCompatibilityGate, cl as ClientCompatibilityRequirement, cm as ClientSemVer, f as CreateSignedRequestVerifierOpts, cn as CreditFundingBasis, co as CreditInvoiceStatus, cp as CreditLedger, cq as CreditLedgerError, cr as CreditLedgerErrorCode, cs as CreditLedgerErrorDetails, ct as CreditLedgerPool, cu as CreditStatus, cv as DRAIN_DELIVERY_RESERVE_SATS, cw as DVM_PROTOCOL_VERSION, cx as DrainConflictReason, cy as DrawRailValue, cz as DrawStatus, cA as JobCostReportPayload, cB as JobTerminalReportPayload, cC as PostgresX402ChannelStorage, cD as ReplayStoreBackend, cE as RevenueSkippedNoRailPayload, cF as RevenueSkippedNoRailReason, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, cG as Secp256k1AuthOpts, z as SignedRequestAudience, E as SignedRequestError, F as SignedRequestFailure, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, cH as X402ChannelStorageOpts, cI as X402RelayLockHolder, cJ as X402RelaySubmissionLock, cK as X402RelaySubmissionLockError, cL as allocateDrawValue, cM as clientCompatibilityAttributes, cN as clientCompatibilityMiddleware, cO as clientUpgradeRequired, O as createSignedRequestVerifier, cP as parseClientCapabilities, cQ as parseClientCompatibility, cR as parseDvmClient, cS as parseProtocolVersion, cT as requireClientCompatibility, cU as secp256k1Auth, cV as signedRequestInput, V as signedRequestStatementHeader } from '../step-cache-CR12EZ1Q.js';
1
+ import { ae as CashuMode, bL as CreditLedgerQuerier, bM as CreditDrainEnqueue, bN as HostedSettlementReportObligations, R as ResolvedCreditConfig, bO as DVMAuthScheme, B as SignedRequestDomain, bP as CreditLedgerLike, bQ as X402RefundSettlementGate, bR as CreditSnapshot, bS as DrawResult, bT as X402SettlementStatus, bU as X402UnresolvedRefund, bV as GrownDrawResult, bW as DrawResolution, bX as FundingRecord, $ as FundingReceipt, bY as CreditInvoiceRecord, bZ as InvoiceSettlement, b_ as BlockedInvoiceCursor, b$ as InvoiceReconciliation, c0 as InvoiceWriteOff, c1 as DrawRecord, c2 as StalePendingDrawCursor, c3 as TempoCreditLossEvidence, c4 as TempoCreditLoss, c5 as X402CreditLossEvidence, c6 as X402CreditLoss, c7 as DrainMethod, c8 as DrainRequestResult, c9 as BitcoinDepositLiability, bp as FundingLot, ca as CreditDrainRecord, cb as ChannelDrainCursor, cc as DrainWriteOff, cd as DrainTransitionResult, ce as DrainReleaseResult, cf as DrainFulfilment, cg as HostingCleanupFence, a0 as JobReceipt, a5 as Message, K as KVStore, G as SignedRequestReplayStore, Z as ZodLike, a as DVMDescriptor } from '../step-cache--7yA5Ihr.js';
2
+ export { ch as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, ci as ClientCompatibility, cj as ClientCompatibilityEnv, ck as ClientCompatibilityGate, cl as ClientCompatibilityRequirement, cm as ClientSemVer, f as CreateSignedRequestVerifierOpts, cn as CreditFundingBasis, co as CreditInvoiceStatus, cp as CreditLedger, cq as CreditLedgerError, cr as CreditLedgerErrorCode, cs as CreditLedgerErrorDetails, ct as CreditLedgerPool, cu as CreditStatus, cv as DRAIN_DELIVERY_RESERVE_SATS, cw as DVM_PROTOCOL_VERSION, cx as DrainConflictReason, cy as DrawRailValue, cz as DrawStatus, cA as HostedTempoCloseReportWriteOff, cB as JobCostReportPayload, cC as JobTerminalReportPayload, cD as PostgresX402ChannelStorage, cE as ReplayStoreBackend, cF as RevenueSkippedNoRailPayload, cG as RevenueSkippedNoRailReason, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, cH as Secp256k1AuthOpts, z as SignedRequestAudience, E as SignedRequestError, F as SignedRequestFailure, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, cI as X402ChannelStorageOpts, cJ as X402RelayLockHolder, cK as X402RelaySubmissionLock, cL as X402RelaySubmissionLockError, cM as allocateDrawValue, cN as clientCompatibilityAttributes, cO as clientCompatibilityMiddleware, cP as clientUpgradeRequired, O as createSignedRequestVerifier, cQ as parseClientCapabilities, cR as parseClientCompatibility, cS as parseDvmClient, cT as parseProtocolVersion, cU as requireClientCompatibility, cV as retryHostedTempoCloseReport, cW as secp256k1Auth, cX as signedRequestInput, V as signedRequestStatementHeader, cY as writeOffHostedTempoCloseReport } from '../step-cache--7yA5Ihr.js';
3
3
  import { Pool } from 'pg';
4
- import { au as CreditMenu, a as AppEnv, U as UpfrontPaymentOpts, i as PaymentInfo, av as ReceiptIssuer, aw as LightningReceive, ax as TempoSettlementReadiness, ay as DVMHostOpts, az as DVMServeResult, L as LockPubkeyStateLoader, C as ConsumedCredentialStore } from '../credit-menu-BH3g9GQa.js';
5
- export { aA as BuildCreditMenuArgs, aB as BuilderIdentity, aC as CREDIT_ENVELOPE_KEYS, aD as CreateX402BatchSettlementServerOpts, aE as CreditEnvelope, aF as CreditEnvelopeError, aG as CreditFundCommitment, aH as CreditTerms, aI as DEFAULT_INVOICE_TTL_SECONDS, aJ as DVMHost, aK as HostingClosureCommand, aL as HostingClosureEvidence, aM as HostingControlCommand, aN as HostingControlConfig, aO as HostingControlStatus, aP as JobManager, aQ as JobManagerOpts, aR as LightningReceiveConfig, aS as MIN_INVOICE_TTL_SECONDS, aT as MemoryConsumedCredentialStore, aU as MemoryConsumedCredentialStoreOpts, aV as MemoryProcessedPaymentStore, aW as MemoryX402ExactSettlementStore, aX as MountOpts, aY as OwnerDisplay, aZ as PaidJobCompletion, a_ as PaymentMode, a$ as PlatformReporterOpts, b0 as PostgresProcessedPaymentStore, b1 as PostgresX402ExactSettlementStore, b2 as PriceFiat, b3 as ProcessedPaymentQuerier, b4 as ProcessedPaymentRail, b5 as ProcessedPaymentRecord, b6 as ProcessedPaymentReplayError, b7 as ProcessedPaymentStore, b8 as X402BatchAcceptance, b9 as X402BatchFunding, ba as X402BatchRefusal, bb as X402BatchSettlementServer, bc as X402ExactAcceptance, bd as X402ExactIntentConflictError, be as X402ExactSettlementAttempt, bf as X402ExactSettlementChainEvidence, bg as X402ExactSettlementEffect, bh as X402ExactSettlementEvidenceMissingError, bi as X402ExactSettlementEvidenceReader, bj as X402ExactSettlementIntent, bk as X402ExactSettlementNotReadyError, bl as X402ExactSettlementServer, bm as X402ExactSettlementServerOpts, bn as X402ExactSettlementStatus, bo as X402ExactSettlementStore, bp as X402SettlementChainEvidence, bq as X402SettlementEvidenceReader, br as X402SettlementSubmissionError, bs as X402_BATCH_AUTO_SETTLEMENT, bt as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bu as X402_BATCH_SETTLEMENT_NETWORK, bv as attachCreditMenu, bw as buildCreditMenu, bx as createDVMHost, by as createX402BatchSettlementServer, bz as creditEnvelopeIgnoreFields, bA as drawSettlementRef, bB as extractCreditEnvelope, bC as fundingCommitment, bD as selectPrimaryCredit, bE as signHostingClosure, bF as signHostingControl, bG as stripCreditEnvelope, bH as toCreditView } from '../credit-menu-BH3g9GQa.js';
4
+ import { au as CreditMenu, a as AppEnv, U as UpfrontPaymentOpts, i as PaymentInfo, av as ReceiptIssuer, aw as LightningReceive, ax as TempoSettlementReadiness, ay as DVMHostOpts, az as DVMServeResult, L as LockPubkeyStateLoader, C as ConsumedCredentialStore } from '../credit-menu-VwX_6KM7.js';
5
+ export { aA as BuildCreditMenuArgs, aB as BuilderIdentity, aC as CREDIT_ENVELOPE_KEYS, aD as CreateX402BatchSettlementServerOpts, aE as CreditEnvelope, aF as CreditEnvelopeError, aG as CreditFundCommitment, aH as CreditTerms, aI as DEFAULT_INVOICE_TTL_SECONDS, aJ as DVMHost, aK as HostingClosureCommand, aL as HostingClosureEvidence, aM as HostingControlCommand, aN as HostingControlConfig, aO as HostingControlStatus, aP as JobManager, aQ as JobManagerOpts, aR as LightningReceiveConfig, aS as MIN_INVOICE_TTL_SECONDS, aT as MemoryConsumedCredentialStore, aU as MemoryConsumedCredentialStoreOpts, aV as MemoryProcessedPaymentStore, aW as MemoryX402ExactSettlementStore, aX as MountOpts, aY as OwnerDisplay, aZ as PaidJobCompletion, a_ as PaymentMode, a$ as PlatformReporterOpts, b0 as PostgresProcessedPaymentStore, b1 as PostgresX402ExactSettlementStore, b2 as PriceFiat, b3 as ProcessedPaymentQuerier, b4 as ProcessedPaymentRail, b5 as ProcessedPaymentRecord, b6 as ProcessedPaymentReplayError, b7 as ProcessedPaymentStore, b8 as X402BatchAcceptance, b9 as X402BatchFunding, ba as X402BatchRefusal, bb as X402BatchSettlementServer, bc as X402ExactAcceptance, bd as X402ExactIntentConflictError, be as X402ExactSettlementAttempt, bf as X402ExactSettlementChainEvidence, bg as X402ExactSettlementEffect, bh as X402ExactSettlementEvidenceMissingError, bi as X402ExactSettlementEvidenceReader, bj as X402ExactSettlementIntent, bk as X402ExactSettlementNotReadyError, bl as X402ExactSettlementServer, bm as X402ExactSettlementServerOpts, bn as X402ExactSettlementStatus, bo as X402ExactSettlementStore, bp as X402SettlementChainEvidence, bq as X402SettlementEvidenceReader, br as X402SettlementSubmissionError, bs as X402_BATCH_AUTO_SETTLEMENT, bt as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bu as X402_BATCH_SETTLEMENT_NETWORK, bv as attachCreditMenu, bw as buildCreditMenu, bx as createDVMHost, by as createX402BatchSettlementServer, bz as creditEnvelopeIgnoreFields, bA as drawSettlementRef, bB as extractCreditEnvelope, bC as fundingCommitment, bD as selectPrimaryCredit, bE as signHostingClosure, bF as signHostingControl, bG as stripCreditEnvelope, bH as toCreditView } from '../credit-menu-VwX_6KM7.js';
6
6
  import { Context, Hono } from 'hono';
7
7
  import { z } from 'zod';
8
- import { F as FxFetcher } from '../fx-DN26_J7o.js';
9
- import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters, b as JobStore } from '../job-store-Cq21JT37.js';
10
- export { a as JobStatus, h as isStreamableJobStore } from '../job-store-Cq21JT37.js';
11
- import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-B7ddtJ2y.js';
12
- export { b as ContentHold, c as ContentHoldError, d as ContentHoldEvent, e as ContentHoldStore, f as ContentHoldsResponse, J as JobContentMetadata, g as baselineContentExpiry, h as contentMetadata, i as isContentHoldStore } from '../content-retention-B7ddtJ2y.js';
8
+ import { F as FxFetcher } from '../fx-BM5h4o5S.js';
9
+ import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters, b as JobStore } from '../job-store-92v8e1LQ.js';
10
+ export { a as JobStatus, h as isStreamableJobStore } from '../job-store-92v8e1LQ.js';
11
+ import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-CrILCNxk.js';
12
+ export { b as ContentHold, c as ContentHoldError, d as ContentHoldEvent, e as ContentHoldStore, f as ContentHoldsResponse, J as JobContentMetadata, g as baselineContentExpiry, h as contentMetadata, i as isContentHoldStore } from '../content-retention-CrILCNxk.js';
13
13
  export { P as PinnedFetch, S as SSRFError, a as SSRFGuardOpts, b as SSRFReason, c as SSRFResolver, d as assertSafeUrl, e as createPinnedFetch } from '../ssrf-dMooihtY.js';
14
14
  import { Env, BlankSchema } from 'hono/types';
15
15
  import 'mppx';
@@ -17,7 +17,7 @@ import '@x402/core/server';
17
17
  import '@x402/evm/batch-settlement/server';
18
18
  import '@x402/core/types';
19
19
  import 'viem';
20
- import '../lightning-backend-S8F8nf8q.js';
20
+ import '../lightning-backend-9oky_wJi.js';
21
21
  import '@cashu/cashu-ts';
22
22
 
23
23
  /** Lifetime of a per-call implicit credit before the ledger refuses new draws. */
@@ -43,6 +43,35 @@ interface ResolvedCashuOpts {
43
43
  */
44
44
  declare function resolveCashuOptsFromEnv(env: Record<string, string>, pool?: Pool, cashuModeHint?: CashuMode): Promise<ResolvedCashuOpts>;
45
45
 
46
+ interface PendingImplicitDrawGroup {
47
+ /** Null when historical funding has no recorded rail. */
48
+ rail: string | null;
49
+ currency: string;
50
+ drawCount: number;
51
+ /** Held amount in integer millionths of this group's currency. */
52
+ amountMicro: number;
53
+ /** Oldest pending draw's creation time, in epoch milliseconds. */
54
+ oldestDrawAt: number;
55
+ }
56
+ interface PendingImplicitDrawSummary {
57
+ drawCount: number;
58
+ /** Null when no implicit draws remain pending. */
59
+ oldestDrawAt: number | null;
60
+ byRailCurrency: PendingImplicitDrawGroup[];
61
+ }
62
+ /**
63
+ * Read database-wide pending holds on implicit credits using a single SELECT. The supplied
64
+ * database must already have the SDK credit schema; this function never initializes it or
65
+ * starts a server. Database access supplies administrative authorization.
66
+ *
67
+ * Includes unfinished jobs and holds without a job record, regardless of stop reason. These
68
+ * funds remain held until settlement or release; this is not a total of payable refunds or
69
+ * all caller balances. No caller identifiers are returned. Unsafe integer totals throw.
70
+ */
71
+ declare function readPendingImplicitDraws({ db, }: {
72
+ db: CreditLedgerQuerier;
73
+ }): Promise<PendingImplicitDrawSummary>;
74
+
46
75
  /**
47
76
  * Reporting is optional; an unwired host still runs the money transition.
48
77
  */
@@ -300,6 +329,10 @@ declare class MemoryCreditLedger implements CreditLedgerLike {
300
329
  creditId: string;
301
330
  drainId: string;
302
331
  }): Promise<void>;
332
+ requireTempoDrainExit(args: {
333
+ creditId: string;
334
+ drainId: string;
335
+ }): Promise<DrainTransitionResult>;
303
336
  releaseDrain(args: {
304
337
  creditId: string;
305
338
  drainId: string;
@@ -532,4 +565,38 @@ interface InstallAdminContentRoutesOpts {
532
565
  }
533
566
  declare function installAdminContentRoutes<E extends Env = Env, S extends BlankSchema = BlankSchema>(app: Hono<E, S>, opts: InstallAdminContentRoutesOpts): void;
534
567
 
535
- export { BitcoinDepositLiability, BlockedInvoiceCursor, CREDIT_REQUEST_SCHEMA, ConsumedCredentialStore, ContentHoldHistory, ContentHoldMutation, CreditInvoiceRecord, CreditLedgerLike, CreditLedgerQuerier, CreditMenu, type CreditRequest, type CreditRouteDeps, CreditSnapshot, DVMAuthScheme, DVMHostOpts, DVMServeResult, DrawRecord, DrawResolution, DrawResult, FundingRecord, GrownDrawResult, IMPLICIT_CREDIT_TTL_MS, type InitLockPool, type InstallAdminContentRoutesOpts, InvoiceReconciliation, InvoiceSettlement, InvoiceWriteOff, JobRecord, JobStore, LightningReceive, MemoryCreditLedger, PostgresJobStore, PostgresKVStore, PostgresReplayStore, type PostgresReplayStoreOpts, REQUEST_ID_FIELD, type ResolvedCashuOpts, SDK_INIT_ADVISORY_LOCK, SignedRequestDomain, SignedRequestReplayStore, StalePendingDrawCursor, StreamableJobStore, handleCreditRequest, hasInvalidRequestId, installAdminContentRoutes, protocolEnvelopeIgnoreFields, requestIdFromEnvelope, resolveCashuOptsFromEnv, serve, stripProtocolEnvelope, withSdkInitLock };
568
+ interface TempoCloseReportSummary {
569
+ obligation_id: string;
570
+ channel_id: string;
571
+ /** Potential builder payout, as a decimal string in native token units. */
572
+ amount_native: string;
573
+ status: "unmatched" | "no_report";
574
+ created_at_ms: number;
575
+ updated_at_ms: number;
576
+ delivered_at_ms: number | null;
577
+ /** Snapshot of the store's retry predicate; a later state change can still cause a conflict. */
578
+ retryable: boolean;
579
+ write_off_allowed: boolean;
580
+ /** True when a retained write-off decision exists, including after an explicit retry. */
581
+ written_off: boolean;
582
+ write_off_note: string | null;
583
+ written_off_at_ms: number | null;
584
+ }
585
+ interface TempoCloseReportsResponse {
586
+ reports: TempoCloseReportSummary[];
587
+ next_after?: string;
588
+ }
589
+ interface RetryTempoCloseReportResponse {
590
+ status: "reserved";
591
+ obligation_id: string;
592
+ }
593
+ interface WriteOffTempoCloseReportResponse {
594
+ status: "written_off";
595
+ obligation_id: string;
596
+ channel_id: string;
597
+ /** Builder payout abandoned, as a decimal string in native token units. */
598
+ amount_forgone_native: string;
599
+ note: string;
600
+ }
601
+
602
+ export { BitcoinDepositLiability, BlockedInvoiceCursor, CREDIT_REQUEST_SCHEMA, ConsumedCredentialStore, ContentHoldHistory, ContentHoldMutation, CreditInvoiceRecord, CreditLedgerLike, CreditLedgerQuerier, CreditMenu, type CreditRequest, type CreditRouteDeps, CreditSnapshot, DVMAuthScheme, DVMHostOpts, DVMServeResult, DrawRecord, DrawResolution, DrawResult, FundingRecord, GrownDrawResult, IMPLICIT_CREDIT_TTL_MS, type InitLockPool, type InstallAdminContentRoutesOpts, InvoiceReconciliation, InvoiceSettlement, InvoiceWriteOff, JobRecord, JobStore, LightningReceive, MemoryCreditLedger, type PendingImplicitDrawGroup, type PendingImplicitDrawSummary, PostgresJobStore, PostgresKVStore, PostgresReplayStore, type PostgresReplayStoreOpts, REQUEST_ID_FIELD, type ResolvedCashuOpts, type RetryTempoCloseReportResponse, SDK_INIT_ADVISORY_LOCK, SignedRequestDomain, SignedRequestReplayStore, StalePendingDrawCursor, StreamableJobStore, type TempoCloseReportSummary, type TempoCloseReportsResponse, type WriteOffTempoCloseReportResponse, handleCreditRequest, hasInvalidRequestId, installAdminContentRoutes, protocolEnvelopeIgnoreFields, readPendingImplicitDraws, requestIdFromEnvelope, resolveCashuOptsFromEnv, serve, stripProtocolEnvelope, withSdkInitLock };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PostgresReplayStore
3
- } from "../chunk-ALWVJ2RB.js";
3
+ } from "../chunk-EWZFANHJ.js";
4
4
  import {
5
5
  PostgresKVStore
6
6
  } from "../chunk-V5ZRATJH.js";
@@ -18,7 +18,7 @@ import {
18
18
  parseNwcUri,
19
19
  validateX402Env,
20
20
  withNwcPool
21
- } from "../chunk-RSNC5T6C.js";
21
+ } from "../chunk-AJ6UHXUA.js";
22
22
  import {
23
23
  MemoryKVStore
24
24
  } from "../chunk-SDK6KDJN.js";
@@ -71,6 +71,7 @@ import {
71
71
  protocolEnvelopeIgnoreFields,
72
72
  requestIdFromEnvelope,
73
73
  requireClientCompatibility,
74
+ retryHostedTempoCloseReport,
74
75
  revenueReporterBannerState,
75
76
  seedLockPubkeyState,
76
77
  selectPrimaryCredit,
@@ -79,33 +80,32 @@ import {
79
80
  stripCreditEnvelope,
80
81
  stripProtocolEnvelope,
81
82
  toCreditView,
82
- unknownRouteNotFound
83
- } from "../chunk-JIZ4ZIXX.js";
83
+ unknownRouteNotFound,
84
+ writeOffHostedTempoCloseReport
85
+ } from "../chunk-QNKK7SPY.js";
84
86
  import {
85
- TEMPO_MODERATO_CHAIN_ID,
86
- TEMPO_MODERATO_RPC,
87
- TEMPO_SETTLEMENT_DEFAULT_LOW_BALANCE_MICRO,
88
- TempoSettlementReadiness,
89
- resolveTempoNetwork
90
- } from "../chunk-QKE5NDPF.js";
91
- import "../chunk-J5J63WDC.js";
92
- import "../chunk-AVV5SYGO.js";
87
+ MemoryProcessedPaymentStore,
88
+ PostgresProcessedPaymentStore,
89
+ ProcessedPaymentReplayError
90
+ } from "../chunk-XRLKGCAW.js";
91
+ import "../chunk-FFXXGCVG.js";
92
+ import "../chunk-VTHYQCDB.js";
93
93
  import {
94
94
  MemoryCreditLedger
95
- } from "../chunk-AGE5XZKE.js";
95
+ } from "../chunk-YOSZIWC3.js";
96
96
  import {
97
97
  PostgresJobStore
98
- } from "../chunk-G3MPHW5I.js";
98
+ } from "../chunk-Y6DO5WSO.js";
99
99
  import "../chunk-YG7G4DPZ.js";
100
100
  import {
101
101
  SignedRequestError,
102
102
  createDefaultReplayStore,
103
103
  createSignedRequestVerifier,
104
104
  signedRequestInput
105
- } from "../chunk-ILBSZMJL.js";
105
+ } from "../chunk-2XQLL6N6.js";
106
106
  import {
107
107
  isStreamableJobStore
108
- } from "../chunk-IHQUBATH.js";
108
+ } from "../chunk-KFCEXCZM.js";
109
109
  import {
110
110
  ContentHoldError,
111
111
  baselineContentExpiry,
@@ -116,7 +116,7 @@ import {
116
116
  IMPLICIT_CREDIT_TTL_MS,
117
117
  generateEphemeralReceiptKey,
118
118
  receiptPubkeyFromSecret
119
- } from "../chunk-ZEPJF4JC.js";
119
+ } from "../chunk-VUGEEMLT.js";
120
120
  import {
121
121
  X402_DEFAULT_FACILITATOR,
122
122
  X402_DEFAULT_NETWORK,
@@ -128,15 +128,11 @@ import {
128
128
  SIGNED_REQUEST_STATEMENT_VERSION,
129
129
  signedRequestStatementHeader
130
130
  } from "../chunk-UKD3R2KU.js";
131
- import "../chunk-OP7VCGQR.js";
132
- import {
133
- initLoggers
134
- } from "../chunk-IOQIXRGM.js";
131
+ import "../chunk-3R7NQA3Z.js";
135
132
  import "../chunk-FUJ36YDV.js";
136
- import "../chunk-66HGCPBU.js";
137
133
  import "../chunk-BQJIFRAZ.js";
138
- import "../chunk-UDJNZ3UG.js";
139
- import "../chunk-2U6LAASN.js";
134
+ import "../chunk-JNECYURT.js";
135
+ import "../chunk-W3VGCNG6.js";
140
136
  import {
141
137
  CreditLedger,
142
138
  CreditLedgerError,
@@ -144,25 +140,31 @@ import {
144
140
  PostgresX402ChannelStorage,
145
141
  X402RelaySubmissionLockError,
146
142
  allocateDrawValue
147
- } from "../chunk-FM6QAGJC.js";
143
+ } from "../chunk-STJBBVNL.js";
144
+ import {
145
+ SDK_INIT_ADVISORY_LOCK,
146
+ withSdkInitLock
147
+ } from "../chunk-COYKJRMM.js";
148
148
  import {
149
149
  applyRetryToPool
150
- } from "../chunk-7PM4R4GD.js";
150
+ } from "../chunk-MMGSYMIC.js";
151
151
  import {
152
152
  assertSupportedX402Network
153
153
  } from "../chunk-BPYMEMQX.js";
154
154
  import {
155
- diagnosticConsole
156
- } from "../chunk-BFGQG4WY.js";
155
+ TEMPO_MODERATO_CHAIN_ID,
156
+ TEMPO_MODERATO_RPC,
157
+ TEMPO_SETTLEMENT_DEFAULT_LOW_BALANCE_MICRO,
158
+ TempoSettlementReadiness,
159
+ resolveTempoNetwork
160
+ } from "../chunk-MU3IE434.js";
157
161
  import {
158
- MemoryProcessedPaymentStore,
159
- PostgresProcessedPaymentStore,
160
- ProcessedPaymentReplayError
161
- } from "../chunk-XRLKGCAW.js";
162
+ initLoggers
163
+ } from "../chunk-M3T5JYDJ.js";
164
+ import "../chunk-66HGCPBU.js";
162
165
  import {
163
- SDK_INIT_ADVISORY_LOCK,
164
- withSdkInitLock
165
- } from "../chunk-COYKJRMM.js";
166
+ diagnosticConsole
167
+ } from "../chunk-QGNXYVBO.js";
166
168
 
167
169
  // src/sdk/server/cashu-env.ts
168
170
  async function resolveCashuOptsFromEnv(env, pool, cashuModeHint) {
@@ -243,6 +245,43 @@ async function resolveCashuOptsFromEnv(env, pool, cashuModeHint) {
243
245
  return { cashuMode, lockPubkey, lockPubkeyGraceSeconds, db, dvmId, canonicalDvmId };
244
246
  }
245
247
 
248
+ // src/sdk/server/pending-implicit-draws.ts
249
+ async function readPendingImplicitDraws({
250
+ db
251
+ }) {
252
+ const { rows } = await db.query(`
253
+ SELECT c.rail, c.currency, COUNT(*)::text AS draw_count,
254
+ SUM(d.amount_micro)::text AS amount_micro,
255
+ MIN(d.created_at)::text AS oldest_draw_at
256
+ FROM credit_draws d
257
+ JOIN credits c ON c.credit_id = d.credit_id
258
+ WHERE d.status = 'pending' AND d.credit_id LIKE 'imp:%'
259
+ GROUP BY c.rail, c.currency
260
+ ORDER BY c.rail NULLS LAST, c.currency
261
+ `);
262
+ const byRailCurrency = rows.map((row) => ({
263
+ rail: row.rail,
264
+ currency: row.currency,
265
+ drawCount: safeInteger(row.draw_count),
266
+ amountMicro: safeInteger(row.amount_micro),
267
+ oldestDrawAt: safeInteger(row.oldest_draw_at)
268
+ }));
269
+ let count = 0n;
270
+ let oldestDrawAt = null;
271
+ for (const group of byRailCurrency) {
272
+ count += BigInt(group.drawCount);
273
+ oldestDrawAt = oldestDrawAt === null ? group.oldestDrawAt : Math.min(oldestDrawAt, group.oldestDrawAt);
274
+ }
275
+ return { drawCount: safeInteger(count.toString()), oldestDrawAt, byRailCurrency };
276
+ }
277
+ function safeInteger(value) {
278
+ const number = Number(value);
279
+ if (!/^\d+$/.test(value) || !Number.isSafeInteger(number)) {
280
+ throw new RangeError("pending implicit draws: aggregate outside nonnegative safe integer range");
281
+ }
282
+ return number;
283
+ }
284
+
246
285
  // src/sdk/server/payment-mode.ts
247
286
  function resolvePaymentMode(opts) {
248
287
  const active = (rail, configured, ready) => ({
@@ -1149,7 +1188,7 @@ function createDVMHost(opts = {}) {
1149
1188
  });
1150
1189
  applyRetryToPool(pool, "dvm-host");
1151
1190
  pgPool = pool;
1152
- const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-AR6ZJUQV.js");
1191
+ const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-FSRUPYH2.js");
1153
1192
  const pgJobStore = new PostgresJobStore2(pool);
1154
1193
  pendingInits.push(pgJobStore.init(), pgJobStore.initStreaming());
1155
1194
  jobStore = pgJobStore;
@@ -1242,11 +1281,11 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1242
1281
  let tempoChargeBackend = "user-supplied";
1243
1282
  const mppTempoRecipient = envMaybe.DVMKIT_TEMPO_RECIPIENT;
1244
1283
  if (!mpp && mppTempoRecipient) {
1245
- const { createMppFromOpts, createDualKeyMppxFromOpts, parseMppMethodsAllowlist } = await import("../mpp-setup-ZTORW3VF.js");
1284
+ const { createMppFromOpts, createDualKeyMppxFromOpts, parseMppMethodsAllowlist } = await import("../mpp-setup-FURD45LI.js");
1246
1285
  tempoChargeBackend = pgPool ? "postgres" : "memory";
1247
1286
  let tempoCharge;
1248
1287
  if (pgPool) {
1249
- const { PostgresTempoChargeStore } = await import("../tempo-charge-store-XEGJYM3G.js");
1288
+ const { PostgresTempoChargeStore } = await import("../tempo-charge-store-5JOIYUIH.js");
1250
1289
  const chargeStore = new PostgresTempoChargeStore(pgPool);
1251
1290
  tempoChargeStore = chargeStore;
1252
1291
  pendingInits.push(chargeStore.init());
@@ -1266,7 +1305,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1266
1305
  { createPublicClient, createWalletClient, erc20Abi, http },
1267
1306
  { tempo: tempoMainnet, tempoModerato }
1268
1307
  ] = await Promise.all([
1269
- import("../tempo-session-store-3WTDOO7H.js"),
1308
+ import("../tempo-session-store-S6QMLQUA.js"),
1270
1309
  import("viem/accounts"),
1271
1310
  import("viem"),
1272
1311
  import("viem/chains")
@@ -1419,7 +1458,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1419
1458
  }
1420
1459
  }
1421
1460
  const fxSource = envMaybe.DVMKIT_FX_SOURCE;
1422
- const { createFxFetcher, resolveFxSourceFromEnv, warmFxSnapshot } = await import("../pricing-G5IN5YJE.js");
1461
+ const { createFxFetcher, resolveFxSourceFromEnv, warmFxSnapshot } = await import("../pricing-X4XU5HXY.js");
1423
1462
  const fxFetcher = opts.fx ?? createFxFetcher({ source: resolveFxSourceFromEnv(envMaybe) });
1424
1463
  const hostRailConfigured = (opts.paymentMethods?.length ?? 0) > 0 || (effectiveMints?.length ?? 0) > 0 || !!x402WithDualServe || !!mpp;
1425
1464
  if (mounts.some((entry) => mountNeedsFx(entry, hostRailConfigured))) warmFxSnapshot(fxFetcher);
@@ -1429,7 +1468,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1429
1468
  assertReceiptIdentity(envMaybe, opts.builder, receiptKey, cashuOpts.dvmId, opts.devMode);
1430
1469
  let sharedPgReplayStore;
1431
1470
  if (pgPool) {
1432
- const { PostgresReplayStore: PostgresReplayStore2 } = await import("../postgres-replay-store-33K33QV7.js");
1471
+ const { PostgresReplayStore: PostgresReplayStore2 } = await import("../postgres-replay-store-XXJSA457.js");
1433
1472
  const store2 = new PostgresReplayStore2(pgPool);
1434
1473
  pendingInits.push(store2.init());
1435
1474
  sharedPgReplayStore = store2;
@@ -1457,13 +1496,13 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1457
1496
  }
1458
1497
  let sharedPgConsumedStore;
1459
1498
  if (pgPool) {
1460
- const { PostgresConsumedCredentialStore } = await import("../postgres-consumed-credential-store-XJTE5PCA.js");
1499
+ const { PostgresConsumedCredentialStore } = await import("../postgres-consumed-credential-store-WO6OCFXZ.js");
1461
1500
  const consumedStore = new PostgresConsumedCredentialStore(pgPool);
1462
1501
  pendingInits.push(consumedStore.init());
1463
1502
  sharedPgConsumedStore = consumedStore;
1464
1503
  }
1465
1504
  if (pgPool) {
1466
- const { CreditLedger: CreditLedger2 } = await import("../credit-ledger-KIQIE6I6.js");
1505
+ const { CreditLedger: CreditLedger2 } = await import("../credit-ledger-4PZNAMDT.js");
1467
1506
  const pgLedger = new CreditLedger2(pgPool, tempoSessionStore);
1468
1507
  pendingInits.push(pgLedger.init());
1469
1508
  creditLedger = pgLedger;
@@ -1472,7 +1511,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
1472
1511
  pendingInits.push(pgProcessed.init());
1473
1512
  processedPayments = pgProcessed;
1474
1513
  } else {
1475
- const { MemoryCreditLedger: MemoryCreditLedger2 } = await import("../memory-credit-ledger-ATYFAYBG.js");
1514
+ const { MemoryCreditLedger: MemoryCreditLedger2 } = await import("../memory-credit-ledger-RP7DT5IY.js");
1476
1515
  creditLedger = disposableCashu?.ledger ?? new MemoryCreditLedger2();
1477
1516
  const { MemoryProcessedPaymentStore: MemoryProcessedPaymentStore2 } = await import("../processed-payment-store-GKMAWOM3.js");
1478
1517
  processedPayments = new MemoryProcessedPaymentStore2();
@@ -2164,9 +2203,11 @@ export {
2164
2203
  parseDvmClient,
2165
2204
  parseProtocolVersion,
2166
2205
  protocolEnvelopeIgnoreFields,
2206
+ readPendingImplicitDraws,
2167
2207
  requestIdFromEnvelope,
2168
2208
  requireClientCompatibility,
2169
2209
  resolveCashuOptsFromEnv,
2210
+ retryHostedTempoCloseReport,
2170
2211
  secp256k1Auth,
2171
2212
  selectPrimaryCredit,
2172
2213
  serve,
@@ -2177,5 +2218,6 @@ export {
2177
2218
  stripCreditEnvelope,
2178
2219
  stripProtocolEnvelope,
2179
2220
  toCreditView,
2180
- withSdkInitLock
2221
+ withSdkInitLock,
2222
+ writeOffHostedTempoCloseReport
2181
2223
  };