ln-service 54.8.0 → 54.9.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
CHANGED
package/README.md
CHANGED
|
@@ -140,6 +140,7 @@ for `unlocker` methods.
|
|
|
140
140
|
- [getBackup](#getbackup) - Get a backup of a channel
|
|
141
141
|
- [getBackups](#getbackups) - Get a backup for all channels
|
|
142
142
|
- [getBlock](#getblock) - Get the raw block data given a block id in the chain
|
|
143
|
+
- [getChainAddresses](#getchainaddresses) - Get created chain addresses
|
|
143
144
|
- [getChainBalance](#getchainbalance) - Get the confirmed chain balance
|
|
144
145
|
- [getChainFeeEstimate](#getchainfeeestimate) - Get a chain fee estimate
|
|
145
146
|
- [getChainFeeRate](#getchainfeerate) - Get the fee rate for a conf target
|
|
@@ -1442,6 +1443,34 @@ const {block} = await getBlock({lnd, id: chain.current_block_hash});
|
|
|
1442
1443
|
const lastBlockSize = Buffer.from(block, 'hex').byteLength();
|
|
1443
1444
|
```
|
|
1444
1445
|
|
|
1446
|
+
### getChainAddresses
|
|
1447
|
+
|
|
1448
|
+
Get the wallet chain addresses
|
|
1449
|
+
|
|
1450
|
+
Requires `onchain:read` permission
|
|
1451
|
+
|
|
1452
|
+
This method is not supported on LND 0.15.5 and below
|
|
1453
|
+
|
|
1454
|
+
{
|
|
1455
|
+
lnd: <Authenticated LND API Object>
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
@returns via cbk or Promise
|
|
1459
|
+
{
|
|
1460
|
+
addresses: [{
|
|
1461
|
+
address: <Chain Address String>
|
|
1462
|
+
is_change: <Is Internal Change Address Bool>
|
|
1463
|
+
tokens: <Balance of Funds Controlled by Output Script Tokens Number>
|
|
1464
|
+
}]
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
```node
|
|
1468
|
+
const {getChainAddresses} = require('ln-service');
|
|
1469
|
+
|
|
1470
|
+
// How many chain addresses have been created
|
|
1471
|
+
const numberOfChainAddresses = (await getChainAddresses({lnd})).addresses;
|
|
1472
|
+
```
|
|
1473
|
+
|
|
1445
1474
|
### getChainBalance
|
|
1446
1475
|
|
|
1447
1476
|
Get balance on the chain.
|
|
@@ -4285,7 +4314,7 @@ Preferred `confidence` is not supported on LND 0.14.5 and below
|
|
|
4285
4314
|
[payment]: <Payment Identifier Hex String>
|
|
4286
4315
|
[probe_timeout_ms]: <Probe Timeout Milliseconds Number>
|
|
4287
4316
|
[routes]: [[{
|
|
4288
|
-
[base_fee_mtokens]: <Base Routing Fee In Millitokens Number>
|
|
4317
|
+
[base_fee_mtokens]: <Base Routing Fee In Millitokens Number String>
|
|
4289
4318
|
[channel_capacity]: <Channel Capacity Tokens Number>
|
|
4290
4319
|
[channel]: <Standard Format Channel Id String>
|
|
4291
4320
|
[cltv_delta]: <CLTV Blocks Delta Number>
|
|
@@ -5526,13 +5555,6 @@ Requires `invoices:read` permission
|
|
|
5526
5555
|
received: <Received Tokens Number>
|
|
5527
5556
|
received_mtokens: <Received Millitokens String>
|
|
5528
5557
|
request: <Bolt 11 Invoice String>
|
|
5529
|
-
routes: [[{
|
|
5530
|
-
base_fee_mtokens: <Base Routing Fee In Millitokens Number>
|
|
5531
|
-
channel: <Standard Format Channel Id String>
|
|
5532
|
-
cltv_delta: <CLTV Blocks Delta Number>
|
|
5533
|
-
fee_rate: <Fee Rate In Millitokens Per Million Number>
|
|
5534
|
-
public_key: <Public Key Hex String>
|
|
5535
|
-
}]]
|
|
5536
5558
|
secret: <Secret Preimage Hex String>
|
|
5537
5559
|
tokens: <Tokens Number>
|
|
5538
5560
|
}
|
package/index.js
CHANGED
|
@@ -34,6 +34,7 @@ const {getAutopilot} = require('lightning');
|
|
|
34
34
|
const {getBackup} = require('lightning');
|
|
35
35
|
const {getBackups} = require('lightning');
|
|
36
36
|
const {getBlock} = require('lightning');
|
|
37
|
+
const {getChainAddresses} = require('lightning');
|
|
37
38
|
const {getChainBalance} = require('lightning');
|
|
38
39
|
const {getChainFeeEstimate} = require('lightning');
|
|
39
40
|
const {getChainFeeRate} = require('lightning');
|
|
@@ -187,6 +188,7 @@ module.exports = {
|
|
|
187
188
|
getBackup,
|
|
188
189
|
getBackups,
|
|
189
190
|
getBlock,
|
|
191
|
+
getChainAddresses,
|
|
190
192
|
getChainBalance,
|
|
191
193
|
getChainFeeEstimate,
|
|
192
194
|
getChainFeeRate,
|
package/package.json
CHANGED
|
@@ -7,33 +7,33 @@
|
|
|
7
7
|
"url": "https://github.com/alexbosworth/ln-service/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"bolt07": "1.8.
|
|
10
|
+
"bolt07": "1.8.3",
|
|
11
11
|
"cors": "2.8.5",
|
|
12
12
|
"express": "4.18.2",
|
|
13
|
-
"invoices": "2.2.
|
|
14
|
-
"lightning": "
|
|
13
|
+
"invoices": "2.2.3",
|
|
14
|
+
"lightning": "7.0.3",
|
|
15
15
|
"macaroon": "3.0.4",
|
|
16
16
|
"morgan": "1.10.0",
|
|
17
17
|
"ws": "8.11.0"
|
|
18
18
|
},
|
|
19
19
|
"description": "Interaction helper for your Lightning Network daemon",
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@alexbosworth/tap": "15.0.
|
|
21
|
+
"@alexbosworth/tap": "15.0.12",
|
|
22
22
|
"@alexbosworth/node-fetch": "2.6.2",
|
|
23
23
|
"async": "3.2.4",
|
|
24
|
-
"asyncjs-util": "1.2.
|
|
24
|
+
"asyncjs-util": "1.2.11",
|
|
25
25
|
"bip32": "3.1.0",
|
|
26
26
|
"bip66": "1.1.5",
|
|
27
27
|
"bitcoinjs-lib": "6.1.0",
|
|
28
28
|
"bn.js": "5.2.1",
|
|
29
29
|
"bs58check": "2.1.2",
|
|
30
30
|
"ecpair": "2.1.0",
|
|
31
|
-
"ln-docker-daemons": "4.0.
|
|
32
|
-
"p2tr": "1.3.
|
|
31
|
+
"ln-docker-daemons": "4.0.3",
|
|
32
|
+
"p2tr": "1.3.3",
|
|
33
33
|
"portfinder": "1.0.32",
|
|
34
|
-
"psbt": "2.7.
|
|
34
|
+
"psbt": "2.7.2",
|
|
35
35
|
"rimraf": "3.0.2",
|
|
36
|
-
"secp256k1": "
|
|
36
|
+
"secp256k1": "5.0.0",
|
|
37
37
|
"tiny-secp256k1": "2.2.1",
|
|
38
38
|
"uuid": "9.0.0",
|
|
39
39
|
"varuint-bitcoin": "1.1.2"
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
|
|
65
65
|
"test": "echo $DOCKER_LND_VERSION && tap -j 2 --branches=1 --functions=1 --lines=1 --statements=1 -t 200 test/autopilotrpc-integration/*.js test/chainrpc-integration/*.js test/integration/*.js test/invoicesrpc-integration/*.js test/peersrpc-integration/*.js test/routerrpc-integration/*.js test/signerrpc-integration/*.js test/tower_clientrpc-integration/*.js test/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
|
|
66
66
|
},
|
|
67
|
-
"version": "54.
|
|
67
|
+
"version": "54.9.0"
|
|
68
68
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const {spawnLightningCluster} = require('ln-docker-daemons');
|
|
2
|
+
const {test} = require('@alexbosworth/tap');
|
|
3
|
+
|
|
4
|
+
const {createChainAddress} = require('./../../');
|
|
5
|
+
const {getChainAddresses} = require('./../../');
|
|
6
|
+
|
|
7
|
+
const count = 100;
|
|
8
|
+
const expiry = () => new Date(Date.now() + (1000 * 60 * 5)).toISOString();
|
|
9
|
+
|
|
10
|
+
// Getting chain addresses should return a list of addresses
|
|
11
|
+
test(`Get chain addresses`, async ({end, equal, rejects, strictSame}) => {
|
|
12
|
+
const [{generate, kill, lnd}] = (await spawnLightningCluster({})).nodes;
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
await getChainAddresses({lnd});
|
|
16
|
+
} catch (err) {
|
|
17
|
+
// LND 0.12.1 does not support getting locked UTXOs
|
|
18
|
+
strictSame(
|
|
19
|
+
err,
|
|
20
|
+
[501, 'BackingLndDoesNotSupportGettingChainAddresses'],
|
|
21
|
+
'Got unsupported error'
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
await kill({});
|
|
25
|
+
|
|
26
|
+
return end();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const expected = [
|
|
31
|
+
{
|
|
32
|
+
address: (await createChainAddress({lnd, format: 'np2wpkh'})).address,
|
|
33
|
+
is_change: false,
|
|
34
|
+
tokens: 0,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
address: (await createChainAddress({lnd})).address,
|
|
38
|
+
is_change: false,
|
|
39
|
+
tokens: 0,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
address: (await createChainAddress({lnd, format: 'p2tr'})).address,
|
|
43
|
+
is_change: false,
|
|
44
|
+
tokens: 0,
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const {addresses} = await getChainAddresses({lnd});
|
|
49
|
+
|
|
50
|
+
strictSame(addresses, expected, 'Got created chain addresses');
|
|
51
|
+
} catch (err) {
|
|
52
|
+
strictSame(err, null, 'Expected no error');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
await kill({});
|
|
56
|
+
|
|
57
|
+
return end();
|
|
58
|
+
});
|
|
@@ -8,8 +8,8 @@ const {lockUtxo} = require('./../../');
|
|
|
8
8
|
const count = 100;
|
|
9
9
|
const expiry = () => new Date(Date.now() + (1000 * 60 * 5)).toISOString();
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
test(`
|
|
11
|
+
// Getting locked UTXOs should result in a list of locked UTXOs
|
|
12
|
+
test(`Get locked UTXOs`, async ({end, equal, rejects, strictSame}) => {
|
|
13
13
|
const [{generate, kill, lnd}] = (await spawnLightningCluster({})).nodes;
|
|
14
14
|
|
|
15
15
|
try {
|