balanceofsatoshis 11.27.0 → 11.29.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,5 +1,21 @@
1
1
  # Versions
2
2
 
3
+ ## 11.29.2
4
+
5
+ - `increase-outbound-liquidity`: Change seed node backing endpoint for API EOL
6
+
7
+ ## 11.29.1
8
+
9
+ - `inbound-liquidity`: Remove `--min-score` due to score API EOL
10
+
11
+ ## 11.29.0
12
+
13
+ - `telegram`: Add support for deleting open-ended trade-secrets
14
+
15
+ ## 11.28.0
16
+
17
+ - `telegram`: Add support for serving open-ended trade-secrets
18
+
3
19
  ## 11.27.0
4
20
 
5
21
  - `change-channel-capacity`: Add support for spending decreased funds into a
@@ -2,7 +2,6 @@ const asyncAuto = require('async/auto');
2
2
  const {getChannels} = require('ln-service');
3
3
  const {getLiquidity} = require('ln-sync');
4
4
  const {getNode} = require('ln-service');
5
- const {getScoredNodes} = require('ln-sync');
6
5
  const {returnResult} = require('asyncjs-util');
7
6
 
8
7
  const balanceFromTokens = require('./balance_from_tokens');
@@ -24,7 +23,6 @@ const topPercentile = 0.9;
24
23
  [is_outbound]: <Return Outbound Liquidity Bool>
25
24
  [is_top]: <Return Top Liquidity Bool>
26
25
  lnd: <Authenticated LND API Object>
27
- [min_node_score]: <Minimum Node Score Number>
28
26
  [max_fee_rate]: <Max Inbound Fee Rate Parts Per Million Number>
29
27
  [request]: <Request Function>
30
28
  [with]: <Liquidity With Public Key Hex or Tag Alias or Id String>
@@ -109,7 +107,6 @@ module.exports = (args, cbk) => {
109
107
  is_outbound: args.is_outbound,
110
108
  is_top: args.is_top,
111
109
  lnd: args.lnd,
112
- min_node_score: args.min_node_score,
113
110
  request: args.request,
114
111
  with: withNodes,
115
112
  },
package/bos CHANGED
@@ -795,7 +795,6 @@ prog
795
795
  .option('--above <tokens>', 'Return amount above watermark', INT)
796
796
  .option('--below <tokens>', 'Return amount above watermark', INT)
797
797
  .option('--max-fee-rate <fee_rate>', 'Maximum fee rate to consider', INT)
798
- .option('--min-score <min_score>', 'Minimum fee rate to consider', INT)
799
798
  .option('--node <node_name>', 'Node to get inbound liquidity')
800
799
  .option('--top', 'Top percentile inbound liquidity in an individual channel')
801
800
  .option('--with <node_key_or_tag>', 'Liquidity with a specific node/tag')
@@ -809,7 +808,6 @@ prog
809
808
  is_top: options.top || undefined,
810
809
  lnd: (await lnd.authenticatedLnd({logger, node: options.node})).lnd,
811
810
  max_fee_rate: options.maxFeeRate || undefined,
812
- min_node_score: options.minScore || undefined,
813
811
  request: commands.simpleRequest,
814
812
  with: options.with,
815
813
  },
@@ -10,7 +10,7 @@ const {getNetwork} = require('ln-sync');
10
10
  const {getNode} = require('ln-service');
11
11
  const {getPeers} = require('ln-service');
12
12
  const {getPendingChannels} = require('ln-service');
13
- const {getScoredNodes} = require('ln-sync');
13
+ const {getSeedNodes} = require('ln-sync');
14
14
  const {openChannel} = require('ln-service');
15
15
  const {returnResult} = require('asyncjs-util');
16
16
 
@@ -133,9 +133,9 @@ module.exports = (args, cbk) => {
133
133
  cbk);
134
134
  }],
135
135
 
