ln-service 53.11.0 → 53.14.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,19 @@
1
1
  # Versions
2
2
 
3
+ ## 53.14.0
4
+
5
+ - `addExternalSocket`: Add method to add a socket to graph announcements
6
+ - `removeExternalSocket`: Add method to remove sockets from graph announcements
7
+
8
+ ## 53.13.0
9
+
10
+ - `getWalletVersion`: Add support for LND 0.14.3-beta
11
+
12
+ ## 53.12.0
13
+
14
+ - `updateAlias`: Add method to update the node graph announcement alias
15
+ - `updateColor`: Add method to update the node graph announcement color
16
+
3
17
  ## 53.11.0
4
18
 
5
19
  - Use TLV for all hops when sending HTLCs along routes
package/README.md CHANGED
@@ -9,7 +9,7 @@ through npm.
9
9
 
10
10
  Supported LND versions:
11
11
 
12
- - v0.14.0-beta to v0.14.2-beta
12
+ - v0.14.0-beta to v0.14.3-beta
13
13
  - v0.13.0-beta to v0.13.4-beta
14
14
  - v0.12.0-beta to v0.12.1-beta
15
15
  - v0.11.0-beta to v0.11.1-beta
@@ -102,6 +102,7 @@ for `unlocker` methods.
102
102
 
103
103
  ## All Methods
104
104
 
