@dvmkit/sdk 0.1.0-rc.5 → 0.1.0-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { Hono, Context } from 'hono';
2
2
  import { Pool } from 'pg';
3
- import { X as JsonValue, bG as CreditLedgerLike, bP as CreditInvoiceRecord, cU as CreditDepositEnqueue, bQ as InvoiceSettlement, Z as ZodLike, a as DVMDescriptor, K as KVStore, o as JobStore, af as CashuMode, ap as MppxServer, a8 as X402Config, p as PaymentMethod, cj as ClientCompatibilityGate, a2 as Message, am as FundingMethod, Y as FundingReceipt, bI as CreditSnapshot, cV as TopUpCapUnenforcedReason, _ as JobReceipt, cc as AppendOutgoingOptions, S as SDKJobContext, aM as StepCache, v as ResponseContent, P as PaymentContent, J as JobRecord, a3 as MessageType, aa as X402Receipt, a9 as X402ExactVersionSupport, cW as X402SettlementIntent, az as PaymentRequirementsV2, bX as CreditLedgerQuerier, cX as X402SettlementCursor, bK as X402SettlementStatus, cY as X402SettlementWriteOff, bH as X402RefundSettlementGate, cZ as X402FacilitatorAuth, c_ as X402BatchSettlementConfig, cz as PostgresX402ChannelStorage, c$ as X402PayoutObserver, d0 as X402SettlementReconciliationReason, ax as PaymentRequirements, a1 as MppxCredential, ag as CreditDepositPayload, bJ as DrawResult, cp as CreditLedgerError, aD as ReceiptCredit, ai as DrainReceiptEvent, ah as DrainReceipt, z as SignedRequestAudience, d1 as CreditDrawReleaseEnqueue, cB as RevenueSkippedNoRailPayload, ch as ClientCompatibility, aA as PayoutReporter, R as ResolvedCreditConfig, g as CreditView } from './job-store-DxFqDPYq.js';
4
- import { F as FxFetcher, b as FxRateSnapshot } from './fx-ptKVFOwq.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-BtCaLnvJ.js';
4
+ import { F as FxFetcher, b as FxRateSnapshot } from './fx-Pf4Ey4f_.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';
@@ -347,6 +347,25 @@ declare function checkMintHealth(mintUrl: string, opts?: CheckMintHealthOptions)
347
347
  * *selection* only, so a mint that can still melt stays loadable for cash-out.
348
348
  */
349
349
  declare function canSwap(nuts: Record<string, unknown>): boolean;
350
+ /** Whether `sats` falls inside a mint's advertised limits, and which end it broke. */
351
+ type AmountBoundsVerdict = "ok" | "below_min" | "above_max";
352
+ /**
353
+ * Judge one amount against one direction's limits. The single predicate both
354
+ * `dvm wallet fund` (mint selection, pre-quote refusal) and
355
+ * `dvm wallet cash-out` (per-leg sizing) ask, so the two commands can't drift
356
+ * on what "out of range" means.
357
+ */
358
+ declare function amountBoundsVerdict(sats: number, bounds?: MintAmountBounds): AmountBoundsVerdict;
359
+ /**
360
+ * Assert that a mint's NUT-06 `nuts` object advertises all required capabilities.
361
+ * Two-phase check:
362
+ * 1. Dict-level — each NUT in `requiredNuts` must be present and not have
363
+ * `supported: false`. Throws naming the missing NUT numbers and mint URL.
364
+ * 2. Method-level — NUT-4 and NUT-5 must each advertise a `bolt11`/`sat`
365
+ * entry in their `methods` array (covers NUT-23). Throws naming the
366
+ * missing method.
367
+ */
368
+ declare function assertNutSupport(mintUrl: string, nuts: Record<string, unknown>, requiredNuts?: readonly number[]): void;
350
369
 
351
370
  /** A Lightning invoice created by the backend. */
