beignet 0.34.0 → 0.35.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 +4 -0
- package/dist/cli/beignet-node.js +26 -20
- package/dist/cli/beignet-node.js.map +1 -1
- package/dist/cli/cli.js +0 -0
- package/dist/cli/openapi.js +1 -1
- package/dist/cli/openapi.js.map +1 -1
- package/dist/direct-funding/bitcoin-core.js +548 -0
- package/dist/direct-funding/bitcoin-core.js.map +1 -0
- package/dist/direct-funding/client.js +240 -0
- package/dist/direct-funding/client.js.map +1 -0
- package/dist/direct-funding/index.js +47 -0
- package/dist/direct-funding/index.js.map +1 -0
- package/dist/direct-funding/node.js +115 -0
- package/dist/direct-funding/node.js.map +1 -0
- package/dist/direct-funding/peer-messaging.js +314 -0
- package/dist/direct-funding/peer-messaging.js.map +1 -0
- package/dist/direct-funding/psbt.js +282 -0
- package/dist/direct-funding/psbt.js.map +1 -0
- package/dist/direct-funding/transports.js +28 -0
- package/dist/direct-funding/transports.js.map +1 -0
- package/dist/lightning/chain/hashes.js +13 -0
- package/dist/lightning/chain/hashes.js.map +1 -0
- package/dist/lightning/channel/types.js +5 -8
- package/dist/lightning/channel/types.js.map +1 -1
- package/dist/lightning/direct-funding/sender/engine.js +5 -0
- package/dist/lightning/direct-funding/sender/engine.js.map +1 -1
- package/dist/lightning/direct-funding/types.js +5 -5
- package/dist/lightning/direct-funding/types.js.map +1 -1
- package/dist/lightning/node/lightning-node.js +7 -1
- package/dist/lightning/node/lightning-node.js.map +1 -1
- package/dist/lightning/transport/peer-manager.js.map +1 -1
- package/dist/types/cli/types.d.ts +11 -1
- package/dist/types/direct-funding/bitcoin-core.d.ts +78 -0
- package/dist/types/direct-funding/client.d.ts +57 -0
- package/dist/types/direct-funding/index.d.ts +17 -0
- package/dist/types/direct-funding/node.d.ts +22 -0
- package/dist/types/direct-funding/peer-messaging.d.ts +62 -0
- package/dist/types/direct-funding/psbt.d.ts +27 -0
- package/dist/types/direct-funding/transports.d.ts +4 -0
- package/dist/types/lightning/chain/hashes.d.ts +11 -0
- package/dist/types/lightning/channel/types.d.ts +1 -8
- package/dist/types/lightning/direct-funding/sender/engine.d.ts +2 -0
- package/docs/README.md +1 -0
- package/package.json +18 -1
package/README.md
CHANGED
|
@@ -37,6 +37,8 @@ console.log(wallet.getBalance());
|
|
|
37
37
|
|
|
38
38
|
From here: [the on-chain wallet](#on-chain-wallet) for sending, PSBTs, multisig and watch-only, or [Lightning](#lightning) for channels and payments.
|
|
39
39
|
|
|
40
|
+
For adding `bgnq` direct-funding payments to another wallet, see the [standalone TypeScript payer SDK](packages/direct-funding/README.md). It includes a PSBT signing adapter, Bitcoin Core integration, and a channel-free peer client.
|
|
41
|
+
|
|
40
42
|
## Try the examples
|
|
41
43
|
|
|
42
44
|
The fastest way to understand the whole system is to run the two REPL examples against a live wallet and a live node. Both are checked-in TypeScript you can read and edit.
|
|
@@ -694,6 +696,8 @@ npm run test:conformance # 300+ official BOLT vector cases (subset of test:lig
|
|
|
694
696
|
npm run test:chaos # recovery kill matrices (parallel), split out of test:lightning
|
|
695
697
|
npm run test:sigkill # process-level SIGKILL chaos matrix (builds dist first)
|
|
696
698
|
npm run test:api # exported API vs tests/api-snapshot (npm run api:snapshot regenerates it)
|
|
699
|
+
npm run test:direct-funding # standalone payer SDK, wallet adapters and packaging
|
|
700
|
+
npm run test:direct-funding:regtest # real Core wallets and funding transactions (needs Docker)
|
|
697
701
|
npm run test:integration # daemon/Electrum integration (needs an Electrum server)
|
|
698
702
|
npm run test:interop # 300+ cases vs LND/CLN/Eclair (needs Docker)
|
|
699
703
|
npm run test:interop:ffor # FFOR Variant D chain gates on regtest (needs only the bitcoind container)
|
package/dist/cli/beignet-node.js
CHANGED
|
@@ -2559,9 +2559,8 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
|
|
|
2559
2559
|
this.node.on('peer:connect', (pubkey) => {
|
|
2560
2560
|
let direction;
|
|
2561
2561
|
try {
|
|
2562
|
-
direction = this.node
|
|
2563
|
-
|
|
2564
|
-
?.getConnectionInfo(pubkey)?.direction;
|
|
2562
|
+
direction = this.node.getPeerManager()?.getConnectionInfo(pubkey)
|
|
2563
|
+
?.direction;
|
|
2565
2564
|
}
|
|
2566
2565
|
catch {
|
|
2567
2566
|
// The log line must not cost the gossip sync below.
|
|
@@ -2604,20 +2603,22 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
|
|
|
2604
2603
|
this.emit('peer:connect', { pubkey });
|
|
2605
2604
|
});
|
|
2606
2605
|
this.node.on('peer:disconnect', (pubkey, info) => {
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2606
|
+
// Subscribers (SSE, webhooks, an embedding app's diagnostics)
|
|
2607
|
+
// get the same cause the log line names.
|
|
2608
|
+
const cause = info
|
|
2609
|
+
? {
|
|
2610
|
+
closedBy: info.initiator === 'remote'
|
|
2611
|
+
? 'peer'
|
|
2612
|
+
: 'us',
|
|
2613
|
+
...(info.reason ? { reason: info.reason } : {}),
|
|
2614
|
+
direction: info.direction,
|
|
2615
|
+
...(info.uptimeMs !== undefined
|
|
2616
|
+
? { uptimeMs: info.uptimeMs }
|
|
2617
|
+
: {})
|
|
2618
|
+
}
|
|
2619
|
+
: {};
|
|
2620
|
+
this.log('info', 'Peer disconnected', { pubkey, ...cause });
|
|
2621
|
+
this.emit('peer:disconnect', { pubkey, ...cause });
|
|
2621
2622
|
});
|
|
2622
2623
|
// The transport error that caused a disconnect (pong timeout, decrypt
|
|
2623
2624
|
// failure, socket reset, ...) is the only place the reason is known —
|
|
@@ -6872,6 +6873,11 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
|
|
|
6872
6873
|
if (!channel)
|
|
6873
6874
|
return null;
|
|
6874
6875
|
const state = channel.getFullState();
|
|
6876
|
+
// Nothing clears preReestablishState when a marked channel closes, so
|
|
6877
|
+
// it names the earlier state only while the channel is still wrapped.
|
|
6878
|
+
const wrappedState = state.state === types_7.ChannelState.AWAITING_REESTABLISH
|
|
6879
|
+
? state.preReestablishState
|
|
6880
|
+
: null;
|
|
6875
6881
|
// Mid-negotiation v2 channels are keyed by temporary id in the peer map
|
|
6876
6882
|
// (see buildChannelInfo); fall back so diagnostics name the peer too.
|
|
6877
6883
|
const peerPubkey = this.node.getChannelManager().getPeerForChannel(channelIdBuf) ||
|
|
@@ -6904,9 +6910,9 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
|
|
|
6904
6910
|
if (state.fundingUnaccounted === true)
|
|
6905
6911
|
issues.push('FUNDING_UNACCOUNTED: Neither mempool nor chain can account for the funding transaction, so the channel takes no new HTLCs. Routing hints will be skipped. Existing HTLCs still settle, and the quarantine lifts by itself if the funding reappears.');
|
|
6906
6912
|
if (state.state !== 'NORMAL' &&
|
|
6907
|
-
|
|
6913
|
+
wrappedState !== 'NORMAL' &&
|
|
6908
6914
|
!acceptsNewThrough) {
|
|
6909
|
-
issues.push(`NOT_NORMAL: Channel state is ${state.state} (pre-reestablish: ${
|
|
6915
|
+
issues.push(`NOT_NORMAL: Channel state is ${state.state} (pre-reestablish: ${wrappedState || 'none'}). Routing hints require a usable channel.`);
|
|
6910
6916
|
}
|
|
6911
6917
|
if (!state.announceChannel)
|
|
6912
6918
|
issues.push('PRIVATE_CHANNEL: Channel is private (not announced). Routing hints are required for payments.');
|
|
@@ -6920,7 +6926,7 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
|
|
|
6920
6926
|
channelId,
|
|
6921
6927
|
peerPubkey,
|
|
6922
6928
|
state: state.state,
|
|
6923
|
-
preReestablishState:
|
|
6929
|
+
preReestablishState: wrappedState || null,
|
|
6924
6930
|
isPeerConnected,
|
|
6925
6931
|
announceChannel: state.announceChannel,
|
|
6926
6932
|
announcementSigsSent: state.announcementSigsSent || false,
|