lightning 5.20.1 → 5.21.1
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 +8 -0
- package/README.md +1 -0
- package/lnd_methods/info/constants.json +3 -1
- package/lnd_methods/onchain/get_chain_fee_estimate.d.ts +2 -0
- package/lnd_methods/onchain/get_chain_fee_estimate.js +6 -0
- package/lnd_methods/onchain/send_to_chain_address.js +5 -0
- package/package.json +6 -6
- package/test/lnd_methods/onchain/test_get_chain_fee_estimate.js +16 -0
- package/test/lnd_methods/onchain/test_send_to_chain_address.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## 5.21.1
|
|
4
4
|
|
|
5
|
+
- `getChainFeeEstimate`: Add support for specifying min `utxo_confirmations`
|
|
6
|
+
|
|
7
|
+
## 5.20.2
|
|
8
|
+
|
|
9
|
+
- `getWalletInfo`: Add support for detecting lnd versions 0.15.0 and 0.15.1
|
|
10
|
+
|
|
11
|
+
## 5.20.1
|
|
12
|
+
|
|
5
13
|
- Update typescript definitions
|
|
6
14
|
|
|
7
15
|
## 5.20.0
|
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ Methods for working with the Lightning Network
|
|
|
18
18
|
https://github.com/ibz/lightning-shell
|
|
19
19
|
- [LNMarkets](https://twitter.com/lnmarkets) -
|
|
20
20
|
https://github.com/lnmarkets/umbrel
|
|
21
|
+
- [LNPingBot](https://github.com/swissrouting/lnpingbot) - https://github.com/swissrouting/lnpingbot
|
|
21
22
|
- [mempool.space](https://mempool.space/) - https://github.com/mempool/mempool
|
|
22
23
|
- [p2plnbot](https://telegram.me/lnp2pbot) - https://github.com/grunch/p2plnbot
|
|
23
24
|
- [rekr](https://rekr.app/) - https://github.com/ryan-lingle/rekr
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"4f567577db9d85b6f392f960b3aabddcad3cd02c": "0.13.3-beta",
|
|
26
26
|
"52bb3f33707b81972c67937c7a89addcdf00991c": "0.10.1-beta",
|
|
27
27
|
"596fd90ef310cd7abbf2251edaae9ba4d5f8a689": "0.13.1-beta",
|
|
28
|
+
"5c36d96c9cbe8b27c29f9682dcbdab7928ae870f": "0.15.0-beta",
|
|
28
29
|
"6042004edaaa5b3cad0a0808ff23dba4716f7178": "0.14.1-beta",
|
|
29
30
|
"61c34683058f2cc8dc10f49392a0057440d831c4": "0.13.4-beta",
|
|
30
31
|
"725ff104808f49f0a5247bfdb4b6b5da7f488d38": "0.13.0-beta",
|
|
@@ -35,7 +36,8 @@
|
|
|
35
36
|
"d176d2d65fc06e6631c4dc9478592be8545a21de": "0.12.0-beta",
|
|
36
37
|
"d233f61383f2f950aa06f5b09da5b0e78e784fae": "0.12.1-beta",
|
|
37
38
|
"d62c575f8499a314eb27f12462d20500b6bda2c7": "0.10.3-beta",
|
|
38
|
-
"df0b82f0165f19bde8832bacd1e35544b0a2990d": "0.14.0-beta"
|
|
39
|
+
"df0b82f0165f19bde8832bacd1e35544b0a2990d": "0.14.0-beta",
|
|
40
|
+
"fd1a95bf322cdd1c743a1554f8e470fbf9a5e564": "0.15.1-beta"
|
|
39
41
|
},
|
|
40
42
|
"weightedType": "weightedcomb",
|
|
41
43
|
"wrongLnd": "12 UNIMPLEMENTED: unknown service autopilotrpc.Autopilot"
|
|
@@ -12,6 +12,8 @@ export type GetChainFeeEstimateArgs = AuthenticatedLightningArgs<{
|
|
|
12
12
|
}[];
|
|
13
13
|
/** Target Confirmations */
|
|
14
14
|
target_confirmations?: number;
|
|
15
|
+
/** Minimum Confirmations for UTXO Selection */
|
|
16
|
+
utxo_confirmations?: number;
|
|
15
17
|
}>;
|
|
16
18
|
|
|
17
19
|
export type GetChainFeeEstimateResult = {
|
|
@@ -8,11 +8,14 @@ const {isArray} = Array;
|
|
|
8
8
|
const method = 'estimateFee';
|
|
9
9
|
const notFound = -1;
|
|
10
10
|
const type = 'default';
|
|
11
|
+
const unconfirmedConfCount = 0;
|
|
11
12
|
|
|
12
13
|
/** Get a chain fee estimate for a prospective chain send
|
|
13
14
|
|
|
14
15
|
Requires `onchain:read` permission
|
|
15
16
|
|
|
17
|
+
Specifying 0 for `utxo_confirmations` is not supported in LND 0.13.0 or below
|
|
18
|
+
|
|
16
19
|
{
|
|
17
20
|
lnd: <Authenticated LND API Object>
|
|
18
21
|
send_to: [{
|
|
@@ -20,6 +23,7 @@ const type = 'default';
|
|
|
20
23
|
tokens: <Tokens Number>
|
|
21
24
|
}]
|
|
22
25
|
[target_confirmations]: <Target Confirmations Number>
|
|
26
|
+
[utxo_confirmations]: <Minimum Confirmations for UTXO Selection Number>
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
@returns via cbk or Promise
|
|
@@ -65,6 +69,8 @@ module.exports = (args, cbk) => {
|
|
|
65
69
|
return args.lnd[type][method]({
|
|
66
70
|
AddrToAmount,
|
|
67
71
|
target_conf: args.target_confirmations || undefined,
|
|
72
|
+
min_confs: args.utxo_confirmations || undefined,
|
|
73
|
+
spend_unconfirmed: args.utxo_confirmations === unconfirmedConfCount,
|
|
68
74
|
},
|
|
69
75
|
(err, res) => {
|
|
70
76
|
if (!!err) {
|
|
@@ -5,6 +5,7 @@ const {isLnd} = require('./../../lnd_requests');
|
|
|
5
5
|
|
|
6
6
|
const initialConfirmationCount = 0;
|
|
7
7
|
const {isArray} = Array;
|
|
8
|
+
const {isInteger} = Number;
|
|
8
9
|
const lowBalanceErr = 'insufficient funds available to construct transaction';
|
|
9
10
|
const method = 'sendCoins';
|
|
10
11
|
const OPEN = 1;
|
|
@@ -53,6 +54,10 @@ module.exports = (args, cbk) => {
|
|
|
53
54
|
return cbk([400, 'ExpectedLndForChainSendRequest']);
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
if (!!args.tokens && !isInteger(args.tokens)) {
|
|
58
|
+
return cbk([400, 'ExpectedWholeNumberAmountToSendFundsOnChain']);
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
if (!args.tokens && !args.is_send_all) {
|
|
57
62
|
return cbk([400, 'MissingTokensToSendOnChain']);
|
|
58
63
|
}
|
package/package.json
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
"url": "https://github.com/alexbosworth/lightning/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@grpc/grpc-js": "1.
|
|
10
|
+
"@grpc/grpc-js": "1.7.0",
|
|
11
11
|
"@grpc/proto-loader": "0.7.2",
|
|
12
12
|
"@types/express": "4.17.13",
|
|
13
|
-
"@types/node": "18.7.
|
|
13
|
+
"@types/node": "18.7.16",
|
|
14
14
|
"@types/request": "2.48.8",
|
|
15
15
|
"@types/ws": "8.5.3",
|
|
16
16
|
"async": "3.2.4",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"cbor": "8.1.0",
|
|
24
24
|
"ecpair": "2.0.1",
|
|
25
25
|
"express": "4.18.1",
|
|
26
|
-
"invoices": "2.
|
|
26
|
+
"invoices": "2.2.0",
|
|
27
27
|
"psbt": "2.7.1",
|
|
28
28
|
"tiny-secp256k1": "2.2.1",
|
|
29
29
|
"type-fest": "2.19.0"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@alexbosworth/node-fetch": "2.6.2",
|
|
34
34
|
"@alexbosworth/tap": "15.0.11",
|
|
35
|
-
"tsd": "0.
|
|
36
|
-
"typescript": "4.8.
|
|
35
|
+
"tsd": "0.23.0",
|
|
36
|
+
"typescript": "4.8.3",
|
|
37
37
|
"ws": "8.8.1"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"directory": "test/typescript"
|
|
60
60
|
},
|
|
61
61
|
"types": "index.d.ts",
|
|
62
|
-
"version": "5.
|
|
62
|
+
"version": "5.21.1"
|
|
63
63
|
}
|
|
@@ -78,6 +78,22 @@ const tests = [
|
|
|
78
78
|
description: 'Fee rate and fee are given in chain response',
|
|
79
79
|
expected: {fee: 1, tokens_per_vbyte: 1},
|
|
80
80
|
},
|
|
81
|
+
{
|
|
82
|
+
args: {
|
|
83
|
+
lnd: {
|
|
84
|
+
default: {
|
|
85
|
+
estimateFee: ({}, cbk) => cbk(null, {
|
|
86
|
+
fee_sat: '1',
|
|
87
|
+
feerate_sat_per_byte: '1',
|
|
88
|
+
}),
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
send_to: [{address: 'address', tokens: 1}],
|
|
92
|
+
utxo_confirmations: 0,
|
|
93
|
+
},
|
|
94
|
+
description: 'Passing 0 UTXO confirmations is supported',
|
|
95
|
+
expected: {fee: 1, tokens_per_vbyte: 1},
|
|
96
|
+
},
|
|
81
97
|
];
|
|
82
98
|
|
|
83
99
|
tests.forEach(({args, description, error, expected}) => {
|
|
@@ -36,6 +36,11 @@ const tests = [
|
|
|
36
36
|
description: 'Expected tokens to send to chain address',
|
|
37
37
|
error: [400, 'MissingTokensToSendOnChain'],
|
|
38
38
|
},
|
|
39
|
+
{
|
|
40
|
+
args: makeArgs({tokens: 0.1}),
|
|
41
|
+
description: 'Expected non-fractional tokens to send to chain address',
|
|
42
|
+
error: [400, 'ExpectedWholeNumberAmountToSendFundsOnChain'],
|
|
43
|
+
},
|
|
39
44
|
{
|
|
40
45
|
args: makeArgs({is_send_all: true, tokens: 1}),
|
|
41
46
|
description: 'Expected either send all or tokens to send to chain address',
|