105
+ - [addExternalSocket](#addexternalsocket) - Advertise a new p2p host:ip address
105
106
  - [addPeer](#addpeer) - Connect to a peer
106
107
  - [authenticatedLndGrpc](#authenticatedlndgrpc) - LND API Object
107
108
  - [broadcastChainTransaction](#broadcastchaintransaction) - Push a chain tx
@@ -201,6 +202,7 @@ for `unlocker` methods.
201
202
  - [proposeChannel](#proposechannel) - Offer a channel proposal to a peer
202
203
  - [recoverFundsFromChannel](#recoverfundsfromchannel) - Restore a channel
203
204
  - [recoverFundsFromChannels](#recoverfundsfromchannels) - Restore all channels
205
+ - [removeExternalSocket](#removeexternalsocket) - Remove a p2p host:ip announce
204
206
  - [removePeer](#removepeer) - Disconnect from a connected peer
205
207
  - [requestChainFeeIncrease](#requestchainfeeincrease) - Request a CPFP spend on
206
208
  a UTXO
@@ -249,8 +251,10 @@ for `unlocker` methods.
249
251
  - [unlockUtxo](#unlockutxo) - Release a locked UTXO so that it can be used
250
252
  again
251
253
  - [unlockWallet](#unlockwallet) - Unlock a locked lnd
254
+ - [updateAlias](#updatealias) - Update node graph identity alias
252
255
  - [updateChainTransaction](#updatechaintransaction) - Update a chain
253
256
  transaction
257
+ - [updateColor](#updatecolor) - Update node graph color value
254
258
  - [updateConnectedWatchtower](#updateconnectedwatchtower) - Update watchtower
255
259
  - [updatePathfindingSettings](#updatepathfindingsettings) - Update pathfinding
256
260
  configuration
@@ -271,14 +275,40 @@ for `unlocker` methods.
271
275
  - [lightning](https://npmjs.com/package/lightning) - methods with typescript
272
276
  typing support
273
277
  - [ln-accounting](https://npmjs.com/package/ln-accounting) - accounting records
274
- - [ln-docker-daemons](https://github.com/alexbosworth/ln-docker-daemons)
275
- - run regtest integration tests
278
+ - [ln-docker-daemons](https://github.com/alexbosworth/ln-docker-daemons) -
279
+ run regtest integration tests
276
280
  - [ln-pathfinding](https://npmjs.com/package/ln-accounting) - pathfinding
277
281
  utilities
278
282
  - [ln-sync](https://www.npmjs.com/package/ln-sync) - metadata helper methods
279
283
  - [probing](https://npmjs.com/package/probing) - payment probing utilities
280
284
  - [psbt](https://www.npmjs.com/package/psbt) - BIP 174 PSBT utilities
281
285
 
286
+ ### addExternalSocket
287
+
288
+ Add a new advertised p2p socket address
289
+
290
+ Note: this method is not supported in LND versions 0.14.3 and below
291
+
292
+ Requires LND built with `peersrpc` build tag
293
+
294
+ Requires `peers:write` permissions
295
+
296
+ {
297
+ lnd: <Authenticated LND API Object>
298
+ socket: <Add Socket Address String>
299
+ }
300
+
301
+ @returns via cbk or Promise
302
+
303
+ Example:
304
+
305
+ ```node
306
+ const {addExternalSocket} = require('ln-service');
307
+
308
+ // Add a new address to advertise on the graph via gossip
309
+ await addExternalSocket({lnd, socket: '192.168.0.1:9735'});
310
+ ```
311
+
282
312
  ### addPeer
283
313
 
284
314
  Add a peer if possible (not self, or already connected)
@@ -3537,7 +3567,7 @@ Requires `onchain:write` permission
3537
3567
 
3538
3568
  Requires LND built with `walletrpc` tag
3539
3569
 
3540
- This method is not supported in LND 0.14.3 and below
3570
+ This method is not supported in LND 0.14.1 and below
3541
3571
 
3542
3572
  {
3543
3573
  lnd: <Authenticated LND API Object>
@@ -4137,6 +4167,32 @@ const {backup} = await getBackups({lnd});
4137
4167
  await recoverFundsFromChannels({backup, lnd});
4138
4168
  ```
4139
4169
 
4170
+ ### removeExternalSocket
4171
+
4172
+ Remove an existing advertised p2p socket address
4173
+
4174
+ Note: this method is not supported in LND versions 0.14.3 and below
4175
+
4176
+ Requires LND built with `peersrpc` build tag
4177
+
4178
+ Requires `peers:write` permissions
4179
+
4180
+ {
4181
+ lnd: <Authenticated LND API Object>
4182
+ socket: <Remove Socket Address String>
4183
+ }
4184
+
4185
+ @returns via cbk or Promise
4186
+
4187
+ Example:
4188
+
4189
+ ```node
4190
+ const {removeExternalSocket} = require('ln-service');
4191
+
4192
+ // Stop an address being advertised on the graph via gossip
4193
+ await removeExternalSocket({lnd, socket: '127.0.0.1:9735'});
4194
+ ```
4195
+
4140
4196
  ### removePeer
4141
4197
 
4142
4198
  Remove a peer if possible
@@ -6571,6 +6627,32 @@ const {lnd} = unauthenticatedLndGrpc({});
6571
6627
  await unlockWallet({lnd, password: 'walletSecretPassword'});
6572
6628
  ```
6573
6629
 
6630
+ ### updateAlias
6631
+
6632
+ Update the node alias as advertised in the graph
6633
+
6634
+ Note: this method is not supported in LND versions 0.14.3 and below
6635
+
6636
+ Requires LND built with `peersrpc` build tag
6637
+
6638
+ Requires `peers:write` permissions
6639
+
6640
+ {
6641
+ alias: <Node Alias String>
6642
+ lnd: <Authenticated LND API Object>
6643
+ }
6644
+
6645
+ @returns via cbk or Promise
6646
+
6647
+ Example:
6648
+
6649
+ ```node
6650
+ const {updateAlias} = require('ln-service');
6651
+
6652
+ // Set the node alias to "foo"
6653
+ await updateAlias({lnd, alias: 'foo'});
6654
+ ```
6655
+
6574
6656
  ### updateChainTransaction
6575
6657
 
6576
6658
  Update an on-chain transaction record metadata
@@ -6599,6 +6681,32 @@ const [{id}] = transactions;
6599
6681
  await updateChainTransaction({id, lnd, description: 'First transaction'});
6600
6682
  ```
6601
6683
 
6684
+ ### updateColor
6685
+
6686
+ Update the node color as advertised in the graph
6687
+
6688
+ Note: this method is not supported in LND versions 0.14.3 and below
6689
+
6690
+ Requires LND built with `peersrpc` build tag
6691
+
6692
+ Requires `peers:write` permissions
6693
+
6694
+ {
6695
+ color: <Node Color String>
6696
+ lnd: <Authenticated LND API Object>
6697
+ }
6698
+
6699
+ @returns via cbk or Promise
6700
+
6701
+ Example:
6702
+
6703
+ ```node
6704
+ const {updateColor} = require('ln-service');
6705
+
6706
+ // Update the node color identity in the network graph
6707
+ await updateColor({lnd, color: '#123456'});
6708
+ ```
6709
+
6602
6710
  ### updateConnectedWatchtower
6603
6711
 
6604
6712
  Update a watchtower
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ const {addExternalSocket} = require('lightning');
1
2
  const {addPeer} = require('lightning');
2
3
  const {authenticatedLndGrpc} = require('lightning');
3
4
  const {broadcastChainTransaction} = require('lightning');
@@ -88,6 +89,7 @@ const {probeForRoute} = require('lightning');
88
89
  const {proposeChannel} = require('lightning');
89
90
  const {recoverFundsFromChannel} = require('lightning');
90
91
  const {recoverFundsFromChannels} = require('lightning');
92
+ const {removeExternalSocket} = require('lightning');
91
93
  const {removePeer} = require('lightning');
92
94
  const {requestChainFeeIncrease} = require('lightning');
93
95
  const {restrictMacaroon} = require('./macaroons');
@@ -129,7 +131,9 @@ const {subscribeToWalletStatus} = require('lightning');
129
131
  const {unauthenticatedLndGrpc} = require('lightning');
130
132
  const {unlockUtxo} = require('lightning');
131
133
  const {unlockWallet} = require('lightning');
134
+ const {updateAlias} = require('lightning');
132
135
  const {updateChainTransaction} = require('lightning');
136
+ const {updateColor} = require('lightning');
133
137
  const {updateConnectedWatchtower} = require('lightning');
134
138
  const {updatePathfindingSettings} = require('lightning');
135
139
  const {updateRoutingFees} = require('lightning');
@@ -140,6 +144,7 @@ const {verifyBytesSignature} = require('lightning');
140
144
  const {verifyMessage} = require('lightning');
141
145
 
142
146
  module.exports = {
147
+ addExternalSocket,
143
148
  addPeer,
144
149
  authenticatedLndGrpc,
145
150
  broadcastChainTransaction,
@@ -230,6 +235,7 @@ module.exports = {
230
235
  proposeChannel,
231
236
  recoverFundsFromChannel,
232
237
  recoverFundsFromChannels,
238
+ removeExternalSocket,
233
239
  removePeer,
234
240
  requestChainFeeIncrease,
235
241
  restrictMacaroon,
@@ -271,7 +277,9 @@ module.exports = {
271
277
  unauthenticatedLndGrpc,
272
278
  unlockUtxo,
273
279
  unlockWallet,
280
+ updateAlias,
274
281
  updateChainTransaction,
282
+ updateColor,
275
283
  updateConnectedWatchtower,
276
284
  updatePathfindingSettings,
277
285
  updateRoutingFees,
package/package.json CHANGED
@@ -10,8 +10,8 @@
10
10
  "bolt07": "1.8.1",
11
11
  "cors": "2.8.5",
12
12
  "express": "4.17.3",
13
- "invoices": "2.0.5",
14
- "lightning": "5.10.1",
13
+ "invoices": "2.0.6",
14
+ "lightning": "5.13.0",
15
15
  "macaroon": "3.0.4",
16
16
  "morgan": "1.10.0",
17
17
  "ws": "8.5.0"
@@ -28,7 +28,7 @@
28
28
  "bn.js": "5.2.0",
29
29
  "bs58check": "2.1.2",
30
30
  "ecpair": "2.0.1",
31
- "ln-docker-daemons": "2.2.7",
31
+ "ln-docker-daemons": "2.2.9",
32
32
  "p2tr": "1.3.1",
33
33
  "portfinder": "1.0.28",
34
34
  "psbt": "2.0.1",
@@ -57,6 +57,7 @@
57
57
  },
58
58
  "scripts": {
59
59
  "integration-test-daily-lnd-build": "DOCKER_LND_VERSION=daily-testing-only npm run test",
60
+ "integration-test-0.14.3": "DOCKER_LND_VERSION=v0.14.3-beta npm run test",
60
61
  "integration-test-0.14.2": "DOCKER_LND_VERSION=v0.14.2-beta npm run test",
61
62
  "integration-test-0.14.1": "DOCKER_LND_VERSION=v0.14.1-beta npm run test",
62
63
  "integration-test-0.14.0": "DOCKER_LND_VERSION=v0.14.0-beta npm run test",
@@ -67,7 +68,7 @@
67
68
  "integration-test-0.13.0": "DOCKER_LND_VERSION=v0.13.0-beta npm run test",
68
69
  "integration-test-0.12.1": "DOCKER_LND_VERSION=v0.12.1-beta npm run test",
69
70
  "integration-test-0.12.0": "DOCKER_LND_VERSION=v0.12.0-beta npm run test",
70
- "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/routerrpc-integration/*.js test/signerrpc-integration/*.js test/tower_clientrpc-integration/*.js test/tower_serverrpc-integration/*.js test/walletrpc-integration/*.js"
71
+ "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"
71
72
  },
72
- "version": "53.11.0"
73
+ "version": "53.14.0"
73
74
  }
@@ -0,0 +1,34 @@
1
+ const {spawnLightningCluster} = require('ln-docker-daemons');
2
+ const {test} = require('@alexbosworth/tap');
3
+
4
+ const {addExternalSocket} = require('./../../');
5
+ const {getWalletInfo} = require('./../../');
6
+
7
+ const socket = '192.168.0.1:12345';
8
+
9
+ // Adding a node socket should result in an updated advertised socket
10
+ test(`Add external socket`, async ({end, strictSame}) => {
11
+ const {kill, nodes} = await spawnLightningCluster({});
12
+
13
+ const [{id, lnd}] = nodes;
14
+
15
+ const additional = `${id}@${socket}`;
16
+
17
+ try {
18
+ const {uris} = await getWalletInfo({lnd});
19
+
20
+ const [existing] = uris;
21
+
22
+ await addExternalSocket({lnd, socket});
23
+
24
+ const updated = await getWalletInfo({lnd});
25
+
26
+ strictSame(updated.uris, [existing, additional], 'Added new socket');
27
+ } catch (err) {
28
+ strictSame(err, [400, 'ExpectedPeersRpcLndBuildTagToAddSocket']);
29
+ }
30
+
31
+ await kill({});
32
+
33
+ return end();
34
+ });
@@ -0,0 +1,32 @@
1
+ const {spawnLightningCluster} = require('ln-docker-daemons');
2
+ const {test} = require('@alexbosworth/tap');
3
+
4
+ const {getWalletInfo} = require('./../../');
5
+ const {removeExternalSocket} = require('./../../');
6
+
7
+ // Removign a node socket should result in a no longer advertised socket
8
+ test(`Add external socket`, async ({end, strictSame}) => {
9
+ const {kill, nodes} = await spawnLightningCluster({});
10
+
11
+ const [{id, lnd}] = nodes;
12
+
13
+ try {
14
+ const {uris} = await getWalletInfo({lnd});
15
+
16
+ const [uri] = uris;
17
+
18
+ const [, socket] = uri.split('@');
19
+
20
+ await removeExternalSocket({lnd, socket});
21
+
22
+ const updated = await getWalletInfo({lnd});
23
+
24
+ strictSame(updated.uris, [], 'External socket removed');
25
+ } catch (err) {
26
+ strictSame(err, [400, 'ExpectedPeersRpcLndBuildTagToRemoveSocket']);
27
+ }
28
+
29
+ await kill({});
30
+
31
+ return end();
32
+ });
@@ -0,0 +1,31 @@
1
+ const {spawnLightningCluster} = require('ln-docker-daemons');
2
+ const {test} = require('@alexbosworth/tap');
3
+
4
+ const {getWalletInfo} = require('./../../');
5
+ const {updateAlias} = require('./../../');
6
+
7
+ const alias = 'alias';
8
+
9
+ // Updating a node alias should result in an updated alias
10
+ test(`Update alias`, async ({end, strictSame}) => {
11
+ const {kill, nodes} = await spawnLightningCluster({});
12
+
13
+ const [{lnd}] = nodes;
14
+
15
+ try {
16
+ const {color} = await getWalletInfo({lnd});
17
+
18
+ await updateAlias({alias, lnd});
19
+
20
+ const updated = await getWalletInfo({lnd});
21
+
22
+ strictSame(updated.alias, alias, 'Alias was updated');
23
+ strictSame(updated.color, color, 'Color was not updated');
24
+ } catch (err) {
25
+ strictSame(err, [400, 'ExpectedPeersRpcLndBuildTagToUpdateAlias']);
26
+ }
27
+
28
+ await kill({});
29
+
30
+ return end();
31
+ });
@@ -0,0 +1,31 @@
1
+ const {spawnLightningCluster} = require('ln-docker-daemons');
2
+ const {test} = require('@alexbosworth/tap');
3
+
4
+ const {getWalletInfo} = require('./../../');
5
+ const {updateColor} = require('./../../');
6
+
7
+ const color = '#666666'
8
+
9
+ // Updating a node color should result in an updated color
10
+ test(`Update color`, async ({end, strictSame}) => {
11
+ const {kill, nodes} = await spawnLightningCluster({});
12
+
13
+ const [{lnd}] = nodes;
14
+
15
+ try {
16
+ const {alias} = await getWalletInfo({lnd});
17
+
18
+ await updateColor({color, lnd});
19
+
20
+ const updated = await getWalletInfo({lnd});
21
+
22
+ strictSame(updated.alias, alias, 'Alias was not updated');
23
+ strictSame(updated.color, color, 'Color was updated');
24
+ } catch (err) {
25
+ strictSame(err, [400, 'ExpectedPeersRpcLndBuildTagToUpdateColor']);
26
+ }
27
+
28
+ await kill({});
29
+
30
+ return end();
31
+ });