beignet 0.33.0 → 0.34.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.
Files changed (53) hide show
  1. package/dist/cli/beignet-node.js +43 -3
  2. package/dist/cli/beignet-node.js.map +1 -1
  3. package/dist/cli/cli.js +5 -1
  4. package/dist/cli/cli.js.map +1 -1
  5. package/dist/cli/config.js +19 -1
  6. package/dist/cli/config.js.map +1 -1
  7. package/dist/cli/daemon-options.js +1 -0
  8. package/dist/cli/daemon-options.js.map +1 -1
  9. package/dist/cli/daemon.js +3 -0
  10. package/dist/cli/daemon.js.map +1 -1
  11. package/dist/cli/openapi.js +49 -0
  12. package/dist/cli/openapi.js.map +1 -1
  13. package/dist/cli/routes.js +2 -0
  14. package/dist/cli/routes.js.map +1 -1
  15. package/dist/lightning/channel/channel-manager.js +21 -4
  16. package/dist/lightning/channel/channel-manager.js.map +1 -1
  17. package/dist/lightning/direct-funding/index.js +5 -2
  18. package/dist/lightning/direct-funding/index.js.map +1 -1
  19. package/dist/lightning/direct-funding/receiver/engine.js +34 -5
  20. package/dist/lightning/direct-funding/receiver/engine.js.map +1 -1
  21. package/dist/lightning/direct-funding/receiver/types.js.map +1 -1
  22. package/dist/lightning/direct-funding/requests.js +284 -17
  23. package/dist/lightning/direct-funding/requests.js.map +1 -1
  24. package/dist/lightning/direct-funding/types.js.map +1 -1
  25. package/dist/lightning/node/config.js +1 -0
  26. package/dist/lightning/node/config.js.map +1 -1
  27. package/dist/lightning/node/lightning-node.js +99 -15
  28. package/dist/lightning/node/lightning-node.js.map +1 -1
  29. package/dist/lightning/node/types.js.map +1 -1
  30. package/dist/lightning/transport/peer-manager.js +67 -11
  31. package/dist/lightning/transport/peer-manager.js.map +1 -1
  32. package/dist/lightning/transport/peer.js +4 -2
  33. package/dist/lightning/transport/peer.js.map +1 -1
  34. package/dist/lightning/transport/wire-capture.js +6 -1
  35. package/dist/lightning/transport/wire-capture.js.map +1 -1
  36. package/dist/types/cli/beignet-node.d.ts +12 -1
  37. package/dist/types/cli/config.d.ts +2 -0
  38. package/dist/types/cli/routes.d.ts +4 -0
  39. package/dist/types/cli/types.d.ts +11 -0
  40. package/dist/types/lightning/channel/channel-manager.d.ts +6 -1
  41. package/dist/types/lightning/direct-funding/index.d.ts +2 -2
  42. package/dist/types/lightning/direct-funding/receiver/engine.d.ts +8 -0
  43. package/dist/types/lightning/direct-funding/receiver/types.d.ts +8 -0
  44. package/dist/types/lightning/direct-funding/requests.d.ts +80 -2
  45. package/dist/types/lightning/direct-funding/types.d.ts +54 -0
  46. package/dist/types/lightning/node/config.d.ts +1 -0
  47. package/dist/types/lightning/node/events.d.ts +4 -3
  48. package/dist/types/lightning/node/lightning-node.d.ts +16 -0
  49. package/dist/types/lightning/node/types.d.ts +13 -0
  50. package/dist/types/lightning/transport/peer-manager.d.ts +34 -0
  51. package/dist/types/lightning/transport/peer.d.ts +2 -1
  52. package/dist/types/lightning/transport/wire-capture.d.ts +2 -0
  53. package/package.json +2 -2
@@ -2138,6 +2138,7 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
2138
2138
  chainBackend: electrumBackend,
2139
2139
  feeEstimator: electrumBackend,
2140
2140
  logger: this.logger,
2141
+ wireTrace: opts.wireTrace,
2141
2142
  sweepDestinationScript,
2142
2143
  socks5Proxy,
2143
2144
  socks5ProxyScope,
@@ -2552,8 +2553,23 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
2552
2553
  });
2553
2554
  });
2554
2555
  // Forward peer events
2556
+ // Connects and disconnects are logged at info: a peer that evicts us
2557
+ // (eclair's max-no-channels) and the auto reconnect after it are
2558
+ // otherwise invisible at the level a daemon runs at.
2555
2559
  this.node.on('peer:connect', (pubkey) => {
2556
- this.log('debug', 'Peer connected', { pubkey });
2560
+ let direction;
2561
+ try {
2562
+ direction = this.node
2563
+ .getPeerManager()
2564
+ ?.getConnectionInfo(pubkey)?.direction;
2565
+ }
2566
+ catch {
2567
+ // The log line must not cost the gossip sync below.
2568
+ }
2569
+ this.log('info', 'Peer connected', {
2570
+ pubkey,
2571
+ ...(direction ? { direction } : {})
2572
+ });
2557
2573
  // Pull the gossip graph from the peer so we can route multi-hop payments
2558
2574
  // to destinations beyond our direct channels. Without this the graph
2559
2575
  // stays empty and only direct-peer payments work.
@@ -2587,8 +2603,20 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
2587
2603
  }
2588
2604
  this.emit('peer:connect', { pubkey });
2589
2605
  });
2590
- this.node.on('peer:disconnect', (pubkey) => {
2591
- this.log('debug', 'Peer disconnected', { pubkey });
2606
+ this.node.on('peer:disconnect', (pubkey, info) => {
2607
+ this.log('info', 'Peer disconnected', {
2608
+ pubkey,
2609
+ ...(info
2610
+ ? {
2611
+ closedBy: info.initiator === 'remote' ? 'peer' : 'us',
2612
+ ...(info.reason ? { reason: info.reason } : {}),
2613
+ direction: info.direction,
2614
+ ...(info.uptimeMs !== undefined
2615
+ ? { uptimeMs: info.uptimeMs }
2616
+ : {})
2617
+ }
2618
+ : {})
2619
+ });
2592
2620
  this.emit('peer:disconnect', { pubkey });
2593
2621
  });
2594
2622
  // The transport error that caused a disconnect (pong timeout, decrypt
@@ -6960,6 +6988,8 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
6960
6988
  capacitySats: Number(ch.fundingSatoshis),
6961
6989
  isAnchor: (0, types_7.isAnchorChannel)(ch.channelType ?? null)
6962
6990
  };
6991
+ if (ch.preReestablishState)
6992
+ info.preReestablishState = ch.preReestablishState;
6963
6993
  // What the connected peer's init negotiated, read rather than guessed:
6964
6994
  // a client deciding whether to offer splice controls has no other way
6965
6995
  // to know, and reconstructing feature bits client-side is exactly the
@@ -7578,6 +7608,16 @@ class BeignetNode extends typed_emitter_1.TypedEmitter {
7578
7608
  listDirectFundingPayments() {
7579
7609
  return this.directFundingSender?.payments() ?? [];
7580
7610
  }
7611
+ /**
7612
+ * Every payment received against a request this node minted, newest first
7613
+ * (issue #1893). `receiptHash` is the `paymentHash` the request was minted
7614
+ * with. Kept after the request itself expires, so a client can still tell
7615
+ * its request was paid: a direct-funding payment settles no invoice and pays
7616
+ * no address, and REVERTED means the splice it went into was undone.
7617
+ */
7618
+ listDirectFundingReceived() {
7619
+ return this.node.getDirectFundingRequests()?.received() ?? [];
7620
+ }
7581
7621
  /**
7582
7622
  * Map a coded protocol refusal onto the daemon's error vocabulary. The codes
7583
7623
  * are carried through verbatim: they are what tells the app a refusal to