352
371
  interface CreatedInvoice {
@@ -5073,4 +5092,4 @@ declare function attachCreditMenu(body: Record<string, unknown>, menu: CreditMen
5073
5092
  */
5074
5093
  declare function toCreditTerms(menu: CreditMenu): CreditTerms;
5075
5094
 
5076
- export { clearAccumulatorForDvm as $, type AccumulatorPool as A, type BuilderIdentityKeypair as B, type CreatedInvoice as C, type X402SettlementRepairRefusal as D, type X402SettlementRepaired as E, type FiatDenomination as F, type X402WedgedSettlement as G, type X402WedgedSettlementPage as H, type InvoiceStatus as I, JobCancelledError as J, X402_BATCH_SETTLEMENT_MAINNET_NETWORK as K, type LightningBackend as L, type MintHealthCheckResult as M, abortJob as N, applyPaymentInfoToJob as O, PAYMENT_PROOF_KEYS as P, assertRevenueReporterReady as Q, type ReporterBannerOpts as R, type SDKServerOpts as S, type TempoChannelReport as T, type UpfrontPaymentOpts as U, type VerifiedIncomingPayment as V, buildAttestation as W, type X402BatchChannelObservation as X, buildPaymentErrorResponse as Y, canSwap as Z, checkMintHealth as _, type LightningPayment as a, type MountOpts as a$, createDVMServer as a0, creditDepositPayload as a1, derivedFundCreditId as a2, devModeSkipsPaymentVerification as a3, fromJobRecord as a4, fundedMicroFor as a5, generateIdentity as a6, hasPaymentProof as a7, hashCapabilities as a8, hashLockKey as a9, verifyUpfrontPayment as aA, writeIdentity as aB, x402RequiredUsdcMicro as aC, x402SettledShare as aD, type CreditMenu as aE, ReceiptIssuer as aF, LightningReceive as aG, TempoSettlementReadiness as aH, type DVMHostOpts as aI, type BuildCreditMenuArgs as aJ, type BuilderIdentity as aK, CREDIT_ENVELOPE_KEYS as aL, type CreateX402BatchSettlementServerOpts as aM, type CreditEnvelope as aN, CreditEnvelopeError as aO, type CreditFundCommitment as aP, type CreditTerms as aQ, DEFAULT_INVOICE_TTL_SECONDS as aR, type DVMHost as aS, JobManager as aT, type JobManagerOpts as aU, type LightningReceiveConfig as aV, MIN_INVOICE_TTL_SECONDS as aW, MemoryConsumedCredentialStore as aX, type MemoryConsumedCredentialStoreOpts as aY, MemoryProcessedPaymentStore as aZ, MemoryX402ExactSettlementStore as a_, implicitCreditId as aa, initWalletAccumulatorTable as ab, insertAccumulatorRows as ac, isDerivedCreditId as ad, isTerminal as ae, isYieldMessage as af, issueUpfrontChallenges as ag, loadIdentitySecret as ah, toLockPubkey as ai, msatsToFiatMicro as aj, paymentErrorBody as ak, pinAskFiat as al, priceFiatMicro as am, processIncomingPayment as an, providerMessage as ao, repairX402ExactSettlementEffect as ap, resolveFxSnapshot as aq, resolvePriceFiat as ar, revenueReporterBannerState as as, signAttestation as at, toCreditTerms as au, toJobRecord as av, unknownRouteNotFound as aw, verifyAttestation as ax, verifyIncomingPayment as ay, verifyTempoSessionManagementCredential as az, type LightningWalletInfo as b, type OwnerDisplay as b0, type PlatformReporterOpts as b1, PostgresProcessedPaymentStore as b2, PostgresX402ExactSettlementStore as b3, type PriceFiat as b4, type ProcessedPaymentQuerier as b5, type ProcessedPaymentRail as b6, type ProcessedPaymentRecord as b7, ProcessedPaymentReplayError as b8, type ProcessedPaymentStore as b9, createX402BatchSettlementServer as bA, creditEnvelopeIgnoreFields as bB, drawSettlementRef as bC, extractCreditEnvelope as bD, fundingCommitment as bE, selectPrimaryCredit as bF, stripCreditEnvelope as bG, toCreditView as bH, type X402BatchAcceptance as ba, type X402BatchFunding as bb, type X402BatchRefusal as bc, type X402BatchSettlementServer as bd, type X402ExactAcceptance as be, X402ExactIntentConflictError as bf, type X402ExactSettlementAttempt as bg, type X402ExactSettlementChainEvidence as bh, type X402ExactSettlementEffect as bi, X402ExactSettlementEvidenceMissingError as bj, type X402ExactSettlementEvidenceReader as bk, type X402ExactSettlementIntent as bl, X402ExactSettlementNotReadyError as bm, X402ExactSettlementServer as bn, type X402ExactSettlementServerOpts as bo, type X402ExactSettlementStatus as bp, type X402ExactSettlementStore as bq, type X402SettlementChainEvidence as br, type X402SettlementEvidenceReader as bs, X402SettlementSubmissionError as bt, X402_BATCH_AUTO_SETTLEMENT as bu, X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS as bv, X402_BATCH_SETTLEMENT_NETWORK as bw, attachCreditMenu as bx, buildCreditMenu as by, createDVMHost as bz, type LockPubkey as c, type AccumulatorQuerier as d, type ConsumedCredentialStore as e, type AppEnv as f, type AttestationPayload as g, type CheckMintHealthOptions as h, type CreditFundingReport as i, type FiatDenominationFailure as j, type FundOnlyRequest as k, type IncomingPaymentOpts as l, MintHealthTracker as m, type PaymentErrorCode as n, type PaymentErrorDetail as o, type PaymentInfo as p, type ResolvedFx as q, type RevenueBootCheckOpts as r, type ServerJob as s, type ShortPayForfeit as t, type TempoObserverHealth as u, TempoSessionChannelMismatchError as v, type VerifyIncomingSnapshot as w, X402FacilitatorHealth as x, type X402SettlementEvidenceOutcome as y, type X402SettlementRepair as z };
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 };
@@ -1,4 +1,4 @@
1
- import { C as Currency } from './job-store-DxFqDPYq.js';
1
+ import { C as Currency } from './job-store-BtCaLnvJ.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-DxFqDPYq.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-DxFqDPYq.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-ptKVFOwq.js';
4
- export { I as InvalidFxRateError, f as fiatToSatsCeil, a as formatFiat, b as formatUsd, r as roundUsd, s as satsToFiat } from './usd-Cha_j80I.js';
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';
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';
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  configureDVM,
9
9
  isConfiguredDVMDescriptor
10
- } from "./chunk-XYTSDAPH.js";
10
+ } from "./chunk-LDTWX7JW.js";
11
11
  import {
12
12
  DEFAULT_CREDIT_MAX,
13
13
  DEFAULT_CREDIT_MIN,
@@ -18,7 +18,7 @@ import {
18
18
  createSignedRequestVerifier,
19
19
  isZodSchema,
20
20
  signedRequestStatementHeader
21
- } from "./chunk-AZBXSXQT.js";
21
+ } from "./chunk-P4RUVDU7.js";
22
22
  import {
23
23
  DEFAULT_FX_CURRENCIES,
24
24
  DEFAULT_FX_RATE_SOURCE,