ln-service 57.2.0 → 57.4.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
@@ -1,5 +1,13 @@
1
1
  # Versions
2
2
 
3
+ ## 57.4.0
4
+
5
+ - `getConnectedWatchtowers`: Add `is_taproot` to get P2TR channels
6
+
7
+ ## 57.3.0
8
+
9
+ - `getConfiguration`: Add method to return configuration information
10
+
3
11
  ## 57.2.0
4
12
 
5
13
  - `deleteChainTransaction`: Add method to delete a chain transaction
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017-2023 Alex Bosworth
3
+ Copyright (c) 2017-2024 Alex Bosworth
4
4
  Copyright (c) 2017 BitcoinJS
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
package/README.md CHANGED
@@ -187,6 +187,7 @@ for `unlocker` methods.
187
187
  - [getChannelBalance](#getchannelbalance) - Get the balance of channel funds
188
188
  - [getChannels](#getchannels) - Get all open channels
189
189
  - [getClosedChannels](#getclosedchannels) - Get previously open channels
190
+ - [getConfiguration](#getconfiguration) - Get configuration information
190
191
  - [getConnectedWatchtowers](#getconnectedwatchtowers) - Get connected towers
191
192
  - [getEphemeralChannelIds](#getephemeralchannelids) - Get other channel ids
192
193
  - [getFailedPayments](#getfailedpayments) - Get payments that were failed back
@@ -1972,6 +1973,36 @@ const {getClosedChannels} = require('ln-service');
1972
1973
  const breachCount = await getClosedChannels({lnd, is_breach_close: true});
1973
1974
  ```
1974
1975
 
1976
+ ### getConfiguration
1977
+
1978
+ Get the current configuration file settings and the output log
1979
+
1980
+ Requires `info:read`, `offchain:read`, `onchain:read`, `peers:read`
1981
+ permissions
1982
+
1983
+ This method is not supported on LND 0.17.3 and below
1984
+
1985
+ {
1986
+ lnd: <Authenticated LND API Object>
1987
+ }
1988
+
1989
+ @returns via cbk or Promise
1990
+ {
1991
+ log: [<Log Line String>]
1992
+ options: [{
1993
+ type: <Option Type String>
1994
+ value: <Option Value String>
1995
+ }]
1996
+ }
1997
+
1998
+ Example:
1999
+
2000
+ ```node
2001
+ const {getConfiguration} = require('ln-service');
2002
+ const {log, options} = await getConfiguration({});
2003
+ const minimumChannelSize = options.find(n => n.type === 'minchansize').value;
2004
+ ```
2005
+
1975
2006
  ### getConnectedWatchtowers
1976
2007
 
1977
2008
  Get a list of connected watchtowers and watchtower info
@@ -1982,7 +2013,13 @@ Requires `offchain:read` permission
1982
2013
 
1983
2014
  Includes previously connected watchtowers
1984
2015
 
2016
+ `is_anchor` flag is not supported on LND 0.11.1 and below
2017
+
2018
+ `is_taproot` flag is not supported on LND 0.17.3 and below
2019
+
1985
2020
  {
2021
+ [is_anchor]: <Get Anchor Type Tower Info Bool>
2022
+ [is_taproot]: <Get Taproot Type Tower Info Bool>
1986
2023
  lnd: <Authenticated LND API Object>
1987
2024
  }
1988
2025
 
@@ -2341,6 +2378,7 @@ Requires `invoices:read` permission
2341
2378
  [chain_address]: <Fallback Chain Address String>
2342
2379
  cltv_delta: <CLTV Delta Number>
2343
2380
  [confirmed_at]: <Settled at ISO 8601 Date String>
2381
+ [confirmed_index]: <Confirmed Index Number>
2344
2382
  created_at: <ISO 8601 Date String>
2345
2383
  description: <Description String>
2346
2384
  [description_hash]: <Description Hash Hex String>
package/index.js CHANGED
@@ -46,6 +46,7 @@ const {getChannel} = require('lightning');
46
46
  const {getChannelBalance} = require('lightning');
47
47
  const {getChannels} = require('lightning');
48
48
  const {getClosedChannels} = require('lightning');
49
+ const {getConfiguration} = require('lightning');
49
50
  const {getConnectedWatchtowers} = require('lightning');
50
51
  const {getEphemeralChannelIds} = require('lightning');
51
52
  const {getFailedPayments} = require('lightning');
@@ -205,6 +206,7 @@ module.exports = {
205
206
  getChannelBalance,
206
207
  getChannels,
207
208
  getClosedChannels,
209
+ getConfiguration,
208
210
  getConnectedWatchtowers,
209
211
  getEphemeralChannelIds,
210
212
  getFailedPayments,
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "bolt07": "1.8.4",
11
11
  "invoices": "3.0.0",
12
- "lightning": "10.2.0",
12
+ "lightning": "10.4.0",
13
13
  "macaroon": "3.0.4"
14
14
  },
15
15
  "description": "Interaction helper for your Lightning Network daemon",
@@ -24,7 +24,7 @@
24
24
  "bn.js": "5.2.1",
25
25
  "bs58check": "3.0.1",
26
26
  "ecpair": "2.1.0",
27
- "ln-docker-daemons": "6.0.6",
27
+ "ln-docker-daemons": "6.0.8",
28
28
  "p2tr": "2.0.0",
29
29
  "portfinder": "1.0.32",
30
30
  "psbt": "3.0.0",
@@ -69,5 +69,5 @@
69
69
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
70
70
  "test": "echo $DOCKER_LND_VERSION && node test/runner"
71
71
  },
72
- "version": "57.2.0"
72
+ "version": "57.4.0"
73
73
  }
@@ -0,0 +1,35 @@
1
+ const {deepEqual} = require('node:assert').strict;
2
+ const {equal} = require('node:assert').strict;
3
+ const {ok} = require('node:assert').strict;
4
+ const test = require('node:test');
5
+
6
+ const asyncRetry = require('async/retry');
7
+ const {spawnLightningCluster} = require('ln-docker-daemons');
8
+
9
+ const {getConfiguration} = require('./../../');
10
+ const {getWalletInfo} = require('./../../');
11
+
12
+ // Getting the configuration info should return info about the config
13
+ test(`Get configuration info`, async () => {
14
+ const {kill, nodes} = await spawnLightningCluster({});
15
+
16
+ const [{lnd}] = nodes;
17
+
18
+ try {
19
+ const {log, options} = await getConfiguration({lnd});
20
+
21
+ ok(!!log.length, 'Got the log lines');
22
+
23
+ const color = options.find(n => n.type === 'color').value.toLowerCase();
24
+
25
+ equal(color, (await getWalletInfo({lnd})).color, 'Got color from config');
26
+
27
+ await kill({});
28
+ } catch (err) {
29
+ await kill({});
30
+
31
+ deepEqual(err, [501, 'GetDebugConfigurationInfoNotSupported'], '404');
32
+ }
33
+
34
+ return;
35
+ });
@@ -24,12 +24,16 @@ test('Get forwards', async () => {
24
24
 
25
25
  const [{generate, lnd}, target, remote] = nodes;
26
26
 
27
- await setupChannel({generate, lnd, to: target});
27
+ await asyncRetry({interval, times}, async () => {
28
+ await addPeer({lnd, public_key: remote.id, socket: remote.socket});
28
29
 
29
- await setupChannel({
30
- lnd: target.lnd,
31
- generate: target.generate,
32
- to: remote,
30
+ await setupChannel({generate, lnd, to: target});
31
+
32
+ await setupChannel({
33
+ lnd: target.lnd,
34
+ generate: target.generate,
35
+ to: remote,
36
+ });
33
37
  });
34
38
 
35
39
  await addPeer({lnd, public_key: remote.id, socket: remote.socket});
@@ -24,14 +24,16 @@ test(`Get network centrality`, async () => {
24
24
  try {
25
25
  await control.generate({count: 100});
26
26
 
27
- await addPeer({lnd, public_key: remote.id, socket: remote.socket});
27
+ await asyncRetry({interval, times}, async () => {
28
+ await addPeer({lnd, public_key: remote.id, socket: remote.socket});
28
29
 
29
- await setupChannel({lnd, generate: control.generate, to: target});
30
+ await setupChannel({lnd, generate: control.generate, to: target});
30
31
 
31
- await setupChannel({
32
- generate: target.generate,
33
- lnd: target.lnd,
34
- to: remote,
32
+ await setupChannel({
33
+ generate: target.generate,
34
+ lnd: target.lnd,
35
+ to: remote,
36
+ });
35
37
  });
36
38
 
37
39
  await asyncRetry({interval, times}, async () => {
@@ -2,12 +2,15 @@ const {deepEqual} = require('node:assert').strict;
2
2
  const {equal} = require('node:assert').strict;
3
3
  const test = require('node:test');
4
4
 
5
+ const asyncRetry = require('async/retry');
5
6
  const {setupChannel} = require('ln-docker-daemons');
6
7
  const {spawnLightningCluster} = require('ln-docker-daemons');
7
8
 
8
9
  const {isDestinationPayable} = require('./../../');
9
10
 
11
+ const interval = 100;
10
12
  const size = 2;
13
+ const times = 1000;
11
14
  const tokens = 1e6 / 2;
12
15
 
13
16
  // Determining if a route is payable should indicate if a route can be found
@@ -17,7 +20,9 @@ test('Is destination payable', async () => {
17
20
  const [{generate, lnd}, target] = nodes;
18
21
 
19
22
  try {
20
- await setupChannel({generate, lnd, to: target});
23
+ await asyncRetry({interval, times}, async () => {
24
+ await setupChannel({generate, lnd, to: target});
25
+ });
21
26
 
22
27
  const canPay = await isDestinationPayable({lnd, destination: target.id});
23
28
 
@@ -42,7 +42,9 @@ test(`Pay via payment request`, async () => {
42
42
  }
43
43
  });
44
44
 
45
- const channel = await setupChannel({generate, lnd, to: target});
45
+ const channel = await asyncRetry({interval, times}, async () => {
46
+ return await setupChannel({generate, lnd, to: target});
47
+ });
46
48
 
47
49
  // Make sure that an error is returned when there is no route
48
50
  try {