@dvmkit/sdk 0.3.4-rc.10 → 0.5.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/dist/{chunk-2KGG5ORW.js → chunk-7ZUKL4IV.js} +3 -3
- package/dist/{chunk-KXZUCCEY.js → chunk-A4YFWZ7R.js} +4 -55
- package/dist/{chunk-C2AGARLM.js → chunk-B2IROPQF.js} +450 -83
- package/dist/{chunk-MKI6OVW4.js → chunk-CZULM42S.js} +0 -51
- package/dist/{chunk-UZC4A4DM.js → chunk-EYTHFFFU.js} +2489 -213
- package/dist/{chunk-M4QDXD2A.js → chunk-FYRR2UEZ.js} +1 -1
- package/dist/{chunk-4UZN2GP5.js → chunk-GAOAYHZA.js} +209 -33
- package/dist/{chunk-YYQG4R7T.js → chunk-GFY5FRX3.js} +6 -4
- package/dist/{chunk-Z4BNLUZF.js → chunk-IWQHUSMO.js} +3 -105
- package/dist/{chunk-4J32DTLT.js → chunk-IXR5RFK7.js} +82 -4
- package/dist/{chunk-2SD2W2BG.js → chunk-JH3SX3LY.js} +252 -26
- package/dist/chunk-KA6VN5FK.js +245 -0
- package/dist/{chunk-YRDA7EWN.js → chunk-LE74UEV7.js} +61 -16
- package/dist/chunk-LIRAHP7B.js +53 -0
- package/dist/{chunk-MG67KXU7.js → chunk-MZRJR2CW.js} +4 -2
- package/dist/chunk-OFVV37XC.js +57 -0
- package/dist/{chunk-A4CM2BD3.js → chunk-PAIM66YA.js} +91 -2
- package/dist/{chunk-JDFLRNAZ.js → chunk-PB4FYZET.js} +67 -7
- package/dist/{chunk-BQ2NMWKE.js → chunk-PLG4XER6.js} +1 -1
- package/dist/chunk-RLTSCKRI.js +109 -0
- package/dist/{chunk-VAMSJRJT.js → chunk-TUA7PYH7.js} +27 -105
- package/dist/{chunk-O3QDFPKM.js → chunk-TZ2WKCDD.js} +1 -1
- package/dist/{chunk-Z3EHBW2G.js → chunk-UOCZXO2Z.js} +7 -5
- package/dist/{chunk-EAMZZ2B4.js → chunk-X7EZ5CLI.js} +59 -0
- package/dist/{chunk-CE7XEHYC.js → chunk-Z4KLECAC.js} +1 -1
- package/dist/{chunk-7X6UDVCQ.js → chunk-Z4ZT5LNT.js} +66 -2
- package/dist/{credit-ledger-A35WH2TI.js → credit-ledger-MI2H7NEC.js} +3 -1
- package/dist/{credit-menu-0-UtJ3hh.d.ts → credit-menu-CAfqe8IY.d.ts} +133 -7
- package/dist/{fx-DhyT1Cjh.d.ts → fx-D9nsN3n4.d.ts} +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +4 -3
- package/dist/internal/caller.d.ts +80 -13
- package/dist/internal/caller.js +56 -54
- package/dist/internal/index.js +1 -1
- package/dist/internal/server.d.ts +11 -85
- package/dist/internal/server.js +21 -18
- package/dist/{job-store-D3CcZp_g.d.ts → job-store-Bx-VFRjg.d.ts} +1 -1
- package/dist/{lightning-backend-BhsyrBLa.d.ts → lightning-backend-BAx2Y8pP.d.ts} +1 -1
- package/dist/{memory-credit-ledger-2LBZVMKJ.js → memory-credit-ledger-W2BAUYJP.js} +4 -2
- package/dist/{mpp-setup-7CGBKNUP.js → mpp-setup-RF5FXGGV.js} +5 -1
- package/dist/{payout-reporter-ZMOA37GN.js → payout-reporter-3Y2U55ZX.js} +1 -1
- package/dist/{postgres-job-store-MSD2HZOI.js → postgres-job-store-VLXLWXUQ.js} +1 -1
- package/dist/{revenue-reporter-EKJOGQYR.js → revenue-reporter-MAERPYGK.js} +1 -1
- package/dist/server/index.d.ts +14 -10
- package/dist/server/index.js +57 -19
- package/dist/{step-cache-v2yhyhSZ.d.ts → step-cache-QG_h5-3G.d.ts} +1769 -1549
- package/dist/{tempo-charge-store-4WX7FPOV.js → tempo-charge-store-Q3D7KYMH.js} +1 -1
- package/dist/tempo-lifecycle-ZBBLFBMH.js +15 -0
- package/dist/{tempo-session-store-LCSDHB7G.js → tempo-session-store-ZRNCOX7P.js} +1 -1
- package/dist/{tempo-wallet-RCGBBAJH.js → tempo-wallet-B5XXV3YH.js} +4 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/{usd-Cu9G6xv2.d.ts → usd-EwRqCPF-.d.ts} +1 -1
- package/dist/{x402-S47Q77UE.js → x402-R6HPBY5D.js} +18 -14
- package/package.json +1 -1
- package/dist/chunk-YHN3WMMF.js +0 -122
- package/dist/tempo-lifecycle-TJ62A7UX.js +0 -13
|
@@ -1,23 +1,23 @@
|
|
|
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-QG_h5-3G.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-QG_h5-3G.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 { A as AccumulatorPool, a as AccumulatorQuerier, C as ConsumedCredentialStore } from '../credit-menu-
|
|
10
|
-
export { b as AppEnv, c as CreditFundingReport, F as FiatDenomination, d as FiatDenominationFailure, e as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, f as PaymentErrorCode, g as PaymentErrorDetail, h as PaymentInfo, R as ReporterBannerOpts,
|
|
11
|
-
import { g as LockPubkey } from '../lightning-backend-
|
|
12
|
-
export { t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-
|
|
13
|
-
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-
|
|
14
|
-
import { Store } from 'mppx';
|
|
9
|
+
import { A as AccumulatorPool, a as AccumulatorQuerier, C as ConsumedCredentialStore } from '../credit-menu-CAfqe8IY.js';
|
|
10
|
+
export { b as AppEnv, c as CreditFundingReport, F as FiatDenomination, d as FiatDenominationFailure, e as FundOnlyRequest, I as IncomingPaymentOpts, J as JobCancelledError, M as MintHealthTracker, P as PAYMENT_PROOF_KEYS, f as PaymentErrorCode, g as PaymentErrorDetail, h as PaymentInfo, i as PostgresTempoChargeStore, R as ReporterBannerOpts, j as ResolvedFx, k as RevenueBootCheckOpts, S as SDKServerOpts, l as ServerJob, m as ShortPayForfeit, T as TempoChannelReport, n as TempoObserverHealth, o as TempoSessionChannelMismatchError, U as UpfrontPaymentOpts, V as VerifiedIncomingPayment, p as VerifyIncomingSnapshot, X as X402BatchChannelObservation, q as X402FacilitatorHealth, r as X402SettlementEvidenceOutcome, s as X402SettlementRepair, t as X402SettlementRepairRefusal, u as X402SettlementRepaired, v as X402WedgedSettlement, w as X402WedgedSettlementPage, x as X402_BATCH_SETTLEMENT_MAINNET_NETWORK, y as abortJob, z as applyPaymentInfoToJob, B as assertRevenueReporterReady, D as buildPaymentErrorResponse, E as clearAccumulatorForDvm, G as createDVMServer, H as creditDepositPayload, K as derivedFundCreditId, L as devModeSkipsPaymentVerification, N as fromJobRecord, O as fundedMicroFor, Q as hasPaymentProof, W as hashLockKey, Y as implicitCreditId, Z as initWalletAccumulatorTable, _ as insertAccumulatorRows, $ as isDerivedCreditId, a0 as isTerminal, a1 as isYieldMessage, a2 as issueUpfrontChallenges, a3 as msatsToFiatMicro, a4 as paymentErrorBody, a5 as pinAskFiat, a6 as priceFiatMicro, a7 as processIncomingPayment, a8 as providerMessage, a9 as repairX402ExactSettlementEffect, aa as resolveFxSnapshot, ab as resolvePriceFiat, ac as revenueReporterBannerState, ad as toCreditTerms, ae as toJobRecord, af as unknownRouteNotFound, ag as verifyIncomingPayment, ah as verifyTempoSessionManagementCredential, ai as verifyUpfrontPayment, aj as x402RequiredUsdcMicro, ak as x402SettledShare } from '../credit-menu-CAfqe8IY.js';
|
|
11
|
+
import { g as LockPubkey } from '../lightning-backend-BAx2Y8pP.js';
|
|
12
|
+
export { t as lockPubkeyStoreToLockPubkey } from '../lightning-backend-BAx2Y8pP.js';
|
|
13
|
+
export { O as OutgoingMessage, S as StaleJobReapable, i as isStaleJobReapable } from '../job-store-Bx-VFRjg.js';
|
|
15
14
|
import { z } from 'zod';
|
|
15
|
+
import 'mppx';
|
|
16
16
|
import '@x402/evm/batch-settlement/server';
|
|
17
|
-
import 'viem';
|
|
18
17
|
import '@x402/core/types';
|
|
18
|
+
import 'viem';
|
|
19
19
|
import '@cashu/cashu-ts';
|
|
20
|
-
import '../fx-
|
|
20
|
+
import '../fx-D9nsN3n4.js';
|
|
21
21
|
|
|
22
22
|
declare function verifyWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<VerifyResponse>;
|
|
23
23
|
declare function settleWithFacilitator(payload: PaymentPayload, requirements: PaymentRequirementsV1 | PaymentRequirementsV2, config?: Pick<X402Config, "facilitator" | "facilitatorAuth">, createAuthHeaders?: FacilitatorConfig["createAuthHeaders"] | undefined): Promise<SettleResponse>;
|
|
@@ -237,80 +237,6 @@ declare function jobCredentialGate(opts: {
|
|
|
237
237
|
acceptsBearer: boolean;
|
|
238
238
|
}): JobCredentialGate;
|
|
239
239
|
|
|
240
|
-
interface PostgresTempoChargeStoreOpts {
|
|
241
|
-
/** Table name. Defaults to `"mpp_tempo_charge_replays"`. Must match `/^[a-zA-Z_][a-zA-Z0-9_]*$/`. */
|
|
242
|
-
tableName?: string;
|
|
243
|
-
/**
|
|
244
|
-
* How long a row survives its last write, in milliseconds. Defaults to one
|
|
245
|
-
* hour — see the class doc for why that is both generous and safe.
|
|
246
|
-
*/
|
|
247
|
-
retentionMs?: number;
|
|
248
|
-
/**
|
|
249
|
-
* Probability (per write) of firing a fire-and-forget GC sweep that deletes
|
|
250
|
-
* expired rows. Defaults to 0.01 — every ~100 writes runs one DELETE. Set to
|
|
251
|
-
* 0 to disable GC entirely (rely on an external sweeper).
|
|
252
|
-
*/
|
|
253
|
-
gcSampleRate?: number;
|
|
254
|
-
/** Clock source (ms). Defaults to `Date.now`. Test seam for deterministic TTL. */
|
|
255
|
-
now?: () => number;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Postgres implementation of the atomic store mppx's `tempo.charge` uses for
|
|
259
|
-
* replay protection.
|
|
260
|
-
*
|
|
261
|
-
* mppx refuses a charge credential whose transaction hash it has already taken
|
|
262
|
-
* (`markHashUsed`), and refuses a zero-dollar proof credential whose challenge
|
|
263
|
-
* id it has already taken — but only against the store it is handed. Omitting
|
|
264
|
-
* one leaves it on `Store.memory()`: per-process, lost on restart, invisible to
|
|
265
|
-
* sibling machines. A replayed credential then reaches a broadcast the chain
|
|
266
|
-
* rejects instead of the cheap `Transaction hash has already been used`.
|
|
267
|
-
*
|
|
268
|
-
* {@link PostgresTempoSessionStore} cannot serve this keyspace — its `update`
|
|
269
|
-
* asserts a monotonic *channel-state object*, and a replay marker is the number
|
|
270
|
-
* `Date.now()`. Values here are deliberately opaque JSON: mppx writes a number
|
|
271
|
-
* for a replay marker and a `SponsorBudget.State` object for the fee-sponsor
|
|
272
|
-
* budget, which shares this store unprefixed so aggregate in-flight fee
|
|
273
|
-
* exposure is sponsor-wide rather than per-process.
|
|
274
|
-
*
|
|
275
|
-
* **Retention is ours — mppx has no TTL at any layer of `Store`.** Every row
|
|
276
|
-
* carries an `expires_at` refreshed on each write, swept by a sampled in-line
|
|
277
|
-
* DELETE. The window is uniform rather than per-keyspace because it is safe for
|
|
278
|
-
* both kinds of row: a replay marker guards a credential whose transaction is
|
|
279
|
-
* settleable for about twenty-five seconds and whose challenge expires in
|
|
280
|
-
* minutes, and a sponsor-budget reservation is bounded by that same expiring
|
|
281
|
-
* nonce (plus a thirty-second lease while it is `prepared`), so an hour-idle
|
|
282
|
-
* budget row holds only reservations `SponsorBudget.reconcile` would release on
|
|
283
|
-
* sight. Sweeping such a row is equivalent to reconciling it, and the next
|
|
284
|
-
* reservation recreates it. Keeping the rule uniform is what lets this store
|
|
285
|
-
* stay ignorant of mppx's key naming across version bumps.
|
|
286
|
-
*
|
|
287
|
-
* `expires_at` is a GC marker only: reads do not filter on it, so protection
|
|
288
|
-
* lapses when a row is swept and never before.
|
|
289
|
-
*/
|
|
290
|
-
declare class PostgresTempoChargeStore implements Store.AtomicStore {
|
|
291
|
-
private readonly pool;
|
|
292
|
-
private readonly tableName;
|
|
293
|
-
private readonly retentionMs;
|
|
294
|
-
private readonly gcSampleRate;
|
|
295
|
-
private readonly now;
|
|
296
|
-
constructor(pool: Pool, opts?: PostgresTempoChargeStoreOpts);
|
|
297
|
-
/** Run the CREATE TABLE migration. Idempotent — safe to call repeatedly. */
|
|
298
|
-
init(): Promise<void>;
|
|
299
|
-
/** Read one stored value, or `null` when absent — mppx's miss sentinel. */
|
|
300
|
-
get(key: string): Promise<unknown>;
|
|
301
|
-
put(key: string, value: unknown): Promise<void>;
|
|
302
|
-
/** Delete one stored value — mppx's compensating release on a failed broadcast. */
|
|
303
|
-
delete(key: string): Promise<void>;
|
|
304
|
-
/**
|
|
305
|
-
* Advisory locking covers the absent-row first write before the row lock.
|
|
306
|
-
* Both competing presentations of one credential and the shared sponsor
|
|
307
|
-
* budget need this serialization. The transaction contains no chain call.
|
|
308
|
-
*/
|
|
309
|
-
update<result>(key: string, fn: (current: unknown) => Store.Change<unknown, result>): Promise<result>;
|
|
310
|
-
private createTables;
|
|
311
|
-
private maybeSweep;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
240
|
/**
|
|
315
241
|
* `topics[0]` of a `CloseRequested` log.
|
|
316
242
|
*
|
|
@@ -351,4 +277,4 @@ declare function humanizeZodError(err: z.ZodError, opts: {
|
|
|
351
277
|
schemaUrl: string;
|
|
352
278
|
}): HumanizedZodError;
|
|
353
279
|
|
|
354
|
-
export { AccumulatorPool, DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, type LockPubkeyPool, type LockPubkeyState, type LockPubkeyStateLoader, LockPubkey as LockPubkeyStoreLockPubkey,
|
|
280
|
+
export { AccumulatorPool, DEFAULT_LOCK_PUBKEY_GRACE_SECONDS, type LockPubkeyPool, type LockPubkeyState, type LockPubkeyStateLoader, LockPubkey as LockPubkeyStoreLockPubkey, TEMPO_CLOSE_DB_RECOVERY_BUDGET_MS, TEMPO_CLOSE_REQUESTED_TOPIC, activePubkeySet, createAdminCashuNonceStore, createInstrumentedFetch, humanizeZodError, initLockPubkeyTable, installAdminCashuRoutes, jobCredentialGate, loadLockPubkeyState, pruneRetired, rateUnavailablePaymentError, rotateLockPubkey, seedLockPubkeyState, settleWithFacilitator, verifyWithFacilitator, verifyX402Payment };
|
package/dist/internal/server.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PostgresTempoSessionStore
|
|
3
|
-
} from "../chunk-
|
|
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
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-Z4ZT5LNT.js";
|
|
10
10
|
import {
|
|
11
11
|
PayoutReporter
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-GAOAYHZA.js";
|
|
13
13
|
import {
|
|
14
14
|
PostgresTempoChargeStore
|
|
15
|
-
} from "../chunk-
|
|
16
|
-
import "../chunk-YG7G4DPZ.js";
|
|
15
|
+
} from "../chunk-KA6VN5FK.js";
|
|
17
16
|
import {
|
|
18
17
|
DEFAULT_LOCK_PUBKEY_GRACE_SECONDS,
|
|
19
18
|
MintHealthTracker,
|
|
@@ -65,20 +64,21 @@ import {
|
|
|
65
64
|
verifyUpfrontPayment,
|
|
66
65
|
x402RequiredUsdcMicro,
|
|
67
66
|
x402SettledShare
|
|
68
|
-
} from "../chunk-
|
|
67
|
+
} from "../chunk-EYTHFFFU.js";
|
|
69
68
|
import "../chunk-XRLKGCAW.js";
|
|
70
69
|
import {
|
|
71
70
|
settleWithFacilitator,
|
|
72
71
|
verifyWithFacilitator
|
|
73
|
-
} from "../chunk-
|
|
74
|
-
import "../chunk-
|
|
75
|
-
import "../chunk-
|
|
72
|
+
} from "../chunk-PLG4XER6.js";
|
|
73
|
+
import "../chunk-FYRR2UEZ.js";
|
|
74
|
+
import "../chunk-PB4FYZET.js";
|
|
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-Z4KLECAC.js";
|
|
82
82
|
import {
|
|
83
83
|
JobCancelledError,
|
|
84
84
|
abortJob,
|
|
@@ -92,11 +92,12 @@ import {
|
|
|
92
92
|
} from "../chunk-O5AT6S5T.js";
|
|
93
93
|
import {
|
|
94
94
|
toLockPubkey
|
|
95
|
-
} from "../chunk-
|
|
96
|
-
import "../chunk-
|
|
97
|
-
import "../chunk-
|
|
98
|
-
import "../chunk-
|
|
99
|
-
import "../chunk-
|
|
95
|
+
} from "../chunk-TUA7PYH7.js";
|
|
96
|
+
import "../chunk-IWQHUSMO.js";
|
|
97
|
+
import "../chunk-PAIM66YA.js";
|
|
98
|
+
import "../chunk-CZULM42S.js";
|
|
99
|
+
import "../chunk-A4YFWZ7R.js";
|
|
100
|
+
import "../chunk-OFVV37XC.js";
|
|
100
101
|
import "../chunk-6DOGTAHA.js";
|
|
101
102
|
import "../chunk-66HGCPBU.js";
|
|
102
103
|
import "../chunk-FUJ36YDV.js";
|
|
@@ -111,13 +112,15 @@ import {
|
|
|
111
112
|
isNonChannelBitcoinRail,
|
|
112
113
|
lotOwedSats,
|
|
113
114
|
netOwedSats
|
|
114
|
-
} from "../chunk-
|
|
115
|
+
} from "../chunk-JH3SX3LY.js";
|
|
115
116
|
import "../chunk-COYKJRMM.js";
|
|
116
117
|
import "../chunk-P6QON7ER.js";
|
|
118
|
+
import "../chunk-RLTSCKRI.js";
|
|
119
|
+
import "../chunk-LIRAHP7B.js";
|
|
117
120
|
import {
|
|
118
121
|
_testing,
|
|
119
122
|
wrapMppx
|
|
120
|
-
} from "../chunk-
|
|
123
|
+
} from "../chunk-IXR5RFK7.js";
|
|
121
124
|
import "../chunk-ETXDTUJO.js";
|
|
122
125
|
export {
|
|
123
126
|
DEFAULT_LOCK_PUBKEY_GRACE_SECONDS,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProofLike } from '@cashu/cashu-ts';
|
|
2
|
-
import { a1 as Message, ah as FundingMethod, X as FundingReceipt,
|
|
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-QG_h5-3G.js';
|
|
3
3
|
|
|
4
4
|
type JobStatus = "processing" | "completed" | "failed" | "awaiting-input" | "cancelled" | "working";
|
|
5
5
|
interface JobRecord {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MemoryCreditLedger
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-FYRR2UEZ.js";
|
|
4
|
+
import "./chunk-JH3SX3LY.js";
|
|
5
5
|
import "./chunk-COYKJRMM.js";
|
|
6
6
|
import "./chunk-P6QON7ER.js";
|
|
7
|
+
import "./chunk-RLTSCKRI.js";
|
|
8
|
+
import "./chunk-LIRAHP7B.js";
|
|
7
9
|
import "./chunk-ETXDTUJO.js";
|
|
8
10
|
export {
|
|
9
11
|
MemoryCreditLedger
|
|
@@ -14,10 +14,12 @@ import {
|
|
|
14
14
|
challengeMeta,
|
|
15
15
|
createDualKeyMppxFromOpts,
|
|
16
16
|
createMppFromOpts,
|
|
17
|
+
installHostedTempoChargeGuard,
|
|
18
|
+
installHostedTempoCloseGuard,
|
|
17
19
|
parseMppMethodsAllowlist,
|
|
18
20
|
resolveTempoNetwork,
|
|
19
21
|
wrapMppx
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-IXR5RFK7.js";
|
|
21
23
|
import "./chunk-ETXDTUJO.js";
|
|
22
24
|
export {
|
|
23
25
|
MPPX_HMAC_MISMATCH_REASON,
|
|
@@ -35,6 +37,8 @@ export {
|
|
|
35
37
|
challengeMeta,
|
|
36
38
|
createDualKeyMppxFromOpts,
|
|
37
39
|
createMppFromOpts,
|
|
40
|
+
installHostedTempoChargeGuard,
|
|
41
|
+
installHostedTempoCloseGuard,
|
|
38
42
|
parseMppMethodsAllowlist,
|
|
39
43
|
resolveTempoNetwork,
|
|
40
44
|
wrapMppx
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
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-QG_h5-3G.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-QG_h5-3G.js';
|
|
3
3
|
import { Pool } from 'pg';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
4
|
+
import { al as CreditMenu, b as AppEnv, U as UpfrontPaymentOpts, h as PaymentInfo, am as ReceiptIssuer, an as LightningReceive, ao as TempoSettlementReadiness, ap as DVMHostOpts, aq as DVMServeResult } from '../credit-menu-CAfqe8IY.js';
|
|
5
|
+
export { ar as BuildCreditMenuArgs, as as BuilderIdentity, at as CREDIT_ENVELOPE_KEYS, C as ConsumedCredentialStore, au as CreateX402BatchSettlementServerOpts, av as CreditEnvelope, aw as CreditEnvelopeError, ax as CreditFundCommitment, ay as CreditTerms, az as DEFAULT_INVOICE_TTL_SECONDS, aA as DVMHost, aB as HostingClosureCommand, aC as HostingClosureEvidence, aD as HostingControlCommand, aE as HostingControlConfig, aF as HostingControlStatus, aG as JobManager, aH as JobManagerOpts, aI as LightningReceiveConfig, aJ as MIN_INVOICE_TTL_SECONDS, aK as MemoryConsumedCredentialStore, aL as MemoryConsumedCredentialStoreOpts, aM as MemoryProcessedPaymentStore, aN as MemoryX402ExactSettlementStore, aO as MountOpts, aP as OwnerDisplay, aQ as PaidJobCompletion, aR as PaymentMode, aS as PlatformReporterOpts, aT as PostgresProcessedPaymentStore, aU as PostgresX402ExactSettlementStore, aV as PriceFiat, aW as ProcessedPaymentQuerier, aX as ProcessedPaymentRail, aY as ProcessedPaymentRecord, aZ as ProcessedPaymentReplayError, a_ as ProcessedPaymentStore, a$ as X402BatchAcceptance, b0 as X402BatchFunding, b1 as X402BatchRefusal, b2 as X402BatchSettlementServer, b3 as X402ExactAcceptance, b4 as X402ExactIntentConflictError, b5 as X402ExactSettlementAttempt, b6 as X402ExactSettlementChainEvidence, b7 as X402ExactSettlementEffect, b8 as X402ExactSettlementEvidenceMissingError, b9 as X402ExactSettlementEvidenceReader, ba as X402ExactSettlementIntent, bb as X402ExactSettlementNotReadyError, bc as X402ExactSettlementServer, bd as X402ExactSettlementServerOpts, be as X402ExactSettlementStatus, bf as X402ExactSettlementStore, bg as X402SettlementChainEvidence, bh as X402SettlementEvidenceReader, bi as X402SettlementSubmissionError, bj as X402_BATCH_AUTO_SETTLEMENT, bk as X402_BATCH_MIN_WITHDRAW_DELAY_SECONDS, bl as X402_BATCH_SETTLEMENT_NETWORK, bm as attachCreditMenu, bn as buildCreditMenu, bo as createDVMHost, bp as createX402BatchSettlementServer, bq as creditEnvelopeIgnoreFields, br as drawSettlementRef, bs as extractCreditEnvelope, bt as fundingCommitment, bu as selectPrimaryCredit, bv as signHostingClosure, bw as signHostingControl, bx as stripCreditEnvelope, by as toCreditView } from '../credit-menu-CAfqe8IY.js';
|
|
6
6
|
import { Context } 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, b as JobStore, h as isStreamableJobStore } from '../job-store-
|
|
8
|
+
import { F as FxFetcher } from '../fx-D9nsN3n4.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 } from '../job-store-Bx-VFRjg.js';
|
|
10
|
+
export { a as JobStatus, b as JobStore, h as isStreamableJobStore } from '../job-store-Bx-VFRjg.js';
|
|
11
11
|
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';
|
|
12
12
|
import 'mppx';
|
|
13
13
|
import '@x402/core/server';
|
|
14
14
|
import '@x402/evm/batch-settlement/server';
|
|
15
|
-
import 'viem';
|
|
16
15
|
import '@x402/core/types';
|
|
16
|
+
import 'viem';
|
|
17
17
|
import '@cashu/cashu-ts';
|
|
18
|
-
import '../lightning-backend-
|
|
18
|
+
import '../lightning-backend-BAx2Y8pP.js';
|
|
19
19
|
|
|
20
20
|
/** Lifetime of a per-call implicit credit before the ledger refuses new draws. */
|
|
21
21
|
declare const IMPLICIT_CREDIT_TTL_MS: number;
|
|
@@ -58,9 +58,9 @@ interface DrainReportWiring {
|
|
|
58
58
|
*/
|
|
59
59
|
declare const CREDIT_REQUEST_SCHEMA: z.ZodObject<{
|
|
60
60
|
op: z.ZodEnum<{
|
|
61
|
-
drain: "drain";
|
|
62
61
|
balance: "balance";
|
|
63
62
|
fund: "fund";
|
|
63
|
+
drain: "drain";
|
|
64
64
|
}>;
|
|
65
65
|
credit_id: z.ZodOptional<z.ZodString>;
|
|
66
66
|
fund: z.ZodOptional<z.ZodObject<{
|
|
@@ -91,6 +91,7 @@ declare const CREDIT_REQUEST_SCHEMA: z.ZodObject<{
|
|
|
91
91
|
}, z.core.$strip>;
|
|
92
92
|
type CreditRequest = z.infer<typeof CREDIT_REQUEST_SCHEMA>;
|
|
93
93
|
interface CreditRouteDeps {
|
|
94
|
+
hostedSettlementReports?: HostedSettlementReportObligations;
|
|
94
95
|
menu: () => Promise<CreditMenu | undefined>;
|
|
95
96
|
creditConfig: ResolvedCreditConfig | undefined;
|
|
96
97
|
auth: DVMAuthScheme | undefined;
|
|
@@ -339,11 +340,13 @@ declare class MemoryCreditLedger implements CreditLedgerLike {
|
|
|
339
340
|
/** Postgres-backed JobStore with cross-machine message streaming via LISTEN/NOTIFY. */
|
|
340
341
|
declare class PostgresJobStore implements StreamableJobStore, ReceiptIssuingStore {
|
|
341
342
|
private pool;
|
|
343
|
+
private hostingCleanupFence?;
|
|
342
344
|
private listenChannel;
|
|
343
345
|
private messageSubscribers;
|
|
344
346
|
private notifySubscribers;
|
|
345
347
|
private requestIdClaimLocks;
|
|
346
348
|
constructor(pool: Pool);
|
|
349
|
+
useHostingCleanupFence(fence: HostingCleanupFence): void;
|
|
347
350
|
/** Run the CREATE TABLE migration. Call once at startup. */
|
|
348
351
|
init(): Promise<void>;
|
|
349
352
|
private createTables;
|
|
@@ -433,6 +436,7 @@ declare class PostgresJobStore implements StreamableJobStore, ReceiptIssuingStor
|
|
|
433
436
|
* visible.
|
|
434
437
|
*/
|
|
435
438
|
private terminateJob;
|
|
439
|
+
private deleteResolvedMessages;
|
|
436
440
|
private fetchCountersTx;
|
|
437
441
|
/**
|
|
438
442
|
* The credit binding on the job row, read inside Tx C. Used on the
|
package/dist/server/index.js
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
CreditEnvelopeError,
|
|
31
31
|
DEFAULT_LOCK_PUBKEY_GRACE_SECONDS,
|
|
32
32
|
DVM_PROTOCOL_VERSION,
|
|
33
|
+
HostedSettlementReportObligations,
|
|
33
34
|
JobManager,
|
|
34
35
|
MemoryConsumedCredentialStore,
|
|
35
36
|
MemoryX402ExactSettlementStore,
|
|
@@ -71,30 +72,32 @@ import {
|
|
|
71
72
|
revenueReporterBannerState,
|
|
72
73
|
seedLockPubkeyState,
|
|
73
74
|
selectPrimaryCredit,
|
|
75
|
+
signHostingClosure,
|
|
74
76
|
signHostingControl,
|
|
75
77
|
stripCreditEnvelope,
|
|
76
78
|
stripProtocolEnvelope,
|
|
77
79
|
toCreditView,
|
|
78
80
|
unknownRouteNotFound
|
|
79
|
-
} from "../chunk-
|
|
81
|
+
} from "../chunk-EYTHFFFU.js";
|
|
80
82
|
import {
|
|
81
83
|
MemoryProcessedPaymentStore,
|
|
82
84
|
PostgresProcessedPaymentStore,
|
|
83
85
|
ProcessedPaymentReplayError
|
|
84
86
|
} from "../chunk-XRLKGCAW.js";
|
|
85
|
-
import "../chunk-
|
|
87
|
+
import "../chunk-PLG4XER6.js";
|
|
86
88
|
import {
|
|
87
89
|
MemoryCreditLedger
|
|
88
|
-
} from "../chunk-
|
|
90
|
+
} from "../chunk-FYRR2UEZ.js";
|
|
89
91
|
import {
|
|
90
92
|
PostgresJobStore
|
|
91
|
-
} from "../chunk-
|
|
93
|
+
} from "../chunk-PB4FYZET.js";
|
|
94
|
+
import "../chunk-YG7G4DPZ.js";
|
|
92
95
|
import {
|
|
93
96
|
SignedRequestError,
|
|
94
97
|
createDefaultReplayStore,
|
|
95
98
|
createSignedRequestVerifier,
|
|
96
99
|
signedRequestInput
|
|
97
|
-
} from "../chunk-
|
|
100
|
+
} from "../chunk-Z4KLECAC.js";
|
|
98
101
|
import {
|
|
99
102
|
isStreamableJobStore
|
|
100
103
|
} from "../chunk-O5AT6S5T.js";
|
|
@@ -102,24 +105,24 @@ import {
|
|
|
102
105
|
generateEphemeralReceiptKey,
|
|
103
106
|
isTestMintUrl,
|
|
104
107
|
receiptPubkeyFromSecret
|
|
105
|
-
} from "../chunk-
|
|
108
|
+
} from "../chunk-TUA7PYH7.js";
|
|
106
109
|
import {
|
|
107
110
|
X402_DEFAULT_FACILITATOR,
|
|
108
111
|
X402_DEFAULT_NETWORK,
|
|
109
|
-
assertSupportedX402Network,
|
|
110
112
|
x402NetworkToCaip2
|
|
111
|
-
} from "../chunk-
|
|
113
|
+
} from "../chunk-IWQHUSMO.js";
|
|
112
114
|
import {
|
|
113
115
|
IMPLICIT_CREDIT_TTL_MS
|
|
114
|
-
} from "../chunk-
|
|
116
|
+
} from "../chunk-PAIM66YA.js";
|
|
115
117
|
import {
|
|
116
118
|
resolveRpcOverride
|
|
117
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-CZULM42S.js";
|
|
118
120
|
import {
|
|
119
121
|
SIGNED_REQUEST_AUTH_ID,
|
|
120
122
|
SIGNED_REQUEST_STATEMENT_VERSION,
|
|
121
123
|
signedRequestStatementHeader
|
|
122
|
-
} from "../chunk-
|
|
124
|
+
} from "../chunk-A4YFWZ7R.js";
|
|
125
|
+
import "../chunk-OFVV37XC.js";
|
|
123
126
|
import {
|
|
124
127
|
initLoggers
|
|
125
128
|
} from "../chunk-6DOGTAHA.js";
|
|
@@ -134,7 +137,7 @@ import {
|
|
|
134
137
|
PostgresX402ChannelStorage,
|
|
135
138
|
X402RelaySubmissionLockError,
|
|
136
139
|
allocateDrawValue
|
|
137
|
-
} from "../chunk-
|
|
140
|
+
} from "../chunk-JH3SX3LY.js";
|
|
138
141
|
import {
|
|
139
142
|
SDK_INIT_ADVISORY_LOCK,
|
|
140
143
|
withSdkInitLock
|
|
@@ -142,13 +145,17 @@ import {
|
|
|
142
145
|
import {
|
|
143
146
|
applyRetryToPool
|
|
144
147
|
} from "../chunk-P6QON7ER.js";
|
|
148
|
+
import {
|
|
149
|
+
assertSupportedX402Network
|
|
150
|
+
} from "../chunk-RLTSCKRI.js";
|
|
151
|
+
import "../chunk-LIRAHP7B.js";
|
|
145
152
|
import {
|
|
146
153
|
TEMPO_MODERATO_CHAIN_ID,
|
|
147
154
|
TEMPO_MODERATO_RPC,
|
|
148
155
|
TEMPO_SETTLEMENT_DEFAULT_LOW_BALANCE_MICRO,
|
|
149
156
|
TempoSettlementReadiness,
|
|
150
157
|
resolveTempoNetwork
|
|
151
|
-
} from "../chunk-
|
|
158
|
+
} from "../chunk-IXR5RFK7.js";
|
|
152
159
|
import {
|
|
153
160
|
diagnosticConsole
|
|
154
161
|
} from "../chunk-ETXDTUJO.js";
|
|
@@ -1082,6 +1089,7 @@ function createDVMHost(opts = {}) {
|
|
|
1082
1089
|
let pgPool;
|
|
1083
1090
|
let creditLedger;
|
|
1084
1091
|
let tempoSessionStore;
|
|
1092
|
+
let tempoChargeStore;
|
|
1085
1093
|
const tempoPayoutReader = {};
|
|
1086
1094
|
const payoutSinks = {};
|
|
1087
1095
|
let tempoPayoutOwner;
|
|
@@ -1137,7 +1145,7 @@ function createDVMHost(opts = {}) {
|
|
|
1137
1145
|
});
|
|
1138
1146
|
applyRetryToPool(pool, "dvm-host");
|
|
1139
1147
|
pgPool = pool;
|
|
1140
|
-
const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-
|
|
1148
|
+
const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-VLXLWXUQ.js");
|
|
1141
1149
|
const pgJobStore = new PostgresJobStore2(pool);
|
|
1142
1150
|
pendingInits.push(pgJobStore.init(), pgJobStore.initStreaming());
|
|
1143
1151
|
jobStore = pgJobStore;
|
|
@@ -1167,6 +1175,8 @@ function createDVMHost(opts = {}) {
|
|
|
1167
1175
|
canonicalDvmId: void 0,
|
|
1168
1176
|
db: void 0
|
|
1169
1177
|
} : await resolveCashuOptsFromEnv(env, pgPool, opts.cashuMode);
|
|
1178
|
+
const hostedSettlementReports = hostingControl && pgPool && cashuOpts.dvmId && mounts.length === 1 ? new HostedSettlementReportObligations(pgPool, cashuOpts.dvmId, hostingControl.scope) : void 0;
|
|
1179
|
+
await hostedSettlementReports?.init();
|
|
1170
1180
|
if (envMaybe.BUILDER_LOCK_PRIVKEY) {
|
|
1171
1181
|
throw new Error("BUILDER_LOCK_PRIVKEY must not be set on a DVM machine.");
|
|
1172
1182
|
}
|
|
@@ -1228,12 +1238,13 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1228
1238
|
let tempoChargeBackend = "user-supplied";
|
|
1229
1239
|
const mppTempoRecipient = envMaybe.DVMKIT_TEMPO_RECIPIENT;
|
|
1230
1240
|
if (!mpp && mppTempoRecipient) {
|
|
1231
|
-
const { createMppFromOpts, createDualKeyMppxFromOpts, parseMppMethodsAllowlist } = await import("../mpp-setup-
|
|
1241
|
+
const { createMppFromOpts, createDualKeyMppxFromOpts, parseMppMethodsAllowlist } = await import("../mpp-setup-RF5FXGGV.js");
|
|
1232
1242
|
tempoChargeBackend = pgPool ? "postgres" : "memory";
|
|
1233
1243
|
let tempoCharge;
|
|
1234
1244
|
if (pgPool) {
|
|
1235
|
-
const { PostgresTempoChargeStore } = await import("../tempo-charge-store-
|
|
1245
|
+
const { PostgresTempoChargeStore } = await import("../tempo-charge-store-Q3D7KYMH.js");
|
|
1236
1246
|
const chargeStore = new PostgresTempoChargeStore(pgPool);
|
|
1247
|
+
tempoChargeStore = chargeStore;
|
|
1237
1248
|
pendingInits.push(chargeStore.init());
|
|
1238
1249
|
tempoCharge = { store: chargeStore };
|
|
1239
1250
|
}
|
|
@@ -1251,7 +1262,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1251
1262
|
{ createPublicClient, createWalletClient, erc20Abi, http },
|
|
1252
1263
|
{ tempo: tempoMainnet, tempoModerato }
|
|
1253
1264
|
] = await Promise.all([
|
|
1254
|
-
import("../tempo-session-store-
|
|
1265
|
+
import("../tempo-session-store-ZRNCOX7P.js"),
|
|
1255
1266
|
import("viem/accounts"),
|
|
1256
1267
|
import("viem"),
|
|
1257
1268
|
import("viem/chains")
|
|
@@ -1263,6 +1274,16 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1263
1274
|
const operator = privateKeyToAccount2(tempoOperatorKey);
|
|
1264
1275
|
const tempoNetwork = resolveTempoNetwork(envMaybe);
|
|
1265
1276
|
const tempoCurrency = tempoNetwork.currency;
|
|
1277
|
+
if (hostedSettlementReports) {
|
|
1278
|
+
const { Session: TempoSession } = await import("mppx/tempo");
|
|
1279
|
+
hostedSettlementReports.configureTempo({
|
|
1280
|
+
network: `eip155:${tempoNetwork.chainId}`,
|
|
1281
|
+
escrow: TempoSession.Precompile.Constants.tip20ChannelEscrow,
|
|
1282
|
+
payee: mppTempoRecipient,
|
|
1283
|
+
token: tempoCurrency,
|
|
1284
|
+
...envMaybe.DVMKIT_TEMPO_RPC_URL ? { rpcUrl: envMaybe.DVMKIT_TEMPO_RPC_URL } : {}
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1266
1287
|
const selectedChain = tempoNetwork.chainId === tempoModerato.id ? tempoModerato : tempoNetwork.chainId === tempoMainnet.id ? tempoMainnet : { ...tempoNetwork.testnet ? tempoModerato : tempoMainnet, id: tempoNetwork.chainId };
|
|
1267
1288
|
const bundledRpc = tempoNetwork.chainId === TEMPO_MODERATO_CHAIN_ID ? TEMPO_MODERATO_RPC : selectedChain.rpcUrls.default.http[0];
|
|
1268
1289
|
const tempoRpc = resolveRpcOverride(envMaybe.DVMKIT_TEMPO_RPC_URL, bundledRpc).url;
|
|
@@ -1296,6 +1317,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1296
1317
|
}
|
|
1297
1318
|
tempoSession = {
|
|
1298
1319
|
store: sessionStore,
|
|
1320
|
+
...hostedSettlementReports ? { hostedObligations: hostedSettlementReports } : {},
|
|
1299
1321
|
account: operator,
|
|
1300
1322
|
chainId: tempoNetwork.chainId,
|
|
1301
1323
|
getClient: ({ chainId }) => {
|
|
@@ -1317,6 +1339,17 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1317
1339
|
beforeSessionSettlement: () => tempoSettlementReadiness?.captureRecoveryVersion(),
|
|
1318
1340
|
onInsufficientFunds: (failure) => tempoSettlementReadiness?.recordInsufficientFunds(failure),
|
|
1319
1341
|
onSessionSettlement: async (settlement) => {
|
|
1342
|
+
if (hostedSettlementReports) {
|
|
1343
|
+
const original = await hostedSettlementReports.findPendingTempo(
|
|
1344
|
+
settlement.channelId,
|
|
1345
|
+
settlement.trigger === "close" ? "close" : "settle"
|
|
1346
|
+
);
|
|
1347
|
+
if (original) {
|
|
1348
|
+
await hostedSettlementReports.recordSubmitted(original.id, settlement.txHash);
|
|
1349
|
+
} else if (await hostedSettlementReports.hasCompleteHistory()) {
|
|
1350
|
+
throw new Error("Hosted Tempo settlement has no original pre-effect reservation");
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1320
1353
|
await tempoSettlementReadiness?.recordSuccessfulTransaction(settlement.recoveryVersion);
|
|
1321
1354
|
diagnosticConsole.info(
|
|
1322
1355
|
{
|
|
@@ -1426,7 +1459,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1426
1459
|
sharedPgConsumedStore = consumedStore;
|
|
1427
1460
|
}
|
|
1428
1461
|
if (pgPool) {
|
|
1429
|
-
const { CreditLedger: CreditLedger2 } = await import("../credit-ledger-
|
|
1462
|
+
const { CreditLedger: CreditLedger2 } = await import("../credit-ledger-MI2H7NEC.js");
|
|
1430
1463
|
const pgLedger = new CreditLedger2(pgPool, tempoSessionStore);
|
|
1431
1464
|
pendingInits.push(pgLedger.init());
|
|
1432
1465
|
creditLedger = pgLedger;
|
|
@@ -1435,7 +1468,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1435
1468
|
pendingInits.push(pgProcessed.init());
|
|
1436
1469
|
processedPayments = pgProcessed;
|
|
1437
1470
|
} else {
|
|
1438
|
-
const { MemoryCreditLedger: MemoryCreditLedger2 } = await import("../memory-credit-ledger-
|
|
1471
|
+
const { MemoryCreditLedger: MemoryCreditLedger2 } = await import("../memory-credit-ledger-W2BAUYJP.js");
|
|
1439
1472
|
creditLedger = disposableCashu?.ledger ?? new MemoryCreditLedger2();
|
|
1440
1473
|
const { MemoryProcessedPaymentStore: MemoryProcessedPaymentStore2 } = await import("../processed-payment-store-GKMAWOM3.js");
|
|
1441
1474
|
processedPayments = new MemoryProcessedPaymentStore2();
|
|
@@ -1559,6 +1592,10 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1559
1592
|
canonicalDvmId: cashuOpts.canonicalDvmId,
|
|
1560
1593
|
db: hostingControl ? pgPool : cashuOpts.db,
|
|
1561
1594
|
hostingControl,
|
|
1595
|
+
hostingCleanupSingleMount: mounts.length === 1,
|
|
1596
|
+
hostingCleanupKnownRailStores: !mpp || tempoChargeBackend === "postgres",
|
|
1597
|
+
hostingTempoSessionStore: tempoSessionStore,
|
|
1598
|
+
hostingTempoChargeStore: tempoChargeStore,
|
|
1562
1599
|
dvmId: cashuOpts.dvmId,
|
|
1563
1600
|
failFast,
|
|
1564
1601
|
mintHealthTracker: opts.mintHealthTracker,
|
|
@@ -2124,6 +2161,7 @@ export {
|
|
|
2124
2161
|
secp256k1Auth,
|
|
2125
2162
|
selectPrimaryCredit,
|
|
2126
2163
|
serve,
|
|
2164
|
+
signHostingClosure,
|
|
2127
2165
|
signHostingControl,
|
|
2128
2166
|
signedRequestInput,
|
|
2129
2167
|
signedRequestStatementHeader,
|