@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/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,24 +72,26 @@ 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-K2YX2VRA.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,
|
|
@@ -102,19 +105,18 @@ import {
|
|
|
102
105
|
generateEphemeralReceiptKey,
|
|
103
106
|
isTestMintUrl,
|
|
104
107
|
receiptPubkeyFromSecret
|
|
105
|
-
} from "../chunk-
|
|
108
|
+
} from "../chunk-5LR6P7WN.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-3MHE725Z.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,
|
|
@@ -134,7 +136,7 @@ import {
|
|
|
134
136
|
PostgresX402ChannelStorage,
|
|
135
137
|
X402RelaySubmissionLockError,
|
|
136
138
|
allocateDrawValue
|
|
137
|
-
} from "../chunk-
|
|
139
|
+
} from "../chunk-JH3SX3LY.js";
|
|
138
140
|
import {
|
|
139
141
|
SDK_INIT_ADVISORY_LOCK,
|
|
140
142
|
withSdkInitLock
|
|
@@ -142,13 +144,17 @@ import {
|
|
|
142
144
|
import {
|
|
143
145
|
applyRetryToPool
|
|
144
146
|
} from "../chunk-P6QON7ER.js";
|
|
147
|
+
import {
|
|
148
|
+
assertSupportedX402Network
|
|
149
|
+
} from "../chunk-RLTSCKRI.js";
|
|
150
|
+
import "../chunk-LIRAHP7B.js";
|
|
145
151
|
import {
|
|
146
152
|
TEMPO_MODERATO_CHAIN_ID,
|
|
147
153
|
TEMPO_MODERATO_RPC,
|
|
148
154
|
TEMPO_SETTLEMENT_DEFAULT_LOW_BALANCE_MICRO,
|
|
149
155
|
TempoSettlementReadiness,
|
|
150
156
|
resolveTempoNetwork
|
|
151
|
-
} from "../chunk-
|
|
157
|
+
} from "../chunk-IXR5RFK7.js";
|
|
152
158
|
import {
|
|
153
159
|
diagnosticConsole
|
|
154
160
|
} from "../chunk-ETXDTUJO.js";
|
|
@@ -1082,6 +1088,7 @@ function createDVMHost(opts = {}) {
|
|
|
1082
1088
|
let pgPool;
|
|
1083
1089
|
let creditLedger;
|
|
1084
1090
|
let tempoSessionStore;
|
|
1091
|
+
let tempoChargeStore;
|
|
1085
1092
|
const tempoPayoutReader = {};
|
|
1086
1093
|
const payoutSinks = {};
|
|
1087
1094
|
let tempoPayoutOwner;
|
|
@@ -1137,7 +1144,7 @@ function createDVMHost(opts = {}) {
|
|
|
1137
1144
|
});
|
|
1138
1145
|
applyRetryToPool(pool, "dvm-host");
|
|
1139
1146
|
pgPool = pool;
|
|
1140
|
-
const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-
|
|
1147
|
+
const { PostgresJobStore: PostgresJobStore2 } = await import("../postgres-job-store-VLXLWXUQ.js");
|
|
1141
1148
|
const pgJobStore = new PostgresJobStore2(pool);
|
|
1142
1149
|
pendingInits.push(pgJobStore.init(), pgJobStore.initStreaming());
|
|
1143
1150
|
jobStore = pgJobStore;
|
|
@@ -1167,6 +1174,8 @@ function createDVMHost(opts = {}) {
|
|
|
1167
1174
|
canonicalDvmId: void 0,
|
|
1168
1175
|
db: void 0
|
|
1169
1176
|
} : await resolveCashuOptsFromEnv(env, pgPool, opts.cashuMode);
|
|
1177
|
+
const hostedSettlementReports = hostingControl && pgPool && cashuOpts.dvmId && mounts.length === 1 ? new HostedSettlementReportObligations(pgPool, cashuOpts.dvmId, hostingControl.scope) : void 0;
|
|
1178
|
+
await hostedSettlementReports?.init();
|
|
1170
1179
|
if (envMaybe.BUILDER_LOCK_PRIVKEY) {
|
|
1171
1180
|
throw new Error("BUILDER_LOCK_PRIVKEY must not be set on a DVM machine.");
|
|
1172
1181
|
}
|
|
@@ -1228,12 +1237,13 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1228
1237
|
let tempoChargeBackend = "user-supplied";
|
|
1229
1238
|
const mppTempoRecipient = envMaybe.DVMKIT_TEMPO_RECIPIENT;
|
|
1230
1239
|
if (!mpp && mppTempoRecipient) {
|
|
1231
|
-
const { createMppFromOpts, createDualKeyMppxFromOpts, parseMppMethodsAllowlist } = await import("../mpp-setup-
|
|
1240
|
+
const { createMppFromOpts, createDualKeyMppxFromOpts, parseMppMethodsAllowlist } = await import("../mpp-setup-RF5FXGGV.js");
|
|
1232
1241
|
tempoChargeBackend = pgPool ? "postgres" : "memory";
|
|
1233
1242
|
let tempoCharge;
|
|
1234
1243
|
if (pgPool) {
|
|
1235
|
-
const { PostgresTempoChargeStore } = await import("../tempo-charge-store-
|
|
1244
|
+
const { PostgresTempoChargeStore } = await import("../tempo-charge-store-Q3D7KYMH.js");
|
|
1236
1245
|
const chargeStore = new PostgresTempoChargeStore(pgPool);
|
|
1246
|
+
tempoChargeStore = chargeStore;
|
|
1237
1247
|
pendingInits.push(chargeStore.init());
|
|
1238
1248
|
tempoCharge = { store: chargeStore };
|
|
1239
1249
|
}
|
|
@@ -1251,7 +1261,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1251
1261
|
{ createPublicClient, createWalletClient, erc20Abi, http },
|
|
1252
1262
|
{ tempo: tempoMainnet, tempoModerato }
|
|
1253
1263
|
] = await Promise.all([
|
|
1254
|
-
import("../tempo-session-store-
|
|
1264
|
+
import("../tempo-session-store-ZRNCOX7P.js"),
|
|
1255
1265
|
import("viem/accounts"),
|
|
1256
1266
|
import("viem"),
|
|
1257
1267
|
import("viem/chains")
|
|
@@ -1263,6 +1273,16 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1263
1273
|
const operator = privateKeyToAccount2(tempoOperatorKey);
|
|
1264
1274
|
const tempoNetwork = resolveTempoNetwork(envMaybe);
|
|
1265
1275
|
const tempoCurrency = tempoNetwork.currency;
|
|
1276
|
+
if (hostedSettlementReports) {
|
|
1277
|
+
const { Session: TempoSession } = await import("mppx/tempo");
|
|
1278
|
+
hostedSettlementReports.configureTempo({
|
|
1279
|
+
network: `eip155:${tempoNetwork.chainId}`,
|
|
1280
|
+
escrow: TempoSession.Precompile.Constants.tip20ChannelEscrow,
|
|
1281
|
+
payee: mppTempoRecipient,
|
|
1282
|
+
token: tempoCurrency,
|
|
1283
|
+
...envMaybe.DVMKIT_TEMPO_RPC_URL ? { rpcUrl: envMaybe.DVMKIT_TEMPO_RPC_URL } : {}
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1266
1286
|
const selectedChain = tempoNetwork.chainId === tempoModerato.id ? tempoModerato : tempoNetwork.chainId === tempoMainnet.id ? tempoMainnet : { ...tempoNetwork.testnet ? tempoModerato : tempoMainnet, id: tempoNetwork.chainId };
|
|
1267
1287
|
const bundledRpc = tempoNetwork.chainId === TEMPO_MODERATO_CHAIN_ID ? TEMPO_MODERATO_RPC : selectedChain.rpcUrls.default.http[0];
|
|
1268
1288
|
const tempoRpc = resolveRpcOverride(envMaybe.DVMKIT_TEMPO_RPC_URL, bundledRpc).url;
|
|
@@ -1296,6 +1316,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1296
1316
|
}
|
|
1297
1317
|
tempoSession = {
|
|
1298
1318
|
store: sessionStore,
|
|
1319
|
+
...hostedSettlementReports ? { hostedObligations: hostedSettlementReports } : {},
|
|
1299
1320
|
account: operator,
|
|
1300
1321
|
chainId: tempoNetwork.chainId,
|
|
1301
1322
|
getClient: ({ chainId }) => {
|
|
@@ -1317,6 +1338,17 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1317
1338
|
beforeSessionSettlement: () => tempoSettlementReadiness?.captureRecoveryVersion(),
|
|
1318
1339
|
onInsufficientFunds: (failure) => tempoSettlementReadiness?.recordInsufficientFunds(failure),
|
|
1319
1340
|
onSessionSettlement: async (settlement) => {
|
|
1341
|
+
if (hostedSettlementReports) {
|
|
1342
|
+
const original = await hostedSettlementReports.findPendingTempo(
|
|
1343
|
+
settlement.channelId,
|
|
1344
|
+
settlement.trigger === "close" ? "close" : "settle"
|
|
1345
|
+
);
|
|
1346
|
+
if (original) {
|
|
1347
|
+
await hostedSettlementReports.recordSubmitted(original.id, settlement.txHash);
|
|
1348
|
+
} else if (await hostedSettlementReports.hasCompleteHistory()) {
|
|
1349
|
+
throw new Error("Hosted Tempo settlement has no original pre-effect reservation");
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1320
1352
|
await tempoSettlementReadiness?.recordSuccessfulTransaction(settlement.recoveryVersion);
|
|
1321
1353
|
diagnosticConsole.info(
|
|
1322
1354
|
{
|
|
@@ -1426,7 +1458,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1426
1458
|
sharedPgConsumedStore = consumedStore;
|
|
1427
1459
|
}
|
|
1428
1460
|
if (pgPool) {
|
|
1429
|
-
const { CreditLedger: CreditLedger2 } = await import("../credit-ledger-
|
|
1461
|
+
const { CreditLedger: CreditLedger2 } = await import("../credit-ledger-MI2H7NEC.js");
|
|
1430
1462
|
const pgLedger = new CreditLedger2(pgPool, tempoSessionStore);
|
|
1431
1463
|
pendingInits.push(pgLedger.init());
|
|
1432
1464
|
creditLedger = pgLedger;
|
|
@@ -1435,7 +1467,7 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1435
1467
|
pendingInits.push(pgProcessed.init());
|
|
1436
1468
|
processedPayments = pgProcessed;
|
|
1437
1469
|
} else {
|
|
1438
|
-
const { MemoryCreditLedger: MemoryCreditLedger2 } = await import("../memory-credit-ledger-
|
|
1470
|
+
const { MemoryCreditLedger: MemoryCreditLedger2 } = await import("../memory-credit-ledger-W2BAUYJP.js");
|
|
1439
1471
|
creditLedger = disposableCashu?.ledger ?? new MemoryCreditLedger2();
|
|
1440
1472
|
const { MemoryProcessedPaymentStore: MemoryProcessedPaymentStore2 } = await import("../processed-payment-store-GKMAWOM3.js");
|
|
1441
1473
|
processedPayments = new MemoryProcessedPaymentStore2();
|
|
@@ -1559,6 +1591,10 @@ ${config.facilitatorAuth?.keyId ?? ""}`;
|
|
|
1559
1591
|
canonicalDvmId: cashuOpts.canonicalDvmId,
|
|
1560
1592
|
db: hostingControl ? pgPool : cashuOpts.db,
|
|
1561
1593
|
hostingControl,
|
|
1594
|
+
hostingCleanupSingleMount: mounts.length === 1,
|
|
1595
|
+
hostingCleanupKnownRailStores: !mpp || tempoChargeBackend === "postgres",
|
|
1596
|
+
hostingTempoSessionStore: tempoSessionStore,
|
|
1597
|
+
hostingTempoChargeStore: tempoChargeStore,
|
|
1562
1598
|
dvmId: cashuOpts.dvmId,
|
|
1563
1599
|
failFast,
|
|
1564
1600
|
mintHealthTracker: opts.mintHealthTracker,
|
|
@@ -2124,6 +2160,7 @@ export {
|
|
|
2124
2160
|
secp256k1Auth,
|
|
2125
2161
|
selectPrimaryCredit,
|
|
2126
2162
|
serve,
|
|
2163
|
+
signHostingClosure,
|
|
2127
2164
|
signHostingControl,
|
|
2128
2165
|
signedRequestInput,
|
|
2129
2166
|
signedRequestStatementHeader,
|