balanceofsatoshis 11.32.0 → 11.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/CHANGELOG.md +13 -1
- package/bos +2 -0
- package/network/get_forwards.js +1 -1
- package/network/get_graph_entry.js +56 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
-
## 11.
|
|
3
|
+
## 11.35.0
|
|
4
|
+
|
|
5
|
+
- `graph`: Add `HOPS` variable to `--filter` for node peer distance from self
|
|
6
|
+
|
|
7
|
+
## 11.34.0
|
|
8
|
+
|
|
9
|
+
- `telegram`: Allow switching the node of a trade-secret
|
|
10
|
+
|
|
11
|
+
## 11.33.0
|
|
12
|
+
|
|
13
|
+
- `telegram`: Allow adjusting the expiration date of a trade-secret
|
|
14
|
+
|
|
15
|
+
## 11.32.1
|
|
4
16
|
|
|
5
17
|
- `change-channel-capacity`: Add support for moving a channel to a different
|
|
6
18
|
saved node.
|
package/bos
CHANGED
|
@@ -761,6 +761,8 @@ prog
|
|
|
761
761
|
// Get the edges of a given node
|
|
762
762
|
.command('graph', 'List out the connections a node has with other nodes')
|
|
763
763
|
.argument('<alias_or_public_key>', 'Node in the graph to look up')
|
|
764
|
+
.help('--filter variables: AGE/CAPACITY/HOPS/IN_FEE_RATE/OUT_FEE_RATE')
|
|
765
|
+
.help('Example: --filter "age<7*144" for connections in the last week')
|
|
764
766
|
.option('--filter <formula>', 'Filter formula to apply', REPEATABLE)
|
|
765
767
|
.option('--node <node_name>', 'Node to use for lookup')
|
|
766
768
|
.option('--sort <sort_connections_by', 'Sort peers by field')
|
package/network/get_forwards.js
CHANGED
|
@@ -9,6 +9,7 @@ const {getHeight} = require('ln-service');
|
|
|
9
9
|
const {getNetworkGraph} = require('ln-service');
|
|
10
10
|
const {getNode} = require('ln-service');
|
|
11
11
|
const {getNodeAlias} = require('ln-sync');
|
|
12
|
+
const {getRouteToDestination} = require('ln-service');
|
|
12
13
|
const moment = require('moment');
|
|
13
14
|
const {returnResult} = require('asyncjs-util');
|
|
14
15
|
|
|
@@ -24,7 +25,10 @@ const defaultSort = 'age';
|
|
|
24
25
|
const disableTag = isDisabled => isDisabled ? `${emojiIcons.disabled} ` : '';
|
|
25
26
|
const displayFee = (n, rate) => n.length ? formatFeeRate({rate}).display : ' ';
|
|
26
27
|
const displayTokens = tokens => formatTokens({tokens}).display;
|
|
28
|
+
const distanceTokens = 100;
|
|
29
|
+
const hasDistanceFilter = filters => /hops/gim.test(filters.join(' '));
|
|
27
30
|
const header = [['Alias','Age','In Fee','Capacity','Out Fee','Public Key']];
|
|
31
|
+
const hopsTitle = 'Hops';
|
|
28
32
|
const {isArray} = Array;
|
|
29
33
|
const isClear = sockets => !!sockets.find(n => !!isIP(n.socket.split(':')[0]));
|
|
30
34
|
const isLarge = features => !!features.find(n => n.type === 'large_channels');
|
|
@@ -144,17 +148,49 @@ module.exports = ({filters, fs, lnd, logger, query, sort}, cbk) => {
|
|
|
144
148
|
return cbk();
|
|
145
149
|
}],
|
|
146
150
|
|
|
151
|
+
// Get distances
|
|
152
|
+
getDistances: ['peerKeys', ({peerKeys}, cbk) => {
|
|
153
|
+
// Exit early when there is no distance filter
|
|
154
|
+
if (!hasDistanceFilter(filters)) {
|
|
155
|
+
return cbk(null, peerKeys.map(destination => ({destination})));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return asyncMap(peerKeys, (destination, cbk) => {
|
|
159
|
+
return getRouteToDestination({
|
|
160
|
+
destination,
|
|
161
|
+
lnd,
|
|
162
|
+
is_ignoring_past_failure: true,
|
|
163
|
+
tokens: distanceTokens,
|
|
164
|
+
},
|
|
165
|
+
(err, res) => {
|
|
166
|
+
if (!!err) {
|
|
167
|
+
return cbk(err);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (!res.route) {
|
|
171
|
+
return cbk(null, {destination, hops: Infinity});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return cbk(null, {destination, hops: --res.route.hops.length});
|
|
175
|
+
});
|
|
176
|
+
},
|
|
177
|
+
cbk);
|
|
178
|
+
}],
|
|
179
|
+
|
|
147
180
|
// Final set of peers
|
|
148
181
|
peers: [
|
|
182
|
+
'getDistances',
|
|
149
183
|
'getHeight',
|
|
150
184
|
'getIcons',
|
|
151
185
|
'getNode',
|
|
152
186
|
'peerKeys',
|
|
153
|
-
({getHeight, getIcons, getNode, peerKeys}, cbk) =>
|
|
187
|
+
({getDistances, getHeight, getIcons, getNode, peerKeys}, cbk) =>
|
|
154
188
|
{
|
|
155
189
|
const sorting = sort || defaultSort;
|
|
156
190
|
|
|
157
191
|
const peers = peerKeys.map(peerKey => {
|
|
192
|
+
const {hops} = getDistances.find(n => n.destination === peerKey);
|
|
193
|
+
|
|
158
194
|
const capacity = getNode.channels
|
|
159
195
|
.filter(n => !!n.policies.find(n => n.public_key === peerKey))
|
|
160
196
|
.reduce((sum, {capacity}) => sum + capacity, Number());
|
|
@@ -192,6 +228,7 @@ module.exports = ({filters, fs, lnd, logger, query, sort}, cbk) => {
|
|
|
192
228
|
filters,
|
|
193
229
|
variables: {
|
|
194
230
|
capacity,
|
|
231
|
+
hops,
|
|
195
232
|
age: getHeight.current_block_height - connectHeight,
|
|
196
233
|
height: connectHeight,
|
|
197
234
|
in_fee_rate: inboundFeeRate,
|
|
@@ -217,6 +254,10 @@ module.exports = ({filters, fs, lnd, logger, query, sort}, cbk) => {
|
|
|
217
254
|
peerKey,
|
|
218
255
|
];
|
|
219
256
|
|
|
257
|
+
if (!!hasDistanceFilter(filters)) {
|
|
258
|
+
row.unshift(hops);
|
|
259
|
+
}
|
|
260
|
+
|
|
220
261
|
return {sorts, row};
|
|
221
262
|
})
|
|
222
263
|
.filter(n => !!n);
|
|
@@ -258,7 +299,20 @@ module.exports = ({filters, fs, lnd, logger, query, sort}, cbk) => {
|
|
|
258
299
|
|
|
259
300
|
// Final set of rows
|
|
260
301
|
rows: ['getRowsWithAliases', ({getRowsWithAliases}, cbk) => {
|
|
261
|
-
|
|
302
|
+
const [titles] = header;
|
|
303
|
+
|
|
304
|
+
const headers = titles.slice();
|
|
305
|
+
|
|
306
|
+
if (!!hasDistanceFilter(filters)) {
|
|
307
|
+
const first = headers.shift();
|
|
308
|
+
|
|
309
|
+
headers.unshift(hopsTitle);
|
|
310
|
+
headers.unshift(first);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const rows = [].concat([headers]).concat(getRowsWithAliases);
|
|
314
|
+
|
|
315
|
+
return cbk(null, {rows});
|
|
262
316
|
}],
|
|
263
317
|
},
|
|
264
318
|
returnResult({reject, resolve, of: 'rows'}, cbk));
|
package/package.json
CHANGED
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"inquirer": "8.2.0",
|
|
36
36
|
"invoices": "2.0.3",
|
|
37
37
|
"ln-accounting": "5.0.5",
|
|
38
|
-
"ln-service": "53.5.
|
|
38
|
+
"ln-service": "53.5.2",
|
|
39
39
|
"ln-sync": "3.7.0",
|
|
40
|
-
"ln-telegram": "3.
|
|
40
|
+
"ln-telegram": "3.10.0",
|
|
41
41
|
"moment": "2.29.1",
|
|
42
42
|
"paid-services": "3.11.0",
|
|
43
43
|
"probing": "2.0.2",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis --push .",
|
|
81
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"
|
|
82
82
|
},
|
|
83
|
-
"version": "11.
|
|
83
|
+
"version": "11.35.0"
|
|
84
84
|
}
|