balanceofsatoshis 11.48.0 → 11.49.2

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/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Versions
2
2
 
3
- ## 11.48.0
3
+ ## 11.49.2
4
+
5
+ - `open`: Fix crash when using `--set-fee-rate` but policy details are missing
6
+
7
+ ## 11.49.1
8
+
9
+ - `telegram`: Add support for notifying of new opening channels
10
+
11
+ ## 11.48.1
4
12
 
5
13
  - `fund`: Support sending to P2TR addresses
6
14
 
package/CONTRIBUTING.md CHANGED
@@ -68,6 +68,8 @@ If you want to help with style, here are some rough guidelines on style ideas:
68
68
  - Prefer using function iteration like map and forEach over for and while
69
69
  - Use arrow functions and not `function` functions whenever possible
70
70
  - Functions should only take and return a single object as argument, result
71
+ - Use the || flags to select between truthy variable options
72
+ - Use !! to explicitly coerce non Bool variables to Boolean
71
73
 
72
74
  ### Errors
73
75
 
package/package.json CHANGED
@@ -33,14 +33,14 @@
33
33
  "import-lazy": "4.0.0",
34
34
  "ini": "2.0.0",
35
35
  "inquirer": "8.2.0",
36
- "invoices": "2.0.3",
36
+ "invoices": "2.0.4",
37
37
  "ln-accounting": "5.0.5",
38
- "ln-service": "53.7.2",
39
- "ln-sync": "3.9.2",
40
- "ln-telegram": "3.14.1",
38
+ "ln-service": "53.8.0",
39
+ "ln-sync": "3.10.0",
40
+ "ln-telegram": "3.15.1",
41
41
  "moment": "2.29.1",
42
42
  "paid-services": "3.11.0",
43
- "probing": "2.0.2",
43
+ "probing": "2.0.3",
44
44
  "psbt": "2.0.0",
45
45
  "qrcode-terminal": "0.12.0",
46
46
  "sanitize-filename": "1.6.3",
@@ -81,5 +81,5 @@
81
81
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis --push .",
82
82
  "test": "tap --branches=1 --functions=1 --lines=1 --statements=1 -t 60 test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.js test/lnd/*.js test/network/*.js test/nodes/*.js test/peers/*.js test/responses/*.js test/routing/*.js test/services/*.js test/swaps/*.js test/tags/*.js test/wallets/*.js"
83
83
  },
84
- "version": "11.48.0"
84
+ "version": "11.49.2"
85
85
  }
@@ -212,6 +212,11 @@ module.exports = (args, cbk) => {
212
212
  return cbk(err);
213
213
  }
214
214
 
215
+ // Exit early when the channel policies are not defined
216
+ if (!!res.policies.find(n => n.cltv_delta === undefined)) {
217
+ return cbk();
218
+ }
219
+
215
220
  return cbk(null, res);
216
221
  });
217
222
  },
@@ -36,6 +36,7 @@ const {postChainTransaction} = require('ln-telegram');
36
36
  const {postClosedMessage} = require('ln-telegram');
37
37
  const {postCreatedTrade} = require('ln-telegram');
38
38
  const {postOpenMessage} = require('ln-telegram');
39
+ const {postOpeningMessage} = require('ln-telegram');
39
40
  const {postSettledInvoice} = require('ln-telegram');
40
41
  const {postSettledPayment} = require('ln-telegram');
41
42
  const {postSettledTrade} = require('ln-telegram');
@@ -49,6 +50,7 @@ const {subscribeToBlocks} = require('goldengate');
49
50
  const {subscribeToChannels} = require('ln-service');
50
51
  const {subscribeToInvoices} = require('ln-service');
51
52
  const {subscribeToPastPayments} = require('ln-service');
53
+ const {subscribeToPendingChannels} = require('ln-sync');
52
54
  const {subscribeToTransactions} = require('ln-service');
53
55
 
54
56
  const interaction = require('./interaction');
@@ -299,7 +301,7 @@ module.exports = (args, cbk) => {
299
301
  key: apiKey.key,
300
302
  nodes: allNodes,
301
303
  reply: ctx.reply,
302
- send: file => ctx.replyWithDocument(fileAsDoc(file)),
304
+ send: (file, opts) => ctx.replyWithDocument(fileAsDoc(file), opts),
303
305
  },
304
306
  err => !!err && !!err[0] >= 500 ? logger.error({err}) : null);
305
307
 
@@ -675,6 +677,36 @@ module.exports = (args, cbk) => {
675
677
  cbk);
676
678
  }],
677
679
 
680
+ // Pending channels changes
681
+ pending: ['apiKey', 'getNodes', 'userId', ({getNodes, userId}, cbk) => {
682
+ return asyncEach(getNodes, ({from, lnd}, cbk) => {
683
+ const sub = subscribeToPendingChannels({lnd});
684
+
685
+ subscriptions.push(sub);
686
+
687
+ sub.on('opening', update => {
688
+ return postOpeningMessage({
689
+ from,
690
+ lnd,
691
+ id: connectedId,
692
+ opening: update.channels,
693
+ send: (id, msg, opt) => bot.api.sendMessage(id, msg, opt),
694
+ },
695
+ err => !!err ? logger.error({node: from, pend_err: err}) : null);
696
+ });
697
+
698
+ sub.once('error', err => {
699
+ // Terminate subscription and restart after a delay
700
+ sub.removeAllListeners();
701
+
702
+ return cbk([503, 'UnexpectedErrorInPendingSubscription', {err}]);
703
+ });
704
+
705
+ return;
706
+ },
707
+ cbk);
708
+ }],
709
+
678
710
  // Send connected message
679
711
  connected: [
680
712
  'apiKey',
@@ -748,16 +780,14 @@ module.exports = (args, cbk) => {
748
780
 
749
781
  // Subscribe to invoices
750
782
  invoices: ['apiKey', 'getNodes', 'userId', ({apiKey, getNodes}, cbk) => {
751
- return asyncEach(getNodes, ({from, lnd}, cbk) => {
752
- const sub = subscribeToInvoices({lnd});
783
+ return asyncEach(getNodes, (node, cbk) => {
784
+ const sub = subscribeToInvoices({lnd: node.lnd});
753
785
 
754
786
  subscriptions.push(sub);
755
787
 
756
788
  sub.on('invoice_updated', invoice => {
757
789
  return postSettledInvoice({
758
- from,
759
- lnd,
760
- request,
790
+ from: node.from,
761
791
  id: connectedId,
762
792
  invoice: {
763
793
  description: invoice.description,
@@ -766,7 +796,9 @@ module.exports = (args, cbk) => {
766
796
  payments: invoice.payments,
767
797
  received: invoice.received,
768
798
  },
769
- key: apiKey.key,
799
+ key: node.public_key,
800
+ lnd: node.lnd,
801
+ nodes: getNodes,
770
802
  quiz: ({answers, correct, question}) => {
771
803
  return bot.api.sendQuiz(
772
804
  connectedId,
@@ -775,6 +807,7 @@ module.exports = (args, cbk) => {
775
807
  {correct_option_id: correct},
776
808
  );
777
809
  },
810
+ send: (id, msg, opts) => bot.api.sendMessage(id, msg, opts),
778
811
  },
779
812
  err => !!err ? logger.error({settled_err: err}) : null);
780
813
  });