beignet 0.32.0 → 0.33.0
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 +1 -1
- package/dist/cli/beignet-node.js +42 -17
- package/dist/cli/beignet-node.js.map +1 -1
- package/dist/cli/cli.js +17 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/daemon.js +18 -3
- package/dist/cli/daemon.js.map +1 -1
- package/dist/cli/openapi.js +54 -3
- package/dist/cli/openapi.js.map +1 -1
- package/dist/cli/payment-queue.js +334 -60
- package/dist/cli/payment-queue.js.map +1 -1
- package/dist/cli/routes.js +2 -0
- package/dist/cli/routes.js.map +1 -1
- package/dist/cli/webhooks.js +254 -53
- package/dist/cli/webhooks.js.map +1 -1
- package/dist/daemon.js.map +1 -1
- package/dist/electrum/index.js +24 -32
- package/dist/electrum/index.js.map +1 -1
- package/dist/lightning/channel/channel-manager.js +11 -7
- package/dist/lightning/channel/channel-manager.js.map +1 -1
- package/dist/lightning/channel/channel.js +24 -2
- package/dist/lightning/channel/channel.js.map +1 -1
- package/dist/lightning/direct-funding/index.js +3 -2
- package/dist/lightning/direct-funding/index.js.map +1 -1
- package/dist/lightning/direct-funding/messages.js +49 -2
- package/dist/lightning/direct-funding/messages.js.map +1 -1
- package/dist/lightning/direct-funding/receiver/engine.js +31 -4
- package/dist/lightning/direct-funding/receiver/engine.js.map +1 -1
- package/dist/lightning/direct-funding/receiver/types.js.map +1 -1
- package/dist/lightning/direct-funding/receiver/verify.js +29 -1
- package/dist/lightning/direct-funding/receiver/verify.js.map +1 -1
- package/dist/lightning/direct-funding/sender/engine.js +8 -0
- package/dist/lightning/direct-funding/sender/engine.js.map +1 -1
- package/dist/lightning/direct-funding/sender/types.js.map +1 -1
- package/dist/lightning/direct-funding/sender/verify.js +17 -4
- package/dist/lightning/direct-funding/sender/verify.js.map +1 -1
- package/dist/lightning/features/flags.js +11 -6
- package/dist/lightning/features/flags.js.map +1 -1
- package/dist/lightning/ffor/types.js +4 -4
- package/dist/lightning/liquidity/jit-receive.js +1 -0
- package/dist/lightning/liquidity/jit-receive.js.map +1 -1
- package/dist/lightning/message/channel-update.js +23 -8
- package/dist/lightning/message/channel-update.js.map +1 -1
- package/dist/lightning/node/lightning-node.js +154 -29
- package/dist/lightning/node/lightning-node.js.map +1 -1
- package/dist/lightning/node/types.js.map +1 -1
- package/dist/lightning/recovery/frame-reads.js +57 -0
- package/dist/lightning/recovery/frame-reads.js.map +1 -0
- package/dist/lightning/recovery/guardian-replication.js +95 -44
- package/dist/lightning/recovery/guardian-replication.js.map +1 -1
- package/dist/lightning/recovery/guardian-rotation.js +2 -5
- package/dist/lightning/recovery/guardian-rotation.js.map +1 -1
- package/dist/lightning/recovery/journal.js +8 -36
- package/dist/lightning/recovery/journal.js.map +1 -1
- package/dist/lightning/sqlite.js.map +1 -1
- package/dist/lightning/storage/index.js.map +1 -1
- package/dist/lightning/storage/serialization.js +6 -0
- package/dist/lightning/storage/serialization.js.map +1 -1
- package/dist/lightning/storage/sqlite-storage.js +64 -13
- package/dist/lightning/storage/sqlite-storage.js.map +1 -1
- package/dist/node.js.map +1 -1
- package/dist/shapes/electrum.js +7 -3
- package/dist/shapes/electrum.js.map +1 -1
- package/dist/types/cli/beignet-node.d.ts +6 -1
- package/dist/types/cli/payment-queue.d.ts +126 -19
- package/dist/types/cli/routes.d.ts +8 -0
- package/dist/types/cli/webhooks.d.ts +80 -3
- package/dist/types/daemon.d.ts +1 -1
- package/dist/types/electrum/index.d.ts +4 -1
- package/dist/types/lightning/channel/channel-manager.d.ts +6 -4
- package/dist/types/lightning/channel/channel.d.ts +13 -2
- package/dist/types/lightning/direct-funding/index.d.ts +1 -1
- package/dist/types/lightning/direct-funding/messages.d.ts +30 -0
- package/dist/types/lightning/direct-funding/receiver/types.d.ts +14 -1
- package/dist/types/lightning/direct-funding/receiver/verify.d.ts +28 -0
- package/dist/types/lightning/direct-funding/sender/types.d.ts +7 -0
- package/dist/types/lightning/features/flags.d.ts +6 -6
- package/dist/types/lightning/ffor/types.d.ts +4 -4
- package/dist/types/lightning/message/channel-update.d.ts +2 -0
- package/dist/types/lightning/node/lightning-node.d.ts +37 -11
- package/dist/types/lightning/node/payment-types.d.ts +8 -0
- package/dist/types/lightning/node/types.d.ts +8 -3
- package/dist/types/lightning/recovery/frame-reads.d.ts +25 -0
- package/dist/types/lightning/sqlite.d.ts +1 -1
- package/dist/types/lightning/storage/index.d.ts +1 -1
- package/dist/types/lightning/storage/serialization.d.ts +2 -0
- package/dist/types/lightning/storage/sqlite-storage.d.ts +33 -12
- package/dist/types/node.d.ts +1 -1
- package/dist/types/shapes/electrum.d.ts +6 -2
- package/dist/types/wallet/index.d.ts +45 -6
- package/dist/types/wallet/live-data.d.ts +22 -1
- package/dist/wallet/index.js +145 -18
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/live-data.js +25 -11
- package/dist/wallet/live-data.js.map +1 -1
- package/docs/AI_AGENT_GUIDE.md +6 -3
- package/docs/FFOR-RESERVED-RETIREMENT.md +1 -1
- package/docs/specs/CONCURRENT-RECEIVE.md +5 -1
- package/docs/specs/ffor-offline-receive.md +4 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -576,7 +576,7 @@ The experimental concurrent profile keeps ordinary payments available
|
|
|
576
576
|
within the channel's remaining capacity. `LightningNode.fforSync()` fetches paid
|
|
577
577
|
slot receipts and redeems them while other vouchers remain live.
|
|
578
578
|
`rescueFforEpoch()` syncs a connected concurrent book without retiring it.
|
|
579
|
-
Feature bits
|
|
579
|
+
Feature bits 442/443 are advertised by default when their dependencies are enabled.
|
|
580
580
|
See [concurrent receive and reserved retirement](docs/FFOR-RESERVED-RETIREMENT.md)
|
|
581
581
|
for the version 1 and 2 contracts and storage requirements. The daemon enables
|
|
582
582
|
advertisement with `BEIGNET_FFOR_CONCURRENT=true` and new concurrent settlement
|
package/dist/cli/beignet-node.js
CHANGED
|
@@ -377,27 +377,32 @@ function sentSats(info) {
|
|
|
377
377
|
/**
|
|
378
378
|
* A payment's amount as every public surface reports it (history, proof,
|
|
379
379
|
* stats): an outgoing amount is what left the node, fees included, rounded
|
|
380
|
-
* UP; an incoming amount
|
|
381
|
-
* Truncating the outgoing figure let a send
|
|
382
|
-
* 50,000 sat balance read 20,001 while the
|
|
383
|
-
* up makes one send agree with the balance
|
|
384
|
-
* before it; sub-sat remainders across
|
|
385
|
-
* the balance by a sat, which only msat
|
|
380
|
+
* UP; an incoming amount is what the node was credited, rounded down, as the
|
|
381
|
+
* balance does (issue #1185). Truncating the outgoing figure let a send
|
|
382
|
+
* paying 20,001.5 sats from a 50,000 sat balance read 20,001 while the
|
|
383
|
+
* balance fell to 29,998. Rounding up makes one send agree with the balance
|
|
384
|
+
* when the balance held whole sats before it; sub-sat remainders across
|
|
385
|
+
* several sends can still differ from the balance by a sat, which only msat
|
|
386
|
+
* figures reconcile exactly.
|
|
386
387
|
*/
|
|
387
388
|
function paymentAmountSats(info) {
|
|
388
389
|
return info.direction === types_6.PaymentDirection.OUTGOING
|
|
389
390
|
? sentSats(info) ?? spendLimitSats(info.amountMsat)
|
|
390
|
-
: Number(info.amountMsat / 1000n);
|
|
391
|
+
: Number((info.receivedMsat ?? info.amountMsat) / 1000n);
|
|
391
392
|
}
|
|
392
393
|
/**
|
|
393
|
-
* The
|
|
394
|
-
*
|
|
395
|
-
*
|
|
394
|
+
* The fee a payment paid, in msat, or undefined when the record does not
|
|
395
|
+
* say. An MPP record's route is its first part only, so its fee is what left
|
|
396
|
+
* the node over what the invoice asked (#1008). An incoming payment's fee is
|
|
397
|
+
* a JIT LSP's skim: what the invoice asked over what the node was credited.
|
|
396
398
|
*/
|
|
397
399
|
function paymentFeeMsat(info) {
|
|
398
400
|
if (info.sentMsat !== undefined && info.sentMsat >= info.amountMsat) {
|
|
399
401
|
return info.sentMsat - info.amountMsat;
|
|
400
402
|
}
|
|
403
|
+
if (info.receivedMsat !== undefined && info.receivedMsat < info.amountMsat) {
|
|
404
|
+
return info.amountMsat - info.receivedMsat;
|
|
405
|
+
}
|
|
401
406
|
return info.route?.totalFeeMsat;
|
|
402
407
|
}
|
|
403
408
|
/**
|
|
@@ -596,11 +601,23 @@ const NETWORK_NAMES = ['mainnet', 'testnet', 'signet', 'regtest'];
|
|
|
596
601
|
function unknownNetwork(network) {
|
|
597
602
|
throw new errors_1.BeignetError('INVALID_PARAMS', `unknown network '${String(network)}'`);
|
|
598
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* Mainnet and regtest are the servers the Bitkit app uses (bitkit-android,
|
|
606
|
+
* `Env.kt`), each with a certificate a public authority signed for its name,
|
|
607
|
+
* so `electrumTlsVerify` passes on them with no pin. They replace
|
|
608
|
+
* `fulcrum.bitkit.blocktank.to:8900`, whose certificate expired on May 10,
|
|
609
|
+
* 2026, and the plaintext `34.65.252.32:18483`, which serves the same regtest
|
|
610
|
+
* chain.
|
|
611
|
+
*/
|
|
599
612
|
const DEFAULT_ELECTRUM = {
|
|
600
|
-
mainnet: { host: '
|
|
613
|
+
mainnet: { host: 'bitkit.to', port: 9999, useTls: true },
|
|
601
614
|
testnet: { host: 'electrum.blockstream.info', port: 60002, useTls: true },
|
|
602
615
|
signet: { host: 'mempool.space', port: 60602, useTls: true },
|
|
603
|
-
regtest: {
|
|
616
|
+
regtest: {
|
|
617
|
+
host: 'electrs.bitkit.stag0.blocktank.to',
|
|
618
|
+
port: 9999,
|
|
619
|
+
useTls: true
|
|
620
|
+
}
|
|
604
621
|
};
|
|
605
622
|
/**
|
|
606
623
|
* Resolve a host to a routable IPv4 address. Returns the host unchanged if it is
|
|
@@ -2843,8 +2860,7 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
|
|
|
2843
2860
|
timer = setTimeout(() => resolve('timeout'), BeignetNode.INITIAL_SYNC_TIMEOUT_MS);
|
|
2844
2861
|
timer.unref?.();
|
|
2845
2862
|
});
|
|
2846
|
-
const attempt = this.wallet
|
|
2847
|
-
.refreshWallet({})
|
|
2863
|
+
const attempt = (0, live_data_1.refreshLiveWallet)(this.wallet)
|
|
2848
2864
|
.then((res) => {
|
|
2849
2865
|
if (res.isErr()) {
|
|
2850
2866
|
this.log('warn', 'Initial wallet refresh failed', {
|
|
@@ -5659,7 +5675,7 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
|
|
|
5659
5675
|
});
|
|
5660
5676
|
}
|
|
5661
5677
|
async refreshWallet() {
|
|
5662
|
-
const result = await this.wallet
|
|
5678
|
+
const result = await (0, live_data_1.refreshLiveWallet)(this.wallet);
|
|
5663
5679
|
if (result.isErr()) {
|
|
5664
5680
|
throw new errors_1.BeignetError('REFRESH_FAILED', result.error.message);
|
|
5665
5681
|
}
|
|
@@ -11208,7 +11224,10 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
|
|
|
11208
11224
|
saveQueueEntry: (entry) => sqlite().saveQueueEntry(entry),
|
|
11209
11225
|
updateQueueEntryStatus: (id, status, error, completedAt) => sqlite().updateQueueEntryStatus(id, status, error, completedAt),
|
|
11210
11226
|
deleteQueueEntry: (id) => sqlite().deleteQueueEntry(id),
|
|
11211
|
-
loadAllQueueEntries: () => sqlite().loadAllQueueEntries()
|
|
11227
|
+
loadAllQueueEntries: () => sqlite().loadAllQueueEntries(),
|
|
11228
|
+
loadActiveQueueEntries: () => sqlite().loadActiveQueueEntries(),
|
|
11229
|
+
loadQueueHistory: (limit, before) => sqlite().loadQueueHistory(limit, before),
|
|
11230
|
+
loadQueueEntry: (id) => sqlite().loadQueueEntry(id)
|
|
11212
11231
|
};
|
|
11213
11232
|
}
|
|
11214
11233
|
enqueuePayment(bolt11, priority, opts) {
|
|
@@ -11217,6 +11236,12 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
|
|
|
11217
11236
|
listQueue() {
|
|
11218
11237
|
return this.getPaymentQueue().list();
|
|
11219
11238
|
}
|
|
11239
|
+
getQueuedPayment(id) {
|
|
11240
|
+
return this.getPaymentQueue().get(id);
|
|
11241
|
+
}
|
|
11242
|
+
listQueueHistory(opts) {
|
|
11243
|
+
return this.getPaymentQueue().history(opts);
|
|
11244
|
+
}
|
|
11220
11245
|
cancelQueuedPayment(id) {
|
|
11221
11246
|
return this.getPaymentQueue().cancel(id);
|
|
11222
11247
|
}
|
|
@@ -11258,7 +11283,7 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
|
|
|
11258
11283
|
}
|
|
11259
11284
|
else if (p.direction === 'INCOMING' && p.status === 'COMPLETED') {
|
|
11260
11285
|
received++;
|
|
11261
|
-
satsReceived +=
|
|
11286
|
+
satsReceived += paymentAmountSats(p);
|
|
11262
11287
|
}
|
|
11263
11288
|
else if (p.status === 'FAILED') {
|
|
11264
11289
|
failed++;
|