@dvmkit/sdk 0.4.0-rc.1 → 0.6.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -0
- package/dist/{chunk-TXX4GOUB.js → chunk-7ZUKL4IV.js} +1 -1
- package/dist/chunk-AFV77S4C.js +258 -0
- package/dist/{chunk-2VGWYG4P.js → chunk-B2IROPQF.js} +446 -81
- package/dist/chunk-BQJIFRAZ.js +36 -0
- package/dist/{chunk-PB4FYZET.js → chunk-EQLA4FFY.js} +54 -4
- package/dist/{chunk-74PUEZJ4.js → chunk-GFY5FRX3.js} +1 -1
- package/dist/{chunk-O3QDFPKM.js → chunk-HCLVYZUZ.js} +2 -2
- package/dist/{chunk-K2YX2VRA.js → chunk-HHBDBMEO.js} +170 -43
- package/dist/{chunk-O5AT6S5T.js → chunk-IV6Q7NRW.js} +25 -195
- package/dist/{chunk-W2EQGDF5.js → chunk-LE74UEV7.js} +49 -8
- package/dist/{chunk-CE7XEHYC.js → chunk-N5RZ5HVB.js} +1 -1
- package/dist/chunk-OFVV37XC.js +57 -0
- package/dist/{chunk-5LR6P7WN.js → chunk-OQA7IHI4.js} +133 -213
- package/dist/{chunk-3MHE725Z.js → chunk-PAIM66YA.js} +90 -1
- package/dist/{chunk-6DOGTAHA.js → chunk-QR2EF2NI.js} +9 -43
- package/dist/{chunk-KXZUCCEY.js → chunk-RCM3P2HE.js} +5 -56
- package/dist/{chunk-R4DQZFAL.js → chunk-UOCZXO2Z.js} +3 -3
- package/dist/content-retention-BTGSQRfP.d.ts +78 -0
- package/dist/{credit-menu-B8_p_vUz.d.ts → credit-menu-BAsrRu3z.d.ts} +98 -5
- package/dist/{fx-DuaYHvVn.d.ts → fx-BgDmyTdd.d.ts} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -3
- package/dist/internal/caller.d.ts +90 -22
- package/dist/internal/caller.js +40 -40
- package/dist/internal/index.js +1 -1
- package/dist/internal/server.d.ts +8 -99
- package/dist/internal/server.js +15 -11
- package/dist/{job-store-D6Rjj5Oi.d.ts → job-store-BVeF5_Jq.d.ts} +1 -1
- package/dist/{lightning-backend-BaeCPmx7.d.ts → lightning-backend-40fIzz1W.d.ts} +1 -1
- package/dist/{postgres-consumed-credential-store-CUQJKRSL.js → postgres-consumed-credential-store-BUVCAPLS.js} +13 -0
- package/dist/{postgres-job-store-VLXLWXUQ.js → postgres-job-store-VHLQBJZC.js} +3 -1
- package/dist/server/index.d.ts +28 -10
- package/dist/server/index.js +24 -10
- package/dist/{step-cache-Bi43A0JN.d.ts → step-cache-CPdH1hei.d.ts} +3 -3
- package/dist/{tempo-lifecycle-OTHV757Y.js → tempo-lifecycle-ZBBLFBMH.js} +5 -4
- package/dist/{tempo-wallet-32JWQZKQ.js → tempo-wallet-B5XXV3YH.js} +1 -1
- package/dist/testing/index.d.ts +9 -2
- package/dist/testing/index.js +6 -3
- package/dist/{usd-AZPVq4eU.d.ts → usd-AWlrwlM5.d.ts} +1 -1
- package/dist/{x402-CEDHGZDI.js → x402-R6HPBY5D.js} +5 -4
- package/package.json +3 -2
- package/recipes/postgres/financial-export-v1.sql +137 -0
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { FacilitatorConfig } from '@x402/core/server';
|
|
2
|
-
import { aj as PaymentPayload, ap as PaymentRequirementsV1, aq as PaymentRequirementsV2, aE as X402Config, av as SettleResponse, aC as VerifyResponse, bi as X402ExactVersionSupport, bj as X402Receipt, bk as TransactionalPayoutHook, bl as CashuMeltCompleted } from '../step-cache-
|
|
3
|
-
export { bm as CreditDepositPayload, bn as CreditDrainPayload, bo as FundingLot, bp as LotDebit, bq as LotDepletion, br as MppxServer, bs as NON_CHANNEL_BITCOIN_RAILS, bt as NonChannelBitcoinRail, bu as PayoutReporter, bv as PostgresTempoSessionStore, bw as RevenueReporter, bx as SIGNED_ENVELOPE_FIELDS, by as SIGNED_ENVELOPE_TYPES, bz as X402TrackedChannel, bA as _testing, bB as createDefaultReplayStore, bC as depleteLots, bD as fifoOrder, bE as inKindDrawMsats, bF as isInKindDepletion, bG as isNonChannelBitcoinRail, bH as lotOwedSats, bI as netOwedSats, bJ as wrapMppx } from '../step-cache-
|
|
2
|
+
import { aj as PaymentPayload, ap as PaymentRequirementsV1, aq as PaymentRequirementsV2, aE as X402Config, av as SettleResponse, aC as VerifyResponse, bi as X402ExactVersionSupport, bj as X402Receipt, bk as TransactionalPayoutHook, bl as CashuMeltCompleted } from '../step-cache-CPdH1hei.js';
|
|
3
|
+
export { bm as CreditDepositPayload, bn as CreditDrainPayload, bo as FundingLot, bp as LotDebit, bq as LotDepletion, br as MppxServer, bs as NON_CHANNEL_BITCOIN_RAILS, bt as NonChannelBitcoinRail, bu as PayoutReporter, bv as PostgresTempoSessionStore, bw as RevenueReporter, bx as SIGNED_ENVELOPE_FIELDS, by as SIGNED_ENVELOPE_TYPES, bz as X402TrackedChannel, bA as _testing, bB as createDefaultReplayStore, bC as depleteLots, bD as fifoOrder, bE as inKindDrawMsats, bF as isInKindDepletion, bG as isNonChannelBitcoinRail, bH as lotOwedSats, bI as netOwedSats, bJ as wrapMppx } from '../step-cache-CPdH1hei.js';
|
|
4
4
|
import { Hono } from 'hono';
|
|
5
5
|
import { Env, BlankSchema } from 'hono/types';
|
|
6
6
|
import { Pool } from 'pg';
|
|
7
7
|
export { Pool } from 'pg';
|
|
8
8
|
import { g as getWallet } from '../wallet-Dwjs5n_M.js';
|
|
9
|
-
import {
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
-
export { t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-BaeCPmx7.js';
|
|
13
|
-
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-D6Rjj5Oi.js';
|
|
9
|
+
import { C as ConsumedCredentialStore, L as LockPubkeyStateLoader } from '../credit-menu-BAsrRu3z.js';
|
|
10
|
+
export { A as AccumulatorPool, a as AppEnv, b as CreditFundingReport, D as DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, F as FiatDenomination, c as FiatDenominationFailure, d as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, e as LockPubkeyPool, f as LockPubkeyState, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, g as PaymentErrorCode, h as PaymentErrorDetail, i as PaymentInfo, j as PostgresTempoChargeStore, R as ReporterBannerOpts, k as ResolvedFx, l as RevenueBootCheckOpts, S as SDKServerOpts, m as ServerJob, n as ShortPayForfeit, T as TempoChannelReport, o as TempoObserverHealth, p as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, q as VerifyIncomingSnapshot, X as X402BatchChannelObservation, r as X402FacilitatorHealth, s as X402SettlementEvidenceOutcome, t as X402SettlementRepair, u as X402SettlementRepairRefusal, v as X402SettlementRepaired, w as X402WedgedSettlement, x as X402WedgedSettlementPage, y as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, z as abortJob, B as activePubkeySet, E as applyPaymentInfoToJob, G as assertRevenueReporterReady, H as buildPaymentErrorResponse, K as clearAccumulatorForDvm, N as createDVMServer, O as creditDepositPayload, Q as derivedFundCreditId, W as devModeSkipsPaymentVerification, Y as fromJobRecord, Z as fundedMicroFor, _ as hasPaymentProof, $ as hashLockKey, a0 as implicitCreditId, a1 as initLockPubkeyTable, a2 as initWalletAccumulatorTable, a3 as insertAccumulatorRows, a4 as isDerivedCreditId, a5 as isTerminal, a6 as isYieldMessage, a7 as issueUpfrontChallenges, a8 as loadLockPubkeyState, a9 as msatsToFiatMicro, aa as paymentErrorBody, ab as pinAskFiat, ac as priceFiatMicro, ad as processIncomingPayment, ae as providerMessage, af as pruneRetired, ag as repairX402ExactSettlementEffect, ah as resolveFxSnapshot, ai as resolvePriceFiat, aj as revenueReporterBannerState, ak as rotateLockPubkey, al as seedLockPubkeyState, am as toCreditTerms, an as toJobRecord, ao as unknownRouteNotFound, ap as verifyIncomingPayment, aq as verifyTempoSessionManagementCredential, ar as verifyUpfrontPayment, as as x402RequiredUsdcMicro, at as x402SettledShare } from '../credit-menu-BAsrRu3z.js';
|
|
11
|
+
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-BVeF5_Jq.js';
|
|
14
12
|
import { z } from 'zod';
|
|
13
|
+
export { g as LockPubkeyStoreLockPubkey, t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-40fIzz1W.js';
|
|
15
14
|
import 'mppx';
|
|
16
15
|
import '@x402/evm/batch-settlement/server';
|
|
17
16
|
import '@x402/core/types';
|
|
18
17
|
import 'viem';
|
|
19
18
|
import '@cashu/cashu-ts';
|
|
20
|
-
import '../fx-
|
|
19
|
+
import '../fx-BgDmyTdd.js';
|
|
21
20
|
|
|
22
21
|
declare function verifyWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<VerifyResponse>;
|
|
23
22
|
declare function settleWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<SettleResponse>;
|
|
@@ -43,96 +42,6 @@ declare function settleWithFacilitator(payload: PaymentPayload, requirements: Pa
|
|
|
43
42
|
*/
|
|
44
43
|
declare function verifyX402Payment(paymentHeader: string, config: X402Config, requiredUsdcMicro: bigint, resource: string, btcUsdRate: number, exactVersions?: X402ExactVersionSupport): Promise<X402Receipt>;
|
|
45
44
|
|
|
46
|
-
/**
|
|
47
|
-
* Snapshot of a DVM's published lock-pubkey state at a point in time. `current`
|
|
48
|
-
* is what the SDK advertises as `cashu.lock_pubkeys[0]`; `retired` are the
|
|
49
|
-
* pubkeys inside the rotation grace window plus legacy sentinel-0 entries
|
|
50
|
-
* kept until explicitly cleaned up. Both halves are needed by the
|
|
51
|
-
* receive path (accept proofs locked to any entry) and the admin auth verifier
|
|
52
|
-
* (accept signatures from any entry during grace).
|
|
53
|
-
*/
|
|
54
|
-
interface LockPubkeyState {
|
|
55
|
-
current: LockPubkey;
|
|
56
|
-
retired: {
|
|
57
|
-
pubkey: LockPubkey;
|
|
58
|
-
retiredAtMs: number;
|
|
59
|
-
}[];
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Lazy accessor for the DVM's lock-pubkey state. Threaded through the SDK
|
|
63
|
-
* server so call sites (info handler, accept flow, admin auth) read the fresh
|
|
64
|
-
* state on every invocation — rotation propagation has to be visible without
|
|
65
|
-
* a process restart.
|
|
66
|
-
*/
|
|
67
|
-
type LockPubkeyStateLoader = () => Promise<LockPubkeyState>;
|
|
68
|
-
type LockPubkeyPool = AccumulatorPool;
|
|
69
|
-
/**
|
|
70
|
-
* Create the `dvm_lock_pubkeys` table if absent. Each row is one entry in a
|
|
71
|
-
* DVM's lock-pubkey lifecycle: `retired_at_ms IS NULL` is the current pubkey,
|
|
72
|
-
* any non-null value is a retired pubkey that the rotation walker can still
|
|
73
|
-
* derive privkeys for. One current row per `dvm_id` is enforced via a partial
|
|
74
|
-
* unique index — keeps `rotateLockPubkey` honest under concurrent calls.
|
|
75
|
-
*/
|
|
76
|
-
declare function initLockPubkeyTable(db: LockPubkeyPool): Promise<void>;
|
|
77
|
-
/**
|
|
78
|
-
* Idempotent first-boot seed. Inserts `pubkey` as the current row for `dvmId`
|
|
79
|
-
* only when no current row exists. Reseeding with a different pubkey is a
|
|
80
|
-
* no-op — once the DB has state, `rotateLockPubkey` is the only sanctioned
|
|
81
|
-
* mutator, so a stale `DVMKIT_CASHU_LOCK_PUBKEY` env on a redeploy can't
|
|
82
|
-
* silently reset the DVM's view of "what's current".
|
|
83
|
-
*
|
|
84
|
-
* Also backfills any distinct `lock_pubkey` values found in
|
|
85
|
-
* `wallet_accumulator` for this DVM that aren't yet in `dvm_lock_pubkeys`,
|
|
86
|
-
* inserting them as retired rows with `retired_at_ms = 0` — the
|
|
87
|
-
* "long-retired-still-meltable" sentinel. This handles legacy batches
|
|
88
|
-
* that would otherwise trip the monitor's `orphan_lock_pubkey` alarm every
|
|
89
|
-
* tick. Sentinel-0 rows are exempt from grace-window filtering and
|
|
90
|
-
* `pruneRetired` so they stay visible until the operator melts the legacy
|
|
91
|
-
* batches and the receive path keeps accepting in-flight tokens locked to
|
|
92
|
-
* them.
|
|
93
|
-
*
|
|
94
|
-
* `ON CONFLICT DO NOTHING` protects concurrent seeds invoked reentrantly from
|
|
95
|
-
* one guarded callback. Nested calls bypass the queue to avoid deadlock, so
|
|
96
|
-
* both inserts can pass `WHERE NOT EXISTS` before either commits.
|
|
97
|
-
*/
|
|
98
|
-
declare function seedLockPubkeyState(db: LockPubkeyPool, dvmId: string, pubkey: string, now?: number): Promise<void>;
|
|
99
|
-
/**
|
|
100
|
-
* Read the active lock-pubkey state for a DVM. Retired rows older than the
|
|
101
|
-
* grace window are filtered out; aged-out rows linger physically until
|
|
102
|
-
* `pruneRetired` deletes them on a monitor tick. Sentinel-0 rows (the
|
|
103
|
-
* `retired_at_ms = 0` legacy backfill from `seedLockPubkeyState`) are always
|
|
104
|
-
* included regardless of grace. Throws when no current row exists — the SDK's
|
|
105
|
-
* accept/info/admin paths must not run before `seedLockPubkeyState` has been
|
|
106
|
-
* called.
|
|
107
|
-
*/
|
|
108
|
-
declare function loadLockPubkeyState(db: AccumulatorQuerier, dvmId: string, graceMs: number, now?: number): Promise<LockPubkeyState>;
|
|
109
|
-
/**
|
|
110
|
-
* Atomically demote the current pubkey to retired (stamping `retired_at_ms`)
|
|
111
|
-
* and insert `newPubkey` as the new current row. Wrapped in a transaction so
|
|
112
|
-
* the partial unique index never has two current rows visible mid-rotation.
|
|
113
|
-
* Returns the post-rotation state filtered by the supplied grace window.
|
|
114
|
-
*/
|
|
115
|
-
declare function rotateLockPubkey(db: LockPubkeyPool, dvmId: string, newPubkey: string, graceMs: number, now?: number): Promise<LockPubkeyState>;
|
|
116
|
-
/**
|
|
117
|
-
* Delete retired rows whose `retired_at_ms` is older than `now - graceMs`.
|
|
118
|
-
* Called from the monitor tick so aged-out entries don't accumulate.
|
|
119
|
-
* `wallet_accumulator` rows pointing at those pubkeys remain meltable (the
|
|
120
|
-
* builder can still derive the privkey from the mnemonic + rotation_index) —
|
|
121
|
-
* pruning only affects what the DVM advertises and accepts.
|
|
122
|
-
*
|
|
123
|
-
* Sentinel-0 rows (the legacy backfill from `seedLockPubkeyState`) are
|
|
124
|
-
* exempted from pruning — they exist precisely so the monitor keeps treating
|
|
125
|
-
* legacy `wallet_accumulator` batches as retired-still-meltable rather than
|
|
126
|
-
* orphan.
|
|
127
|
-
*/
|
|
128
|
-
declare function pruneRetired(db: AccumulatorQuerier, dvmId: string, graceMs: number, now?: number): Promise<number>;
|
|
129
|
-
/**
|
|
130
|
-
* Default rotation grace window in seconds. Override through
|
|
131
|
-
* `SDKServerOpts.lockPubkeyGraceSeconds`.
|
|
132
|
-
*/
|
|
133
|
-
declare const DEFAULT_LOCK_PUBKEY_GRACE_SECONDS = 86400;
|
|
134
|
-
declare function activePubkeySet(state: LockPubkeyState): LockPubkey[];
|
|
135
|
-
|
|
136
45
|
interface InstallAdminCashuRoutesOpts {
|
|
137
46
|
db: Pool;
|
|
138
47
|
/** Identifier of this DVM — bound into every signed admin challenge. */
|
|
@@ -277,4 +186,4 @@ declare function humanizeZodError(err: z.ZodError, opts: {
|
|
|
277
186
|
schemaUrl: string;
|
|
278
187
|
}): HumanizedZodError;
|
|
279
188
|
|
|
280
|
-
export {
|
|
189
|
+
export { LockPubkeyStateLoader, TEMPO_CLOSE_DB_RECOVERY_BUDGET_MS, TEMPO_CLOSE_REQUESTED_TOPIC, createAdminCashuNonceStore, createInstrumentedFetch, humanizeZodError, installAdminCashuRoutes, jobCredentialGate, rateUnavailablePaymentError, settleWithFacilitator, verifyWithFacilitator, verifyX402Payment };
|
package/dist/internal/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../chunk-X7EZ5CLI.js";
|
|
4
4
|
import {
|
|
5
5
|
verifyX402Payment
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-7ZUKL4IV.js";
|
|
7
7
|
import {
|
|
8
8
|
RevenueReporter
|
|
9
9
|
} from "../chunk-Z4ZT5LNT.js";
|
|
@@ -64,42 +64,46 @@ import {
|
|
|
64
64
|
verifyUpfrontPayment,
|
|
65
65
|
x402RequiredUsdcMicro,
|
|
66
66
|
x402SettledShare
|
|
67
|
-
} from "../chunk-
|
|
67
|
+
} from "../chunk-HHBDBMEO.js";
|
|
68
68
|
import "../chunk-XRLKGCAW.js";
|
|
69
69
|
import {
|
|
70
70
|
settleWithFacilitator,
|
|
71
71
|
verifyWithFacilitator
|
|
72
72
|
} from "../chunk-PLG4XER6.js";
|
|
73
73
|
import "../chunk-FYRR2UEZ.js";
|
|
74
|
-
import "../chunk-
|
|
74
|
+
import "../chunk-EQLA4FFY.js";
|
|
75
75
|
import "../chunk-YG7G4DPZ.js";
|
|
76
76
|
import {
|
|
77
77
|
SIGNED_ENVELOPE_FIELDS,
|
|
78
78
|
SIGNED_ENVELOPE_TYPES,
|
|
79
79
|
createDefaultReplayStore,
|
|
80
80
|
humanizeZodError
|
|
81
|
-
} from "../chunk-
|
|
81
|
+
} from "../chunk-N5RZ5HVB.js";
|
|
82
|
+
import {
|
|
83
|
+
createInstrumentedFetch,
|
|
84
|
+
isStaleJobReapable
|
|
85
|
+
} from "../chunk-IV6Q7NRW.js";
|
|
82
86
|
import {
|
|
83
87
|
JobCancelledError,
|
|
84
88
|
abortJob,
|
|
85
|
-
createInstrumentedFetch,
|
|
86
89
|
fromJobRecord,
|
|
87
|
-
isStaleJobReapable,
|
|
88
90
|
isTerminal,
|
|
89
91
|
isYieldMessage,
|
|
90
92
|
providerMessage,
|
|
91
93
|
toJobRecord
|
|
92
|
-
} from "../chunk-
|
|
94
|
+
} from "../chunk-AFV77S4C.js";
|
|
93
95
|
import {
|
|
94
96
|
toLockPubkey
|
|
95
|
-
} from "../chunk-
|
|
97
|
+
} from "../chunk-OQA7IHI4.js";
|
|
96
98
|
import "../chunk-IWQHUSMO.js";
|
|
97
|
-
import "../chunk-
|
|
99
|
+
import "../chunk-PAIM66YA.js";
|
|
98
100
|
import "../chunk-CZULM42S.js";
|
|
99
|
-
import "../chunk-
|
|
100
|
-
import "../chunk-
|
|
101
|
+
import "../chunk-RCM3P2HE.js";
|
|
102
|
+
import "../chunk-OFVV37XC.js";
|
|
103
|
+
import "../chunk-QR2EF2NI.js";
|
|
101
104
|
import "../chunk-66HGCPBU.js";
|
|
102
105
|
import "../chunk-FUJ36YDV.js";
|
|
106
|
+
import "../chunk-BQJIFRAZ.js";
|
|
103
107
|
import "../chunk-BYCEKO65.js";
|
|
104
108
|
import "../chunk-AT6V3SY7.js";
|
|
105
109
|
import {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProofLike } from '@cashu/cashu-ts';
|
|
2
|
-
import { a1 as Message, ah as FundingMethod, X as FundingReceipt, bP as CreditSnapshot, Y as JobReceipt, ax as StepRecord, a2 as MessageType } from './step-cache-
|
|
2
|
+
import { a1 as Message, ah as FundingMethod, X as FundingReceipt, bP as CreditSnapshot, Y as JobReceipt, ax as StepRecord, a2 as MessageType } from './step-cache-CPdH1hei.js';
|
|
3
3
|
|
|
4
4
|
type JobStatus = "processing" | "completed" | "failed" | "awaiting-input" | "cancelled" | "working";
|
|
5
5
|
interface JobRecord {
|
|
@@ -51,6 +51,19 @@ var PostgresConsumedCredentialStore = class {
|
|
|
51
51
|
);
|
|
52
52
|
return (rowCount ?? 0) > 0;
|
|
53
53
|
}
|
|
54
|
+
async consume(realm, challengeId, ttlSeconds) {
|
|
55
|
+
const now = this.now();
|
|
56
|
+
const { rowCount } = await this.pool.query(
|
|
57
|
+
`INSERT INTO ${this.tableName}(realm,challenge_id,expires_at) VALUES($1,$2,$3)
|
|
58
|
+
ON CONFLICT(realm,challenge_id) DO UPDATE SET expires_at=EXCLUDED.expires_at
|
|
59
|
+
WHERE ${this.tableName}.expires_at <= $4`,
|
|
60
|
+
[realm, challengeId, now + ttlSeconds * 1e3, now]
|
|
61
|
+
);
|
|
62
|
+
if (rowCount === 1 && this.gcSampleRate > 0 && Math.random() < this.gcSampleRate) {
|
|
63
|
+
this.gcSweep(now);
|
|
64
|
+
}
|
|
65
|
+
return rowCount === 1;
|
|
66
|
+
}
|
|
54
67
|
async mark(realm, challengeId, ttlSeconds) {
|
|
55
68
|
const now = this.now();
|
|
56
69
|
const expiresAt = now + ttlSeconds * 1e3;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { cg as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, ch as ClientCompatibility, ci as ClientCompatibilityEnv, cj as ClientCompatibilityGate, ck as ClientCompatibilityRequirement, cl as ClientSemVer, e as CreateSignedRequestVerifierOpts, cm as CreditFundingBasis, cn as CreditInvoiceStatus, co as CreditLedger, cp as CreditLedgerError, cq as CreditLedgerErrorCode, cr as CreditLedgerErrorDetails, cs as CreditLedgerPool, ct as CreditStatus, cu as DRAIN_DELIVERY_RESERVE_SATS, cv as DVM_PROTOCOL_VERSION, cw as DrainConflictReason, cx as DrawRailValue, cy as DrawStatus, cz as JobCostReportPayload, cA as JobTerminalReportPayload, cB as PostgresX402ChannelStorage, cC as ReplayStoreBackend, cD as RevenueSkippedNoRailPayload, cE as RevenueSkippedNoRailReason, w as SIGNED_REQUEST_AUTH_ID, x as SIGNED_REQUEST_STATEMENT_VERSION, cF as Secp256k1AuthOpts, y as SignedRequestAudience, B as SignedRequestError, E as SignedRequestFailure, G as SignedRequestSignOpts, H as SignedRequestStatementHeader, M as SignedRequestVerifier, cG as X402ChannelStorageOpts, cH as X402RelayLockHolder, cI as X402RelaySubmissionLock, cJ as X402RelaySubmissionLockError, cK as allocateDrawValue, cL as clientCompatibilityAttributes, cM as clientCompatibilityMiddleware, cN as clientUpgradeRequired, N as createSignedRequestVerifier, cO as parseClientCapabilities, cP as parseClientCompatibility, cQ as parseDvmClient, cR as parseProtocolVersion, cS as requireClientCompatibility, cT as secp256k1Auth, cU as signedRequestInput, T as signedRequestStatementHeader } from '../step-cache-
|
|
1
|
+
import { ac as CashuMode, bK as CreditDrainEnqueue, bL as HostedSettlementReportObligations, R as ResolvedCreditConfig, bM as DVMAuthScheme, z as SignedRequestDomain, bN as CreditLedgerLike, bO as X402RefundSettlementGate, bP as CreditSnapshot, bQ as DrawResult, bR as X402SettlementStatus, bS as X402UnresolvedRefund, bT as GrownDrawResult, bU as DrawResolution, bV as FundingRecord, X as FundingReceipt, bW as CreditInvoiceRecord, bX as InvoiceSettlement, bY as BlockedInvoiceCursor, bZ as InvoiceReconciliation, b_ as InvoiceWriteOff, b$ as DrawRecord, c0 as StalePendingDrawCursor, c1 as TempoCreditLossEvidence, c2 as CreditLedgerQuerier, c3 as TempoCreditLoss, c4 as X402CreditLossEvidence, c5 as X402CreditLoss, c6 as DrainMethod, c7 as DrainRequestResult, c8 as BitcoinDepositLiability, bo as FundingLot, c9 as CreditDrainRecord, ca as ChannelDrainCursor, cb as DrainWriteOff, cc as DrainReleaseResult, cd as DrainFulfilment, ce as DrainTransitionResult, cf as HostingCleanupFence, Y as JobReceipt, a1 as Message, K as KVStore, F as SignedRequestReplayStore, Z as ZodLike, a as DVMDescriptor } from '../step-cache-CPdH1hei.js';
|
|
2
|
+
export { cg as CLIENT_COMPATIBILITY_HEADERS, d as CanonicalEnvelope, ch as ClientCompatibility, ci as ClientCompatibilityEnv, cj as ClientCompatibilityGate, ck as ClientCompatibilityRequirement, cl as ClientSemVer, e as CreateSignedRequestVerifierOpts, cm as CreditFundingBasis, cn as CreditInvoiceStatus, co as CreditLedger, cp as CreditLedgerError, cq as CreditLedgerErrorCode, cr as CreditLedgerErrorDetails, cs as CreditLedgerPool, ct as CreditStatus, cu as DRAIN_DELIVERY_RESERVE_SATS, cv as DVM_PROTOCOL_VERSION, cw as DrainConflictReason, cx as DrawRailValue, cy as DrawStatus, cz as JobCostReportPayload, cA as JobTerminalReportPayload, cB as PostgresX402ChannelStorage, cC as ReplayStoreBackend, cD as RevenueSkippedNoRailPayload, cE as RevenueSkippedNoRailReason, w as SIGNED_REQUEST_AUTH_ID, x as SIGNED_REQUEST_STATEMENT_VERSION, cF as Secp256k1AuthOpts, y as SignedRequestAudience, B as SignedRequestError, E as SignedRequestFailure, G as SignedRequestSignOpts, H as SignedRequestStatementHeader, M as SignedRequestVerifier, cG as X402ChannelStorageOpts, cH as X402RelayLockHolder, cI as X402RelaySubmissionLock, cJ as X402RelaySubmissionLockError, cK as allocateDrawValue, cL as clientCompatibilityAttributes, cM as clientCompatibilityMiddleware, cN as clientUpgradeRequired, N as createSignedRequestVerifier, cO as parseClientCapabilities, cP as parseClientCompatibility, cQ as parseDvmClient, cR as parseProtocolVersion, cS as requireClientCompatibility, cT as secp256k1Auth, cU as signedRequestInput, T as signedRequestStatementHeader } from '../step-cache-CPdH1hei.js';
|
|
3
3
|
import { Pool } from 'pg';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
import { Context } from 'hono';
|
|
4
|
+
import { au as CreditMenu, a as AppEnv, U as UpfrontPaymentOpts, i as PaymentInfo, av as ReceiptIssuer, aw as LightningReceive, ax as TempoSettlementReadiness, ay as DVMHostOpts, az as DVMServeResult, L as LockPubkeyStateLoader, C as ConsumedCredentialStore } from '../credit-menu-BAsrRu3z.js';
|
|
5
|
+
export { aA as BuildCreditMenuArgs, aB as BuilderIdentity, aC as CREDIT_ENVELOPE_KEYS, aD as CreateX402BatchSettlementServerOpts, aE as CreditEnvelope, aF as CreditEnvelopeError, aG as CreditFundCommitment, aH as CreditTerms, aI as DEFAULT_INVOICE_TTL_SECONDS, aJ as DVMHost, aK as HostingClosureCommand, aL as HostingClosureEvidence, aM as HostingControlCommand, aN as HostingControlConfig, aO as HostingControlStatus, aP as JobManager, aQ as JobManagerOpts, aR as LightningReceiveConfig, aS as MIN_INVOICE_TTL_SECONDS, aT as MemoryConsumedCredentialStore, aU as MemoryConsumedCredentialStoreOpts, aV as MemoryProcessedPaymentStore, aW as MemoryX402ExactSettlementStore, aX as MountOpts, aY as OwnerDisplay, aZ as PaidJobCompletion, a_ as PaymentMode, a$ as PlatformReporterOpts, b0 as PostgresProcessedPaymentStore, b1 as PostgresX402ExactSettlementStore, b2 as PriceFiat, b3 as ProcessedPaymentQuerier, b4 as ProcessedPaymentRail, b5 as ProcessedPaymentRecord, b6 as ProcessedPaymentReplayError, b7 as ProcessedPaymentStore, b8 as X402BatchAcceptance, b9 as X402BatchFunding, ba as X402BatchRefusal, bb as X402BatchSettlementServer, bc as X402ExactAcceptance, bd as X402ExactIntentConflictError, be as X402ExactSettlementAttempt, bf as X402ExactSettlementChainEvidence, bg as X402ExactSettlementEffect, bh as X402ExactSettlementEvidenceMissingError, bi as X402ExactSettlementEvidenceReader, bj as X402ExactSettlementIntent, bk as X402ExactSettlementNotReadyError, bl as X402ExactSettlementServer, bm as X402ExactSettlementServerOpts, bn as X402ExactSettlementStatus, bo as X402ExactSettlementStore, bp as X402SettlementChainEvidence, bq as X402SettlementEvidenceReader, br as X402SettlementSubmissionError, bs as X402_BATCH_AUTO_SETTLEMENT, bt as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bu as X402_BATCH_SETTLEMENT_NETWORK, bv as attachCreditMenu, bw as buildCreditMenu, bx as createDVMHost, by as createX402BatchSettlementServer, bz as creditEnvelopeIgnoreFields, bA as drawSettlementRef, bB as extractCreditEnvelope, bC as fundingCommitment, bD as selectPrimaryCredit, bE as signHostingClosure, bF as signHostingControl, bG as stripCreditEnvelope, bH as toCreditView } from '../credit-menu-BAsrRu3z.js';
|
|
6
|
+
import { Context, Hono } from 'hono';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import { F as FxFetcher } from '../fx-
|
|
9
|
-
import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters } from '../job-store-
|
|
10
|
-
export { a as JobStatus,
|
|
8
|
+
import { F as FxFetcher } from '../fx-BgDmyTdd.js';
|
|
9
|
+
import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters, b as JobStore } from '../job-store-BVeF5_Jq.js';
|
|
10
|
+
export { a as JobStatus, h as isStreamableJobStore } from '../job-store-BVeF5_Jq.js';
|
|
11
|
+
import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-BTGSQRfP.js';
|
|
12
|
+
export { b as ContentHold, c as ContentHoldError, d as ContentHoldEvent, e as ContentHoldStore, f as ContentHoldsResponse, J as JobContentMetadata, g as baselineContentExpiry, h as contentMetadata, i as isContentHoldStore } from '../content-retention-BTGSQRfP.js';
|
|
11
13
|
export { P as PinnedFetch, S as SSRFError, a as SSRFGuardOpts, b as SSRFReason, c as SSRFResolver, d as assertSafeUrl, e as createPinnedFetch } from '../ssrf-dMooihtY.js';
|
|
14
|
+
import { Env, BlankSchema } from 'hono/types';
|
|
12
15
|
import 'mppx';
|
|
13
16
|
import '@x402/core/server';
|
|
14
17
|
import '@x402/evm/batch-settlement/server';
|
|
15
18
|
import '@x402/core/types';
|
|
16
19
|
import 'viem';
|
|
20
|
+
import '../lightning-backend-40fIzz1W.js';
|
|
17
21
|
import '@cashu/cashu-ts';
|
|
18
|
-
import '../lightning-backend-BaeCPmx7.js';
|
|
19
22
|
|
|
20
23
|
/** Lifetime of a per-call implicit credit before the ledger refuses new draws. */
|
|
21
24
|
declare const IMPLICIT_CREDIT_TTL_MS: number;
|
|
@@ -395,6 +398,11 @@ declare class PostgresJobStore implements StreamableJobStore, ReceiptIssuingStor
|
|
|
395
398
|
expectedLastActivityAt: number;
|
|
396
399
|
redactedAt: number;
|
|
397
400
|
}): Promise<boolean>;
|
|
401
|
+
getContentSnapshot(jobId: string, dvmId?: string): Promise<{
|
|
402
|
+
job: JobRecord;
|
|
403
|
+
history: ContentHoldHistory;
|
|
404
|
+
} | undefined>;
|
|
405
|
+
mutateContentHold(jobId: string, mutation: ContentHoldMutation, dvmId?: string): Promise<ContentHoldHistory>;
|
|
398
406
|
claimReceiptSeq(jobId: string): Promise<number>;
|
|
399
407
|
saveReceipt(jobId: string, receipt: JobReceipt): Promise<JobReceipt | undefined>;
|
|
400
408
|
appendOutgoing(jobId: string, message: OutgoingMessage, opts?: AppendOutgoingOptions): Promise<number>;
|
|
@@ -513,4 +521,14 @@ declare function hasInvalidRequestId(data: unknown): boolean;
|
|
|
513
521
|
/** Single-DVM host. Use createDVMHost for multiple mounts with distinct prefixes. */
|
|
514
522
|
declare function serve<State, InputSchema extends ZodLike | undefined = undefined>(descriptor: DVMDescriptor<State, InputSchema>, opts?: DVMHostOpts): Promise<DVMServeResult>;
|
|
515
523
|
|
|
516
|
-
|
|
524
|
+
interface InstallAdminContentRoutesOpts {
|
|
525
|
+
dvmId: string;
|
|
526
|
+
store: JobStore;
|
|
527
|
+
retentionDays: number;
|
|
528
|
+
getLockPubkeyState: LockPubkeyStateLoader;
|
|
529
|
+
nonceStore: ConsumedCredentialStore;
|
|
530
|
+
now?: () => number;
|
|
531
|
+
}
|
|
532
|
+
declare function installAdminContentRoutes<E extends Env = Env, S extends BlankSchema = BlankSchema>(app: Hono<E, S>, opts: InstallAdminContentRoutesOpts): void;
|
|
533
|
+
|
|
534
|
+
export { BitcoinDepositLiability, BlockedInvoiceCursor, CREDIT_REQUEST_SCHEMA, ConsumedCredentialStore, ContentHoldHistory, ContentHoldMutation, CreditInvoiceRecord, CreditLedgerLike, CreditLedgerQuerier, CreditMenu, type CreditRequest, type CreditRouteDeps, CreditSnapshot, DVMAuthScheme, DVMHostOpts, DVMServeResult, DrawRecord, DrawResolution, DrawResult, FundingRecord, GrownDrawResult, IMPLICIT_CREDIT_TTL_MS, type InitLockPool, type InstallAdminContentRoutesOpts, InvoiceReconciliation, InvoiceSettlement, InvoiceWriteOff, JobRecord, JobStore, LightningReceive, MemoryCreditLedger, PostgresJobStore, PostgresKVStore, PostgresReplayStore, type PostgresReplayStoreOpts, REQUEST_ID_FIELD, type ResolvedCashuOpts, SDK_INIT_ADVISORY_LOCK, SignedRequestDomain, SignedRequestReplayStore, StalePendingDrawCursor, StreamableJobStore, handleCreditRequest, hasInvalidRequestId, installAdminContentRoutes, protocolEnvelopeIgnoreFields, requestIdFromEnvelope, resolveCashuOptsFromEnv, serve, stripProtocolEnvelope, withSdkInitLock };
|
package/dist/server/index.js
CHANGED
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
hasInvalidRequestId,
|
|
63
63
|
initLockPubkeyTable,
|
|
64
64
|
initWalletAccumulatorTable,
|
|
65
|
+
installAdminContentRoutes,
|
|
65
66
|
parseClientCapabilities,
|
|
66
67
|
parseClientCompatibility,
|
|
67
68
|
parseDvmClient,
|
|
@@ -78,7 +79,7 @@ import {
|
|
|
78
79
|
stripProtocolEnvelope,
|
|
79
80
|
toCreditView,
|
|
80
81
|
unknownRouteNotFound
|
|
81
|
-
} from "../chunk-
|
|
82
|
+
} from "../chunk-HHBDBMEO.js";
|
|
82
83
|
import {
|
|
83
84
|
MemoryProcessedPaymentStore,
|
|
84
85
|
PostgresProcessedPaymentStore,
|
|
@@ -90,22 +91,28 @@ import {
|
|
|
90
91
|
} from "../chunk-FYRR2UEZ.js";
|
|
91
92
|
import {
|
|
92
93
|
PostgresJobStore
|
|
93
|
-
} from "../chunk-
|
|
94
|
+
} from "../chunk-EQLA4FFY.js";
|
|
94
95
|
import "../chunk-YG7G4DPZ.js";
|
|
95
96
|
import {
|
|
96
97
|
SignedRequestError,
|
|
97
98
|
createDefaultReplayStore,
|
|
98
99
|
createSignedRequestVerifier,
|
|
99
100
|
signedRequestInput
|
|
100
|
-
} from "../chunk-
|
|
101
|
+
} from "../chunk-N5RZ5HVB.js";
|
|
101
102
|
import {
|
|
102
103
|
isStreamableJobStore
|
|
103
|
-
} from "../chunk-
|
|
104
|
+
} from "../chunk-IV6Q7NRW.js";
|
|
105
|
+
import {
|
|
106
|
+
ContentHoldError,
|
|
107
|
+
baselineContentExpiry,
|
|
108
|
+
contentMetadata,
|
|
109
|
+
isContentHoldStore
|
|
110
|
+
} from "../chunk-AFV77S4C.js";
|
|
104
111
|
import {
|
|
105
112
|
generateEphemeralReceiptKey,
|
|
106
113
|
isTestMintUrl,
|
|
107
114
|
receiptPubkeyFromSecret
|
|
108
|
-
} from "../chunk-
|
|
115
|
+
} from "../chunk-OQA7IHI4.js";
|
|
109
116
|
import {
|
|
110
117
|
X402_DEFAULT_FACILITATOR,
|
|
111
118
|
X402_DEFAULT_NETWORK,
|
|
@@ -113,7 +120,7 @@ import {
|
|
|
113
120
|
} from "../chunk-IWQHUSMO.js";
|
|
114
121
|
import {
|
|
115
122
|
IMPLICIT_CREDIT_TTL_MS
|
|
116
|
-
} from "../chunk-
|
|
123
|
+
} from "../chunk-PAIM66YA.js";
|
|
117
124
|
import {
|
|
118
125
|
resolveRpcOverride
|
|
119
126
|
} from "../chunk-CZULM42S.js";
|
|
@@ -121,12 +128,14 @@ import {
|
|
|
121
128
|
SIGNED_REQUEST_AUTH_ID,
|
|
122
129
|
SIGNED_REQUEST_STATEMENT_VERSION,
|
|
123
130
|
signedRequestStatementHeader
|
|
124
|
-
} from "../chunk-
|
|
131
|
+
} from "../chunk-RCM3P2HE.js";
|
|
132
|
+
import "../chunk-OFVV37XC.js";
|
|
125
133
|
import {
|
|
126
134
|
initLoggers
|
|
127
|
-
} from "../chunk-
|
|
135
|
+
} from "../chunk-QR2EF2NI.js";
|
|
128
136
|
import "../chunk-66HGCPBU.js";
|
|
129
137
|
import "../chunk-FUJ36YDV.js";
|
|
138
|
+
import "../chunk-BQJIFRAZ.js";
|
|
130
139
|
import "../chunk-BYCEKO65.js";
|
|
131
140
|
import "../chunk-AT6V3SY7.js";
|
|
132
141
|
import {
|
|
@@ -1144,7 +1153,7 @@ function createDVMHost(opts = {}) {
|
|
|
1144
1153
|
});
|
|
1145
1154
|
applyRetryToPool(pool, "dvm-host");
|
|
1146
1155
|
pgPool = pool;
|
|
1147
|
-
const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-
|
|
1156
|
+
const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-VHLQBJZC.js");
|
|
1148
1157
|
const pgJobStore = new PostgresJobStore2(pool);
|
|
1149
1158
|
pendingInits.push(pgJobStore.init(), pgJobStore.initStreaming());
|
|
1150
1159
|
jobStore = pgJobStore;
|
|
@@ -1452,7 +1461,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1452
1461
|
}
|
|
1453
1462
|
let sharedPgConsumedStore;
|
|
1454
1463
|
if (pgPool) {
|
|
1455
|
-
const { PostgresConsumedCredentialStore } = await import("../postgres-consumed-credential-store-
|
|
1464
|
+
const { PostgresConsumedCredentialStore } = await import("../postgres-consumed-credential-store-BUVCAPLS.js");
|
|
1456
1465
|
const consumedStore = new PostgresConsumedCredentialStore(pgPool);
|
|
1457
1466
|
pendingInits.push(consumedStore.init());
|
|
1458
1467
|
sharedPgConsumedStore = consumedStore;
|
|
@@ -2095,6 +2104,7 @@ export {
|
|
|
2095
2104
|
CLIENT_COMPATIBILITY_HEADERS,
|
|
2096
2105
|
CREDIT_ENVELOPE_KEYS,
|
|
2097
2106
|
CREDIT_REQUEST_SCHEMA,
|
|
2107
|
+
ContentHoldError,
|
|
2098
2108
|
CreditEnvelopeError,
|
|
2099
2109
|
CreditLedger,
|
|
2100
2110
|
CreditLedgerError,
|
|
@@ -2134,10 +2144,12 @@ export {
|
|
|
2134
2144
|
allocateDrawValue,
|
|
2135
2145
|
assertSafeUrl,
|
|
2136
2146
|
attachCreditMenu,
|
|
2147
|
+
baselineContentExpiry,
|
|
2137
2148
|
buildCreditMenu,
|
|
2138
2149
|
clientCompatibilityAttributes,
|
|
2139
2150
|
clientCompatibilityMiddleware,
|
|
2140
2151
|
clientUpgradeRequired,
|
|
2152
|
+
contentMetadata,
|
|
2141
2153
|
createDVMHost,
|
|
2142
2154
|
createPinnedFetch,
|
|
2143
2155
|
createSignedRequestVerifier,
|
|
@@ -2148,6 +2160,8 @@ export {
|
|
|
2148
2160
|
fundingCommitment,
|
|
2149
2161
|
handleCreditRequest,
|
|
2150
2162
|
hasInvalidRequestId,
|
|
2163
|
+
installAdminContentRoutes,
|
|
2164
|
+
isContentHoldStore,
|
|
2151
2165
|
isStreamableJobStore,
|
|
2152
2166
|
parseClientCapabilities,
|
|
2153
2167
|
parseClientCompatibility,
|
|
@@ -5427,7 +5427,7 @@ declare const DEFAULT_CREDIT_MAX: PriceValue;
|
|
|
5427
5427
|
/** Platform default for {@link CreditConfig.ttl}: 30 days. */
|
|
5428
5428
|
declare const DEFAULT_CREDIT_TTL_SECONDS: number;
|
|
5429
5429
|
/** Default lifetime of caller-controlled job content before it is redacted. */
|
|
5430
|
-
declare const DEFAULT_JOB_RETENTION_DAYS =
|
|
5430
|
+
declare const DEFAULT_JOB_RETENTION_DAYS = 730;
|
|
5431
5431
|
/**
|
|
5432
5432
|
* Per-capability configuration for the multi-capability shape.
|
|
5433
5433
|
* Each capability is an independent unit a caller pays for: its own input
|
|
@@ -5591,7 +5591,7 @@ interface DVMConfig<State = Record<string, unknown>, InputSchema extends ZodLike
|
|
|
5591
5591
|
/**
|
|
5592
5592
|
* Days terminal job content remains available before the SDK redacts it.
|
|
5593
5593
|
* The durable row, payment linkage, and signed receipt remain for accounting
|
|
5594
|
-
* and request-id safety. Default:
|
|
5594
|
+
* and request-id safety. Default: 730. Set to `0` to disable automatic
|
|
5595
5595
|
* redaction.
|
|
5596
5596
|
*/
|
|
5597
5597
|
jobRetentionDays?: number;
|
|
@@ -5761,4 +5761,4 @@ declare class StepCache {
|
|
|
5761
5761
|
static deserialize(records: StepRecord[]): StepCache;
|
|
5762
5762
|
}
|
|
5763
5763
|
|
|
5764
|
-
export { type X402Version as $, type ApprovalContent as A, SignedRequestError as B, type Currency as C, type DVMConfig as D, type SignedRequestFailure as E, type SignedRequestReplayStore as F, type SignedRequestSignOpts as G, type SignedRequestStatementHeader as H, type IncomingMessage as I, type JobCost as J, type KVStore as K, type Logger as L, type SignedRequestVerifier as M, createSignedRequestVerifier as N, isZodSchema as O, type PaymentContent as P, type QuoteConfig as Q, type ResolvedCreditConfig as R, type SDKJobContext as S, signedRequestStatementHeader as T, UnsupportedCurrencyError as U, validateCurrency as V, type JsonValue as W, type FundingReceipt as X, type JobReceipt as Y, type ZodLike as Z, type PaymentRequired as _, type DVMDescriptor as a, isDrainReceipt as a$, type MppxCredential as a0, type Message as a1, type MessageType as a2, type MppxChallenge as a3, X402_BATCH_SETTLEMENT_SCHEME as a4, X402_EXACT_SCHEME as a5, type
|
|
5764
|
+
export { type X402Version as $, type ApprovalContent as A, SignedRequestError as B, type Currency as C, type DVMConfig as D, type SignedRequestFailure as E, type SignedRequestReplayStore as F, type SignedRequestSignOpts as G, type SignedRequestStatementHeader as H, type IncomingMessage as I, type JobCost as J, type KVStore as K, type Logger as L, type SignedRequestVerifier as M, createSignedRequestVerifier as N, isZodSchema as O, type PaymentContent as P, type QuoteConfig as Q, type ResolvedCreditConfig as R, type SDKJobContext as S, signedRequestStatementHeader as T, UnsupportedCurrencyError as U, validateCurrency as V, type JsonValue as W, type FundingReceipt as X, type JobReceipt as Y, type ZodLike as Z, type PaymentRequired as _, type DVMDescriptor as a, isDrainReceipt as a$, type MppxCredential as a0, type Message as a1, type MessageType as a2, type MppxChallenge as a3, X402_BATCH_SETTLEMENT_SCHEME as a4, X402_EXACT_SCHEME as a5, type DrainReceipt as a6, type ReceiptCredit as a7, type X402Wallet as a8, type ResourceInfo as a9, type UnsignedFundingReceipt as aA, type UnsignedJobReceipt as aB, type VerifyResponse as aC, type WorkingContent as aD, type X402Config$1 as aE, type X402ResponseBody as aF, type X402SelfRelayRpcFailureReason as aG, X402_DEFAULT_NETWORK as aH, X402_V1_VERSION as aI, X402_VERSION as aJ, buildPaymentRequiredV2 as aK, buildPaymentRequirements as aL, caip2ToX402Network as aM, canonicalRequestPath as aN, canonicaliseForSigning as aO, canonicalize as aP, chainIdFromCaip2 as aQ, computeResultHash as aR, decodePayment as aS, decodePaymentRequiredHeader as aT, encodePayment as aU, encodePaymentRequiredHeader as aV, encodeSettleResponseHeader as aW, exactEvmAuthorization as aX, isArtifactMessage as aY, isCancelMessage as aZ, isCompleteMessage as a_, type BuildPaymentRequirementsOpts as aa, type CapabilityDescriptor as ab, type CashuMode as ac, type CompleteContent as ad, type DrainReceiptEvent as ae, type ExactEvmPayload as af, type ExactEvmPayloadAuthorization as ag, type FundingMethod as ah, type MessageFrom as ai, type PaymentPayload as aj, type PaymentPayloadV1 as ak, type PaymentPayloadV2 as al, type PaymentRequestContent as am, type PaymentRequiredV2 as an, type PaymentRequirements as ao, type PaymentRequirementsV1 as ap, type PaymentRequirementsV2 as aq, type PromptContent as ar, RAIL_REFUNDABLE as as, type ReceiptOutcome as at, type ReceiptPayment as au, type SettleResponse as av, StepCache as aw, type StepRecord as ax, type TextContent as ay, type UnsignedDrainReceipt as az, type ArtifactContent as b, type DrawRecord as b$, isFundingReceipt as b0, isPaymentRequestMessage as b1, isPromptMessage as b2, isSignedJobReceipt as b3, isTextMessage as b4, isWorkingMessage as b5, paymentRequiredV2FromV1 as b6, signDrainReceipt as b7, signFundingReceipt as b8, signReceipt as b9, _testing as bA, createDefaultReplayStore as bB, depleteLots as bC, fifoOrder as bD, inKindDrawMsats as bE, isInKindDepletion as bF, isNonChannelBitcoinRail as bG, lotOwedSats as bH, netOwedSats as bI, wrapMppx as bJ, type CreditDrainEnqueue as bK, HostedSettlementReportObligations as bL, type DVMAuthScheme as bM, type CreditLedgerLike as bN, type X402RefundSettlementGate as bO, type CreditSnapshot as bP, type DrawResult as bQ, type X402SettlementStatus as bR, type X402UnresolvedRefund as bS, type GrownDrawResult as bT, type DrawResolution as bU, type FundingRecord as bV, type CreditInvoiceRecord as bW, type InvoiceSettlement as bX, type BlockedInvoiceCursor as bY, type InvoiceReconciliation as bZ, type InvoiceWriteOff as b_, usdcContractByCaip2 as ba, usdcContractFor as bb, usdcDomainNameFor as bc, usdcDomainVersionFor as bd, verifyDrainReceipt as be, verifyFundingReceipt as bf, verifyReceipt as bg, x402NetworkToCaip2 as bh, type X402ExactVersionSupport as bi, type X402Receipt as bj, type TransactionalPayoutHook as bk, type CashuMeltCompleted as bl, type CreditDepositPayload as bm, type CreditDrainPayload as bn, type FundingLot as bo, type LotDebit as bp, type LotDepletion as bq, type MppxServer as br, NON_CHANNEL_BITCOIN_RAILS as bs, type NonChannelBitcoinRail as bt, PayoutReporter as bu, PostgresTempoSessionStore as bv, RevenueReporter as bw, SIGNED_ENVELOPE_FIELDS as bx, SIGNED_ENVELOPE_TYPES as by, type X402TrackedChannel as bz, type CancelContent as c, type X402BatchSettlementConfig as c$, type StalePendingDrawCursor as c0, type TempoCreditLossEvidence as c1, type CreditLedgerQuerier as c2, type TempoCreditLoss as c3, type X402CreditLossEvidence as c4, type X402CreditLoss as c5, type DrainMethod as c6, type DrainRequestResult as c7, type BitcoinDepositLiability as c8, type CreditDrainRecord as c9, type JobTerminalReportPayload as cA, PostgresX402ChannelStorage as cB, type ReplayStoreBackend as cC, type RevenueSkippedNoRailPayload as cD, type RevenueSkippedNoRailReason as cE, type Secp256k1AuthOpts as cF, type X402ChannelStorageOpts as cG, type X402RelayLockHolder as cH, type X402RelaySubmissionLock as cI, X402RelaySubmissionLockError as cJ, allocateDrawValue as cK, clientCompatibilityAttributes as cL, clientCompatibilityMiddleware as cM, clientUpgradeRequired as cN, parseClientCapabilities as cO, parseClientCompatibility as cP, parseDvmClient as cQ, parseProtocolVersion as cR, requireClientCompatibility as cS, secp256k1Auth as cT, signedRequestInput as cU, type HostedIntent as cV, type X402SettlementIntent as cW, type HostedFundingReservation as cX, type X402SettlementCursor as cY, type X402SettlementWriteOff as cZ, type X402FacilitatorAuth as c_, type ChannelDrainCursor as ca, type DrainWriteOff as cb, type DrainReleaseResult as cc, type DrainFulfilment as cd, type DrainTransitionResult as ce, HostingCleanupFence as cf, CLIENT_COMPATIBILITY_HEADERS as cg, type ClientCompatibility as ch, type ClientCompatibilityEnv as ci, type ClientCompatibilityGate as cj, type ClientCompatibilityRequirement as ck, type ClientSemVer as cl, type CreditFundingBasis as cm, type CreditInvoiceStatus as cn, CreditLedger as co, CreditLedgerError as cp, type CreditLedgerErrorCode as cq, type CreditLedgerErrorDetails as cr, type CreditLedgerPool as cs, type CreditStatus as ct, DRAIN_DELIVERY_RESERVE_SATS as cu, DVM_PROTOCOL_VERSION as cv, type DrainConflictReason as cw, type DrawRailValue as cx, type DrawStatus as cy, type JobCostReportPayload as cz, type CanonicalEnvelope as d, type X402PayoutObserver as d0, type CreditDepositEnqueue as d1, type X402SettlementReconciliationReason as d2, type CreditDrawReleaseEnqueue as d3, type CreateSignedRequestVerifierOpts as e, type CreditConfig as f, type CreditView as g, DEFAULT_CREDIT_MAX as h, DEFAULT_CREDIT_MIN as i, DEFAULT_CREDIT_TTL_SECONDS as j, DEFAULT_JOB_RETENTION_DAYS as k, type DVMRouteContext as l, type InputType as m, InvalidCurrencyError as n, type PaymentMethod as o, type PriceValue as p, type ProgressContent as q, type PromptOpts as r, type QuoteContext as s, type QuoteResult as t, type ResponseContent as u, type SDKPaymentRequestOpts as v, SIGNED_REQUEST_AUTH_ID as w, SIGNED_REQUEST_STATEMENT_VERSION as x, type SignedRequestAudience as y, type SignedRequestDomain as z };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
assertTempoWalletIdle
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-UOCZXO2Z.js";
|
|
4
|
+
import "./chunk-GFY5FRX3.js";
|
|
5
|
+
import "./chunk-B2IROPQF.js";
|
|
6
6
|
import "./chunk-MZRJR2CW.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-PAIM66YA.js";
|
|
8
8
|
import "./chunk-CZULM42S.js";
|
|
9
|
+
import "./chunk-OFVV37XC.js";
|
|
9
10
|
import "./chunk-FUJ36YDV.js";
|
|
10
11
|
import "./chunk-AT6V3SY7.js";
|
|
11
12
|
import "./chunk-LIRAHP7B.js";
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { C as ContentHoldHistory, a as ContentHoldMutation } from '../content-retention-BTGSQRfP.js';
|
|
2
|
+
import { Y as JobReceipt, a1 as Message, a2 as MessageType, K as KVStore, L as Logger, u as ResponseContent, P as PaymentContent, S as SDKJobContext } from '../step-cache-CPdH1hei.js';
|
|
3
|
+
import { c as StreamableJobStore, R as ReceiptIssuingStore, J as JobRecord, d as RequestIdClaim, e as RequestIdClaimResult, f as JobRetentionCursor, O as OutgoingMessage, A as AppendOutgoingOptions, P as PaymentCreditDelta, V as VerifyAndCreditResult, g as JobCounters } from '../job-store-BVeF5_Jq.js';
|
|
3
4
|
import 'hono';
|
|
4
5
|
import 'mppx';
|
|
5
6
|
import '@x402/core/server';
|
|
@@ -16,6 +17,7 @@ import '@cashu/cashu-ts';
|
|
|
16
17
|
* concurrency control beyond JS's single-threaded execution.
|
|
17
18
|
*/
|
|
18
19
|
declare class MemoryJobStore implements StreamableJobStore, ReceiptIssuingStore {
|
|
20
|
+
private contentHolds;
|
|
19
21
|
private data;
|
|
20
22
|
private messages;
|
|
21
23
|
private nextSeq;
|
|
@@ -44,6 +46,11 @@ declare class MemoryJobStore implements StreamableJobStore, ReceiptIssuingStore
|
|
|
44
46
|
expectedLastActivityAt: number;
|
|
45
47
|
redactedAt: number;
|
|
46
48
|
}): Promise<boolean>;
|
|
49
|
+
getContentSnapshot(jobId: string): Promise<{
|
|
50
|
+
job: JobRecord;
|
|
51
|
+
history: ContentHoldHistory;
|
|
52
|
+
} | undefined>;
|
|
53
|
+
mutateContentHold(jobId: string, mutation: ContentHoldMutation): Promise<ContentHoldHistory>;
|
|
47
54
|
claimReceiptSeq(jobId: string): Promise<number>;
|
|
48
55
|
saveReceipt(jobId: string, receipt: JobReceipt): Promise<JobReceipt | undefined>;
|
|
49
56
|
appendOutgoing(jobId: string, message: OutgoingMessage, opts?: AppendOutgoingOptions): Promise<number>;
|
package/dist/testing/index.js
CHANGED
|
@@ -2,15 +2,18 @@ import {
|
|
|
2
2
|
MemoryKVStore
|
|
3
3
|
} from "../chunk-SDK6KDJN.js";
|
|
4
4
|
import {
|
|
5
|
-
JobCancelledError,
|
|
6
5
|
MemoryJobStore,
|
|
7
6
|
createInstrumentedFetch
|
|
8
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-IV6Q7NRW.js";
|
|
8
|
+
import {
|
|
9
|
+
JobCancelledError
|
|
10
|
+
} from "../chunk-AFV77S4C.js";
|
|
9
11
|
import {
|
|
10
12
|
createNoopLogger
|
|
11
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-QR2EF2NI.js";
|
|
12
14
|
import "../chunk-66HGCPBU.js";
|
|
13
15
|
import "../chunk-FUJ36YDV.js";
|
|
16
|
+
import "../chunk-BQJIFRAZ.js";
|
|
14
17
|
import {
|
|
15
18
|
validateCurrency
|
|
16
19
|
} from "../chunk-BYCEKO65.js";
|