@dvmkit/sdk 0.1.0-rc.7 → 0.1.1-rc.7

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.
@@ -21234,7 +21234,7 @@ async function makeInvoice(conn, params, opts = {}) {
21234
21234
  throw new NwcError("missing_payment_hash", "Wallet did not return a payment hash");
21235
21235
  }
21236
21236
  callerLoggers.lightning.info("lightning.make_invoice.result", {
21237
- payment_hash: tx.paymentHash
21237
+ payment_hash_hash: sha256hex(tx.paymentHash).slice(0, 16)
21238
21238
  });
21239
21239
  return tx;
21240
21240
  }
@@ -21246,7 +21246,7 @@ async function lookupInvoice(conn, params, opts = {}) {
21246
21246
  {
21247
21247
  relays: conn.relays.join(","),
21248
21248
  wallet_pubkey: conn.walletPubkey,
21249
- payment_hash: params.paymentHash
21249
+ payment_hash_hash: params.paymentHash ? sha256hex(params.paymentHash).slice(0, 16) : void 0
21250
21250
  },
21251
21251
  async () => {
21252
21252
  const body = {};
@@ -21260,6 +21260,31 @@ async function lookupInvoice(conn, params, opts = {}) {
21260
21260
  }
21261
21261
  );
21262
21262
  }
