@dvmkit/sdk 0.3.4-rc.10 → 0.4.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-C2AGARLM.js → chunk-2VGWYG4P.js} +5 -3
- package/dist/{chunk-A4CM2BD3.js → chunk-3MHE725Z.js} +1 -1
- package/dist/{chunk-VAMSJRJT.js → chunk-5LR6P7WN.js} +5 -3
- package/dist/{chunk-YYQG4R7T.js → chunk-74PUEZJ4.js} +6 -4
- package/dist/{chunk-MKI6OVW4.js → chunk-CZULM42S.js} +0 -51
- package/dist/{chunk-M4QDXD2A.js → chunk-FYRR2UEZ.js} +1 -1
- package/dist/{chunk-4UZN2GP5.js → chunk-GAOAYHZA.js} +209 -33
- 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-UZC4A4DM.js → chunk-K2YX2VRA.js} +2480 -206
- package/dist/chunk-KA6VN5FK.js +245 -0
- package/dist/chunk-LIRAHP7B.js +53 -0
- package/dist/{chunk-MG67KXU7.js → chunk-MZRJR2CW.js} +4 -2
- package/dist/{chunk-JDFLRNAZ.js → chunk-PB4FYZET.js} +67 -7
- package/dist/{chunk-BQ2NMWKE.js → chunk-PLG4XER6.js} +1 -1
- package/dist/{chunk-Z3EHBW2G.js → chunk-R4DQZFAL.js} +7 -5
- package/dist/chunk-RLTSCKRI.js +109 -0
- package/dist/{chunk-2KGG5ORW.js → chunk-TXX4GOUB.js} +3 -3
- package/dist/{chunk-YRDA7EWN.js → chunk-W2EQGDF5.js} +14 -10
- package/dist/{chunk-EAMZZ2B4.js → chunk-X7EZ5CLI.js} +59 -0
- 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-B8_p_vUz.d.ts} +133 -7
- package/dist/{fx-DhyT1Cjh.d.ts → fx-DuaYHvVn.d.ts} +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/internal/caller.d.ts +6 -6
- package/dist/internal/caller.js +28 -24
- package/dist/internal/server.d.ts +11 -85
- package/dist/internal/server.js +18 -16
- package/dist/{job-store-D3CcZp_g.d.ts → job-store-D6Rjj5Oi.d.ts} +1 -1
- package/dist/{lightning-backend-BhsyrBLa.d.ts → lightning-backend-BaeCPmx7.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 +54 -17
- package/dist/{step-cache-v2yhyhSZ.d.ts → step-cache-Bi43A0JN.d.ts} +1769 -1549
- package/dist/{tempo-charge-store-4WX7FPOV.js → tempo-charge-store-Q3D7KYMH.js} +1 -1
- package/dist/tempo-lifecycle-OTHV757Y.js +14 -0
- package/dist/{tempo-session-store-LCSDHB7G.js → tempo-session-store-ZRNCOX7P.js} +1 -1
- package/dist/{tempo-wallet-RCGBBAJH.js → tempo-wallet-32JWQZKQ.js} +4 -3
- package/dist/testing/index.d.ts +3 -3
- package/dist/{usd-Cu9G6xv2.d.ts → usd-AZPVq4eU.d.ts} +1 -1
- package/dist/{x402-S47Q77UE.js → x402-CEDHGZDI.js} +17 -14
- package/package.json +1 -1
- package/dist/chunk-YHN3WMMF.js +0 -122
- package/dist/tempo-lifecycle-TJ62A7UX.js +0 -13
package/dist/internal/caller.js
CHANGED
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
withIdentitiesLock,
|
|
56
56
|
withTempoChannelLock,
|
|
57
57
|
withholdsTempoCreditSession
|
|
58
|
-
} from "../chunk-
|
|
58
|
+
} from "../chunk-R4DQZFAL.js";
|
|
59
59
|
import {
|
|
60
60
|
TEMPO_CHAIN_ID,
|
|
61
61
|
TEMPO_MODERATO_CHAIN_ID,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
tempoTokenReference,
|
|
72
72
|
tempoWrongAssetHint,
|
|
73
73
|
tryResolveTempoAsset
|
|
74
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-74PUEZJ4.js";
|
|
75
75
|
import {
|
|
76
76
|
DvmX402ChannelStorage,
|
|
77
77
|
X402_EXACT_AUTHORIZATION_TTL_SECONDS,
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
x402PendingStale,
|
|
117
117
|
x402PendingUnsettled,
|
|
118
118
|
x402WrongAssetHint
|
|
119
|
-
} from "../chunk-
|
|
119
|
+
} from "../chunk-W2EQGDF5.js";
|
|
120
120
|
import {
|
|
121
121
|
RAIL_FLAGS,
|
|
122
122
|
SUPPORTED_PROTOCOL_VERSION,
|
|
@@ -163,7 +163,7 @@ import {
|
|
|
163
163
|
setOutputTraceId,
|
|
164
164
|
settleDrainEvidence,
|
|
165
165
|
withinAdvertisedTolerance
|
|
166
|
-
} from "../chunk-
|
|
166
|
+
} from "../chunk-2VGWYG4P.js";
|
|
167
167
|
import {
|
|
168
168
|
CREDIT_POSTURES,
|
|
169
169
|
FEEDBACK_POSTURES,
|
|
@@ -181,7 +181,7 @@ import {
|
|
|
181
181
|
retireConfigBackup,
|
|
182
182
|
rollbackConfig,
|
|
183
183
|
updateConfig
|
|
184
|
-
} from "../chunk-
|
|
184
|
+
} from "../chunk-MZRJR2CW.js";
|
|
185
185
|
import {
|
|
186
186
|
CAPABILITY_NAME_RE
|
|
187
187
|
} from "../chunk-O3QDFPKM.js";
|
|
@@ -289,16 +289,14 @@ import {
|
|
|
289
289
|
withWalletLock,
|
|
290
290
|
writeAgentMnemonic,
|
|
291
291
|
writeIdentity
|
|
292
|
-
} from "../chunk-
|
|
292
|
+
} from "../chunk-5LR6P7WN.js";
|
|
293
293
|
import {
|
|
294
294
|
X402_BATCH_SETTLEMENT_SCHEME,
|
|
295
295
|
X402_DEFAULT_FACILITATOR,
|
|
296
296
|
X402_DEFAULT_NETWORK,
|
|
297
297
|
X402_EXACT_SCHEME,
|
|
298
|
-
X402_NETWORKS,
|
|
299
298
|
X402_V1_VERSION,
|
|
300
299
|
X402_VERSION,
|
|
301
|
-
assertSupportedX402Network,
|
|
302
300
|
buildPaymentRequiredV2,
|
|
303
301
|
buildPaymentRequirements,
|
|
304
302
|
caip2ToX402Network,
|
|
@@ -314,13 +312,8 @@ import {
|
|
|
314
312
|
usdcContractFor,
|
|
315
313
|
usdcDomainNameFor,
|
|
316
314
|
usdcDomainVersionFor,
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
x402NetworkLabel,
|
|
320
|
-
x402NetworkListForCopy,
|
|
321
|
-
x402NetworkToCaip2,
|
|
322
|
-
x402SupportedNetworksHint
|
|
323
|
-
} from "../chunk-Z4BNLUZF.js";
|
|
315
|
+
x402NetworkToCaip2
|
|
316
|
+
} from "../chunk-IWQHUSMO.js";
|
|
324
317
|
import {
|
|
325
318
|
COINGECKO_SIMPLE_PRICE_URL,
|
|
326
319
|
assertValidBudget,
|
|
@@ -343,7 +336,7 @@ import {
|
|
|
343
336
|
parseBudget,
|
|
344
337
|
usdToMsats,
|
|
345
338
|
usdcToMsats
|
|
346
|
-
} from "../chunk-
|
|
339
|
+
} from "../chunk-3MHE725Z.js";
|
|
347
340
|
import {
|
|
348
341
|
AGENT_MNEMONIC_FILE,
|
|
349
342
|
BTC_RATE_FILE,
|
|
@@ -354,7 +347,6 @@ import {
|
|
|
354
347
|
CONFIG_FILE,
|
|
355
348
|
CONFIG_PINNED_FILE,
|
|
356
349
|
CREDITS_FILE,
|
|
357
|
-
DvmError,
|
|
358
350
|
FAVORITES_FILE,
|
|
359
351
|
FEEDBACK_NUDGES_FILE,
|
|
360
352
|
IDENTITIES_FILE,
|
|
@@ -369,13 +361,10 @@ import {
|
|
|
369
361
|
X402_CHANNELS_FILE,
|
|
370
362
|
ensureConfigDir,
|
|
371
363
|
ensureConfigSubdir,
|
|
372
|
-
isAbortError,
|
|
373
|
-
providerProseSources,
|
|
374
364
|
repairConfigDirMode,
|
|
375
365
|
resolveRpcHttpTransportOptions,
|
|
376
|
-
resolveRpcOverride
|
|
377
|
-
|
|
378
|
-
} from "../chunk-MKI6OVW4.js";
|
|
366
|
+
resolveRpcOverride
|
|
367
|
+
} from "../chunk-CZULM42S.js";
|
|
379
368
|
import {
|
|
380
369
|
RAIL_REFUNDABLE,
|
|
381
370
|
SIGNED_REQUEST_AUTH_ID,
|
|
@@ -417,6 +406,21 @@ import {
|
|
|
417
406
|
applyRetryToPool,
|
|
418
407
|
withInitRetry
|
|
419
408
|
} from "../chunk-P6QON7ER.js";
|
|
409
|
+
import {
|
|
410
|
+
X402_NETWORKS,
|
|
411
|
+
assertSupportedX402Network,
|
|
412
|
+
x402NetworkByCaip2,
|
|
413
|
+
x402NetworkBySlug,
|
|
414
|
+
x402NetworkLabel,
|
|
415
|
+
x402NetworkListForCopy,
|
|
416
|
+
x402SupportedNetworksHint
|
|
417
|
+
} from "../chunk-RLTSCKRI.js";
|
|
418
|
+
import {
|
|
419
|
+
DvmError,
|
|
420
|
+
isAbortError,
|
|
421
|
+
providerProseSources,
|
|
422
|
+
transportErrorCode
|
|
423
|
+
} from "../chunk-LIRAHP7B.js";
|
|
420
424
|
import {
|
|
421
425
|
DIAGNOSTIC_CATALOGUE_VERSION,
|
|
422
426
|
bindDiagnosticCapabilityAuthority,
|
|
@@ -9435,7 +9439,7 @@ async function probeX402(x402, timeoutMs) {
|
|
|
9435
9439
|
let network;
|
|
9436
9440
|
let address;
|
|
9437
9441
|
try {
|
|
9438
|
-
const { loadX402Wallet: loadX402Wallet2, getX402Balance: getX402Balance2, ensureAddress: ensureAddress2, usdcContractByCaip2: usdcContractByCaip22 } = await import("../x402-
|
|
9442
|
+
const { loadX402Wallet: loadX402Wallet2, getX402Balance: getX402Balance2, ensureAddress: ensureAddress2, usdcContractByCaip2: usdcContractByCaip22 } = await import("../x402-CEDHGZDI.js");
|
|
9439
9443
|
const wallet = loadX402Wallet2();
|
|
9440
9444
|
if (!wallet) {
|
|
9441
9445
|
const storedKey = x402.privateKey;
|
|
@@ -9487,7 +9491,7 @@ async function probeMpp(mpp, timeoutMs) {
|
|
|
9487
9491
|
if (!mpp) return null;
|
|
9488
9492
|
if (mpp.method === "tempo") {
|
|
9489
9493
|
try {
|
|
9490
|
-
const { connectedTempoAccount: connectedTempoAccount2, getTempoUsdcBalance: getTempoUsdcBalance2, resolveTempoNetwork: resolveTempoNetwork2 } = await import("../tempo-wallet-
|
|
9494
|
+
const { connectedTempoAccount: connectedTempoAccount2, getTempoUsdcBalance: getTempoUsdcBalance2, resolveTempoNetwork: resolveTempoNetwork2 } = await import("../tempo-wallet-32JWQZKQ.js");
|
|
9491
9495
|
const account = await connectedTempoAccount2();
|
|
9492
9496
|
if (!account) {
|
|
9493
9497
|
return {
|
|
@@ -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-Bi43A0JN.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-Bi43A0JN.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-B8_p_vUz.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-B8_p_vUz.js';
|
|
11
|
+
import { g as LockPubkey } from '../lightning-backend-BaeCPmx7.js';
|
|
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';
|
|
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-DuaYHvVn.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-TXX4GOUB.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,14 +64,15 @@ import {
|
|
|
65
64
|
verifyUpfrontPayment,
|
|
66
65
|
x402RequiredUsdcMicro,
|
|
67
66
|
x402SettledShare
|
|
68
|
-
} from "../chunk-
|
|
67
|
+
} from "../chunk-K2YX2VRA.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,
|
|
@@ -92,10 +92,10 @@ 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-
|
|
95
|
+
} from "../chunk-5LR6P7WN.js";
|
|
96
|
+
import "../chunk-IWQHUSMO.js";
|
|
97
|
+
import "../chunk-3MHE725Z.js";
|
|
98
|
+
import "../chunk-CZULM42S.js";
|
|
99
99
|
import "../chunk-KXZUCCEY.js";
|
|
100
100
|
import "../chunk-6DOGTAHA.js";
|
|
101
101
|
import "../chunk-66HGCPBU.js";
|
|
@@ -111,13 +111,15 @@ import {
|
|
|
111
111
|
isNonChannelBitcoinRail,
|
|
112
112
|
lotOwedSats,
|
|
113
113
|
netOwedSats
|
|
114
|
-
} from "../chunk-
|
|
114
|
+
} from "../chunk-JH3SX3LY.js";
|
|
115
115
|
import "../chunk-COYKJRMM.js";
|
|
116
116
|
import "../chunk-P6QON7ER.js";
|
|
117
|
+
import "../chunk-RLTSCKRI.js";
|
|
118
|
+
import "../chunk-LIRAHP7B.js";
|
|
117
119
|
import {
|
|
118
120
|
_testing,
|
|
119
121
|
wrapMppx
|
|
120
|
-
} from "../chunk-
|
|
122
|
+
} from "../chunk-IXR5RFK7.js";
|
|
121
123
|
import "../chunk-ETXDTUJO.js";
|
|
122
124
|
export {
|
|
123
125
|
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-Bi43A0JN.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 { ab as CashuMode, bK as CreditDrainEnqueue, R as ResolvedCreditConfig,
|
|
2
|
-
export {
|
|
1
|
+
import { ab 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-Bi43A0JN.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-Bi43A0JN.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-B8_p_vUz.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-B8_p_vUz.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-DuaYHvVn.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-D6Rjj5Oi.js';
|
|
10
|
+
export { a as JobStatus, b as JobStore, h as isStreamableJobStore } from '../job-store-D6Rjj5Oi.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-BaeCPmx7.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
|