beignet 0.5.7 → 0.5.8

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.
@@ -673,6 +673,7 @@ class BeignetNode extends events_1.EventEmitter {
673
673
  lightningBalanceSats: lightningBalance,
674
674
  pendingCloseBalanceSats: this.getPendingCloseBalanceSats(),
675
675
  erroredBalanceSats: this.getErroredBalanceSats(),
676
+ splicingBalanceSats: this.getSplicingBalanceSats(),
676
677
  channelCount: info.channelCount,
677
678
  peerCount: info.peerCount,
678
679
  listening: this.node.isListening()
@@ -705,7 +706,14 @@ class BeignetNode extends events_1.EventEmitter {
705
706
  const lnBalance = this.node.getBalance();
706
707
  const lightning = Number(lnBalance.localBalanceMsat / 1000n);
707
708
  const unsettledSats = Number(lnBalance.unsettledBalanceMsat / 1000n);
708
- return { onchain, lightning, total: onchain + lightning, unsettledSats };
709
+ const splicingSats = this.getSplicingBalanceSats();
710
+ return {
711
+ onchain,
712
+ lightning,
713
+ total: onchain + lightning,
714
+ unsettledSats,
715
+ splicingSats
716
+ };
709
717
  }
710
718
  getPendingCloseBalanceSats() {
711
719
  const recovering = new Set([
@@ -730,6 +738,15 @@ class BeignetNode extends events_1.EventEmitter {
730
738
  }
731
739
  return Number(totalMsat / 1000n);
732
740
  }
741
+ getSplicingBalanceSats() {
742
+ let totalMsat = 0n;
743
+ for (const ch of this.node.listChannels()) {
744
+ if (ch.state === types_3.ChannelState.SPLICING) {
745
+ totalMsat += ch.pendingSpliceLocalBalanceMsat ?? ch.localBalanceMsat;
746
+ }
747
+ }
748
+ return Number(totalMsat / 1000n);
749
+ }
733
750
  async resolveWalletSweepScript() {
734
751
  const bitcoin = require('bitcoinjs-lib');
735
752
  try {
@@ -1504,6 +1521,8 @@ class BeignetNode extends events_1.EventEmitter {
1504
1521
  info.feeratePerKw = ch.feeratePerKw;
1505
1522
  if (ch.htlcCount !== undefined)
1506
1523
  info.htlcCount = ch.htlcCount;
1524
+ if (ch.pendingSpliceLocalBalanceMsat !== undefined)
1525
+ info.pendingSpliceLocalBalanceSats = Number(ch.pendingSpliceLocalBalanceMsat / 1000n);
1507
1526
  if (ch.isPrivate !== undefined)
1508
1527
  info.isPrivate = ch.isPrivate;
1509
1528
  if (ch.feeBaseMsat !== undefined)