21263
+ async function listTransactions(conn, options, opts = {}) {
21264
+ return callerLoggers.lightning.span(
21265
+ "lightning.list_transactions",
21266
+ {
21267
+ relays: conn.relays.join(","),
21268
+ wallet_pubkey: conn.walletPubkey,
21269
+ from: options.from,
21270
+ limit: options.limit
21271
+ },
21272
+ async () => {
21273
+ const body = {};
21274
+ if (options.from !== void 0) body.from = options.from;
21275
+ if (options.limit !== void 0) body.limit = options.limit;
21276
+ const result = await sendNwcRequest(conn, "list_transactions", body, opts);
21277
+ if (!Array.isArray(result.transactions)) {
21278
+ throw new NwcError("invalid_response", "Wallet did not return a transaction list.");
21279
+ }
21280
+ const transactions = result.transactions.map(toTransactionSnapshot);
21281
+ callerLoggers.lightning.info("lightning.list_transactions.result", {
21282
+ transaction_count: transactions.length
21283
+ });
21284
+ return transactions;
21285
+ }
21286
+ );
21287
+ }
21263
21288
  var VOLUNTEERED_BUDGET_KEYS = [
21264
21289
  "budget",
21265
21290
  "budget_renewal",
@@ -21309,6 +21334,7 @@ async function attemptPayment(conn, method, event, pool, timeoutMs) {
21309
21334
  async function reconcile(conn, bolt11, pool, timeoutMs) {
21310
21335
  try {
21311
21336
  const tx = await lookupInvoice(conn, { invoice: bolt11 }, { pool, timeoutMs });
21337
+ if (tx.invoice !== bolt11) return { kind: "unknown" };
21312
21338
  if (tx.settledAt != null && tx.preimage) {
21313
21339
  return {
21314
21340
  kind: "settled",
@@ -21448,7 +21474,46 @@ function toTransaction(raw) {
21448
21474
  ...feesPaidMsats !== void 0 ? { feesPaidMsats } : {},
21449
21475
  createdAt: raw.created_at ?? Math.floor(Date.now() / 1e3),
21450
21476
  expiresAt: raw.expires_at,
21451
- settledAt: raw.settled_at
21477
+ settledAt: raw.settled_at ?? void 0
21478
+ };
21479
+ }
21480
+ function toTransactionSnapshot(value) {
21481
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
21482
+ throw new NwcError("invalid_response", "Wallet returned a malformed transaction.");
21483
+ }
21484
+ const raw = value;
21485
+ if (raw.type !== "incoming" && raw.type !== "outgoing") {
21486
+ throw new NwcError("invalid_response", "Wallet returned an invalid transaction type.");
21487
+ }
21488
+ const amountMsats = requiredNonNegativeInteger(raw.amount, "amount");
21489
+ const createdAt = requiredNonNegativeInteger(raw.created_at, "creation time");
21490
+ const feesPaidMsats = optionalFeeMsats(raw.fees_paid);
21491
+ if (raw.fees_paid != null && feesPaidMsats === void 0) {
21492
+ throw new NwcError("invalid_response", "Wallet returned an invalid transaction fee.");
21493
+ }
21494
+ const settledAt = optionalNonNegativeInteger(raw.settled_at);
21495
+ if (raw.settled_at != null && settledAt === void 0) {
21496
+ throw new NwcError("invalid_response", "Wallet returned an invalid settlement time.");
21497
+ }
21498
+ const invoice = optionalPrivateString(raw.invoice, "invoice");
21499
+ const paymentHash = optionalPrivateString(raw.payment_hash, "payment hash");
21500
+ const reducedIdentity = {
21501
+ type: raw.type,
21502
+ invoice: invoice ?? null,
21503
+ paymentHash: paymentHash ?? null,
21504
+ amountMsats,
21505
+ feesPaidMsats: feesPaidMsats ?? null,
21506
+ createdAt,
21507
+ settledAt: settledAt ?? null
21508
+ };
21509
+ return {
21510
+ fingerprint: sha256hex(JSON.stringify(reducedIdentity)),
21511
+ ...invoice ? { invoiceHash: sha256hex(invoice) } : {},
21512
+ type: raw.type,
21513
+ amountMsats,
21514
+ ...feesPaidMsats !== void 0 ? { feesPaidMsats } : {},
21515
+ createdAt,
21516
+ ...settledAt !== void 0 ? { settledAt } : {}
21452
21517
  };
21453
21518
  }
21454
21519
  function settledOutcome(payment, outcome) {
@@ -21461,6 +21526,23 @@ function settledOutcome(payment, outcome) {
21461
21526
  function optionalFeeMsats(value) {
21462
21527
  return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : void 0;
21463
21528
  }
21529
+ function optionalNonNegativeInteger(value) {
21530
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : void 0;
21531
+ }
21532
+ function requiredNonNegativeInteger(value, field) {
21533
+ const parsed = optionalNonNegativeInteger(value);
21534
+ if (parsed === void 0) {
21535
+ throw new NwcError("invalid_response", `Wallet returned an invalid transaction ${field}.`);
21536
+ }
21537
+ return parsed;
21538
+ }
21539
+ function optionalPrivateString(value, field) {
21540
+ if (value === void 0 || value === null) return void 0;
21541
+ if (typeof value !== "string" || value.length === 0) {
21542
+ throw new NwcError("invalid_response", `Wallet returned an invalid transaction ${field}.`);
21543
+ }
21544
+ return value;
21545
+ }
21464
21546
  async function publishEvent(pool, relays, event) {
21465
21547
  const connections = await Promise.allSettled(relays.map((url) => pool.ensureRelay(url)));
21466
21548
  const live = connections.flatMap((c) => c.status === "fulfilled" ? [c.value] : []);
@@ -21545,6 +21627,9 @@ var NwcBackend = class {
21545
21627
  expiresAt: tx.expiresAt != null ? tx.expiresAt * 1e3 : void 0
21546
21628
  };
21547
21629
  }
21630
+ async listTransactions(options) {
21631
+ return listTransactions(this.conn, options, this.opts);
21632
+ }
21548
21633
  };
21549
21634
 
21550
21635
  // src/sdk/server/tempo-observer-health.ts
@@ -21896,6 +21981,7 @@ export {
21896
21981
  revenueReporterBannerState,
21897
21982
  createDVMServer,
21898
21983
  unknownRouteNotFound,
21984
+ sha256hex,
21899
21985
  NwcError,
21900
21986
  nwcTimeoutMs,
21901
21987
  nwcDedupWindowMs,
@@ -21906,6 +21992,7 @@ export {
21906
21992
  getInfo,
21907
21993
  makeInvoice,
21908
21994
  lookupInvoice,
21995
+ listTransactions,
21909
21996
  NwcBackend,
21910
21997
  createPlatformTempoObserverHealth
21911
21998
  };
@@ -1,7 +1,7 @@
1
1
  import { Hono, Context } from 'hono';
2
2
  import { Pool } from 'pg';
3
- import { X as JsonValue, bR as CreditLedgerLike, b_ as CreditInvoiceRecord, d3 as CreditDepositEnqueue, b$ as InvoiceSettlement, Z as ZodLike, a as DVMDescriptor, K as KVStore, o as JobStore, ah as CashuMode, at as MppxServer, aa as X402Config, p as PaymentMethod, cu as ClientCompatibilityGate, a2 as Message, ap as FundingMethod, Y as FundingReceipt, bT as CreditSnapshot, d4 as TopUpCapUnenforcedReason, _ as JobReceipt, cn as AppendOutgoingOptions, S as SDKJobContext, aQ as StepCache, v as ResponseContent, P as PaymentContent, J as JobRecord, a3 as MessageType, ac as X402Receipt, ab as X402ExactVersionSupport, d5 as X402SettlementIntent, aE as PaymentRequirementsV2, c6 as CreditLedgerQuerier, d6 as X402SettlementCursor, bV as X402SettlementStatus, d7 as X402SettlementWriteOff, bS as X402RefundSettlementGate, d8 as X402FacilitatorAuth, d9 as X402BatchSettlementConfig, cK as PostgresX402ChannelStorage, da as X402PayoutObserver, db as X402SettlementReconciliationReason, aC as PaymentRequirements, a1 as MppxCredential, aj as CreditDepositPayload, bU as DrawResult, cA as CreditLedgerError, a7 as ReceiptCredit, al as DrainReceiptEvent, ak as DrainReceipt, z as SignedRequestAudience, dc as CreditDrawReleaseEnqueue, cM as RevenueSkippedNoRailPayload, cs as ClientCompatibility, aF as PayoutReporter, R as ResolvedCreditConfig, g as CreditView } from './job-store-BtCaLnvJ.js';
4
- import { F as FxFetcher, b as FxRateSnapshot } from './fx-Pf4Ey4f_.js';
3
+ import { X as JsonValue, bR as CreditLedgerLike, b_ as CreditInvoiceRecord, d3 as CreditDepositEnqueue, b$ as InvoiceSettlement, Z as ZodLike, a as DVMDescriptor, K as KVStore, o as JobStore, ah as CashuMode, at as MppxServer, aa as X402Config, p as PaymentMethod, cu as ClientCompatibilityGate, a2 as Message, ap as FundingMethod, Y as FundingReceipt, bT as CreditSnapshot, d4 as TopUpCapUnenforcedReason, _ as JobReceipt, cn as AppendOutgoingOptions, S as SDKJobContext, aQ as StepCache, v as ResponseContent, P as PaymentContent, J as JobRecord, a3 as MessageType, ac as X402Receipt, ab as X402ExactVersionSupport, d5 as X402SettlementIntent, aE as PaymentRequirementsV2, c6 as CreditLedgerQuerier, d6 as X402SettlementCursor, bV as X402SettlementStatus, d7 as X402SettlementWriteOff, bS as X402RefundSettlementGate, d8 as X402FacilitatorAuth, d9 as X402BatchSettlementConfig, cK as PostgresX402ChannelStorage, da as X402PayoutObserver, db as X402SettlementReconciliationReason, aC as PaymentRequirements, a1 as MppxCredential, aj as CreditDepositPayload, bU as DrawResult, cA as CreditLedgerError, a7 as ReceiptCredit, al as DrainReceiptEvent, ak as DrainReceipt, z as SignedRequestAudience, dc as CreditDrawReleaseEnqueue, cM as RevenueSkippedNoRailPayload, cs as ClientCompatibility, aF as PayoutReporter, R as ResolvedCreditConfig, g as CreditView } from './job-store-DOSfYnLX.js';
4
+ import { F as FxFetcher, b as FxRateSnapshot } from './fx-H6K6qcH1.js';
5
5
  import { ProofLike, SerializedDLEQ } from '@cashu/cashu-ts';
6
6
  import { Challenge } from 'mppx';
7
7
  import { SettleResponse, SupportedResponse } from '@x402/core/types';
@@ -400,6 +400,30 @@ interface LightningPayment {
400
400
  /** Whether the wallet answered directly, or the outcome had to be reconciled. */
401
401
  outcome: LightningPayOutcome;
402
402
  }
403
+ /** Bounds for a read-only wallet transaction snapshot. */
404
+ interface LightningTransactionListOptions {
405
+ /** Include transactions created at or after this Unix timestamp (seconds). */
406
+ from?: number;
407
+ /** Maximum number of transactions the wallet may return. */
408
+ limit?: number;
409
+ }
410
+ /**
411
+ * Credential-safe transaction evidence used to account for a wallet debit.
412
+ *
413
+ * Invoice, payment hash and preimage are deliberately replaced by digests or
414
+ * omitted. `fingerprint` identifies the complete reduced row; `invoiceHash`
415
+ * lets a caller bind an outgoing row to the invoice it just paid.
416
+ */
417
+ interface LightningTransactionSnapshot {
418
+ fingerprint: string;
419
+ invoiceHash?: string;
420
+ type: "incoming" | "outgoing";
421
+ amountMsats: number;
422
+ /** Wallet-reported routing fee. Absent when the wallet omitted it. */
423
+ feesPaidMsats?: number;
424
+ createdAt: number;
425
+ settledAt?: number;
426
+ }
403
427
  /** What a backend can tell us about the wallet behind it. */
404
428
  interface LightningWalletInfo {
405
429
  /** Human-readable wallet name (e.g. "Alby Hub"). */
@@ -441,6 +465,12 @@ interface LightningBackend {
441
465
  }): Promise<CreatedInvoice>;
442
466
  /** Look up an invoice's settlement status by payment hash. */
443
467
  lookupInvoice(paymentHash: string): Promise<InvoiceStatus>;
468
+ /**
469
+ * Return a bounded, credential-safe transaction snapshot when supported.
470
+ * Optional so existing backends remain source-compatible; without it an
471
+ * exact total wallet debit cannot be attributed.
472
+ */
473
+ listTransactions?(options: LightningTransactionListOptions): Promise<LightningTransactionSnapshot[]>;
444
474
  }
445
475
 
446
476
  /**
@@ -5092,4 +5122,4 @@ declare function attachCreditMenu(body: Record<string, unknown>, menu: CreditMen
5092
5122
  */
5093
5123
  declare function toCreditTerms(menu: CreditMenu): CreditTerms;
5094
5124
 
5095
- export { buildPaymentErrorResponse as $, type AccumulatorPool as A, type BuilderIdentityKeypair as B, type CreatedInvoice as C, type X402SettlementRepair as D, type X402SettlementRepairRefusal as E, type FiatDenomination as F, type X402SettlementRepaired as G, type X402WedgedSettlement as H, type InvoiceStatus as I, JobCancelledError as J, type X402WedgedSettlementPage as K, type LightningBackend as L, type MintAmountBounds as M, X402_BATCH_SETTLEMENT_MAINNET_NETWORK as N, abortJob as O, PAYMENT_PROOF_KEYS as P, amountBoundsVerdict as Q, type ReporterBannerOpts as R, type SDKServerOpts as S, type TempoChannelReport as T, type UpfrontPaymentOpts as U, type VerifiedIncomingPayment as V, applyPaymentInfoToJob as W, type X402BatchChannelObservation as X, assertNutSupport as Y, assertRevenueReporterReady as Z, buildAttestation as _, type LightningPayment as a, type MemoryConsumedCredentialStoreOpts as a$, canSwap as a0, checkMintHealth as a1, clearAccumulatorForDvm as a2, createDVMServer as a3, creditDepositPayload as a4, derivedFundCreditId as a5, devModeSkipsPaymentVerification as a6, fromJobRecord as a7, fundedMicroFor as a8, generateIdentity as a9, verifyAttestation as aA, verifyIncomingPayment as aB, verifyTempoSessionManagementCredential as aC, verifyUpfrontPayment as aD, writeIdentity as aE, x402RequiredUsdcMicro as aF, x402SettledShare as aG, type CreditMenu as aH, ReceiptIssuer as aI, LightningReceive as aJ, TempoSettlementReadiness as aK, type DVMHostOpts as aL, type BuildCreditMenuArgs as aM, type BuilderIdentity as aN, CREDIT_ENVELOPE_KEYS as aO, type CreateX402BatchSettlementServerOpts as aP, type CreditEnvelope as aQ, CreditEnvelopeError as aR, type CreditFundCommitment as aS, type CreditTerms as aT, DEFAULT_INVOICE_TTL_SECONDS as aU, type DVMHost as aV, JobManager as aW, type JobManagerOpts as aX, type LightningReceiveConfig as aY, MIN_INVOICE_TTL_SECONDS as aZ, MemoryConsumedCredentialStore as a_, hasPaymentProof as aa, hashCapabilities as ab, hashLockKey as ac, implicitCreditId as ad, initWalletAccumulatorTable as ae, insertAccumulatorRows as af, isDerivedCreditId as ag, isTerminal as ah, isYieldMessage as ai, issueUpfrontChallenges as aj, loadIdentitySecret as ak, toLockPubkey as al, msatsToFiatMicro as am, paymentErrorBody as an, pinAskFiat as ao, priceFiatMicro as ap, processIncomingPayment as aq, providerMessage as ar, repairX402ExactSettlementEffect as as, resolveFxSnapshot as at, resolvePriceFiat as au, revenueReporterBannerState as av, signAttestation as aw, toCreditTerms as ax, toJobRecord as ay, unknownRouteNotFound as az, type LightningWalletInfo as b, MemoryProcessedPaymentStore as b0, MemoryX402ExactSettlementStore as b1, type MountOpts as b2, type OwnerDisplay as b3, type PlatformReporterOpts as b4, PostgresProcessedPaymentStore as b5, PostgresX402ExactSettlementStore as b6, type PriceFiat as b7, type ProcessedPaymentQuerier as b8, type ProcessedPaymentRail as b9, attachCreditMenu as bA, buildCreditMenu as bB, createDVMHost as bC, createX402BatchSettlementServer as bD, creditEnvelopeIgnoreFields as bE, drawSettlementRef as bF, extractCreditEnvelope as bG, fundingCommitment as bH, selectPrimaryCredit as bI, stripCreditEnvelope as bJ, toCreditView as bK, type ProcessedPaymentRecord as ba, ProcessedPaymentReplayError as bb, type ProcessedPaymentStore as bc, type X402BatchAcceptance as bd, type X402BatchFunding as be, type X402BatchRefusal as bf, type X402BatchSettlementServer as bg, type X402ExactAcceptance as bh, X402ExactIntentConflictError as bi, type X402ExactSettlementAttempt as bj, type X402ExactSettlementChainEvidence as bk, type X402ExactSettlementEffect as bl, X402ExactSettlementEvidenceMissingError as bm, type X402ExactSettlementEvidenceReader as bn, type X402ExactSettlementIntent as bo, X402ExactSettlementNotReadyError as bp, X402ExactSettlementServer as bq, type X402ExactSettlementServerOpts as br, type X402ExactSettlementStatus as bs, type X402ExactSettlementStore as bt, type X402SettlementChainEvidence as bu, type X402SettlementEvidenceReader as bv, X402SettlementSubmissionError as bw, X402_BATCH_AUTO_SETTLEMENT as bx, X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS as by, X402_BATCH_SETTLEMENT_NETWORK as bz, type LockPubkey as c, type AccumulatorQuerier as d, type ConsumedCredentialStore as e, type MintHealthCheckResult as f, type AppEnv as g, type AttestationPayload as h, type CheckMintHealthOptions as i, type CreditFundingReport as j, type FiatDenominationFailure as k, type FundOnlyRequest as l, type IncomingPaymentOpts as m, MintHealthTracker as n, type PaymentErrorCode as o, type PaymentErrorDetail as p, type PaymentInfo as q, type ResolvedFx as r, type RevenueBootCheckOpts as s, type ServerJob as t, type ShortPayForfeit as u, type TempoObserverHealth as v, TempoSessionChannelMismatchError as w, type VerifyIncomingSnapshot as x, X402FacilitatorHealth as y, type X402SettlementEvidenceOutcome as z };
5125
+ export { assertRevenueReporterReady as $, type AccumulatorPool as A, type BuilderIdentityKeypair as B, type CreatedInvoice as C, X402FacilitatorHealth as D, type X402SettlementEvidenceOutcome as E, type FiatDenomination as F, type X402SettlementRepair as G, type X402SettlementRepairRefusal as H, type InvoiceStatus as I, JobCancelledError as J, type X402SettlementRepaired as K, type LightningTransactionListOptions as L, type MintAmountBounds as M, type X402WedgedSettlement as N, type X402WedgedSettlementPage as O, PAYMENT_PROOF_KEYS as P, X402_BATCH_SETTLEMENT_MAINNET_NETWORK as Q, type ReporterBannerOpts as R, type SDKServerOpts as S, type TempoChannelReport as T, type UpfrontPaymentOpts as U, type VerifiedIncomingPayment as V, abortJob as W, type X402BatchChannelObservation as X, amountBoundsVerdict as Y, applyPaymentInfoToJob as Z, assertNutSupport as _, type LightningTransactionSnapshot as a, MIN_INVOICE_TTL_SECONDS as a$, buildAttestation as a0, buildPaymentErrorResponse as a1, canSwap as a2, checkMintHealth as a3, clearAccumulatorForDvm as a4, createDVMServer as a5, creditDepositPayload as a6, derivedFundCreditId as a7, devModeSkipsPaymentVerification as a8, fromJobRecord as a9, toJobRecord as aA, unknownRouteNotFound as aB, verifyAttestation as aC, verifyIncomingPayment as aD, verifyTempoSessionManagementCredential as aE, verifyUpfrontPayment as aF, writeIdentity as aG, x402RequiredUsdcMicro as aH, x402SettledShare as aI, type CreditMenu as aJ, ReceiptIssuer as aK, LightningReceive as aL, TempoSettlementReadiness as aM, type DVMHostOpts as aN, type BuildCreditMenuArgs as aO, type BuilderIdentity as aP, CREDIT_ENVELOPE_KEYS as aQ, type CreateX402BatchSettlementServerOpts as aR, type CreditEnvelope as aS, CreditEnvelopeError as aT, type CreditFundCommitment as aU, type CreditTerms as aV, DEFAULT_INVOICE_TTL_SECONDS as aW, type DVMHost as aX, JobManager as aY, type JobManagerOpts as aZ, type LightningReceiveConfig as a_, fundedMicroFor as aa, generateIdentity as ab, hasPaymentProof as ac, hashCapabilities as ad, hashLockKey as ae, implicitCreditId as af, initWalletAccumulatorTable as ag, insertAccumulatorRows as ah, isDerivedCreditId as ai, isTerminal as aj, isYieldMessage as ak, issueUpfrontChallenges as al, loadIdentitySecret as am, toLockPubkey as an, msatsToFiatMicro as ao, paymentErrorBody as ap, pinAskFiat as aq, priceFiatMicro as ar, processIncomingPayment as as, providerMessage as at, repairX402ExactSettlementEffect as au, resolveFxSnapshot as av, resolvePriceFiat as aw, revenueReporterBannerState as ax, signAttestation as ay, toCreditTerms as az, type LightningBackend as b, MemoryConsumedCredentialStore as b0, type MemoryConsumedCredentialStoreOpts as b1, MemoryProcessedPaymentStore as b2, MemoryX402ExactSettlementStore as b3, type MountOpts as b4, type OwnerDisplay as b5, type PlatformReporterOpts as b6, PostgresProcessedPaymentStore as b7, PostgresX402ExactSettlementStore as b8, type PriceFiat as b9, X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS as bA, X402_BATCH_SETTLEMENT_NETWORK as bB, attachCreditMenu as bC, buildCreditMenu as bD, createDVMHost as bE, createX402BatchSettlementServer as bF, creditEnvelopeIgnoreFields as bG, drawSettlementRef as bH, extractCreditEnvelope as bI, fundingCommitment as bJ, selectPrimaryCredit as bK, stripCreditEnvelope as bL, toCreditView as bM, type ProcessedPaymentQuerier as ba, type ProcessedPaymentRail as bb, type ProcessedPaymentRecord as bc, ProcessedPaymentReplayError as bd, type ProcessedPaymentStore as be, type X402BatchAcceptance as bf, type X402BatchFunding as bg, type X402BatchRefusal as bh, type X402BatchSettlementServer as bi, type X402ExactAcceptance as bj, X402ExactIntentConflictError as bk, type X402ExactSettlementAttempt as bl, type X402ExactSettlementChainEvidence as bm, type X402ExactSettlementEffect as bn, X402ExactSettlementEvidenceMissingError as bo, type X402ExactSettlementEvidenceReader as bp, type X402ExactSettlementIntent as bq, X402ExactSettlementNotReadyError as br, X402ExactSettlementServer as bs, type X402ExactSettlementServerOpts as bt, type X402ExactSettlementStatus as bu, type X402ExactSettlementStore as bv, type X402SettlementChainEvidence as bw, type X402SettlementEvidenceReader as bx, X402SettlementSubmissionError as by, X402_BATCH_AUTO_SETTLEMENT as bz, type LightningPayment as c, type LightningWalletInfo as d, type LockPubkey as e, type AccumulatorQuerier as f, type ConsumedCredentialStore as g, type MintHealthCheckResult as h, type AppEnv as i, type AttestationPayload as j, type CheckMintHealthOptions as k, type CreditFundingReport as l, type FiatDenominationFailure as m, type FundOnlyRequest as n, type IncomingPaymentOpts as o, MintHealthTracker as p, type PaymentErrorCode as q, type PaymentErrorDetail as r, type PaymentInfo as s, type ResolvedFx as t, type RevenueBootCheckOpts as u, type ServerJob as v, type ShortPayForfeit as w, type TempoObserverHealth as x, TempoSessionChannelMismatchError as y, type VerifyIncomingSnapshot as z };
@@ -1,4 +1,4 @@
1
- import { C as Currency } from './job-store-BtCaLnvJ.js';
1
+ import { C as Currency } from './job-store-DOSfYnLX.js';
2
2
 
3
3
  /**
4
4
  * Quote-time fx snapshot. Embedded in scribe's `lockedQuote` for within-job
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './job-store-BtCaLnvJ.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 DVMRouteContext, I as IncomingMessage, l as InputType, m as InvalidCurrencyError, J as JobRecord, n as JobStatus, o as JobStore, K as KVStore, L as Logger, P as PaymentContent, p as PaymentMethod, q as PriceValue, r as ProgressContent, s as PromptOpts, Q as QuoteConfig, t as QuoteContext, u as QuoteResult, R as ResolvedCreditConfig, v as ResponseContent, S as SDKJobContext, w as SDKPaymentRequestOpts, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, z as SignedRequestAudience, B as SignedRequestDomain, E as SignedRequestError, F as SignedRequestFailure, G as SignedRequestReplayStore, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, U as UnsupportedCurrencyError, O as createSignedRequestVerifier, T as isZodSchema, V as signedRequestStatementHeader, W as validateCurrency } from './job-store-BtCaLnvJ.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-Pf4Ey4f_.js';
4
- export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-D7fW2S7I.js';
1
+ import { C as Currency, Z as ZodLike, D as DVMConfig, a as DVMDescriptor } from './job-store-DOSfYnLX.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 DVMRouteContext, I as IncomingMessage, l as InputType, m as InvalidCurrencyError, J as JobRecord, n as JobStatus, o as JobStore, K as KVStore, L as Logger, P as PaymentContent, p as PaymentMethod, q as PriceValue, r as ProgressContent, s as PromptOpts, Q as QuoteConfig, t as QuoteContext, u as QuoteResult, R as ResolvedCreditConfig, v as ResponseContent, S as SDKJobContext, w as SDKPaymentRequestOpts, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, z as SignedRequestAudience, B as SignedRequestDomain, E as SignedRequestError, F as SignedRequestFailure, G as SignedRequestReplayStore, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, U as UnsupportedCurrencyError, O as createSignedRequestVerifier, T as isZodSchema, V as signedRequestStatementHeader, W as validateCurrency } from './job-store-DOSfYnLX.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-H6K6qcH1.js';
4
+ export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-Civ738b3.js';
5
5
  export { P as PinnedFetch, S as SSRFError, a as SSRFGuardOpts, b as SSRFReason, c as SSRFResolver, d as assertSafeUrl, e as createPinnedFetch } from './ssrf-DbFkpDv0.js';
6
6
  export { z } from 'zod';
7
7
  import '@cashu/cashu-ts';
@@ -1,16 +1,16 @@
1
- import { L as LightningBackend, a as LightningPayment, b as LightningWalletInfo, C as CreatedInvoice, I as InvoiceStatus, A as AccumulatorPool, c as LockPubkey, d as AccumulatorQuerier, e as ConsumedCredentialStore, M as MintAmountBounds, f as MintHealthCheckResult } from '../credit-menu-CYkETVM4.js';
2
- export { g as AppEnv, h as AttestationPayload, B as BuilderIdentityKeypair, i as CheckMintHealthOptions, j as CreditFundingReport, F as FiatDenomination, k as FiatDenominationFailure, l as FundOnlyRequest, m as IncomingPaymentOpts, J as JobCancelledError, n as MintHealthTracker, P as PAYMENT_PROOF_KEYS, o as PaymentErrorCode, p as PaymentErrorDetail, q as PaymentInfo, R as ReporterBannerOpts, r as ResolvedFx, s as RevenueBootCheckOpts, S as SDKServerOpts, t as ServerJob, u as ShortPayForfeit, T as TempoChannelReport, v as TempoObserverHealth, w as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, x as VerifyIncomingSnapshot, X as X402BatchChannelObservation, y as X402FacilitatorHealth, z as X402SettlementEvidenceOutcome, D as X402SettlementRepair, E as X402SettlementRepairRefusal, G as X402SettlementRepaired, H as X402WedgedSettlement, K as X402WedgedSettlementPage, N as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, O as abortJob, Q as amountBoundsVerdict, W as applyPaymentInfoToJob, Y as assertNutSupport, Z as assertRevenueReporterReady, _ as buildAttestation, $ as buildPaymentErrorResponse, a0 as canSwap, a1 as checkMintHealth, a2 as clearAccumulatorForDvm, a3 as createDVMServer, a4 as creditDepositPayload, a5 as derivedFundCreditId, a6 as devModeSkipsPaymentVerification, a7 as fromJobRecord, a8 as fundedMicroFor, a9 as generateIdentity, aa as hasPaymentProof, ab as hashCapabilities, ac as hashLockKey, ad as implicitCreditId, ae as initWalletAccumulatorTable, af as insertAccumulatorRows, ag as isDerivedCreditId, ah as isTerminal, ai as isYieldMessage, aj as issueUpfrontChallenges, ak as loadIdentitySecret, al as lockPubkeyStoreToLockPubkey, am as msatsToFiatMicro, an as paymentErrorBody, ao as pinAskFiat, ap as priceFiatMicro, aq as processIncomingPayment, ar as providerMessage, as as repairX402ExactSettlementEffect, at as resolveFxSnapshot, au as resolvePriceFiat, av as revenueReporterBannerState, aw as signAttestation, ax as toCreditTerms, ay as toJobRecord, al as toLockPubkey, az as unknownRouteNotFound, aA as verifyAttestation, aB as verifyIncomingPayment, aC as verifyTempoSessionManagementCredential, aD as verifyUpfrontPayment, aE as writeIdentity, aF as x402RequiredUsdcMicro, aG as x402SettledShare } from '../credit-menu-CYkETVM4.js';
1
+ import { L as LightningTransactionListOptions, a as LightningTransactionSnapshot, b as LightningBackend, c as LightningPayment, d as LightningWalletInfo, C as CreatedInvoice, I as InvoiceStatus, A as AccumulatorPool, e as LockPubkey, f as AccumulatorQuerier, g as ConsumedCredentialStore, M as MintAmountBounds, h as MintHealthCheckResult } from '../credit-menu-BrTfAr7l.js';
2
+ export { i as AppEnv, j as AttestationPayload, B as BuilderIdentityKeypair, k as CheckMintHealthOptions, l as CreditFundingReport, F as FiatDenomination, m as FiatDenominationFailure, n as FundOnlyRequest, o as IncomingPaymentOpts, J as JobCancelledError, p as MintHealthTracker, P as PAYMENT_PROOF_KEYS, q as PaymentErrorCode, r as PaymentErrorDetail, s as PaymentInfo, R as ReporterBannerOpts, t as ResolvedFx, u as RevenueBootCheckOpts, S as SDKServerOpts, v as ServerJob, w as ShortPayForfeit, T as TempoChannelReport, x as TempoObserverHealth, y as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, z as VerifyIncomingSnapshot, X as X402BatchChannelObservation, D as X402FacilitatorHealth, E as X402SettlementEvidenceOutcome, G as X402SettlementRepair, H as X402SettlementRepairRefusal, K as X402SettlementRepaired, N as X402WedgedSettlement, O as X402WedgedSettlementPage, Q as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, W as abortJob, Y as amountBoundsVerdict, Z as applyPaymentInfoToJob, _ as assertNutSupport, $ as assertRevenueReporterReady, a0 as buildAttestation, a1 as buildPaymentErrorResponse, a2 as canSwap, a3 as checkMintHealth, a4 as clearAccumulatorForDvm, a5 as createDVMServer, a6 as creditDepositPayload, a7 as derivedFundCreditId, a8 as devModeSkipsPaymentVerification, a9 as fromJobRecord, aa as fundedMicroFor, ab as generateIdentity, ac as hasPaymentProof, ad as hashCapabilities, ae as hashLockKey, af as implicitCreditId, ag as initWalletAccumulatorTable, ah as insertAccumulatorRows, ai as isDerivedCreditId, aj as isTerminal, ak as isYieldMessage, al as issueUpfrontChallenges, am as loadIdentitySecret, an as lockPubkeyStoreToLockPubkey, ao as msatsToFiatMicro, ap as paymentErrorBody, aq as pinAskFiat, ar as priceFiatMicro, as as processIncomingPayment, at as providerMessage, au as repairX402ExactSettlementEffect, av as resolveFxSnapshot, aw as resolvePriceFiat, ax as revenueReporterBannerState, ay as signAttestation, az as toCreditTerms, aA as toJobRecord, an as toLockPubkey, aB as unknownRouteNotFound, aC as verifyAttestation, aD as verifyIncomingPayment, aE as verifyTempoSessionManagementCredential, aF as verifyUpfrontPayment, aG as writeIdentity, aH as x402RequiredUsdcMicro, aI as x402SettledShare } from '../credit-menu-BrTfAr7l.js';
3
3
  import { ProofLike, MeltQuoteBolt11Response, Proof, Wallet, SerializedDLEQ, MintQuoteBolt11Response, MintQuoteState, MintPreview, OutputDataLike, CounterSource, CounterRange } from '@cashu/cashu-ts';
4
- import { X as JsonValue, B as SignedRequestDomain, M as SignedRequestStatementHeader, Y as FundingReceipt, _ as JobReceipt$1, z as SignedRequestAudience, $ as PaymentRequired, a0 as X402Version, a1 as MppxCredential, a2 as Message, a3 as MessageType, a4 as MppxChallenge, a5 as X402_BATCH_SETTLEMENT_SCHEME, a6 as X402_EXACT_SCHEME, a7 as ReceiptCredit, C as Currency, a8 as X402Wallet, a9 as ResourceInfo, aa as X402Config, ab as X402ExactVersionSupport, ac as X402Receipt, L as Logger$1, ad as TransactionalPayoutHook, ae as CashuMeltCompleted, K as KVStore } from '../job-store-BtCaLnvJ.js';
5
- export { af as BuildPaymentRequirementsOpts, ag as CapabilityDescriptor, ah as CashuMode, ai as CompleteContent, aj as CreditDepositPayload, ak as DrainReceipt, al as DrainReceiptEvent, am as ExactEvmPayload, an as ExactEvmPayloadAuthorization, ao as FundingLot, ap as FundingMethod, aq as LotDebit, ar as LotDepletion, as as MessageFrom, at as MppxServer, au as NON_CHANNEL_BITCOIN_RAILS, av as NonChannelBitcoinRail, aw as OutgoingMessage, ax as PaymentPayload, ay as PaymentPayloadV1, az as PaymentPayloadV2, aA as PaymentRequestContent, aB as PaymentRequiredV2, aC as PaymentRequirements, aD as PaymentRequirementsV1, aE as PaymentRequirementsV2, aF as PayoutReporter, aG as PostgresTempoSessionStore, aH as PromptContent, aI as RAIL_REFUNDABLE, aJ as ReceiptOutcome, aK as ReceiptPayment, aL as RevenueReporter, aM as SIGNED_ENVELOPE_FIELDS, aN as SIGNED_ENVELOPE_TYPES, aO as SettleResponse, aP as StaleJobReapable, aQ as StepCache, aR as StepRecord, aS as TextContent, aT as UnsignedDrainReceipt, aU as UnsignedFundingReceipt, aV as UnsignedJobReceipt, aW as VerifyResponse, aX as WorkingContent, aY as X402ResponseBody, aZ as X402SelfRelayRpcFailureReason, a_ as X402TrackedChannel, a$ as X402_DEFAULT_NETWORK, b0 as X402_V1_VERSION, b1 as X402_VERSION, b2 as _testing, b3 as buildPaymentRequiredV2, b4 as buildPaymentRequirements, b5 as caip2ToX402Network, b6 as canonicalRequestPath, b7 as canonicaliseForSigning, b8 as canonicalize, b9 as chainIdFromCaip2, ba as computeResultHash, bb as createDefaultReplayStore, bc as decodePayment, bd as decodePaymentRequiredHeader, be as depleteLots, bf as encodePayment, bg as encodePaymentRequiredHeader, bh as encodeSettleResponseHeader, bi as exactEvmAuthorization, bj as fifoOrder, bk as inKindDrawMsats, bl as isArtifactMessage, bm as isCancelMessage, bn as isCompleteMessage, bo as isDrainReceipt, bp as isFundingReceipt, bq as isInKindDepletion, br as isNonChannelBitcoinRail, bs as isPaymentRequestMessage, bt as isPromptMessage, bu as isSignedJobReceipt, bv as isStaleJobReapable, bw as isTextMessage, bx as isWorkingMessage, by as lotOwedSats, bz as netOwedSats, bA as paymentRequiredV2FromV1, bB as settleWithFacilitator, bC as signDrainReceipt, bD as signFundingReceipt, bE as signReceipt, bF as usdcContractByCaip2, bG as usdcContractFor, bH as usdcDomainNameFor, bI as usdcDomainVersionFor, bJ as verifyDrainReceipt, bK as verifyFundingReceipt, bL as verifyReceipt, bM as verifyWithFacilitator, bN as wrapMppx, bO as x402NetworkToCaip2 } from '../job-store-BtCaLnvJ.js';
4
+ import { X as JsonValue, B as SignedRequestDomain, M as SignedRequestStatementHeader, Y as FundingReceipt, _ as JobReceipt$1, z as SignedRequestAudience, $ as PaymentRequired, a0 as X402Version, a1 as MppxCredential, a2 as Message, a3 as MessageType, a4 as MppxChallenge, a5 as X402_BATCH_SETTLEMENT_SCHEME, a6 as X402_EXACT_SCHEME, a7 as ReceiptCredit, C as Currency, a8 as X402Wallet, a9 as ResourceInfo, aa as X402Config, ab as X402ExactVersionSupport, ac as X402Receipt, L as Logger$1, ad as TransactionalPayoutHook, ae as CashuMeltCompleted, K as KVStore } from '../job-store-DOSfYnLX.js';
5
+ export { af as BuildPaymentRequirementsOpts, ag as CapabilityDescriptor, ah as CashuMode, ai as CompleteContent, aj as CreditDepositPayload, ak as DrainReceipt, al as DrainReceiptEvent, am as ExactEvmPayload, an as ExactEvmPayloadAuthorization, ao as FundingLot, ap as FundingMethod, aq as LotDebit, ar as LotDepletion, as as MessageFrom, at as MppxServer, au as NON_CHANNEL_BITCOIN_RAILS, av as NonChannelBitcoinRail, aw as OutgoingMessage, ax as PaymentPayload, ay as PaymentPayloadV1, az as PaymentPayloadV2, aA as PaymentRequestContent, aB as PaymentRequiredV2, aC as PaymentRequirements, aD as PaymentRequirementsV1, aE as PaymentRequirementsV2, aF as PayoutReporter, aG as PostgresTempoSessionStore, aH as PromptContent, aI as RAIL_REFUNDABLE, aJ as ReceiptOutcome, aK as ReceiptPayment, aL as RevenueReporter, aM as SIGNED_ENVELOPE_FIELDS, aN as SIGNED_ENVELOPE_TYPES, aO as SettleResponse, aP as StaleJobReapable, aQ as StepCache, aR as StepRecord, aS as TextContent, aT as UnsignedDrainReceipt, aU as UnsignedFundingReceipt, aV as UnsignedJobReceipt, aW as VerifyResponse, aX as WorkingContent, aY as X402ResponseBody, aZ as X402SelfRelayRpcFailureReason, a_ as X402TrackedChannel, a$ as X402_DEFAULT_NETWORK, b0 as X402_V1_VERSION, b1 as X402_VERSION, b2 as _testing, b3 as buildPaymentRequiredV2, b4 as buildPaymentRequirements, b5 as caip2ToX402Network, b6 as canonicalRequestPath, b7 as canonicaliseForSigning, b8 as canonicalize, b9 as chainIdFromCaip2, ba as computeResultHash, bb as createDefaultReplayStore, bc as decodePayment, bd as decodePaymentRequiredHeader, be as depleteLots, bf as encodePayment, bg as encodePaymentRequiredHeader, bh as encodeSettleResponseHeader, bi as exactEvmAuthorization, bj as fifoOrder, bk as inKindDrawMsats, bl as isArtifactMessage, bm as isCancelMessage, bn as isCompleteMessage, bo as isDrainReceipt, bp as isFundingReceipt, bq as isInKindDepletion, br as isNonChannelBitcoinRail, bs as isPaymentRequestMessage, bt as isPromptMessage, bu as isSignedJobReceipt, bv as isStaleJobReapable, bw as isTextMessage, bx as isWorkingMessage, by as lotOwedSats, bz as netOwedSats, bA as paymentRequiredV2FromV1, bB as settleWithFacilitator, bC as signDrainReceipt, bD as signFundingReceipt, bE as signReceipt, bF as usdcContractByCaip2, bG as usdcContractFor, bH as usdcDomainNameFor, bI as usdcDomainVersionFor, bJ as verifyDrainReceipt, bK as verifyFundingReceipt, bL as verifyReceipt, bM as verifyWithFacilitator, bN as wrapMppx, bO as x402NetworkToCaip2 } from '../job-store-DOSfYnLX.js';
6
6
  import { SimplePool } from 'nostr-tools/pool';
7
7
  import { Session } from 'mppx/tempo';
8
8
  import { Pool } from 'pg';
9
9
  export { Pool } from 'pg';
10
10
  import { PaymentRequired as PaymentRequired$1 } from '@x402/core/types';
11
11
  import { ClientChannelStorage, BatchSettlementClientContext, BatchSettlementEvmScheme } from '@x402/evm/batch-settlement/client';
12
- export { e as FX_CACHE_TTL_MS, g as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-Pf4Ey4f_.js';
13
- export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-D7fW2S7I.js';
12
+ export { e as FX_CACHE_TTL_MS, g as FX_RETRY_COUNT, w as warmFxSnapshot } from '../fx-H6K6qcH1.js';
13
+ export { c as InvalidUsdPriceError, p as parseUsdPrice } from '../usd-Civ738b3.js';
14
14
  import { Hono } from 'hono';
15
15
  import { Env, BlankSchema } from 'hono/types';
16
16
  import { Store } from 'mppx';
@@ -77,7 +77,11 @@ interface BudgetLedgerEntry {
77
77
  principalMsats?: number;
78
78
  /** Wallet-reported NWC routing fee. Null means the wallet omitted it. */
79
79
  routingFeeMsats?: number | null;
80
- /** Exact NWC wallet debit. Null means the routing fee, and therefore total, is unknown. */
80
+ /** Total NWC wallet fee from an exact debit. Null means the total is unprovable. */
81
+ totalWalletFeeMsats?: number | null;
82
+ /** Wallet fee not itemized as routing. Null means the split is unprovable. */
83
+ unitemizedWalletFeeMsats?: number | null;
84
+ /** Exact NWC wallet debit. Null means wallet evidence could not prove it. */
81
85
  walletDebitMsats?: number | null;
82
86
  /** BTC/USD rate used at spend time. */
83
87
  btcRate: number;
@@ -127,6 +131,8 @@ interface RecordSpendOptions {
127
131
  msats: number;
128
132
  principalMsats?: number;
129
133
  routingFeeMsats?: number | null;
134
+ totalWalletFeeMsats?: number | null;
135
+ unitemizedWalletFeeMsats?: number | null;
130
136
  walletDebitMsats?: number | null;
131
137
  btcRate: number;
132
138
  /** Outflow kind. Defaults to `job`. */
@@ -1213,6 +1219,13 @@ declare function lookupInvoice(conn: NwcConnection, params: {
1213
1219
  paymentHash?: string;
1214
1220
  invoice?: string;
1215
1221
  }, opts?: NwcRequestOptions): Promise<NwcTransaction>;
1222
+ /**
1223
+ * List a bounded set of credential-safe wallet transactions.
1224
+ *
1225
+ * Raw invoices, payment hashes and preimages never cross this boundary. They
1226
+ * contribute only to SHA-256 identities used to compare repeated snapshots.
1227
+ */
1228
+ declare function listTransactions(conn: NwcConnection, options: LightningTransactionListOptions, opts?: NwcRequestOptions): Promise<LightningTransactionSnapshot[]>;
1216
1229
 
1217
1230
  /**
1218
1231
  * The caller's Lightning float (internal-review) — a budgeted NWC connection to an
@@ -1263,7 +1276,11 @@ interface FloatPayment {
1263
1276
  principalMsats: number;
1264
1277
  /** Wallet-reported routing fee in millisatoshis, or null when unreported. */
1265
1278
  routingFeeMsats: number | null;
1266
- /** Exact wallet debit in millisatoshis, or null when the routing fee is unknown. */
1279
+ /** Total wallet fee derived from an exact balance delta, or null when unprovable. */
1280
+ totalWalletFeeMsats: number | null;
1281
+ /** Wallet fee not itemized as routing, or null when that split is unprovable. */
1282
+ unitemizedWalletFeeMsats: number | null;
1283
+ /** Exact wallet debit in millisatoshis, or null when wallet evidence is ambiguous. */
1267
1284
  walletDebitMsats: number | null;
1268
1285
  }
1269
1286
  /** JSON-safe representation of a float payment; intentionally excludes the preimage. */
@@ -1271,6 +1288,8 @@ interface FloatPaymentJson {
1271
1288
  outcome: FloatPayment["outcome"];
1272
1289
  principal_sats: number;
1273
1290
  routing_fee_sats: number | null;
1291
+ total_wallet_fee_sats: number | null;
1292
+ unitemized_wallet_fee_sats: number | null;
1274
1293
  wallet_debit_sats: number | null;
1275
1294
  }
1276
1295
  /** Convert the internal millisatoshi breakdown into the caller-facing CLI contract. */
@@ -1372,6 +1391,9 @@ declare function assertFloatBudget(plannedMsats: number): Promise<number>;
1372
1391
  declare function recordFloatSpend(params: {
1373
1392
  principalMsats: number;
1374
1393
  routingFeeMsats: number | null;
1394
+ totalWalletFeeMsats?: number | null;
1395
+ unitemizedWalletFeeMsats?: number | null;
1396
+ walletDebitMsats?: number | null;
1375
1397
  btcRate: number;
1376
1398
  /** Stable handle for the funding — a mint quote id, or a credit reference. */
1377
1399
  reference: string;
@@ -3360,7 +3382,11 @@ interface CreditFundOutcome {
3360
3382
  principalSats?: number;
3361
3383
  /** Wallet-reported Lightning routing fee. Null means the wallet omitted it. */
3362
3384
  routingFeeSats?: number | null;
3363
- /** Exact Lightning wallet debit. Null means the routing fee, and total, is unknown. */
3385
+ /** Total Lightning wallet fee. Null means the total is unprovable. */
3386
+ totalWalletFeeSats?: number | null;
3387
+ /** Wallet fee not itemized as routing. Null means the split is unprovable. */
3388
+ unitemizedWalletFeeSats?: number | null;
3389
+ /** Exact Lightning wallet debit. Null means wallet evidence could not prove it. */
3364
3390
  walletDebitSats?: number | null;
3365
3391
  /** Stablecoin micro-units committed through a Tempo charge or session. */
3366
3392
  spentMicro?: number;
@@ -4107,7 +4133,11 @@ interface PendingFunding {
4107
4133
  principalMsats?: number;
4108
4134
  /** Wallet-reported routing fee. Null means the wallet omitted it. */
4109
4135
  routingFeeMsats?: number | null;
4110
- /** Exact wallet debit. Null means the routing fee, and therefore total, is unknown. */
4136
+ /** Total wallet fee from an exact debit. Null means the total is unprovable. */
4137
+ totalWalletFeeMsats?: number | null;
4138
+ /** Wallet fee not itemized as routing. Null means the split is unprovable. */
4139
+ unitemizedWalletFeeMsats?: number | null;
4140
+ /** Exact wallet debit. Null means wallet evidence could not prove it. */
4111
4141
  walletDebitMsats?: number | null;
4112
4142
  /** How the caller wallet reached settlement. */
4113
4143
  paymentOutcome?: "paid" | "reconciled" | "republished";
@@ -5645,6 +5675,7 @@ declare class NwcBackend implements LightningBackend {
5645
5675
  expirySeconds?: number;
5646
5676
  }): Promise<CreatedInvoice>;
5647
5677
  lookupInvoice(paymentHash: string): Promise<InvoiceStatus>;
5678
+ listTransactions(options: LightningTransactionListOptions): Promise<LightningTransactionSnapshot[]>;
5648
5679
  }
5649
5680
 
5650
5681
  /** Maximum lifetime of an exact x402 EIP-3009 authorization after signing. */
@@ -10782,4 +10813,4 @@ declare function readX402ChannelOnChain(args: {
10782
10813
  */
10783
10814
  declare function x402ChannelControlledBy(channel: StoredX402ChannelMetadata, address: string | null | undefined): boolean;
10784
10815
 
10785
- export { ADMIN_STATE_UNAVAILABLE, AGENT_MNEMONIC_FILE, AccumulatorPool, type AgentProof, type AgentWallet, type AmountLabelOptions, type AttestedDvmIdentity, BTC_RATE_FILE, BUDGET_FILE, type BudgetCaps, type BudgetSpendKind, type BudgetWindow, type BuilderLockKeypair, CAPABILITY_NAME_RE, COINGECKO_SIMPLE_PRICE_URL, CONFIG_AUDIT_FILE, CONFIG_BACKUP_FILE, CONFIG_DIR, CONFIG_FILE, CONFIG_PINNED_FILE, CREDITS_FILE, CREDIT_DRAIN_RAILS, CREDIT_FUNDING_MODES, CREDIT_FUND_RAILS, CREDIT_POSTURES, type CachedBtcRate, type CancelOptions, type CashOutMintOutcome, type CashOutQuote, type CliIdentityEntry, type CoinGeckoBtcSpot, type CoinGeckoSpot, type Config, type ConfigBackupInfo, type ConfigDirModeResult, type ConfigField, type ConfigRollbackPreview, type ConfigSnapshotSlot, CreatedInvoice, type CreditConfig, type CreditDrainRail, type CreditFundOutcome, type CreditFundRail, type CreditFundStatus, type CreditFundingMode, type CreditMenu, type CreditOpResult, type CreditPlan, type CreditPosture, type CreditRailPick, type CreditRailReason, type CreditRailSource, type CreditTerms, type CreditWire, DEFAULT_AGENT_MINT_URL, DEFAULT_CREDIT_POSTURE, DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, DEFAULT_RESERVE_LOCKTIME_SECONDS, DbTransport, type DeferredFunding, type DeliveredResult, type DescribeOptions, type DrainReceiptChecks, type DrainReceiptVerifyResult, type DrainWire, type DrawCeilingSource, type DrawSkip, DvmError, DvmX402ChannelStorage, type EffectiveFundingRail, FAVORITES_FILE, FEEDBACK_NUDGES_FILE, FEEDBACK_POSTURES, type FeedbackPosture, type Float, type FloatPayment, type FloatProbe, type FundCreditArgs, FundingReceipt, type FundingReceiptChecks, type FundingReceiptVerifyResult, IDENTITIES_FILE, IDENTITIES_VERSION, type IdentitiesFile, InvoiceStatus, JOBS_FILE, type JobCompletion, type JobEnvelope, type JobPolicy, JobReceipt$1 as JobReceipt, type JobRecord, type JobStatus, JsonValue, LightningBackend, type LightningFundingOffer, LightningPayment, LightningWalletInfo, type LnAddressParts, LockPubkey, type LockPubkeyPool, type LockPubkeyState, type LockPubkeyStateLoader, LockPubkey as LockPubkeyStoreLockPubkey, MESSAGES_DIR, type MeltQuoteInfo, type MeltSweepResult, MemoryKVStore, Message, type MessagePollOptions, MessageType, MintAmountBounds, MintHealthCheckResult, type MintSource, type MnemonicValidationResult, MppxChallenge, MppxCredential, NWC_FUNDING_FLOAT_ROLE, type NextAction, type NextActionRefund, NwcBackend, type NwcConnection, NwcError, type NwcRequestOptions, type NwcTransaction, type OutboundMessage, PAIRINGS_DIR, PRIVKEY_HEX_RE, type PayInvoiceOutcome, type PayInvoiceReconcilingOptions, type PayInvoiceResult, type PayOutcome, type Payment, type PaymentRailKey, PaymentRequired, type PendingDrain, type PendingFunding, type PendingMint, type PendingSubmission, type PendingX402ExactFunding, type PendingX402Funding, type PersistedOutputData, PersistentCounterSource, PostgresTempoChargeStore, type PreparedAgentSpend, type ProtectedTarget, type ProviderInfo, type ProviderRef, type ProviderText, type Quote, RAIL_FLAGS, RECEIPTS_FILE, RECENT_SPENDS_CAP, RECOMMENDED_MINTS, RECOVERY_MNEMONIC_FILE, REQUEST_INTENTS_DIR, RESUME_MAX_AGE_MS, RESUME_MAX_ATTEMPTS, ROUTER_FEEDBACK_CLAIM_HEADER, ROUTER_FEEDBACK_CLAIM_TTL_MS, type Rail, type RailFlag, type RailProbe, type ReceiptCapture, type ReceiptChecks, ReceiptCredit, type ReceiptInvalidReason, type ReceiptKeypair, type ReceiptParseError, type ReceiptTrustAnchor, type ReceiptVerification, type ReceiptVerifyResult, type ReleaseMintOutcome, type ResolvedBtcRate, ResourceInfo, SPANS_INSERTED_CHANNEL, STABLECOIN_FUND_RAILS, SUPPORTED_PROTOCOL_VERSION, type SelectError, type SendMessageOptions, type SpanRow, type SpanTransport, SpanWriter, type StaleRateNotice, type StatusOptions, type StoredCredit, type StoredFundingMenuSnapshot, type StoredImplicitCredit, type StoredReceipt, type StoredSiblingCredit, type StoredX402ChannelConfig, type StoredX402ChannelMetadata, type StreamOptions, type StreamResult, type SubmissionSweepOutcome, type SubmitOptions, type SuppressedPurchase, type SweepResult, TEMPO_CHAIN_ID, TEMPO_CHANNELS_FILE, TEMPO_CLOSE_DB_RECOVERY_BUDGET_MS, TEMPO_CLOSE_REQUESTED_TOPIC, TEMPO_EXIT_KEY_MISSING_HINT, type TempoAccount, type TempoChannelAssociation, type TempoChannelExitResult, type TempoChannelReconcileResult, type TerminalJobStatus, type Transport, type JobReceipt as TransportJobReceipt, type TrustAnchorRead, type TrustLadder, type V1InfoCapability, type V1InfoResponse, type VerifyJobReceiptArgs, WALLET_FILE, WALLET_VERSION, type WalletInfo, type X402Asset, type X402Balance, type X402BatchPayment, type X402ChannelChainReport, type X402ChannelClient, type X402ChannelReconciliation, X402Config, type X402ConnectedWallet, type X402CreditFlavour, type X402CreditInstrument, X402EnvValidationError, type X402Network, type X402PaymentProof, type X402RefundArgs, type X402RefundOutcome, type X402RepinnedWallet, type X402UnobservedBalanceProvenance, X402Version, X402Wallet, X402_BATCH_CHANNEL_ABI, X402_BATCH_SETTLEMENT_KEY, X402_BATCH_SETTLEMENT_SCHEME, X402_CHANNELS_FILE, X402_DEFAULT_FACILITATOR, X402_EXACT_AUTHORIZATION_TTL_SECONDS, X402_EXACT_SCHEME, X402_NETWORKS, X402_PENDING_STALE_MS, X402_RECEIVER_AUTHORIZER_KEY, X402_REFUSAL_TRANSACTION_DISCOVERY_WINDOW_MS, X402_RPC_URL_KEY, X402_SELF_RELAY_KEY, abandonPendingSubmission, acknowledgeReplayedX402Payment, acknowledgeX402ChannelOwner, activePubkeySet, addPayment, advanceTempoChannelExit, applyImplicitReceiptCredit, applyReceiptCredit, applyRetryToPool, asProviderText, asProviderTextOpt, assertAgentMnemonicReplaceable, assertFloatBudget, assertSupportedX402Network, assertTempoWalletIdle, assertValidBudget, assertX402ChannelPayer, assertX402RequirementDescribesChannel, assertX402WalletIdle, attestedDvmIdentity, authenticatedBuilderPubkey, authorizeProtectedRemoval, automaticCreditBoundRail, availableRails, backfillTrustAnchor, backupSecretFile, buildAdminAuthHeader, buildAdminChallenge, buildCompletionHintFields, buildDisplayMintInventory, buildPolicy, buildTempoCredential, builderLockPath, canReplaceExpiredX402Deposit, captureFundingReceipt, captureTransportReceipt, cashOutFromMint, cashuSubmissionBindingFingerprint, checkMeltQuoteState, checkReceiptAttestation, clearCreditSelection, clearPendingDrain, clearPendingX402ExactFunding, clearPendingX402Funding, clearRefillRailUnavailable, generateIdentity as cliIdentityStoreGenerateIdentity, commitAgentSpend, completionFromMessages, completionSnapshot, computeNextAction, computeSmartDenominations, configSnapshotPath, connectedTempoAccount, connectedX402Payer, correctPendingFundAmount, costAnchor, coveringMintsForSpend, createAdminCashuNonceStore, createInstrumentedFetch, createMonotonicClock, createNoopLogger, createStdoutLogger, createTempoCloseCredential, createX402BatchPayment, currentContext, deleteAgentMnemonic, deriveAgentMasterKeypair, deriveBuilderLockKeypair, deriveBuilderLockPubkey, deriveIdentityFromPrivkey, derivePubkeyFromPrivkey, deriveReceiptKeypair, deriveReceiptSecret, deriveTempoAddress, describeConfigBackup, describeMintBounds, drainReceiptsDisplay, drainReceiptsHint, dvmLocationIdentity, effectiveCreditPosture, effectiveFundingMint, effectiveFundingRail, effectiveMints, emitFloatBudgetWarning, enforceGlobalBudget, ensureAddress, ensureConfig, ensureConfigDir, ensureConfigSubdir, ensureProvisionalCredit, entryKind, epochMsToIso, extractBuilderHandle, fetchBtcUsdRate, fetchCoinGeckoBtcUsd, fetchCoinGeckoSpot, fetchLnurlPayInvoice, fetchMeltQuote, fetchMissingJobReceipt, fetchTrustAnchor, findSigningIdentityByPubkey, findX402Channel, floatBudgetJson, floatPaymentDisplay, floatPaymentJson, forgetCredit, formatAmount, formatAmountBestEffort, formatLocktime, formatPaymentAmount, formatSats, formatStaleness, formatUsd, formatUsdcMicrounits, fundAgentWallet, fundCredit, fundWireAmountMicro, fundingModeForTempoIntent, fundingModeForX402Flavour, fundingRailLabel, generateAgentMnemonic, generateEphemeralReceiptKey, generateTempoKey, generateX402PrivateKey, getBalance, getBalanceByMint, getFundingGuidance, getInfo, getInputFeesForProofs, getLastKnownBtcRate, getOutputTraceId, getTempoUsdcBalance, getWallet, getX402Balance, hashedCanonicalDvmId, humanizeZodError, identitiesFileExists, info, initLockPubkeyTable, initLoggers, insertSpanBatch, installAdminCashuRoutes, isAbortError, isCreditFundRail, isCreditFundingMode, isCreditPosture, isFeedbackPosture, isPaymentRailKey, isPublicRequestId, isResumable, isStablecoinFundRail, isTerminalJobStatus, isValidEvmPrivateKey, issueRouterFeedbackClaim, jobCredentialGate, json, listCredits, listFundingMenuSnapshots, listImplicitCredits, listPendingFundings, listPendingX402Fundings, listPendingX402FundingsForChannel, listResumableTempoChargeFundings, listResumableX402ExactFundings, listResumableX402Fundings, listTempoChannelAssociations, listX402Channels, loadAgentWallet, loadAllJobs, loadConfig, loadConfiguredMints, loadCredit, loadFloat, loadIdentities, loadImplicitCredits, loadJob, loadLedger, loadLockPubkeyState, loadPendingFunding, loadReceipt, loadReceipts, loadResumableX402ExactFunding, loadResumableX402Funding, loadTempoChannelAssociation, loadTempoChannelController, loadTempoChannelEntry, loadX402Wallet, loggers, looksLikeMnemonic, lookupInvoice, makeInvoice, markCredit, markImplicitCreditLost, markJobTerminal, markRefillDrainNoticed, markRefillRailUnavailable, maxKeysetDenomination, microToSats, missingDleqRecoveryDiagnostic, mnemonicFingerprint, monetaryJson, msatsToMicro, msatsToUsd, msatsToUsdCents, msatsToUsdc, needsPocketRefill, needsTopup, nextStepHint, normalizeCreditEndpoint, normalizeFeedbackEndpointHost, nwcDedupWindowMs, nwcRejectionDisplay, nwcTimeoutMs, offersTempoCreditFunding, offersX402CreditFunding, parseBudget, parseCreditMenu, parseCreditTerms, parseLnAddress, parseLocktime, parseNwcUri, parseStatedBudget, parseTraceparent, payInvoiceReconciling, payViaFloat, paymentRailLabel, pendingDrainById, pendingDrainFor, pickCreditFundRail, pinConfigSnapshot, pinDimension, planConfigReset, planCreditForQuote, planProbeDraw, pocketTargetMicro, pollNextAction, pollPendingCreditFundings, preferLightningFirst, prepareAgentSpend, prepareP2PKMint, previewConfigRollback, printFundingGuidance, probeFloat, probeRailLabel, probeWallets, processX402BatchCorrection, processX402BatchResponse, processX402BatchResponseForWallet, providerProseSources, providerTextToString, pruneRetired, railLabelAtSentenceStart, randomTraceId, rateUnavailablePaymentError, raw, readFundValuation, readX402ChannelOnChain, receiptDisplay, receiptFailureDetail, receiptHint, receiptIssuedAtIso, receiptJsonFields, receiptPubkeyFromSecret, receiptTrustFields, receiveToAgentWallet, reclaimAtMs, reconcileRefusedX402Deposits, reconcileTempoChannelOnChain, recordBalanceResponse, recordCreditX402Instrument, recordDrainReceipts, recordFloatSpend, recordFundResponse, recordFundingMenuSnapshot, recordPendingDrain, recordPendingX402ExactFunding, recordPendingX402Funding, recordRefusedDrawBalance, recordSpend, recordX402ChannelMetadata, recoverPendingSubmission, redactUrl, redactUrlsInText, refFromJob, refundX402BatchChannel, releaseAgentReserve, removeX402Wallet, renderReceiptHuman, repairConfigDirMode, repinX402WalletNetwork, replayStoredReceipt, reserveAgentWallet, resolveBtcUsdRate, resolveFundMint, resolveLnurlPayMetadataUrl, resolveRpcHttpTransportOptions, resolveRpcOverride, resolveSigningIdentity, resolveTempoAsset, resolveX402Asset, resolveX402ChannelRpc, restoreProofsFromOutputs, retireConfigBackup, retirePendingX402Funding, rollbackConfig, rotateLockPubkey, rpcEndpointLine, rpcEndpointSuffix, saveAgentWallet, saveIdentities, saveJob, saveLedger, saveX402Wallet, seedLockPubkeyState, selectProofsForSpend, serializeOutputData, setEmitter, setOutputTraceId, settleDrainEvidence, shellQuoteArg, signDvmRequestData, signRequestData, signedRequestDomain, spendableAt, staleRateNotice, statusSnapshot, swapFeeForProofs, swapSendReserve, sweepPendingMelts, sweepPendingMints, sweepPendingSubmissions, sweepStaleInFlight, tempoBalanceCheckHint, tempoChannelControlledBy, tempoCredentialAmountMicro, tempoKeyImportRoutes, tempoSessionChallenge, tempoSessionChallengeMicro, tempoTokenReference, tempoWrongAssetHint, tierCapOverrides, toAgentProof, toFloatError, transportErrorCode, trustLadderFor, trustOverrideCapMicro, tryResolveBtcUsdRate, tryResolveTempoAsset, tryX402Payment, unreachableRailDisplay, unreachableRailHint, unrecordedFloatBudgetWarning, unsignRequestData, updateConfig, updateJob, usdToMsats, usdcToMsats, validateAgentMnemonic, validateLnAddress, validateX402Env, verifyCanonicalSignedRequest, verifyChallenge, verifyDrainReceiptChain, verifyFundingReceiptChain, verifyJobReceipt, verifyRouterFeedbackClaim, verifyX402Payment, walletExists, weakestReceiptVerdict, windowStart, withIdentitiesLock, withInitRetry, withNwcPool, withTempoChannelLock, withTraceContext, withWalletLock, withX402ChannelLock, writeAgentMnemonic, x402ChannelBalanceUnreconciledAt, x402ChannelControlledBy, x402ChannelReservation, x402CreditChannelNetworks, x402CreditExactNetworks, x402ExactFundingDead, x402FlavourForInstrument, x402NetworkByCaip2, x402NetworkBySlug, x402NetworkLabel, x402NetworkListForCopy, x402PendingBlockExpiresAt, x402PendingDepositExpiresAt, x402PendingFundingJson, x402PendingRetired, x402PendingStale, x402PendingUnsettled, x402RequiredFromError, x402ReservationRelease, x402SupportedNetworksHint, x402VoucherPendingRefusal, x402WrongAssetHint };
10816
+ export { ADMIN_STATE_UNAVAILABLE, AGENT_MNEMONIC_FILE, AccumulatorPool, type AgentProof, type AgentWallet, type AmountLabelOptions, type AttestedDvmIdentity, BTC_RATE_FILE, BUDGET_FILE, type BudgetCaps, type BudgetSpendKind, type BudgetWindow, type BuilderLockKeypair, CAPABILITY_NAME_RE, COINGECKO_SIMPLE_PRICE_URL, CONFIG_AUDIT_FILE, CONFIG_BACKUP_FILE, CONFIG_DIR, CONFIG_FILE, CONFIG_PINNED_FILE, CREDITS_FILE, CREDIT_DRAIN_RAILS, CREDIT_FUNDING_MODES, CREDIT_FUND_RAILS, CREDIT_POSTURES, type CachedBtcRate, type CancelOptions, type CashOutMintOutcome, type CashOutQuote, type CliIdentityEntry, type CoinGeckoBtcSpot, type CoinGeckoSpot, type Config, type ConfigBackupInfo, type ConfigDirModeResult, type ConfigField, type ConfigRollbackPreview, type ConfigSnapshotSlot, CreatedInvoice, type CreditConfig, type CreditDrainRail, type CreditFundOutcome, type CreditFundRail, type CreditFundStatus, type CreditFundingMode, type CreditMenu, type CreditOpResult, type CreditPlan, type CreditPosture, type CreditRailPick, type CreditRailReason, type CreditRailSource, type CreditTerms, type CreditWire, DEFAULT_AGENT_MINT_URL, DEFAULT_CREDIT_POSTURE, DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, DEFAULT_RESERVE_LOCKTIME_SECONDS, DbTransport, type DeferredFunding, type DeliveredResult, type DescribeOptions, type DrainReceiptChecks, type DrainReceiptVerifyResult, type DrainWire, type DrawCeilingSource, type DrawSkip, DvmError, DvmX402ChannelStorage, type EffectiveFundingRail, FAVORITES_FILE, FEEDBACK_NUDGES_FILE, FEEDBACK_POSTURES, type FeedbackPosture, type Float, type FloatPayment, type FloatProbe, type FundCreditArgs, FundingReceipt, type FundingReceiptChecks, type FundingReceiptVerifyResult, IDENTITIES_FILE, IDENTITIES_VERSION, type IdentitiesFile, InvoiceStatus, JOBS_FILE, type JobCompletion, type JobEnvelope, type JobPolicy, JobReceipt$1 as JobReceipt, type JobRecord, type JobStatus, JsonValue, LightningBackend, type LightningFundingOffer, LightningPayment, LightningTransactionListOptions, LightningTransactionSnapshot, LightningWalletInfo, type LnAddressParts, LockPubkey, type LockPubkeyPool, type LockPubkeyState, type LockPubkeyStateLoader, LockPubkey as LockPubkeyStoreLockPubkey, MESSAGES_DIR, type MeltQuoteInfo, type MeltSweepResult, MemoryKVStore, Message, type MessagePollOptions, MessageType, MintAmountBounds, MintHealthCheckResult, type MintSource, type MnemonicValidationResult, MppxChallenge, MppxCredential, NWC_FUNDING_FLOAT_ROLE, type NextAction, type NextActionRefund, NwcBackend, type NwcConnection, NwcError, type NwcRequestOptions, type NwcTransaction, type OutboundMessage, PAIRINGS_DIR, PRIVKEY_HEX_RE, type PayInvoiceOutcome, type PayInvoiceReconcilingOptions, type PayInvoiceResult, type PayOutcome, type Payment, type PaymentRailKey, PaymentRequired, type PendingDrain, type PendingFunding, type PendingMint, type PendingSubmission, type PendingX402ExactFunding, type PendingX402Funding, type PersistedOutputData, PersistentCounterSource, PostgresTempoChargeStore, type PreparedAgentSpend, type ProtectedTarget, type ProviderInfo, type ProviderRef, type ProviderText, type Quote, RAIL_FLAGS, RECEIPTS_FILE, RECENT_SPENDS_CAP, RECOMMENDED_MINTS, RECOVERY_MNEMONIC_FILE, REQUEST_INTENTS_DIR, RESUME_MAX_AGE_MS, RESUME_MAX_ATTEMPTS, ROUTER_FEEDBACK_CLAIM_HEADER, ROUTER_FEEDBACK_CLAIM_TTL_MS, type Rail, type RailFlag, type RailProbe, type ReceiptCapture, type ReceiptChecks, ReceiptCredit, type ReceiptInvalidReason, type ReceiptKeypair, type ReceiptParseError, type ReceiptTrustAnchor, type ReceiptVerification, type ReceiptVerifyResult, type ReleaseMintOutcome, type ResolvedBtcRate, ResourceInfo, SPANS_INSERTED_CHANNEL, STABLECOIN_FUND_RAILS, SUPPORTED_PROTOCOL_VERSION, type SelectError, type SendMessageOptions, type SpanRow, type SpanTransport, SpanWriter, type StaleRateNotice, type StatusOptions, type StoredCredit, type StoredFundingMenuSnapshot, type StoredImplicitCredit, type StoredReceipt, type StoredSiblingCredit, type StoredX402ChannelConfig, type StoredX402ChannelMetadata, type StreamOptions, type StreamResult, type SubmissionSweepOutcome, type SubmitOptions, type SuppressedPurchase, type SweepResult, TEMPO_CHAIN_ID, TEMPO_CHANNELS_FILE, TEMPO_CLOSE_DB_RECOVERY_BUDGET_MS, TEMPO_CLOSE_REQUESTED_TOPIC, TEMPO_EXIT_KEY_MISSING_HINT, type TempoAccount, type TempoChannelAssociation, type TempoChannelExitResult, type TempoChannelReconcileResult, type TerminalJobStatus, type Transport, type JobReceipt as TransportJobReceipt, type TrustAnchorRead, type TrustLadder, type V1InfoCapability, type V1InfoResponse, type VerifyJobReceiptArgs, WALLET_FILE, WALLET_VERSION, type WalletInfo, type X402Asset, type X402Balance, type X402BatchPayment, type X402ChannelChainReport, type X402ChannelClient, type X402ChannelReconciliation, X402Config, type X402ConnectedWallet, type X402CreditFlavour, type X402CreditInstrument, X402EnvValidationError, type X402Network, type X402PaymentProof, type X402RefundArgs, type X402RefundOutcome, type X402RepinnedWallet, type X402UnobservedBalanceProvenance, X402Version, X402Wallet, X402_BATCH_CHANNEL_ABI, X402_BATCH_SETTLEMENT_KEY, X402_BATCH_SETTLEMENT_SCHEME, X402_CHANNELS_FILE, X402_DEFAULT_FACILITATOR, X402_EXACT_AUTHORIZATION_TTL_SECONDS, X402_EXACT_SCHEME, X402_NETWORKS, X402_PENDING_STALE_MS, X402_RECEIVER_AUTHORIZER_KEY, X402_REFUSAL_TRANSACTION_DISCOVERY_WINDOW_MS, X402_RPC_URL_KEY, X402_SELF_RELAY_KEY, abandonPendingSubmission, acknowledgeReplayedX402Payment, acknowledgeX402ChannelOwner, activePubkeySet, addPayment, advanceTempoChannelExit, applyImplicitReceiptCredit, applyReceiptCredit, applyRetryToPool, asProviderText, asProviderTextOpt, assertAgentMnemonicReplaceable, assertFloatBudget, assertSupportedX402Network, assertTempoWalletIdle, assertValidBudget, assertX402ChannelPayer, assertX402RequirementDescribesChannel, assertX402WalletIdle, attestedDvmIdentity, authenticatedBuilderPubkey, authorizeProtectedRemoval, automaticCreditBoundRail, availableRails, backfillTrustAnchor, backupSecretFile, buildAdminAuthHeader, buildAdminChallenge, buildCompletionHintFields, buildDisplayMintInventory, buildPolicy, buildTempoCredential, builderLockPath, canReplaceExpiredX402Deposit, captureFundingReceipt, captureTransportReceipt, cashOutFromMint, cashuSubmissionBindingFingerprint, checkMeltQuoteState, checkReceiptAttestation, clearCreditSelection, clearPendingDrain, clearPendingX402ExactFunding, clearPendingX402Funding, clearRefillRailUnavailable, generateIdentity as cliIdentityStoreGenerateIdentity, commitAgentSpend, completionFromMessages, completionSnapshot, computeNextAction, computeSmartDenominations, configSnapshotPath, connectedTempoAccount, connectedX402Payer, correctPendingFundAmount, costAnchor, coveringMintsForSpend, createAdminCashuNonceStore, createInstrumentedFetch, createMonotonicClock, createNoopLogger, createStdoutLogger, createTempoCloseCredential, createX402BatchPayment, currentContext, deleteAgentMnemonic, deriveAgentMasterKeypair, deriveBuilderLockKeypair, deriveBuilderLockPubkey, deriveIdentityFromPrivkey, derivePubkeyFromPrivkey, deriveReceiptKeypair, deriveReceiptSecret, deriveTempoAddress, describeConfigBackup, describeMintBounds, drainReceiptsDisplay, drainReceiptsHint, dvmLocationIdentity, effectiveCreditPosture, effectiveFundingMint, effectiveFundingRail, effectiveMints, emitFloatBudgetWarning, enforceGlobalBudget, ensureAddress, ensureConfig, ensureConfigDir, ensureConfigSubdir, ensureProvisionalCredit, entryKind, epochMsToIso, extractBuilderHandle, fetchBtcUsdRate, fetchCoinGeckoBtcUsd, fetchCoinGeckoSpot, fetchLnurlPayInvoice, fetchMeltQuote, fetchMissingJobReceipt, fetchTrustAnchor, findSigningIdentityByPubkey, findX402Channel, floatBudgetJson, floatPaymentDisplay, floatPaymentJson, forgetCredit, formatAmount, formatAmountBestEffort, formatLocktime, formatPaymentAmount, formatSats, formatStaleness, formatUsd, formatUsdcMicrounits, fundAgentWallet, fundCredit, fundWireAmountMicro, fundingModeForTempoIntent, fundingModeForX402Flavour, fundingRailLabel, generateAgentMnemonic, generateEphemeralReceiptKey, generateTempoKey, generateX402PrivateKey, getBalance, getBalanceByMint, getFundingGuidance, getInfo, getInputFeesForProofs, getLastKnownBtcRate, getOutputTraceId, getTempoUsdcBalance, getWallet, getX402Balance, hashedCanonicalDvmId, humanizeZodError, identitiesFileExists, info, initLockPubkeyTable, initLoggers, insertSpanBatch, installAdminCashuRoutes, isAbortError, isCreditFundRail, isCreditFundingMode, isCreditPosture, isFeedbackPosture, isPaymentRailKey, isPublicRequestId, isResumable, isStablecoinFundRail, isTerminalJobStatus, isValidEvmPrivateKey, issueRouterFeedbackClaim, jobCredentialGate, json, listCredits, listFundingMenuSnapshots, listImplicitCredits, listPendingFundings, listPendingX402Fundings, listPendingX402FundingsForChannel, listResumableTempoChargeFundings, listResumableX402ExactFundings, listResumableX402Fundings, listTempoChannelAssociations, listTransactions, listX402Channels, loadAgentWallet, loadAllJobs, loadConfig, loadConfiguredMints, loadCredit, loadFloat, loadIdentities, loadImplicitCredits, loadJob, loadLedger, loadLockPubkeyState, loadPendingFunding, loadReceipt, loadReceipts, loadResumableX402ExactFunding, loadResumableX402Funding, loadTempoChannelAssociation, loadTempoChannelController, loadTempoChannelEntry, loadX402Wallet, loggers, looksLikeMnemonic, lookupInvoice, makeInvoice, markCredit, markImplicitCreditLost, markJobTerminal, markRefillDrainNoticed, markRefillRailUnavailable, maxKeysetDenomination, microToSats, missingDleqRecoveryDiagnostic, mnemonicFingerprint, monetaryJson, msatsToMicro, msatsToUsd, msatsToUsdCents, msatsToUsdc, needsPocketRefill, needsTopup, nextStepHint, normalizeCreditEndpoint, normalizeFeedbackEndpointHost, nwcDedupWindowMs, nwcRejectionDisplay, nwcTimeoutMs, offersTempoCreditFunding, offersX402CreditFunding, parseBudget, parseCreditMenu, parseCreditTerms, parseLnAddress, parseLocktime, parseNwcUri, parseStatedBudget, parseTraceparent, payInvoiceReconciling, payViaFloat, paymentRailLabel, pendingDrainById, pendingDrainFor, pickCreditFundRail, pinConfigSnapshot, pinDimension, planConfigReset, planCreditForQuote, planProbeDraw, pocketTargetMicro, pollNextAction, pollPendingCreditFundings, preferLightningFirst, prepareAgentSpend, prepareP2PKMint, previewConfigRollback, printFundingGuidance, probeFloat, probeRailLabel, probeWallets, processX402BatchCorrection, processX402BatchResponse, processX402BatchResponseForWallet, providerProseSources, providerTextToString, pruneRetired, railLabelAtSentenceStart, randomTraceId, rateUnavailablePaymentError, raw, readFundValuation, readX402ChannelOnChain, receiptDisplay, receiptFailureDetail, receiptHint, receiptIssuedAtIso, receiptJsonFields, receiptPubkeyFromSecret, receiptTrustFields, receiveToAgentWallet, reclaimAtMs, reconcileRefusedX402Deposits, reconcileTempoChannelOnChain, recordBalanceResponse, recordCreditX402Instrument, recordDrainReceipts, recordFloatSpend, recordFundResponse, recordFundingMenuSnapshot, recordPendingDrain, recordPendingX402ExactFunding, recordPendingX402Funding, recordRefusedDrawBalance, recordSpend, recordX402ChannelMetadata, recoverPendingSubmission, redactUrl, redactUrlsInText, refFromJob, refundX402BatchChannel, releaseAgentReserve, removeX402Wallet, renderReceiptHuman, repairConfigDirMode, repinX402WalletNetwork, replayStoredReceipt, reserveAgentWallet, resolveBtcUsdRate, resolveFundMint, resolveLnurlPayMetadataUrl, resolveRpcHttpTransportOptions, resolveRpcOverride, resolveSigningIdentity, resolveTempoAsset, resolveX402Asset, resolveX402ChannelRpc, restoreProofsFromOutputs, retireConfigBackup, retirePendingX402Funding, rollbackConfig, rotateLockPubkey, rpcEndpointLine, rpcEndpointSuffix, saveAgentWallet, saveIdentities, saveJob, saveLedger, saveX402Wallet, seedLockPubkeyState, selectProofsForSpend, serializeOutputData, setEmitter, setOutputTraceId, settleDrainEvidence, shellQuoteArg, signDvmRequestData, signRequestData, signedRequestDomain, spendableAt, staleRateNotice, statusSnapshot, swapFeeForProofs, swapSendReserve, sweepPendingMelts, sweepPendingMints, sweepPendingSubmissions, sweepStaleInFlight, tempoBalanceCheckHint, tempoChannelControlledBy, tempoCredentialAmountMicro, tempoKeyImportRoutes, tempoSessionChallenge, tempoSessionChallengeMicro, tempoTokenReference, tempoWrongAssetHint, tierCapOverrides, toAgentProof, toFloatError, transportErrorCode, trustLadderFor, trustOverrideCapMicro, tryResolveBtcUsdRate, tryResolveTempoAsset, tryX402Payment, unreachableRailDisplay, unreachableRailHint, unrecordedFloatBudgetWarning, unsignRequestData, updateConfig, updateJob, usdToMsats, usdcToMsats, validateAgentMnemonic, validateLnAddress, validateX402Env, verifyCanonicalSignedRequest, verifyChallenge, verifyDrainReceiptChain, verifyFundingReceiptChain, verifyJobReceipt, verifyRouterFeedbackClaim, verifyX402Payment, walletExists, weakestReceiptVerdict, windowStart, withIdentitiesLock, withInitRetry, withNwcPool, withTempoChannelLock, withTraceContext, withWalletLock, withX402ChannelLock, writeAgentMnemonic, x402ChannelBalanceUnreconciledAt, x402ChannelControlledBy, x402ChannelReservation, x402CreditChannelNetworks, x402CreditExactNetworks, x402ExactFundingDead, x402FlavourForInstrument, x402NetworkByCaip2, x402NetworkBySlug, x402NetworkLabel, x402NetworkListForCopy, x402PendingBlockExpiresAt, x402PendingDepositExpiresAt, x402PendingFundingJson, x402PendingRetired, x402PendingStale, x402PendingUnsettled, x402RequiredFromError, x402ReservationRelease, x402SupportedNetworksHint, x402VoucherPendingRefusal, x402WrongAssetHint };
@@ -281,6 +281,7 @@ import {
281
281
  isX402SettlementReconciliationReason,
282
282
  issueUpfrontChallenges,
283
283
  jobCredentialGate,
284
+ listTransactions,
284
285
  loadAgentWallet,
285
286
  loadIdentitySecret,
286
287
  loadLockPubkeyState,
@@ -314,6 +315,7 @@ import {
314
315
  rotateLockPubkey,
315
316
  saveAgentWallet,
316
317
  seedLockPubkeyState,
318
+ sha256hex,
317
319
  signAttestation,
318
320
  signDrainReceipt,
319
321
  signFundingReceipt,
@@ -342,7 +344,7 @@ import {
342
344
  writeIdentity,
343
345
  x402RequiredUsdcMicro,
344
346
  x402SettledShare
345
- } from "../chunk-CMDI3ENK.js";
347
+ } from "../chunk-Y6W5ZZTW.js";
346
348
  import {
347
349
  X402_BATCH_SETTLEMENT_SCHEME,
348
350
  X402_DEFAULT_FACILITATOR,
@@ -657,6 +659,10 @@ function appendSpend(ledger, opts) {
657
659
  if (opts.kind !== void 0 && opts.kind !== "job") entry.kind = opts.kind;
658
660
  if (opts.principalMsats !== void 0) entry.principalMsats = opts.principalMsats;
659
661
  if (opts.routingFeeMsats !== void 0) entry.routingFeeMsats = opts.routingFeeMsats;
662
+ if (opts.totalWalletFeeMsats !== void 0)
663
+ entry.totalWalletFeeMsats = opts.totalWalletFeeMsats;
664
+ if (opts.unitemizedWalletFeeMsats !== void 0)
665
+ entry.unitemizedWalletFeeMsats = opts.unitemizedWalletFeeMsats;
660
666
  if (opts.walletDebitMsats !== void 0) entry.walletDebitMsats = opts.walletDebitMsats;
661
667
  if (opts.label !== void 0) entry.label = opts.label;
662
668
  if (opts.labelSource !== void 0) entry.labelSource = opts.labelSource;
@@ -860,15 +866,29 @@ function floatPaymentJson(payment) {
860
866
  outcome: payment.outcome,
861
867
  principal_sats: payment.principalMsats / 1e3,
862
868
  routing_fee_sats: payment.routingFeeMsats === null ? null : payment.routingFeeMsats / 1e3,
869
+ total_wallet_fee_sats: payment.totalWalletFeeMsats === null ? null : payment.totalWalletFeeMsats / 1e3,
870
+ unitemized_wallet_fee_sats: payment.unitemizedWalletFeeMsats === null ? null : payment.unitemizedWalletFeeMsats / 1e3,
863
871
  wallet_debit_sats: payment.walletDebitMsats === null ? null : payment.walletDebitMsats / 1e3
864
872
  };
865
873
  }
866
874
  function floatPaymentDisplay(payment) {
867
875
  const principal = formatSats2(payment.principalMsats);
868
- if (payment.routingFeeMsats === null || payment.walletDebitMsats === null) {
869
- return `Invoice principal ${principal}; the wallet did not report its routing fee, so the total wallet debit is unknown.`;
876
+ if (payment.walletDebitMsats === null) {
877
+ const routing2 = payment.routingFeeMsats === null ? "The wallet did not report its routing fee." : `The wallet reported ${formatSats2(payment.routingFeeMsats)} of routing fee.`;
878
+ return `Invoice principal ${principal}; the total wallet debit and total wallet fee are unknown. ${routing2}`;
870
879
  }
871
- return `${formatSats2(payment.walletDebitMsats)} went out: invoice principal ${principal} plus ${formatSats2(payment.routingFeeMsats)} routing fee.`;
880
+ if (payment.totalWalletFeeMsats === null) {
881
+ return `${formatSats2(payment.walletDebitMsats)} went out for invoice principal ${principal}; the total wallet fee is unknown.`;
882
+ }
883
+ const totalFee = formatSats2(payment.totalWalletFeeMsats);
884
+ if (payment.routingFeeMsats === null) {
885
+ return `${formatSats2(payment.walletDebitMsats)} went out: invoice principal ${principal} and total wallet fee ${totalFee}. The wallet did not report its routing fee, so the fee split is unknown.`;
886
+ }
887
+ const routing = formatSats2(payment.routingFeeMsats);
888
+ if (payment.unitemizedWalletFeeMsats === null) {
889
+ return `${formatSats2(payment.walletDebitMsats)} went out: invoice principal ${principal} and total wallet fee ${totalFee}. The wallet reported ${routing} of routing fee; the remaining fee split is unknown.`;
890
+ }
891
+ return `${formatSats2(payment.walletDebitMsats)} went out: invoice principal ${principal} and total wallet fee ${totalFee} (${routing} wallet-reported routing fee and ${formatSats2(payment.unitemizedWalletFeeMsats)} unitemized wallet fee).`;
872
892
  }
873
893
  function unrecordedFloatBudgetWarning(float) {
874
894
  if (float.statedBudget) return void 0;
@@ -945,15 +965,17 @@ async function assertFloatBudget(plannedMsats) {
945
965
  return enforceGlobalBudget({ plannedMsats });
946
966
  }
947
967
  function recordFloatSpend(params) {
948
- const walletDebitMsats = params.routingFeeMsats === null ? null : params.principalMsats + params.routingFeeMsats;
968
+ const walletDebitMsats = params.walletDebitMsats ?? null;
949
969
  recordSpend({
950
970
  kind: "float_fund",
951
971
  // The legacy `msats` field drives cap arithmetic. Use the exact debit when
952
- // the wallet supplied its fee; otherwise retain the known principal and
972
+ // read-only evidence proved it; otherwise retain the known principal and
953
973
  // mark the total unknown in the component fields below.
954
974
  msats: walletDebitMsats ?? params.principalMsats,
955
975
  principalMsats: params.principalMsats,
956
976
  routingFeeMsats: params.routingFeeMsats,
977
+ totalWalletFeeMsats: params.totalWalletFeeMsats ?? null,
978
+ unitemizedWalletFeeMsats: params.unitemizedWalletFeeMsats ?? null,
957
979
  walletDebitMsats,
958
980
  btcRate: params.btcRate,
959
981
  jobId: params.reference,
@@ -963,21 +985,127 @@ function recordFloatSpend(params) {
963
985
  }
964
986
  async function payViaFloat(params) {
965
987
  try {
966
- const payment = await backendFor(params.float, { timeoutMs: params.timeoutMs }).payInvoice(
967
- params.bolt11,
968
- params.amountMsats
988
+ return await withNwcPool(
989
+ params.float.conn,
990
+ (opts) => payViaLightningBackend({
991
+ bolt11: params.bolt11,
992
+ amountMsats: params.amountMsats,
993
+ backend: backendFor(params.float, opts)
994
+ }),
995
+ params.timeoutMs
969
996
  );
970
- const routingFeeMsats = payment.feesPaidMsats ?? null;
971
- return {
972
- outcome: payment.outcome,
973
- principalMsats: params.amountMsats,
974
- routingFeeMsats,
975
- walletDebitMsats: routingFeeMsats === null ? null : params.amountMsats + routingFeeMsats
976
- };
977
997
  } catch (err) {
978
998
  throw toFloatError(err);
979
999
  }
980
1000
  }
1001
+ var FLOAT_TRANSACTION_LIMIT = 100;
1002
+ var FLOAT_HISTORY_LOOKBACK_SECONDS = 300;
1003
+ async function payViaLightningBackend(params) {
1004
+ const now = params.now ?? (() => Date.now());
1005
+ const historyFrom = Math.max(
1006
+ 0,
1007
+ Math.floor(now() / 1e3) - FLOAT_HISTORY_LOOKBACK_SECONDS
1008
+ );
1009
+ const before = await stableWalletSnapshot(params.backend, historyFrom);
1010
+ const payment = await params.backend.payInvoice(params.bolt11, params.amountMsats);
1011
+ const fallback = paymentWithoutAuthoritativeDebit(payment, params.amountMsats);
1012
+ if (!before) return fallback;
1013
+ const after = await stableWalletSnapshot(params.backend, historyFrom);
1014
+ if (!after) return fallback;
1015
+ return paymentFromEvidence(params, payment, before, after);
1016
+ }
1017
+ function paymentWithoutAuthoritativeDebit(payment, principalMsats) {
1018
+ return {
1019
+ outcome: payment.outcome,
1020
+ principalMsats,
1021
+ routingFeeMsats: payment.feesPaidMsats ?? null,
1022
+ totalWalletFeeMsats: null,
1023
+ unitemizedWalletFeeMsats: null,
1024
+ walletDebitMsats: null
1025
+ };
1026
+ }
1027
+ async function stableWalletSnapshot(backend, from) {
1028
+ if (!backend.listTransactions) return void 0;
1029
+ try {
1030
+ const first = await walletSnapshot(backend, from);
1031
+ const second = await walletSnapshot(backend, from);
1032
+ return sameWalletSnapshot(first, second) ? second : void 0;
1033
+ } catch {
1034
+ return void 0;
1035
+ }
1036
+ }
1037
+ async function walletSnapshot(backend, from) {
1038
+ const balanceMsats = await backend.getBalance();
1039
+ if (!Number.isSafeInteger(balanceMsats) || balanceMsats < 0) {
1040
+ throw new NwcError("invalid_response", "Wallet returned an invalid balance.");
1041
+ }
1042
+ const transactions = await backend.listTransactions({
1043
+ from,
1044
+ limit: FLOAT_TRANSACTION_LIMIT + 1
1045
+ });
1046
+ if (transactions.length > FLOAT_TRANSACTION_LIMIT) {
1047
+ throw new NwcError("invalid_response", "Wallet transaction snapshot exceeded its limit.");
1048
+ }
1049
+ return {
1050
+ balanceMsats,
1051
+ transactions: [...transactions].sort(
1052
+ (left, right) => left.fingerprint.localeCompare(right.fingerprint)
1053
+ )
1054
+ };
1055
+ }
1056
+ function sameWalletSnapshot(left, right) {
1057
+ return left.balanceMsats === right.balanceMsats && left.transactions.length === right.transactions.length && left.transactions.every(
1058
+ (transaction, index) => transaction.fingerprint === right.transactions[index]?.fingerprint
1059
+ );
1060
+ }
1061
+ function paymentFromEvidence(params, payment, before, after) {
1062
+ const fallback = paymentWithoutAuthoritativeDebit(payment, params.amountMsats);
1063
+ const appended = appendedTransactions(before.transactions, after.transactions);
1064
+ if (appended.length !== 1) return fallback;
1065
+ const transaction = appended[0];
1066
+ if (transaction.type !== "outgoing" || transaction.invoiceHash !== sha256hex(params.bolt11) || transaction.amountMsats !== params.amountMsats || transaction.settledAt === void 0) {
1067
+ return fallback;
1068
+ }
1069
+ const responseRoutingFee = payment.feesPaidMsats;
1070
+ const historyRoutingFee = transaction.feesPaidMsats;
1071
+ if (responseRoutingFee !== void 0 && historyRoutingFee !== void 0 && responseRoutingFee !== historyRoutingFee) {
1072
+ return fallback;
1073
+ }
1074
+ const routingFeeMsats = historyRoutingFee ?? responseRoutingFee ?? null;
1075
+ const walletDebitMsats = before.balanceMsats - after.balanceMsats;
1076
+ if (!Number.isSafeInteger(walletDebitMsats) || walletDebitMsats < params.amountMsats) {
1077
+ return fallback;
1078
+ }
1079
+ const totalWalletFeeMsats = walletDebitMsats - params.amountMsats;
1080
+ if (routingFeeMsats !== null && routingFeeMsats > totalWalletFeeMsats) return fallback;
1081
+ return {
1082
+ outcome: payment.outcome,
1083
+ principalMsats: params.amountMsats,
1084
+ routingFeeMsats,
1085
+ totalWalletFeeMsats,
1086
+ unitemizedWalletFeeMsats: routingFeeMsats === null ? null : totalWalletFeeMsats - routingFeeMsats,
1087
+ walletDebitMsats
1088
+ };
1089
+ }
1090
+ function appendedTransactions(before, after) {
1091
+ const remaining = /* @__PURE__ */ new Map();
1092
+ for (const transaction of before) {
1093
+ remaining.set(transaction.fingerprint, (remaining.get(transaction.fingerprint) ?? 0) + 1);
1094
+ }
1095
+ const nextCounts = /* @__PURE__ */ new Map();
1096
+ for (const transaction of after) {
1097
+ nextCounts.set(transaction.fingerprint, (nextCounts.get(transaction.fingerprint) ?? 0) + 1);
1098
+ }
1099
+ if ([...remaining].some(([fingerprint, count]) => (nextCounts.get(fingerprint) ?? 0) < count)) {
1100
+ return [];
1101
+ }
1102
+ return after.filter((transaction) => {
1103
+ const count = remaining.get(transaction.fingerprint) ?? 0;
1104
+ if (count === 0) return true;
1105
+ remaining.set(transaction.fingerprint, count - 1);
1106
+ return false;
1107
+ });
1108
+ }
981
1109
  async function fundViaFloat(params) {
982
1110
  const float = params.float ?? requireFloat();
983
1111
  const btcRate = await assertFloatBudget(params.amountMsats);
@@ -990,6 +1118,9 @@ async function fundViaFloat(params) {
990
1118
  recordFloatSpend({
991
1119
  principalMsats: payment.principalMsats,
992
1120
  routingFeeMsats: payment.routingFeeMsats,
1121
+ totalWalletFeeMsats: payment.totalWalletFeeMsats,
1122
+ unitemizedWalletFeeMsats: payment.unitemizedWalletFeeMsats,
1123
+ walletDebitMsats: payment.walletDebitMsats,
993
1124
  btcRate,
994
1125
  reference: params.reference,
995
1126
  counterparty: params.counterparty,
@@ -8338,6 +8469,8 @@ async function fundOverLightning(args, fundId, resumed) {
8338
8469
  ...pending,
8339
8470
  principalMsats: payment.principalMsats,
8340
8471
  routingFeeMsats: payment.routingFeeMsats,
8472
+ totalWalletFeeMsats: payment.totalWalletFeeMsats,
8473
+ unitemizedWalletFeeMsats: payment.unitemizedWalletFeeMsats,
8341
8474
  walletDebitMsats: payment.walletDebitMsats,
8342
8475
  paymentOutcome: payment.outcome
8343
8476
  };
@@ -8484,6 +8617,8 @@ function lightningSpend(payment) {
8484
8617
  ...walletDebitSats !== null ? { spentSats: walletDebitSats } : {},
8485
8618
  principalSats: payment.principalMsats / 1e3,
8486
8619
  routingFeeSats: payment.routingFeeMsats === null ? null : payment.routingFeeMsats / 1e3,
8620
+ totalWalletFeeSats: payment.totalWalletFeeMsats === null ? null : payment.totalWalletFeeMsats / 1e3,
8621
+ unitemizedWalletFeeSats: payment.unitemizedWalletFeeMsats === null ? null : payment.unitemizedWalletFeeMsats / 1e3,
8487
8622
  walletDebitSats,
8488
8623
  paymentOutcome: payment.outcome
8489
8624
  };
@@ -8496,16 +8631,28 @@ function lightningSpendFromPending(pending) {
8496
8631
  ...walletDebitSats !== null ? { spentSats: walletDebitSats } : {},
8497
8632
  principalSats: pending.principalMsats / 1e3,
8498
8633
  routingFeeSats: pending.routingFeeMsats == null ? null : pending.routingFeeMsats / 1e3,
8634
+ totalWalletFeeSats: pending.totalWalletFeeMsats == null ? null : pending.totalWalletFeeMsats / 1e3,
8635
+ unitemizedWalletFeeSats: pending.unitemizedWalletFeeMsats == null ? null : pending.unitemizedWalletFeeMsats / 1e3,
8499
8636
  walletDebitSats,
8500
8637
  paymentOutcome: pending.paymentOutcome
8501
8638
  };
8502
8639
  }
8503
8640
  function lightningSpendDisplay(spend) {
8504
8641
  const principal = spend.principalSats ?? 0;
8505
- if (spend.routingFeeSats == null || spend.walletDebitSats == null) {
8506
- return `Invoice principal ${String(principal)} sats; the wallet did not report its routing fee, so the total wallet debit is unknown.`;
8642
+ if (spend.walletDebitSats == null) {
8643
+ const routing = spend.routingFeeSats == null ? "The wallet did not report its routing fee." : `The wallet reported ${String(spend.routingFeeSats)} sats of routing fee.`;
8644
+ return `Invoice principal ${String(principal)} sats; the total wallet debit and total wallet fee are unknown. ${routing}`;
8645
+ }
8646
+ if (spend.totalWalletFeeSats == null) {
8647
+ return `${String(spend.walletDebitSats)} sats went out for invoice principal ${String(principal)} sats; the total wallet fee is unknown.`;
8648
+ }
8649
+ if (spend.routingFeeSats == null) {
8650
+ return `${String(spend.walletDebitSats)} sats went out: invoice principal ${String(principal)} sats and total wallet fee ${String(spend.totalWalletFeeSats)} sats. The wallet did not report its routing fee, so the fee split is unknown.`;
8651
+ }
8652
+ if (spend.unitemizedWalletFeeSats == null) {
8653
+ return `${String(spend.walletDebitSats)} sats went out: invoice principal ${String(principal)} sats and total wallet fee ${String(spend.totalWalletFeeSats)} sats. The wallet reported ${String(spend.routingFeeSats)} sats of routing fee; the remaining fee split is unknown.`;
8507
8654
  }
8508
- return `${String(spend.walletDebitSats)} sats went out: invoice principal ${String(principal)} sats plus ${String(spend.routingFeeSats)} sats routing fee.`;
8655
+ return `${String(spend.walletDebitSats)} sats went out: invoice principal ${String(principal)} sats and total wallet fee ${String(spend.totalWalletFeeSats)} sats (${String(spend.routingFeeSats)} sats wallet-reported routing fee and ${String(spend.unitemizedWalletFeeSats)} sats unitemized wallet fee).`;
8509
8656
  }
8510
8657
  function lightningCreditBody(pending) {
8511
8658
  return {
@@ -9702,6 +9849,7 @@ export {
9702
9849
  listResumableX402ExactFundings,
9703
9850
  listResumableX402Fundings,
9704
9851
  listTempoChannelAssociations,
9852
+ listTransactions,
9705
9853
  listX402Channels,
9706
9854
  loadAgentWallet,
9707
9855
  loadAllJobs,
@@ -1100,7 +1100,8 @@ declare function verifyDrainReceipt(receipt: DrainReceipt): boolean;
1100
1100
  * these rails, not only a reclaim: `inKindDrawMsats` turns the depletion a
1101
1101
  * settle already performs into the draw's booked rail value, so one credit has
1102
1102
  * one answer to "what were these sats" and the pooled remainder stops being a
1103
- * second authority. See the internal-review invariant in `src/sdk/CLAUDE.md`.
1103
+ * second authority: settled draw sats plus reclaim sats must equal the sats
1104
+ * that credit's funding lots received.
1104
1105
  */
1105
1106
  /**
1106
1107
  * The rails whose credits carry a Bitcoin deposit this ledger owes back in
@@ -1,11 +1,11 @@
1
- import { ah as CashuMode, bP as CreditDrainEnqueue, R as ResolvedCreditConfig, bQ as DVMAuthScheme, B as SignedRequestDomain, bR as CreditLedgerLike, bS as X402RefundSettlementGate, bT as CreditSnapshot, bU as DrawResult, bV as X402SettlementStatus, bW as X402UnresolvedRefund, bX as GrownDrawResult, bY as DrawResolution, bZ as FundingRecord, Y as FundingReceipt, b_ as CreditInvoiceRecord, b$ as InvoiceSettlement, c0 as BlockedInvoiceCursor, c1 as InvoiceReconciliation, c2 as InvoiceWriteOff, c3 as DrawRecord, c4 as StalePendingDrawCursor, c5 as TempoCreditLossEvidence, c6 as CreditLedgerQuerier, c7 as TempoCreditLoss, c8 as X402CreditLossEvidence, c9 as X402CreditLoss, ca as DrainMethod, cb as DrainRequestResult, cc as BitcoinDepositLiability, ao as FundingLot, cd as CreditDrainRecord, ce as ChannelDrainCursor, cf as DrainWriteOff, cg as DrainReleaseResult, ch as DrainFulfilment, ci as DrainTransitionResult, cj as StreamableJobStore, ck as ReceiptIssuingStore, J as JobRecord, cl as RequestIdClaim, cm as RequestIdClaimResult, _ as JobReceipt, aw as OutgoingMessage, cn as AppendOutgoingOptions, co as PaymentCreditDelta, cp as VerifyAndCreditResult, cq as JobCounters, a2 as Message, K as KVStore, G as SignedRequestReplayStore, Z as ZodLike, a as DVMDescriptor } from '../job-store-BtCaLnvJ.js';
2
- export { cr as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, cs as ClientCompatibility, ct as ClientCompatibilityEnv, cu as ClientCompatibilityGate, cv as ClientCompatibilityRequirement, cw as ClientSemVer, e as CreateSignedRequestVerifierOpts, cx as CreditFundingBasis, cy as CreditInvoiceStatus, cz as CreditLedger, cA as CreditLedgerError, cB as CreditLedgerErrorCode, cC as CreditLedgerErrorDetails, cD as CreditLedgerPool, cE as CreditStatus, cF as DRAIN_DELIVERY_RESERVE_SATS, cG as DVM_PROTOCOL_VERSION, cH as DrainConflictReason, cI as DrawRailValue, cJ as DrawStatus, n as JobStatus, o as JobStore, cK as PostgresX402ChannelStorage, cL as ReplayStoreBackend, cM as RevenueSkippedNoRailPayload, cN as RevenueSkippedNoRailReason, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, cO as Secp256k1AuthOpts, z as SignedRequestAudience, E as SignedRequestError, F as SignedRequestFailure, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, cP as X402ChannelStorageOpts, cQ as X402RelayLockHolder, cR as X402RelaySubmissionLock, cS as X402RelaySubmissionLockError, cT as allocateDrawValue, cU as clientCompatibilityAttributes, cV as clientCompatibilityMiddleware, cW as clientUpgradeRequired, O as createSignedRequestVerifier, cX as isStreamableJobStore, cY as parseClientCapabilities, cZ as parseClientCompatibility, c_ as parseDvmClient, c$ as parseProtocolVersion, d0 as requireClientCompatibility, d1 as secp256k1Auth, d2 as signedRequestInput, V as signedRequestStatementHeader } from '../job-store-BtCaLnvJ.js';
1
+ import { ah as CashuMode, bP as CreditDrainEnqueue, R as ResolvedCreditConfig, bQ as DVMAuthScheme, B as SignedRequestDomain, bR as CreditLedgerLike, bS as X402RefundSettlementGate, bT as CreditSnapshot, bU as DrawResult, bV as X402SettlementStatus, bW as X402UnresolvedRefund, bX as GrownDrawResult, bY as DrawResolution, bZ as FundingRecord, Y as FundingReceipt, b_ as CreditInvoiceRecord, b$ as InvoiceSettlement, c0 as BlockedInvoiceCursor, c1 as InvoiceReconciliation, c2 as InvoiceWriteOff, c3 as DrawRecord, c4 as StalePendingDrawCursor, c5 as TempoCreditLossEvidence, c6 as CreditLedgerQuerier, c7 as TempoCreditLoss, c8 as X402CreditLossEvidence, c9 as X402CreditLoss, ca as DrainMethod, cb as DrainRequestResult, cc as BitcoinDepositLiability, ao as FundingLot, cd as CreditDrainRecord, ce as ChannelDrainCursor, cf as DrainWriteOff, cg as DrainReleaseResult, ch as DrainFulfilment, ci as DrainTransitionResult, cj as StreamableJobStore, ck as ReceiptIssuingStore, J as JobRecord, cl as RequestIdClaim, cm as RequestIdClaimResult, _ as JobReceipt, aw as OutgoingMessage, cn as AppendOutgoingOptions, co as PaymentCreditDelta, cp as VerifyAndCreditResult, cq as JobCounters, a2 as Message, K as KVStore, G as SignedRequestReplayStore, Z as ZodLike, a as DVMDescriptor } from '../job-store-DOSfYnLX.js';
2
+ export { cr as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, cs as ClientCompatibility, ct as ClientCompatibilityEnv, cu as ClientCompatibilityGate, cv as ClientCompatibilityRequirement, cw as ClientSemVer, e as CreateSignedRequestVerifierOpts, cx as CreditFundingBasis, cy as CreditInvoiceStatus, cz as CreditLedger, cA as CreditLedgerError, cB as CreditLedgerErrorCode, cC as CreditLedgerErrorDetails, cD as CreditLedgerPool, cE as CreditStatus, cF as DRAIN_DELIVERY_RESERVE_SATS, cG as DVM_PROTOCOL_VERSION, cH as DrainConflictReason, cI as DrawRailValue, cJ as DrawStatus, n as JobStatus, o as JobStore, cK as PostgresX402ChannelStorage, cL as ReplayStoreBackend, cM as RevenueSkippedNoRailPayload, cN as RevenueSkippedNoRailReason, x as SIGNED_REQUEST_AUTH_ID, y as SIGNED_REQUEST_STATEMENT_VERSION, cO as Secp256k1AuthOpts, z as SignedRequestAudience, E as SignedRequestError, F as SignedRequestFailure, H as SignedRequestSignOpts, M as SignedRequestStatementHeader, N as SignedRequestVerifier, cP as X402ChannelStorageOpts, cQ as X402RelayLockHolder, cR as X402RelaySubmissionLock, cS as X402RelaySubmissionLockError, cT as allocateDrawValue, cU as clientCompatibilityAttributes, cV as clientCompatibilityMiddleware, cW as clientUpgradeRequired, O as createSignedRequestVerifier, cX as isStreamableJobStore, cY as parseClientCapabilities, cZ as parseClientCompatibility, c_ as parseDvmClient, c$ as parseProtocolVersion, d0 as requireClientCompatibility, d1 as secp256k1Auth, d2 as signedRequestInput, V as signedRequestStatementHeader } from '../job-store-DOSfYnLX.js';
3
3
  import { Pool } from 'pg';
4
- import { aH as CreditMenu, g as AppEnv, U as UpfrontPaymentOpts, q as PaymentInfo, aI as ReceiptIssuer, aJ as LightningReceive, aK as TempoSettlementReadiness, aL as DVMHostOpts } from '../credit-menu-CYkETVM4.js';
5
- export { aM as BuildCreditMenuArgs, aN as BuilderIdentity, aO as CREDIT_ENVELOPE_KEYS, e as ConsumedCredentialStore, aP as CreateX402BatchSettlementServerOpts, aQ as CreditEnvelope, aR as CreditEnvelopeError, aS as CreditFundCommitment, aT as CreditTerms, aU as DEFAULT_INVOICE_TTL_SECONDS, aV as DVMHost, aW as JobManager, aX as JobManagerOpts, aY as LightningReceiveConfig, aZ as MIN_INVOICE_TTL_SECONDS, a_ as MemoryConsumedCredentialStore, a$ as MemoryConsumedCredentialStoreOpts, b0 as MemoryProcessedPaymentStore, b1 as MemoryX402ExactSettlementStore, b2 as MountOpts, b3 as OwnerDisplay, b4 as PlatformReporterOpts, b5 as PostgresProcessedPaymentStore, b6 as PostgresX402ExactSettlementStore, b7 as PriceFiat, b8 as ProcessedPaymentQuerier, b9 as ProcessedPaymentRail, ba as ProcessedPaymentRecord, bb as ProcessedPaymentReplayError, bc as ProcessedPaymentStore, bd as X402BatchAcceptance, be as X402BatchFunding, bf as X402BatchRefusal, bg as X402BatchSettlementServer, bh as X402ExactAcceptance, bi as X402ExactIntentConflictError, bj as X402ExactSettlementAttempt, bk as X402ExactSettlementChainEvidence, bl as X402ExactSettlementEffect, bm as X402ExactSettlementEvidenceMissingError, bn as X402ExactSettlementEvidenceReader, bo as X402ExactSettlementIntent, bp as X402ExactSettlementNotReadyError, bq as X402ExactSettlementServer, br as X402ExactSettlementServerOpts, bs as X402ExactSettlementStatus, bt as X402ExactSettlementStore, bu as X402SettlementChainEvidence, bv as X402SettlementEvidenceReader, bw as X402SettlementSubmissionError, bx as X402_BATCH_AUTO_SETTLEMENT, by as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bz as X402_BATCH_SETTLEMENT_NETWORK, bA as attachCreditMenu, bB as buildCreditMenu, bC as createDVMHost, bD as createX402BatchSettlementServer, bE as creditEnvelopeIgnoreFields, bF as drawSettlementRef, bG as extractCreditEnvelope, bH as fundingCommitment, bI as selectPrimaryCredit, bJ as stripCreditEnvelope, bK as toCreditView } from '../credit-menu-CYkETVM4.js';
4
+ import { aJ as CreditMenu, i as AppEnv, U as UpfrontPaymentOpts, s as PaymentInfo, aK as ReceiptIssuer, aL as LightningReceive, aM as TempoSettlementReadiness, aN as DVMHostOpts } from '../credit-menu-BrTfAr7l.js';
5
+ export { aO as BuildCreditMenuArgs, aP as BuilderIdentity, aQ as CREDIT_ENVELOPE_KEYS, g as ConsumedCredentialStore, aR as CreateX402BatchSettlementServerOpts, aS as CreditEnvelope, aT as CreditEnvelopeError, aU as CreditFundCommitment, aV as CreditTerms, aW as DEFAULT_INVOICE_TTL_SECONDS, aX as DVMHost, aY as JobManager, aZ as JobManagerOpts, a_ as LightningReceiveConfig, a$ as MIN_INVOICE_TTL_SECONDS, b0 as MemoryConsumedCredentialStore, b1 as MemoryConsumedCredentialStoreOpts, b2 as MemoryProcessedPaymentStore, b3 as MemoryX402ExactSettlementStore, b4 as MountOpts, b5 as OwnerDisplay, b6 as PlatformReporterOpts, b7 as PostgresProcessedPaymentStore, b8 as PostgresX402ExactSettlementStore, b9 as PriceFiat, ba as ProcessedPaymentQuerier, bb as ProcessedPaymentRail, bc as ProcessedPaymentRecord, bd as ProcessedPaymentReplayError, be as ProcessedPaymentStore, bf as X402BatchAcceptance, bg as X402BatchFunding, bh as X402BatchRefusal, bi as X402BatchSettlementServer, bj as X402ExactAcceptance, bk as X402ExactIntentConflictError, bl as X402ExactSettlementAttempt, bm as X402ExactSettlementChainEvidence, bn as X402ExactSettlementEffect, bo as X402ExactSettlementEvidenceMissingError, bp as X402ExactSettlementEvidenceReader, bq as X402ExactSettlementIntent, br as X402ExactSettlementNotReadyError, bs as X402ExactSettlementServer, bt as X402ExactSettlementServerOpts, bu as X402ExactSettlementStatus, bv as X402ExactSettlementStore, bw as X402SettlementChainEvidence, bx as X402SettlementEvidenceReader, by as X402SettlementSubmissionError, bz as X402_BATCH_AUTO_SETTLEMENT, bA as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bB as X402_BATCH_SETTLEMENT_NETWORK, bC as attachCreditMenu, bD as buildCreditMenu, bE as createDVMHost, bF as createX402BatchSettlementServer, bG as creditEnvelopeIgnoreFields, bH as drawSettlementRef, bI as extractCreditEnvelope, bJ as fundingCommitment, bK as selectPrimaryCredit, bL as stripCreditEnvelope, bM as toCreditView } from '../credit-menu-BrTfAr7l.js';
6
6
  import { Context } from 'hono';
7
7
  import { z } from 'zod';
8
- import { F as FxFetcher } from '../fx-Pf4Ey4f_.js';
8
+ import { F as FxFetcher } from '../fx-H6K6qcH1.js';
9
9
  export { P as PinnedFetch, S as SSRFError, a as SSRFGuardOpts, b as SSRFReason, c as SSRFResolver, d as assertSafeUrl, e as createPinnedFetch } from '../ssrf-DbFkpDv0.js';
10
10
  import '@cashu/cashu-ts';
11
11
  import 'mppx';
@@ -74,7 +74,7 @@ import {
74
74
  unknownRouteNotFound,
75
75
  validateX402Env,
76
76
  withNwcPool
77
- } from "../chunk-CMDI3ENK.js";
77
+ } from "../chunk-Y6W5ZZTW.js";
78
78
  import {
79
79
  X402_DEFAULT_FACILITATOR,
80
80
  X402_DEFAULT_NETWORK,
@@ -1,4 +1,4 @@
1
- import { cj as StreamableJobStore, ck as ReceiptIssuingStore, J as JobRecord, cl as RequestIdClaim, cm as RequestIdClaimResult, _ as JobReceipt, aw as OutgoingMessage, cn as AppendOutgoingOptions, co as PaymentCreditDelta, cp as VerifyAndCreditResult, cq as JobCounters, a2 as Message, a3 as MessageType, K as KVStore, L as Logger, v as ResponseContent, P as PaymentContent, S as SDKJobContext } from '../job-store-BtCaLnvJ.js';
1
+ import { cj as StreamableJobStore, ck as ReceiptIssuingStore, J as JobRecord, cl as RequestIdClaim, cm as RequestIdClaimResult, _ as JobReceipt, aw as OutgoingMessage, cn as AppendOutgoingOptions, co as PaymentCreditDelta, cp as VerifyAndCreditResult, cq as JobCounters, a2 as Message, a3 as MessageType, K as KVStore, L as Logger, v as ResponseContent, P as PaymentContent, S as SDKJobContext } from '../job-store-DOSfYnLX.js';
2
2
  import '@cashu/cashu-ts';
3
3
  import 'mppx';
4
4
  import '@x402/core/server';
@@ -1,4 +1,4 @@
1
- import { C as Currency } from './job-store-BtCaLnvJ.js';
1
+ import { C as Currency } from './job-store-DOSfYnLX.js';
2
2
 
3
3
  /**
4
4
  * Thrown by `fiatToSatsCeil` / `satsToFiat` when the supplied `ratePerBtc` is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvmkit/sdk",
3
- "version": "0.1.0-rc.7",
3
+ "version": "0.1.1-rc.7",
4
4
  "description": "SDK for building accountless, pay-per-use Digital Vending Machines",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {