ln-service 56.3.1 → 56.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
+ ## 56.4.0
4
+
5
+ - `getChannels`: Add `description` to show the channel description
6
+ - `openChannel`, `openChannels`, `proposeChannel`: Add `description` to set
7
+ the channel description
8
+ - `subscribeToChannels`: Add `description` to `channel_opened`
9
+ - `subscribeToRpcRequests`: Add `description` to `open_channel_request`
10
+
3
11
  ## 56.3.1
4
12
 
5
13
  - `subscribeToPastPayment`, `subscribeToPayViaDetails`,
package/README.md CHANGED
@@ -1684,6 +1684,8 @@ Requires `offchain:read` permission
1684
1684
 
1685
1685
  `is_trusted_funding` is not supported on LND 0.15.0 and below
1686
1686
 
1687
+ `description` is not supported on LND 0.16.3 and below
1688
+
1687
1689
  {
1688
1690
  [is_active]: <Limit Results To Only Active Channels Bool> // false
1689
1691
  [is_offline]: <Limit Results To Only Offline Channels Bool> // false
@@ -1701,6 +1703,7 @@ Requires `offchain:read` permission
1701
1703
  commit_transaction_weight: <Commit Transaction Weight Number>
1702
1704
  [cooperative_close_address]: <Coop Close Restricted to Address String>
1703
1705
  [cooperative_close_delay_height]: <Prevent Coop Close Until Height Number>
1706
+ [description]: <Channel Description String>
1704
1707
  id: <Standard Format Channel Id String>
1705
1708
  is_active: <Channel Active Bool>
1706
1709
  is_closing: <Channel Is Closing Bool>
@@ -3698,12 +3701,15 @@ Requires `offchain:write`, `onchain:write`, `peers:write` permissions
3698
3701
  `base_fee_mtokens` is not supported on LND 0.15.5 and below
3699
3702
  `fee_rate` is not supported on LND 0.15.5 and below
3700
3703
 
3701
- `is_max_funding` is not supported on LND 0.16.0 and below
3704
+ `is_max_funding` is not supported on LND 0.16.3 and below
3705
+
3706
+ `description` is not supported on LND 0.16.3 and below
3702
3707
 
3703
3708
  {
3704
3709
  [base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
3705
3710
  [chain_fee_tokens_per_vbyte]: <Chain Fee Tokens Per VByte Number>
3706
3711
  [cooperative_close_address]: <Restrict Cooperative Close To Address String>
3712
+ [description]: <Immutable Channel Description String>
3707
3713
  [fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
3708
3714
  [give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
3709
3715
  [is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
@@ -3754,11 +3760,14 @@ as well as a channel open request listener to accept the trusted funding.
3754
3760
  `base_fee_mtokens` is not supported on LND 0.15.5 and below
3755
3761
  `fee_rate` is not supported on LND 0.15.5 and below
3756
3762
 
3763
+ `description` is not supported on LND 0.16.3 and below
3764
+
3757
3765
  {
3758
3766
  channels: [{
3759
3767
  [base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
3760
3768
  capacity: <Channel Capacity Tokens Number>
3761
3769
  [cooperative_close_address]: <Restrict Coop Close To Address String>
3770
+ [description]: <Immutable Channel Description String>
3762
3771
  [fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
3763
3772
  [give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
3764
3773
  [is_private]: <Channel is Private Bool> // Defaults to false
@@ -4384,10 +4393,13 @@ Requires `address:read`, `offchain:write`, `onchain:write` permissions
4384
4393
 
4385
4394
  Requires LND compiled with `walletrpc` build tag
4386
4395
 
4396
+ `description` is not supported on LND 0.16.3 and below
4397
+
4387
4398
  {
4388
4399
  capacity: <Channel Capacity Tokens Number>
4389
4400
  [cooperative_close_address]: <Restrict Cooperative Close To Address String>
4390
4401
  [cooperative_close_delay]: <Cooperative Close Relative Delay Number>
4402
+ [description]: <Immutable Channel Description String>
4391
4403
  [give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
4392
4404
  id: <Pending Channel Id Hex String>
4393
4405
  [is_private]: <Channel is Private Bool> // Defaults to false
@@ -5251,6 +5263,8 @@ Requires `offchain:read` permission
5251
5263
 
5252
5264
  `is_trusted_funding`, `other_ids` are not supported on LND 0.15.0 and below
5253
5265
 
5266
+ `description` is not supported on LND 0.16.3 and below
5267
+
5254
5268
  {
5255
5269
  lnd: <Authenticated LND API Object>
5256
5270
  }
@@ -5308,6 +5322,7 @@ Requires `offchain:read` permission
5308
5322
  commit_transaction_weight: <Commit Transaction Weight Number>
5309
5323
  [cooperative_close_address]: <Coop Close Restricted to Address String>
5310
5324
  [cooperative_close_delay_height]: <Prevent Coop Close Until Height Number>
5325
+ [description]: <Channel Description String>
5311
5326
  id: <Standard Format Channel Id String>
5312
5327
  is_active: <Channel Active Bool>
5313
5328
  is_closing: <Channel Is Closing Bool>
@@ -6790,6 +6805,8 @@ LND must be running with "RPC middleware" enabled: `rpcmiddleware.enable=1`
6790
6805
 
6791
6806
  This method is not supported in LND 0.13.4 and below
6792
6807
 
6808
+ `description` is not supported on LND 0.16.3 and below
6809
+
6793
6810
  {
6794
6811
  [id]: <RPC Middleware Interception Name String>
6795
6812
  [is_intercepting_close_channel_requests]: <Intercept Channel Closes Bool>
@@ -6833,6 +6850,7 @@ This method is not supported in LND 0.13.4 and below
6833
6850
  [base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
6834
6851
  [chain_fee_tokens_per_vbyte]: <Chain Fee Tokens Per VByte Number>
6835
6852
  [cooperative_close_address]: <Prefer Cooperative Close To Address String>
6853
+ [description]: <Immutable Channel Description String>
6836
6854
  [fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
6837
6855
  [give_tokens]: <Tokens to Gift To Partner Number>
6838
6856
  [is_private]: <Channel is Private Bool>
package/package.json CHANGED
@@ -11,13 +11,14 @@
11
11
  "cors": "2.8.5",
12
12
  "express": "4.18.2",
13
13
  "invoices": "2.2.3",
14
- "lightning": "9.3.1",
14
+ "lightning": "9.4.0",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.13.0"
18
18
  },
19
19
  "description": "Interaction helper for your Lightning Network daemon",
20
20
  "devDependencies": {
21
+ "@alexbosworth/blockchain": "1.3.0",
21
22
  "@alexbosworth/tap": "15.0.12",
22
23
  "@alexbosworth/node-fetch": "2.6.2",
23
24
  "async": "3.2.4",
@@ -28,11 +29,11 @@
28
29
  "bn.js": "5.2.1",
29
30
  "bs58check": "3.0.1",
30
31
  "ecpair": "2.1.0",
31
- "ln-docker-daemons": "5.0.3",
32
+ "ln-docker-daemons": "5.0.4",
32
33
  "p2tr": "1.3.3",
33
34
  "portfinder": "1.0.32",
34
35
  "psbt": "2.7.2",
35
- "rimraf": "5.0.0",
36
+ "rimraf": "5.0.1",
36
37
  "secp256k1": "5.0.0",
37
38
  "tiny-secp256k1": "2.2.1",
38
39
  "uuid": "9.0.0",
@@ -67,5 +68,5 @@
67
68
  "integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
68
69
  "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"
69
70
  },
70
- "version": "56.3.1"
71
+ "version": "56.4.0"
71
72
  }
@@ -1,15 +1,10 @@
1
- const asyncRetry = require('async/retry');
2
- const {Block} = require('bitcoinjs-lib');
1
+ const {idForBlock} = require('@alexbosworth/blockchain');
3
2
  const {spawnLightningCluster} = require('ln-docker-daemons');
4
3
  const {test} = require('@alexbosworth/tap');
5
4
 
6
5
  const {getBlock} = require('./../../');
7
6
  const {getHeight} = require('./../../');
8
7
 
9
- const confirmationCount = 6;
10
- const {fromHex} = Block;
11
- const times = 100;
12
-
13
8
  // Get height should return height
14
9
  test(`Get height`, async ({end, equal, fail}) => {
15
10
  const {nodes} = await spawnLightningCluster({});
@@ -25,7 +20,7 @@ test(`Get height`, async ({end, equal, fail}) => {
25
20
  try {
26
21
  const {block} = await getBlock({lnd, id: blockchain.current_block_hash});
27
22
 
28
- equal(fromHex(block).getId(), hash, 'Got block');
23
+ equal(idForBlock({block}).id, hash, 'Got block');
29
24
  } catch (err) {
30
25
  const [code, message] = err;
31
26
 
@@ -40,8 +35,7 @@ test(`Get height`, async ({end, equal, fail}) => {
40
35
  // Try getting a block by the height
41
36
  try {
42
37
  const {block} = await getBlock({height, lnd});
43
-
44
- equal(fromHex(block).getId(), hash, 'Got block for height');
38
+ equal(idForBlock({block}).id, hash, 'Got block for height');
45
39
  } catch (err) {
46
40
  equal(err, null, 'Expected no error');
47
41
  }
@@ -50,7 +44,7 @@ test(`Get height`, async ({end, equal, fail}) => {
50
44
  try {
51
45
  const {block} = await getBlock({lnd});
52
46
 
53
- equal(fromHex(block).getId(), hash, 'Got chain tip block');
47
+ equal(idForBlock({block}).id, hash, 'Got chain tip block');
54
48
  } catch (err) {
55
49
  equal(err, null, 'Expected no error');
56
50
  }
@@ -15,6 +15,7 @@ const count = 100;
15
15
  const defaultBaseFee = '1000';
16
16
  const defaultFee = 1e3;
17
17
  const defaultVout = 0;
18
+ const description = 'description';
18
19
  const feeRate = 420;
19
20
  const giftTokens = 1000;
20
21
  const interval = 250;
@@ -36,6 +37,7 @@ test(`Open channel`, async ({end, equal}) => {
36
37
  await addPeer({lnd, public_key: target.id, socket: target.socket});
37
38
 
38
39
  return await openChannel({
40
+ description,
39
41
  lnd,
40
42
  base_fee_mtokens: baseFee,
41
43
  chain_fee_tokens_per_vbyte: defaultFee,
@@ -62,6 +64,10 @@ test(`Open channel`, async ({end, equal}) => {
62
64
  throw new Error('ExpectedChannelOpened');
63
65
  }
64
66
 
67
+ if (!!channel.description) {
68
+ equal(channel.description, description, 'Description set');
69
+ }
70
+
65
71
  const {policies} = await getChannel({lnd, id: channel.id});
66
72
 
67
73
  const policy = policies.find(n => n.public_key === id);
@@ -12,6 +12,7 @@ const {subscribeToChannels} = require('./../../');
12
12
 
13
13
  const channelCapacityTokens = 1e6;
14
14
  const defaultFee = 1e3;
15
+ const description = 'description';
15
16
  const giveTokens = 1e5;
16
17
  const interval = 100;
17
18
  const size = 2;
@@ -56,6 +57,7 @@ test('Subscribe to channels', async ({end, equal, fail}) => {
56
57
 
57
58
  // Create a channel from the control to the target node
58
59
  return await openChannel({
60
+ description,
59
61
  lnd,
60
62
  socket,
61
63
  chain_fee_tokens_per_vbyte: defaultFee,
@@ -105,6 +107,11 @@ test('Subscribe to channels', async ({end, equal, fail}) => {
105
107
  equal(openEvent.local_balance, 890950, 'Channel local balance returned');
106
108
  }
107
109
 
110
+ // LND 0.16.3 and below do not support channel descriptions
111
+ if (!!openEvent.description) {
112
+ equal(openEvent.description, description, 'Got channel open description');
113
+ }
114
+
108
115
  equal(openEvent.capacity, channelCapacityTokens, 'Channel open capacity');
109
116
  equal(!!openEvent.id, true, 'Channel id is returned');
110
117
  equal(openEvent.is_active, true, 'Channel is active');
@@ -1,8 +1,8 @@
1
1
  const asyncRetry = require('async/retry');
2
+ const {componentsOfTransaction} = require('@alexbosworth/blockchain');
2
3
  const {script} = require('bitcoinjs-lib');
3
4
  const {spawnLightningCluster} = require('ln-docker-daemons');
4
5
  const {test} = require('@alexbosworth/tap');
5
- const {Transaction} = require('bitcoinjs-lib');
6
6
 
7
7
  const {getChainTransactions} = require('./../../');
8
8
  const {sendToChainOutputScripts} = require('./../../');
@@ -12,7 +12,6 @@ const asHex = buffer => buffer.toString('hex');
12
12
  const {compile} = script;
13
13
  const confirmationCount = 6;
14
14
  const count = 100;
15
- const {fromHex} = Transaction;
16
15
  const interval = 10;
17
16
  const OP_RETURN = 0x6a;
18
17
  const size = 2;
@@ -33,9 +32,8 @@ test(`Send to chain output scripts`, async ({end, equal, strictSame}) => {
33
32
 
34
33
  const sent = await sendToChainOutputScripts({lnd, send_to: sendTo});
35
34
 
36
- const outs = fromHex(sent.transaction).outs
37
- .filter(n => n.value === tokens)
38
- .map(({script, value}) => ({script: asHex(script), tokens: value}));
35
+ const outs = componentsOfTransaction({transaction: sent.transaction}).outputs
36
+ .filter(n => n.tokens === tokens);
39
37
 
40
38
  // The OP_RETURN is present in the output
41
39
  strictSame(outs, sendTo, 'Got expected outputs');
@@ -1,5 +1,4 @@
1
1
  const asyncRetry = require('async/retry');
2
- const {address} = require('bitcoinjs-lib');
3
2
  const {decodePsbt} = require('psbt');
4
3
  const {spawnLightningCluster} = require('ln-docker-daemons');
5
4
  const {test} = require('@alexbosworth/tap');
@@ -19,7 +18,6 @@ const confirmationCount = 6;
19
18
  const count = 100;
20
19
  const description = 'description';
21
20
  const format = 'p2wpkh';
22
- const {fromBech32} = address;
23
21
  const interval = 10;
24
22
  const regtestBech32AddressHrp = 'bcrt';
25
23
  const size = 2;