ln-service 57.6.0 → 57.7.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,9 @@
1
1
  # Versions
2
2
 
3
+ ## 57.7.0
4
+
5
+ - `getPendingChannels`: Add support for `close_transaction` to return raw tx
6
+
3
7
  ## 57.6.0
4
8
 
5
9
  - `addAdvertisedFeature`: Add method to advertise a feature bit support
package/README.md CHANGED
@@ -3101,6 +3101,8 @@ Requires `offchain:read` permission
3101
3101
 
3102
3102
  `blocks_until_expiry` is not supported in LND 0.16.4 or before
3103
3103
 
3104
+ `close_transaction` is not supported in LND 0.17.4 or before
3105
+
3104
3106
  {
3105
3107
  lnd: <Authenticated LND API Object>
3106
3108
  }
@@ -3110,6 +3112,7 @@ Requires `offchain:read` permission
3110
3112
  pending_channels: [{
3111
3113
  [blocks_until_expiry]: <Blocks Until Open Channel Expires Number>
3112
3114
  capacity: <Channel Capacity Tokens Number>
3115
+ [close_transaction]: <Channel Closing Raw Transaction Hex String>
3113
3116
  [close_transaction_id]: <Channel Closing Transaction Id String>
3114
3117
  [description]: <Channel Description String>
3115
3118
  is_active: <Channel Is Active Bool>
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.6.0",
12
+ "lightning": "10.7.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.10",
27
+ "ln-docker-daemons": "6.0.11",
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.6.0"
72
+ "version": "57.7.0"
73
73
  }
@@ -1,7 +1,10 @@
1
+ const {equal} = require('node:assert').strict;
1
2
  const {strictEqual} = require('node:assert').strict;
2
3
  const test = require('node:test');
3
4
 
4
5
  const asyncRetry = require('async/retry');
6
+ const {componentsOfTransaction} = require('@alexbosworth/blockchain');
7
+ const {idForTransactionComponents} = require('@alexbosworth/blockchain');
5
8
  const {setupChannel} = require('ln-docker-daemons');
6
9
  const {spawnLightningCluster} = require('ln-docker-daemons');
7
10
 
@@ -11,6 +14,7 @@ const {getWalletInfo} = require('./../../');
11
14
 
12
15
  const defaultFee = 1e3;
13
16
  const give = 1e4;
17
+ const hexAsBuffer = hex => Buffer.from(hex, 'hex');
14
18
  const interval = 10;
15
19
  const size = 2;
16
20
  const times = 2000;
@@ -55,6 +59,30 @@ test(`Get pending channels`, async () => {
55
59
  return {channel};
56
60
  });
57
61
 
62
+ const transaction = channel.close_transaction;
63
+
64
+ // LND 0.17.4 and below do not support close_transaction
65
+ if (!!transaction) {
66
+ const components = componentsOfTransaction({transaction});
67
+
68
+ const closing = idForTransactionComponents({
69
+ inputs: components.inputs.map(input => ({
70
+ hash: hexAsBuffer(input.id).reverse(),
71
+ script: hexAsBuffer(input.script),
72
+ sequence: input.sequence,
73
+ vout: input.vout,
74
+ })),
75
+ locktime: components.locktime,
76
+ outputs: components.outputs.map(output => ({
77
+ script: hexAsBuffer(output.script),
78
+ tokens: output.tokens,
79
+ })),
80
+ version: components.version,
81
+ });
82
+
83
+ equal(closing.id, channel.close_transaction_id, 'Got closing tx');
84
+ }
85
+
58
86
  if (channel.is_partner_initiated !== undefined) {
59
87
  strictEqual(channel.is_partner_initiated, false, 'Channel initiated');
60
88
  }
@@ -82,11 +110,13 @@ test(`Get pending channels`, async () => {
82
110
  if (!!channel.remote_balance) {
83
111
  strictEqual(channel.remote_balance, give, 'Opposing channel balance');
84
112
  }
113
+
114
+ await kill({});
85
115
  } catch (err) {
116
+ await kill({});
117
+
86
118
  strictEqual(err, null, 'Expected no error');
87
119
  }
88
120
 
89
- await kill({});
90
-
91
121
  return;
92
122
  });