136
- // Get scored nodes
137
- getScored: ['getNetwork', ({getNetwork}, cbk) => {
138
- return getScoredNodes({
136
+ // Get seed nodes
137
+ getSeed: ['getNetwork', ({getNetwork}, cbk) => {
138
+ return getSeedNodes({
139
139
  network: getNetwork.network,
140
140
  request: args.request,
141
141
  },
@@ -148,14 +148,14 @@ module.exports = (args, cbk) => {
148
148
  'getClosed',
149
149
  'getPending',
150
150
  'getForwards',
151
- 'getScored',
152
- ({getChannels, getClosed, getForwards, getPending, getScored}, cbk) =>
151
+ 'getSeed',
152
+ ({getChannels, getClosed, getForwards, getPending, getSeed}, cbk) =>
153
153
  {
154
154
  const allChannels = []
155
155
  .concat(getChannels.channels)
156
156
  .concat(getPending.pending_channels.filter(n => !!n.is_opening));
157
157
 
158
- const scored = getScored.nodes.map(n => n.public_key);
158
+ const scored = getSeed.nodes.map(n => n.public_key);
159
159
 
160
160
  const {peers} = peersWithActivity({
161
161
  additions: [].concat(args.peer).filter(n => !!n),
@@ -174,7 +174,7 @@ module.exports = (args, cbk) => {
174
174
  .filter(n => n.forwarded > minForwarded); // Previous forwards
175
175
 
176
176
  const scorePeers = peersWithActivity({
177
- additions: getScored.nodes.map(n => n.public_key),
177
+ additions: getSeed.nodes.map(n => n.public_key),
178
178
  channels: allChannels,
179
179
  forwards: getForwards.forwards,
180
180
  terminated: getClosed.channels,
package/package.json CHANGED
@@ -35,11 +35,11 @@
35
35
  "inquirer": "8.2.0",
36
36
  "invoices": "2.0.3",
37
37
  "ln-accounting": "5.0.5",
38
- "ln-service": "53.4.2",
39
- "ln-sync": "3.6.1",
40
- "ln-telegram": "3.5.1",
38
+ "ln-service": "53.5.0",
39
+ "ln-sync": "3.7.0",
40
+ "ln-telegram": "3.7.0",
41
41
  "moment": "2.29.1",
42
- "paid-services": "3.7.0",
42
+ "paid-services": "3.9.1",
43
43
  "probing": "2.0.2",
44
44
  "psbt": "1.1.10",
45
45
  "qrcode-terminal": "0.12.0",
@@ -69,16 +69,6 @@
69
69
  "license": "MIT",
70
70
  "main": "index.js",
71
71
  "name": "balanceofsatoshis",
72
- "overrides": {
73
- "caporal@1.4.0": {
74
- "cli-table3@0.5.1": {
75
- "colors@1.4.2": "1.4.0"
76
- },
77
- "prettyjson@1.2.1": {
78
- "colors@1.4.2": "1.4.0"
79
- }
80
- }
81
- },
82
72
  "repository": {
83
73
  "type": "git",
84
74
  "url": "https://github.com/alexbosworth/balanceofsatoshis.git"
@@ -90,5 +80,5 @@
90
80
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis --push .",
91
81
  "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"
92
82
  },
93
- "version": "11.27.0"
83
+ "version": "11.29.2"
94
84
  }
@@ -8,6 +8,7 @@ const asyncMap = require('async/map');
8
8
  const asyncRetry = require('async/retry');
9
9
  const {Bot} = require('grammy');
10
10
  const {getForwards} = require('ln-service');
11
+ const {getNetwork} = require('ln-service');
11
12
  const {getTransactionRecord} = require('ln-sync');
12
13
  const {getWalletInfo} = require('ln-service');
13
14
  const {handleBackupCommand} = require('ln-telegram');
@@ -28,12 +29,15 @@ const {isMessageReplyToInvoice} = require('ln-telegram');
28
29
  const {notifyOfForwards} = require('ln-telegram');
29
30
  const {postChainTransaction} = require('ln-telegram');
30
31
  const {postClosedMessage} = require('ln-telegram');
32
+ const {postCreatedTrade} = require('ln-telegram');
31
33
  const {postOpenMessage} = require('ln-telegram');
32
34
  const {postSettledInvoice} = require('ln-telegram');
33
35
  const {postSettledPayment} = require('ln-telegram');
36
+ const {postSettledTrade} = require('ln-telegram');
34
37
  const {postUpdatedBackup} = require('ln-telegram');
35
38
  const {returnResult} = require('asyncjs-util');
36
39
  const {sendMessage} = require('ln-telegram');
40
+ const {serviceAnchoredTrades} = require('paid-services');
37
41
  const {subscribeToBackups} = require('ln-service');
38
42
  const {subscribeToBlocks} = require('goldengate');
39
43
  const {subscribeToChannels} = require('ln-service');
@@ -754,6 +758,67 @@ module.exports = ({fs, id, limits, lnds, logger, payments, request}, cbk) => {
754
758
  cbk);
755
759
  }],
756
760
 
761
+ // Service trade secrets
762
+ secrets: ['apiKey', 'getNodes', 'userId', ({apiKey, getNodes}, cbk) => {
763
+ return asyncEach(getNodes, (node, cbk) => {
764
+ const sub = serviceAnchoredTrades({lnd: node.lnd});
765
+ const start = new Date().toISOString();
766
+
767
+ subscriptions.push(sub);
768
+
769
+ sub.on('settled', async trade => {
770
+ try {
771
+ await postSettledTrade({
772
+ api: bot.api,
773
+ description: trade.description,
774
+ destination: node.public_key,
775
+ lnd: node.lnd,
776
+ nodes: getNodes,
777
+ to: trade.to,
778
+ tokens: trade.tokens,
779
+ user: connectedId,
780
+ });
781
+ } catch (err) {
782
+ logger.error({err});
783
+ }
784
+ });
785
+
786
+ sub.on('start', async trade => {
787
+ // Exit early when this is an older trade
788
+ if (trade.created_at < start) {
789
+ return;
790
+ }
791
+
792
+ try {
793
+ await postCreatedTrade({
794
+ api: bot.api,
795
+ description: trade.description,
796
+ destination: node.public_key,
797
+ expires_at: trade.expires_at,
798
+ id: trade.id,
799
+ lnd: node.lnd,
800
+ nodes: getNodes,
801
+ tokens: trade.tokens,
802
+ user: connectedId,
803
+ });
804
+ } catch (err) {
805
+ logger.error({err});
806
+ }
807
+ });
808
+
809
+ sub.on('error', err => {
810
+ sub.removeAllListeners();
811
+
812
+ logger.error({err});
813
+
814
+ return cbk(err);
815
+ });
816
+
817
+ return;
818
+ },
819
+ cbk);
820
+ }],
821
+
757
822
  // Subscribe to chain transactions
758
823
  transactions: [
759
824
  'apiKey',