balanceofsatoshis 18.2.0 → 18.2.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 +9 -0
- package/README.md +1 -0
- package/bos +1 -0
- package/network/get_graph_entry.js +18 -2
- package/package.json +14 -14
- package/swaps/rebalance.js +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 18.2.2
|
|
4
|
+
|
|
5
|
+
- `graph`: represent inbound fees in policy display
|
|
6
|
+
- `rebalance`: fix support for 0.18.0 inbound fees
|
|
7
|
+
|
|
8
|
+
## 18.2.1
|
|
9
|
+
|
|
10
|
+
- Support LND 0.18.0
|
|
11
|
+
|
|
3
12
|
## 18.2.0
|
|
4
13
|
|
|
5
14
|
- `call`: Add support for `inbound_base_discount_mtokens` and
|
package/README.md
CHANGED
package/bos
CHANGED
|
@@ -887,6 +887,7 @@ prog
|
|
|
887
887
|
.argument('<alias_or_public_key>', 'Node in the graph to look up')
|
|
888
888
|
.help('--filter variables: AGE/CAPACITY/HOPS/IN_FEE_RATE/OUT_FEE_RATE')
|
|
889
889
|
.help('Example: --filter "age<7*144" for connections in the last week')
|
|
890
|
+
.help(' ←-PPM will represent a source-based inbound discount when present')
|
|
890
891
|
.option('--filter <formula>', 'Filter formula to apply', REPEATABLE)
|
|
891
892
|
.option('--node <node_name>', 'Node to use for lookup')
|
|
892
893
|
.option('--sort <sort_connections_by', 'Sort peers by field')
|
|
@@ -23,6 +23,7 @@ const ageMs = time => moment(new Date(Date.now() - time)).fromNow(true);
|
|
|
23
23
|
const blockTime = (current, start) => 1000 * 60 * 10 * (current - start);
|
|
24
24
|
const defaultSort = 'age';
|
|
25
25
|
const disableTag = isDisabled => isDisabled ? `${emojiIcons.disabled} ` : '';
|
|
26
|
+
const displayDiscount = fee => !!fee && isFinite(fee) ? ` ←${-fee}` : '';
|
|
26
27
|
const displayFee = (n, rate) => n.length ? formatFeeRate({rate}).display : ' ';
|
|
27
28
|
const displayTokens = tokens => formatTokens({tokens}).display;
|
|
28
29
|
const distanceTokens = 100;
|
|
@@ -34,6 +35,7 @@ const isClear = sockets => !!sockets.find(n => !!isIP(n.socket.split(':')[0]));
|
|
|
34
35
|
const isLarge = features => !!features.find(n => n.type === 'large_channels');
|
|
35
36
|
const isOnion = sockets => !!sockets.find(n => /onion/.test(n.socket));
|
|
36
37
|
const isPublicKey = n => !!n && /^0[2-3][0-9A-F]{64}$/i.test(n);
|
|
38
|
+
const join = arr => arr.join('');
|
|
37
39
|
const {max} = Math;
|
|
38
40
|
const {min} = Math;
|
|
39
41
|
const sortBy = (a, b) => a > b ? 1 : (a !== b ? -1 : 0);
|
|
@@ -208,10 +210,12 @@ module.exports = ({filters, fs, lnd, logger, query, sort}, cbk) => {
|
|
|
208
210
|
.map(n => n.policies.find(n => n.public_key !== peerKey))
|
|
209
211
|
.filter(n => n.fee_rate !== undefined);
|
|
210
212
|
|
|
213
|
+
const backFee = min(...inPolicies.map(n => n.inbound_rate_discount));
|
|
211
214
|
const inDisabled = inPolicies.filter(n => n.is_disabled === true);
|
|
212
215
|
const inboundFeeRate = max(...inPolicies.map(n => n.fee_rate));
|
|
213
216
|
const outDisabled = outPolicies.filter(n => n.is_disabled === true);
|
|
214
217
|
const outFeeRate = max(...outPolicies.map(n => n.fee_rate));
|
|
218
|
+
const rebate = min(...outPolicies.map(n => n.inbound_rate_discount));
|
|
215
219
|
|
|
216
220
|
const isInDisabled = inDisabled.length === inPolicies.length;
|
|
217
221
|
const isOutDisabled = outDisabled.length === outPolicies.length;
|
|
@@ -246,11 +250,23 @@ module.exports = ({filters, fs, lnd, logger, query, sort}, cbk) => {
|
|
|
246
250
|
return;
|
|
247
251
|
}
|
|
248
252
|
|
|
253
|
+
const displayInPolicy = [
|
|
254
|
+
disableTag(isInDisabled),
|
|
255
|
+
displayFee(inPolicies, inboundFeeRate),
|
|
256
|
+
displayDiscount(backFee),
|
|
257
|
+
];
|
|
258
|
+
|
|
259
|
+
const displayOutPolicy = [
|
|
260
|
+
disableTag(isOutDisabled),
|
|
261
|
+
displayFee(outPolicies, outFeeRate),
|
|
262
|
+
displayDiscount(rebate),
|
|
263
|
+
];
|
|
264
|
+
|
|
249
265
|
const row = [
|
|
250
266
|
ageMs(blockTime(getHeight.current_block_height, connectHeight)),
|
|
251
|
-
|
|
267
|
+
join(displayInPolicy),
|
|
252
268
|
displayTokens(capacity),
|
|
253
|
-
|
|
269
|
+
join(displayOutPolicy),
|
|
254
270
|
peerKey,
|
|
255
271
|
];
|
|
256
272
|
|
package/package.json
CHANGED
|
@@ -24,25 +24,25 @@
|
|
|
24
24
|
"bitcoinjs-lib": "6.1.5",
|
|
25
25
|
"bolt01": "2.0.0",
|
|
26
26
|
"bolt03": "1.3.2",
|
|
27
|
-
"bolt07": "1.
|
|
27
|
+
"bolt07": "1.9.0",
|
|
28
28
|
"cbor": "9.0.2",
|
|
29
29
|
"colorette": "2.0.20",
|
|
30
30
|
"crypto-js": "4.2.0",
|
|
31
|
-
"csv-parse": "5.5.
|
|
31
|
+
"csv-parse": "5.5.6",
|
|
32
32
|
"ecpair": "2.1.0",
|
|
33
|
-
"goldengate": "14.0.
|
|
34
|
-
"grammy": "1.
|
|
33
|
+
"goldengate": "14.0.5",
|
|
34
|
+
"grammy": "1.24.1",
|
|
35
35
|
"hot-formula-parser": "4.0.0",
|
|
36
36
|
"import-lazy": "4.0.0",
|
|
37
|
-
"ini": "4.1.
|
|
38
|
-
"inquirer": "9.2.
|
|
39
|
-
"ln-accounting": "8.0.
|
|
40
|
-
"ln-service": "57.
|
|
41
|
-
"ln-sync": "6.0.
|
|
42
|
-
"ln-telegram": "6.1.
|
|
37
|
+
"ini": "4.1.3",
|
|
38
|
+
"inquirer": "9.2.23",
|
|
39
|
+
"ln-accounting": "8.0.1",
|
|
40
|
+
"ln-service": "57.13.1",
|
|
41
|
+
"ln-sync": "6.0.3",
|
|
42
|
+
"ln-telegram": "6.1.4",
|
|
43
43
|
"moment": "2.30.1",
|
|
44
|
-
"paid-services": "6.1.
|
|
45
|
-
"probing": "5.0.
|
|
44
|
+
"paid-services": "6.1.3",
|
|
45
|
+
"probing": "5.0.1",
|
|
46
46
|
"psbt": "3.0.0",
|
|
47
47
|
"qrcode-terminal": "0.12.0",
|
|
48
48
|
"sanitize-filename": "1.6.3",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"description": "Lightning balance CLI",
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"invoices": "3.0.0",
|
|
57
|
-
"ln-docker-daemons": "6.0.
|
|
57
|
+
"ln-docker-daemons": "6.0.17",
|
|
58
58
|
"mock-lnd": "1.4.4"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .",
|
|
83
83
|
"test": "npx nyc@15.1.0 node --experimental-test-coverage --test 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/telegram/*.js test/wallets/*.js"
|
|
84
84
|
},
|
|
85
|
-
"version": "18.2.
|
|
85
|
+
"version": "18.2.2"
|
|
86
86
|
}
|
package/swaps/rebalance.js
CHANGED
|
@@ -699,6 +699,26 @@ module.exports = (args, cbk) => {
|
|
|
699
699
|
|
|
700
700
|
// Get route for rebalance
|
|
701
701
|
getRoute: ['channels', 'invoice', ({channels, invoice}, cbk) => {
|
|
702
|
+
// Find any inbound policy, LND 0.18.0 miscalculates fees here
|
|
703
|
+
const hasInboundPolicy = channels.find(channel => {
|
|
704
|
+
return channel.policies.find(policy => {
|
|
705
|
+
if (policy.inbound_base_discount_mtokens !== '0') {
|
|
706
|
+
return true;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
if (policy.inbound_rate_discount !== 0) {
|
|
710
|
+
return true;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
return false;
|
|
714
|
+
});
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
// Exit early when there is an inbound fee that needs a recalc
|
|
718
|
+
if (!!hasInboundPolicy) {
|
|
719
|
+
return cbk(null, {});
|
|
720
|
+
}
|
|
721
|
+
|
|
702
722
|
return getRouteThroughHops({
|
|
703
723
|
cltv_delta: cltvDelta,
|
|
704
724
|
lnd: args.lnd,
|