@dvmkit/sdk 0.2.0-rc.9 → 0.3.0-rc.9
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 +2 -0
- package/dist/{chunk-V7EVFLAK.js → chunk-2D75MNNG.js} +154 -523
- package/dist/{chunk-BIFLRKMO.js → chunk-2KGG5ORW.js} +1 -1
- package/dist/{chunk-5URG56JJ.js → chunk-A4CM2BD3.js} +18 -2
- package/dist/{chunk-FT6HTUM4.js → chunk-AJNFXR7J.js} +1 -1
- package/dist/{chunk-S3XAHZQY.js → chunk-COYKJRMM.js} +24 -3
- package/dist/{chunk-UP2F5RRT.js → chunk-D7YQYLLM.js} +1 -4
- package/dist/{chunk-OMIQMMME.js → chunk-FPOLJRBF.js} +3 -3
- package/dist/{chunk-QP53RWAD.js → chunk-HHTL3ZFT.js} +9 -6
- package/dist/{chunk-PCUQZDZA.js → chunk-LTAIBLS2.js} +537 -321
- package/dist/{chunk-JDT5LCJC.js → chunk-MD3H3BF7.js} +1 -1
- package/dist/{chunk-KSQEFVFJ.js → chunk-MMCE7XSR.js} +1 -1
- package/dist/{chunk-MRAGS5VP.js → chunk-N5B66UOS.js} +4 -16
- package/dist/{chunk-2ATUAUAO.js → chunk-O6D72KYA.js} +2 -2
- package/dist/{chunk-KXCKFIJI.js → chunk-QX52F6IB.js} +1 -1
- package/dist/{chunk-PHHAYRQV.js → chunk-U5VNEALI.js} +23 -10
- package/dist/{chunk-JLXYOV4Y.js → chunk-V5ZRATJH.js} +1 -1
- package/dist/{chunk-6GRIKOFB.js → chunk-VA7GT6C6.js} +5 -16
- package/dist/{chunk-O2X2CCKH.js → chunk-VIVXB4CD.js} +1 -1
- package/dist/{chunk-L67WTZX2.js → chunk-XMDQOXHO.js} +10 -33
- package/dist/{chunk-QT4ONTST.js → chunk-XRLKGCAW.js} +1 -1
- package/dist/{chunk-KMZXTBLA.js → chunk-XZ7LW4S5.js} +0 -1
- package/dist/{chunk-XQXJKJ3P.js → chunk-YO56VCTQ.js} +0 -4
- package/dist/{credit-ledger-5ZEJRI46.js → credit-ledger-MHA652TV.js} +2 -2
- package/dist/{credit-menu-D4Gcdgc4.d.ts → credit-menu-BlCL7gZx.d.ts} +175 -533
- package/dist/{fx-B0SLBe5x.d.ts → fx-DhyT1Cjh.d.ts} +1 -1
- package/dist/index.d.ts +5 -17
- package/dist/internal/caller.d.ts +109 -698
- package/dist/internal/caller.js +10 -12
- package/dist/internal/server.d.ts +17 -42
- package/dist/internal/server.js +16 -15
- package/dist/{job-store-B2uZvga4.d.ts → job-store-D3CcZp_g.d.ts} +6 -10
- package/dist/{lightning-backend-CQBnQgsT.d.ts → lightning-backend-BhsyrBLa.d.ts} +1 -15
- package/dist/{memory-credit-ledger-ZOH6C3N4.js → memory-credit-ledger-BYBATRN3.js} +3 -3
- package/dist/{mpp-secret-state-WNAQQ6K4.js → mpp-secret-state-B5GCILVH.js} +1 -1
- package/dist/{mpp-setup-IOJBF7DB.js → mpp-setup-MPP3ST5X.js} +1 -1
- package/dist/{payout-reporter-5PIRYFVQ.js → payout-reporter-KEMUXEUO.js} +2 -2
- package/dist/{postgres-consumed-credential-store-ISRHBMOU.js → postgres-consumed-credential-store-6N2V5MJN.js} +1 -1
- package/dist/postgres-job-store-VE2JRUEC.js +7 -0
- package/dist/postgres-kv-store-DXGTKXLU.js +7 -0
- package/dist/{postgres-replay-store-IZFLTTAC.js → postgres-replay-store-ZF4JNZOW.js} +2 -2
- package/dist/{processed-payment-store-FIDI3RNH.js → processed-payment-store-GKMAWOM3.js} +2 -2
- package/dist/revenue-reporter-O75BGYFK.js +7 -0
- package/dist/server/index.d.ts +37 -140
- package/dist/server/index.js +64 -127
- package/dist/{step-cache-CXg7ziML.d.ts → step-cache-v2yhyhSZ.d.ts} +359 -1112
- package/dist/{tempo-charge-store-76TDAF34.js → tempo-charge-store-SDTUNTKA.js} +2 -2
- package/dist/{tempo-lifecycle-DXM7QXJQ.js → tempo-lifecycle-G5SB4HFC.js} +4 -4
- package/dist/{tempo-session-store-2JNOKJGX.js → tempo-session-store-WF3VZXNF.js} +2 -2
- package/dist/{tempo-wallet-O67H5M4N.js → tempo-wallet-ZFNUDFVO.js} +1 -1
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +2 -2
- package/dist/{usd-BNDg1715.d.ts → usd-Cu9G6xv2.d.ts} +1 -1
- package/dist/{x402-7S2EFINY.js → x402-CI6PSHNO.js} +4 -4
- package/package.json +2 -2
- package/dist/postgres-job-store-OGQ6IT4U.js +0 -7
- package/dist/postgres-kv-store-D5E2EZ24.js +0 -7
- package/dist/revenue-reporter-NNCNRY4C.js +0 -7
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-YG7G4DPZ.js";
|
|
5
5
|
import {
|
|
6
6
|
withSdkInitLock
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-COYKJRMM.js";
|
|
8
8
|
|
|
9
9
|
// src/sdk/server/tempo-charge-store.ts
|
|
10
10
|
var DEFAULT_TABLE_NAME = "mpp_tempo_charge_replays";
|
|
@@ -46,7 +46,6 @@ var PostgresTempoChargeStore = class {
|
|
|
46
46
|
);
|
|
47
47
|
return rows[0] ? parseStoreValue(rows[0].value_json) : null;
|
|
48
48
|
}
|
|
49
|
-
/** Replace one stored value. */
|
|
50
49
|
async put(key, value) {
|
|
51
50
|
await this.update(key, () => ({ op: "set", value, result: void 0 }));
|
|
52
51
|
}
|
|
@@ -55,19 +54,9 @@ var PostgresTempoChargeStore = class {
|
|
|
55
54
|
await this.update(key, () => ({ op: "delete", result: void 0 }));
|
|
56
55
|
}
|
|
57
56
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* write is the one that matters here: `FOR UPDATE` locks nothing when no row
|
|
62
|
-
* exists, so two machines marking one hash for the first time would both read
|
|
63
|
-
* `null` and both believe they won.
|
|
64
|
-
*
|
|
65
|
-
* Replay keys are unique per credential, so they never contend. The contended
|
|
66
|
-
* key is the fee-sponsor budget — one per `(chain, sponsor)`, read-modified
|
|
67
|
-
* several times per sponsored charge — and serializing it across machines is
|
|
68
|
-
* the point of sharing the store at all. The critical section is a SELECT and
|
|
69
|
-
* an upsert, so a queue of waiters clears in tens of milliseconds; a pooled
|
|
70
|
-
* connection is held for exactly that long and never across a chain call.
|
|
57
|
+
* Advisory locking covers the absent-row first write before the row lock.
|
|
58
|
+
* Both competing presentations of one credential and the shared sponsor
|
|
59
|
+
* budget need this serialization. The transaction contains no chain call.
|
|
71
60
|
*/
|
|
72
61
|
async update(key, fn) {
|
|
73
62
|
const client = await this.pool.connect();
|
|
@@ -106,7 +95,6 @@ var PostgresTempoChargeStore = class {
|
|
|
106
95
|
client.release();
|
|
107
96
|
}
|
|
108
97
|
}
|
|
109
|
-
/** The boot DDL itself — always runs under {@link withSdkInitLock}. */
|
|
110
98
|
async createTables() {
|
|
111
99
|
await this.pool.query(`
|
|
112
100
|
CREATE TABLE IF NOT EXISTS ${this.tableName} (
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
listCredits,
|
|
5
5
|
maxAdvertisedMicro,
|
|
6
6
|
withinAdvertisedTolerance
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MMCE7XSR.js";
|
|
8
8
|
import {
|
|
9
9
|
authorizeProtectedRemoval,
|
|
10
10
|
isValidEvmPrivateKey,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
getLastKnownBtcRate,
|
|
35
35
|
msatsToUsdc,
|
|
36
36
|
usdcToMsats
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-A4CM2BD3.js";
|
|
38
38
|
import {
|
|
39
39
|
DvmError,
|
|
40
40
|
X402_CHANNELS_FILE,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
lotOwedSats,
|
|
16
16
|
netOwedSats,
|
|
17
17
|
x402SettlementPending
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-2D75MNNG.js";
|
|
19
19
|
|
|
20
20
|
// src/sdk/server/memory-credit-ledger.ts
|
|
21
21
|
import { randomUUID } from "crypto";
|
|
@@ -42,7 +42,6 @@ var MemoryCreditLedger = class _MemoryCreditLedger {
|
|
|
42
42
|
fork.x402Settlements = this.x402Settlements;
|
|
43
43
|
return fork;
|
|
44
44
|
}
|
|
45
|
-
/** See {@link CreditLedger.useX402SettlementGate} — same contract. */
|
|
46
45
|
useX402SettlementGate(gate) {
|
|
47
46
|
this.x402Settlements = gate;
|
|
48
47
|
}
|
|
@@ -62,12 +61,10 @@ var MemoryCreditLedger = class _MemoryCreditLedger {
|
|
|
62
61
|
);
|
|
63
62
|
return run(() => this.drawSync(args, blocking));
|
|
64
63
|
}
|
|
65
|
-
/** See {@link CreditLedger.blockingX402Refund} — same contract. */
|
|
66
64
|
async blockingX402Refund(channelId, statuses) {
|
|
67
65
|
if (!channelId || !this.x402Settlements) return void 0;
|
|
68
66
|
return this.x402Settlements.pendingRefundSettlement(channelId, statuses);
|
|
69
67
|
}
|
|
70
|
-
/** The unresolved x402 refund that must stop an effect on `creditId`. */
|
|
71
68
|
blockingRefundForCredit(creditId, statuses) {
|
|
72
69
|
return this.blockingX402Refund(this.credits.get(creditId)?.x402ChannelId, statuses);
|
|
73
70
|
}
|
|
@@ -540,7 +537,6 @@ var MemoryCreditLedger = class _MemoryCreditLedger {
|
|
|
540
537
|
credit.draws.set(args.drawId, draw);
|
|
541
538
|
return { ...drawResult(draw, credit), replayed: false };
|
|
542
539
|
}
|
|
543
|
-
/** Mid-job top-up growth — see `CreditLedger.growDraw` for the semantics. */
|
|
544
540
|
growDrawSync(args) {
|
|
545
541
|
assertAmount(args.addAmountMicro, { min: 1 });
|
|
546
542
|
const credit = this.requireCredit(args.creditId);
|
|
@@ -667,7 +663,6 @@ var MemoryCreditLedger = class _MemoryCreditLedger {
|
|
|
667
663
|
const page = after ? out.filter((d) => compareStaleDrawKey(d, after) > 0) : out;
|
|
668
664
|
return Promise.resolve(page.slice(0, args.limit));
|
|
669
665
|
}
|
|
670
|
-
/** Settled draws' native value for the credit an x402 channel funded. */
|
|
671
666
|
earnedNativeForX402Channel(channelId) {
|
|
672
667
|
for (const credit of this.credits.values()) {
|
|
673
668
|
if (credit.x402ChannelId !== channelId) continue;
|
|
@@ -860,15 +855,17 @@ var MemoryCreditLedger = class _MemoryCreditLedger {
|
|
|
860
855
|
bitcoinDepositLiability() {
|
|
861
856
|
const byRail = /* @__PURE__ */ new Map();
|
|
862
857
|
const byCurrency = /* @__PURE__ */ new Map();
|
|
858
|
+
const uncoveredByCurrency = /* @__PURE__ */ new Map();
|
|
859
|
+
const unbackedByCurrency = /* @__PURE__ */ new Map();
|
|
863
860
|
const liability = {
|
|
864
861
|
depositSats: 0,
|
|
865
862
|
credits: 0,
|
|
866
863
|
byRail: [],
|
|
867
864
|
byCurrency: [],
|
|
868
865
|
uncoveredCredits: 0,
|
|
869
|
-
|
|
866
|
+
uncoveredByCurrency: [],
|
|
870
867
|
unbackedCredits: 0,
|
|
871
|
-
|
|
868
|
+
unbackedByCurrency: []
|
|
872
869
|
};
|
|
873
870
|
for (const credit of this.credits.values()) {
|
|
874
871
|
if (!isNonChannelBitcoinRail(credit.rail)) continue;
|
|
@@ -886,10 +883,24 @@ var MemoryCreditLedger = class _MemoryCreditLedger {
|
|
|
886
883
|
liability.credits++;
|
|
887
884
|
if (covered < credit.balanceMicro) {
|
|
888
885
|
liability.uncoveredCredits++;
|
|
889
|
-
|
|
886
|
+
const currency2 = uncoveredByCurrency.get(credit.currency) ?? {
|
|
887
|
+
currency: credit.currency,
|
|
888
|
+
micro: 0,
|
|
889
|
+
credits: 0
|
|
890
|
+
};
|
|
891
|
+
currency2.micro += credit.balanceMicro;
|
|
892
|
+
currency2.credits++;
|
|
893
|
+
uncoveredByCurrency.set(credit.currency, currency2);
|
|
890
894
|
} else if (basisless > 0) {
|
|
891
895
|
liability.unbackedCredits++;
|
|
892
|
-
|
|
896
|
+
const currency2 = unbackedByCurrency.get(credit.currency) ?? {
|
|
897
|
+
currency: credit.currency,
|
|
898
|
+
micro: 0,
|
|
899
|
+
credits: 0
|
|
900
|
+
};
|
|
901
|
+
currency2.micro += credit.balanceMicro;
|
|
902
|
+
currency2.credits++;
|
|
903
|
+
unbackedByCurrency.set(credit.currency, currency2);
|
|
893
904
|
}
|
|
894
905
|
const rail = byRail.get(credit.rail) ?? { rail: credit.rail, sats: 0, credits: 0 };
|
|
895
906
|
rail.sats += owed;
|
|
@@ -906,6 +917,8 @@ var MemoryCreditLedger = class _MemoryCreditLedger {
|
|
|
906
917
|
}
|
|
907
918
|
liability.byRail = [...byRail.values()];
|
|
908
919
|
liability.byCurrency = [...byCurrency.values()];
|
|
920
|
+
liability.uncoveredByCurrency = [...uncoveredByCurrency.values()];
|
|
921
|
+
liability.unbackedByCurrency = [...unbackedByCurrency.values()];
|
|
909
922
|
return Promise.resolve(liability);
|
|
910
923
|
}
|
|
911
924
|
listFundingLots(creditId) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withSdkInitLock
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-COYKJRMM.js";
|
|
4
4
|
|
|
5
5
|
// src/sdk/server/revenue-reporter.ts
|
|
6
6
|
import { randomUUID } from "crypto";
|
|
@@ -166,13 +166,8 @@ var RevenueReporter = class _RevenueReporter {
|
|
|
166
166
|
await this.insertPending(tx, "release", payload);
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
* Same discipline as {@link enqueueDeposit} and the same reason: no network
|
|
172
|
-
* I/O here, only the durable queue row, written through `tx` so the report
|
|
173
|
-
* and the status CAS commit or roll back together. A drain whose row was
|
|
174
|
-
* lost between the two would overstate outstanding liability forever —
|
|
175
|
-
* the mirror image of a lost deposit.
|
|
169
|
+
* Await durable queue insertion through tx so the terminal drain and its
|
|
170
|
+
* report commit or roll back together; no network I/O here.
|
|
176
171
|
*/
|
|
177
172
|
async enqueueCreditDrain(tx, payload) {
|
|
178
173
|
await this.insertPending(tx, "drain", payload);
|
|
@@ -238,14 +233,8 @@ var RevenueReporter = class _RevenueReporter {
|
|
|
238
233
|
}
|
|
239
234
|
}
|
|
240
235
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
* Same discipline as {@link enqueueCreditDrain}: no network I/O, only the
|
|
245
|
-
* durable queue row written through `tx`. A release whose row was lost after
|
|
246
|
-
* the sweep committed would understate committed value forever; a lost
|
|
247
|
-
* reversal would overstate it, which is the worse direction — the builder
|
|
248
|
-
* would see money as theirs that a revived credit can still buy work with.
|
|
236
|
+
* Await durable queue insertion through tx so expiry release or reversal and
|
|
237
|
+
* its report commit together. A missing reversal would overstate builder value.
|
|
249
238
|
*/
|
|
250
239
|
async enqueueCreditExpiryRelease(tx, payload) {
|
|
251
240
|
await this.insertPending(tx, "expiry_release", payload);
|
|
@@ -101,7 +101,7 @@ async function generateTempoKey(opts = {}) {
|
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
if (existing && opts.force) {
|
|
104
|
-
const { assertTempoWalletIdle } = await import("./tempo-lifecycle-
|
|
104
|
+
const { assertTempoWalletIdle } = await import("./tempo-lifecycle-G5SB4HFC.js");
|
|
105
105
|
await assertTempoWalletIdle("replace");
|
|
106
106
|
}
|
|
107
107
|
const { privateKeyToAccount, generatePrivateKey } = await import("viem/accounts");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
withSdkInitLock
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-COYKJRMM.js";
|
|
4
4
|
|
|
5
5
|
// src/sdk/server/payout-reporter.ts
|
|
6
6
|
import { createHash, randomUUID } from "crypto";
|
|
@@ -35,7 +35,6 @@ var PostgresX402BatchStore = class {
|
|
|
35
35
|
this.db = db;
|
|
36
36
|
}
|
|
37
37
|
db;
|
|
38
|
-
/** Create the table (idempotent), under the SDK init lock like every other boot DDL. */
|
|
39
38
|
async init() {
|
|
40
39
|
await withSdkInitLock(this.db, async () => {
|
|
41
40
|
await this.db.query(`
|
|
@@ -155,7 +154,6 @@ var PayoutReporter = class {
|
|
|
155
154
|
this.intervalMs = opts.snapshotIntervalMs ?? PAYOUT_SNAPSHOT_INTERVAL_MS;
|
|
156
155
|
this.now = opts.now ?? Date.now;
|
|
157
156
|
}
|
|
158
|
-
/** Boot DDL for the durable batch store, when this reporter owns one. */
|
|
159
157
|
async init() {
|
|
160
158
|
if (this.ownsBatchStore && this.batches instanceof PostgresX402BatchStore) {
|
|
161
159
|
await this.batches.init();
|
|
@@ -200,7 +198,6 @@ var PayoutReporter = class {
|
|
|
200
198
|
warn("payout_flush_failed", { error: message(err) });
|
|
201
199
|
}
|
|
202
200
|
}
|
|
203
|
-
/** The hook `mark-melted` runs inside its transaction: the mark and its payout commit together. */
|
|
204
201
|
meltHook() {
|
|
205
202
|
return {
|
|
206
203
|
enqueue: (event, tx) => this.cashuMelted(event, tx),
|
|
@@ -211,17 +208,9 @@ var PayoutReporter = class {
|
|
|
211
208
|
};
|
|
212
209
|
}
|
|
213
210
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* belongs to one mint. The amount is the face value melted; the mint's fee
|
|
218
|
-
* and the Lightning amount received are builder-machine facts this DVM does
|
|
219
|
-
* not see.
|
|
220
|
-
*
|
|
221
|
-
* Queued through `tx` when the caller is inside the transaction that marks
|
|
222
|
-
* the rows, and a failure is thrown rather than swallowed so that mark rolls
|
|
223
|
-
* back with it — see {@link TransactionalPayoutHook}. Without `tx` the rows
|
|
224
|
-
* are queued on their own and delivered at once.
|
|
211
|
+
* Report melted face value per mint, not the Lightning amount received after fees. Hash the
|
|
212
|
+
* payment preimage; do not publish it. With tx, propagate enqueue failures and defer
|
|
213
|
+
* delivery until commit. Without tx, enqueue independently and start delivery.
|
|
225
214
|
*/
|
|
226
215
|
async cashuMelted(event, tx) {
|
|
227
216
|
const byMint = /* @__PURE__ */ new Map();
|
|
@@ -261,7 +250,6 @@ var PayoutReporter = class {
|
|
|
261
250
|
void this.snapshotCashu();
|
|
262
251
|
}
|
|
263
252
|
}
|
|
264
|
-
/** The host attaches the session store and ledger readers once they exist. */
|
|
265
253
|
attachTempo(reader) {
|
|
266
254
|
this.tempo = reader;
|
|
267
255
|
}
|
|
@@ -294,7 +282,6 @@ var PayoutReporter = class {
|
|
|
294
282
|
}
|
|
295
283
|
void this.snapshotTempo();
|
|
296
284
|
}
|
|
297
|
-
/** The hook `reconcile-tempo-drain` runs inside its transaction: the booking and its payout commit together. */
|
|
298
285
|
tempoRepairHook() {
|
|
299
286
|
return {
|
|
300
287
|
enqueue: (event, tx) => this.tempoCloseReconciled(event, tx),
|
|
@@ -305,14 +292,9 @@ var PayoutReporter = class {
|
|
|
305
292
|
};
|
|
306
293
|
}
|
|
307
294
|
/**
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
* figure is the receipt's payee total for the channel.
|
|
312
|
-
*
|
|
313
|
-
* Queued through `tx` when the caller is inside the transaction that books
|
|
314
|
-
* the drain, and thrown rather than swallowed so that booking rolls back
|
|
315
|
-
* with it — see {@link TransactionalPayoutHook}.
|
|
295
|
+
* Report the receipt’s payee total under the live close’s transaction ID, flagged repaired.
|
|
296
|
+
* The platform upgrades a live row if one exists. Join tx and propagate enqueue failures;
|
|
297
|
+
* this does not report the caller refund.
|
|
316
298
|
*/
|
|
317
299
|
async tempoCloseReconciled(event, tx) {
|
|
318
300
|
const settled = BigInt(event.settledToPayee);
|
|
@@ -343,7 +325,6 @@ var PayoutReporter = class {
|
|
|
343
325
|
void this.snapshotTempo();
|
|
344
326
|
}
|
|
345
327
|
}
|
|
346
|
-
/** The observer the batch-settlement server attaches to and routes its manager through. */
|
|
347
328
|
x402Observer() {
|
|
348
329
|
return {
|
|
349
330
|
attach: (ctx) => {
|
|
@@ -363,13 +344,9 @@ var PayoutReporter = class {
|
|
|
363
344
|
};
|
|
364
345
|
}
|
|
365
346
|
/**
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
* fleet lock the before/after read is consistent. A channel the claim
|
|
370
|
-
* removed on its way through — a refund's claim-then-delete —
|
|
371
|
-
* moved whatever it still owed before it went, and that value reaches
|
|
372
|
-
* `pay_to` in this batch too, so it counts at its pre-claim figure.
|
|
347
|
+
* Read claim deltas from storage because upstream returns voucher counts. Under the fleet
|
|
348
|
+
* lock, before/after reads are consistent. A deleted channel contributes its pre-claim
|
|
349
|
+
* unclaimed value, including refund claim-then-delete.
|
|
373
350
|
*/
|
|
374
351
|
trackX402Manager(manager) {
|
|
375
352
|
const claim = async (...args) => {
|
|
@@ -75,7 +75,6 @@ var TempoSettlementReadiness = class {
|
|
|
75
75
|
if (this.timer) clearInterval(this.timer);
|
|
76
76
|
this.timer = void 0;
|
|
77
77
|
}
|
|
78
|
-
/** Read and report the configured fee-token balance now. */
|
|
79
78
|
async checkBalance(opts) {
|
|
80
79
|
if (this.inFlight) {
|
|
81
80
|
const current = await this.inFlight;
|
|
@@ -8,11 +8,9 @@ var StepCache = class _StepCache {
|
|
|
8
8
|
has(id) {
|
|
9
9
|
return this.cache.has(id);
|
|
10
10
|
}
|
|
11
|
-
/** Get a cached step result. Throws if not present. */
|
|
12
11
|
get(id) {
|
|
13
12
|
return this.getRecord(id).value;
|
|
14
13
|
}
|
|
15
|
-
/** Get a cached step record, including replay metadata. Throws if not present. */
|
|
16
14
|
getRecord(id) {
|
|
17
15
|
const record = this.cache.get(id);
|
|
18
16
|
if (record === void 0) throw new Error(`StepCache: no cached result for step "${id}"`);
|
|
@@ -25,11 +23,9 @@ var StepCache = class _StepCache {
|
|
|
25
23
|
...costs !== void 0 && costs.length > 0 ? { costs: costs.map(({ amount, currency }) => ({ amount, currency })) } : {}
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
|
-
/** Export all cached steps for persistence. */
|
|
29
26
|
serialize() {
|
|
30
27
|
return [...this.cache.values()];
|
|
31
28
|
}
|
|
32
|
-
/** Restore a StepCache from persisted records. */
|
|
33
29
|
static deserialize(records) {
|
|
34
30
|
const cache = new _StepCache();
|
|
35
31
|
for (const { id, value, costs } of records) {
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
isDrainMethod,
|
|
11
11
|
isFundingRail,
|
|
12
12
|
x402SettlementPending
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-2D75MNNG.js";
|
|
14
|
+
import "./chunk-COYKJRMM.js";
|
|
15
15
|
import "./chunk-C3MTFLC6.js";
|
|
16
16
|
export {
|
|
17
17
|
CreditLedger,
|