lightning 4.14.3 → 4.14.4

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,6 +1,6 @@
1
1
  # Versions
2
2
 
3
- ## 4.14.3
3
+ ## 4.14.4
4
4
 
5
5
  - `getPayment`, `subscribeToPastPayment`: Add `pending` for pending payment details
6
6
 
package/index.js CHANGED
@@ -75,10 +75,10 @@ const {lndGateway} = require('./lnd_gateway');
75
75
  const {lockUtxo} = require('./lnd_methods');
76
76
  const {openChannel} = require('./lnd_methods');
77
77
  const {openChannels} = require('./lnd_methods');
78
+ const {pay} = require('./lnd_methods');
78
79
  const {payViaPaymentDetails} = require('./lnd_methods');
79
80
  const {payViaPaymentRequest} = require('./lnd_methods');
80
81
  const {payViaRoutes} = require('./lnd_methods');
81
- const {pay} = require('./lnd_methods');
82
82
  const {prepareForChannelProposal} = require('./lnd_methods');
83
83
  const {probeForRoute} = require('./lnd_methods');
84
84
  const {proposeChannel} = require('./lnd_methods');
@@ -123,8 +123,8 @@ const {subscribeToWalletStatus} = require('./lnd_methods');
123
123
  const {unauthenticatedLndGrpc} = require('./lnd_grpc');
124
124
  const {unlockUtxo} = require('./lnd_methods');
125
125
  const {unlockWallet} = require('./lnd_methods');
126
- const {updateConnectedWatchtower} = require('./lnd_methods');
127
126
  const {updateChainTransaction} = require('./lnd_methods');
127
+ const {updateConnectedWatchtower} = require('./lnd_methods');
128
128
  const {updatePathfindingSettings} = require('./lnd_methods');
129
129
  const {updateRoutingFees} = require('./lnd_methods');
130
130
  const {verifyAccess} = require('./lnd_methods');
@@ -211,10 +211,10 @@ module.exports = {
211
211
  lockUtxo,
212
212
  openChannel,
213
213
  openChannels,
214
+ pay,
214
215
  payViaPaymentDetails,
215
216
  payViaPaymentRequest,
216
217
  payViaRoutes,
217
- pay,
218
218
  prepareForChannelProposal,
219
219
  probeForRoute,
220
220
  proposeChannel,
@@ -259,8 +259,8 @@ module.exports = {
259
259
  unauthenticatedLndGrpc,
260
260
  unlockUtxo,
261
261
  unlockWallet,
262
- updateConnectedWatchtower,
263
262
  updateChainTransaction,
263
+ updateConnectedWatchtower,
264
264
  updatePathfindingSettings,
265
265
  updateRoutingFees,
266
266
  verifyAccess,
@@ -6,8 +6,6 @@ import {
6
6
  export type DisconnectWatchtowerArgs = AuthenticatedLightningArgs<{
7
7
  /** Watchtower Public Key Hex String */
8
8
  public_key: string;
9
- /** Retry Delay Milliseconds Number */
10
- retry_delay?: number;
11
9
  }>;
12
10
 
13
11
  /**
@@ -17,7 +17,6 @@ const unimplementedError = '12 UNIMPLEMENTED: unknown service wtclientrpc.Watcht
17
17
  {
18
18
  lnd: <Authenticated LND API Object>
19
19
  public_key: <Watchtower Public Key Hex String>
20
- [retry_delay]: <Retry Delay Milliseconds Number>
21
20
  }
22
21
 
23
22
  @returns via cbk or Promise
@@ -8,10 +8,12 @@ const {confirmedFromPayment} = require('./../../lnd_responses');
8
8
  const {confirmedFromPaymentStatus} = require('./../../lnd_responses');
9
9
  const emitPayment = require('./emit_payment');
10
10
  const {failureFromPayment} = require('./../../lnd_responses');
11
+ const {handleRemoveListener} = require('./../../grpc');
11
12
  const {isLnd} = require('./../../lnd_requests');
12
13
  const {safeTokens} = require('./../../bolt00');
13
14
  const {states} = require('./payment_states');
14
15
 
16
+ const events = ['confirmed', 'failed', 'paying'];
15
17
  const hexToBuffer = hex => Buffer.from(hex, 'hex');
16
18
  const {isArray} = Array;
17
19
  const isHash = n => /^[0-9A-F]{64}$/i.test(n);
@@ -141,6 +143,9 @@ module.exports = args => {
141
143
 
142
144
  const sub = args.lnd[type][method]({payment_hash: hash});
143
145
 
146
+ // Terminate subscription when all listeners are removed
147
+ handleRemoveListener({emitter, events, subscription: sub});
148
+
144
149
  sub.on('data', data => emitPayment({data, emitter}));
145
150
  sub.on('end', () => emitter.emit('end'));
146
151
  sub.on('error', err => emitError(err));
package/package.json CHANGED
@@ -22,7 +22,7 @@
22
22
  "bolt09": "0.2.0",
23
23
  "cbor": "8.1.0",
24
24
  "express": "4.17.1",
25
- "invoices": "2.0.1",
25
+ "invoices": "2.0.2",
26
26
  "psbt": "1.1.10"
27
27
  },
28
28
  "description": "Lightning Network client library",
@@ -56,5 +56,5 @@
56
56
  "directory": "test/typescript"
57
57
  },
58
58
  "types": "index.d.ts",
59
- "version": "4.14.3"
59
+ "version": "4.14.4"
60
60
  }
@@ -52,6 +52,8 @@ const makeLnd = args => {
52
52
  };
53
53
  const emitter = new EventEmitter();
54
54
 
55
+ emitter.cancel = () => {};
56
+
55
57
  if (!!args.is_end) {
56
58
  process.nextTick(() => emitter.emit('end'));
57
59
  } else if (!!args.err) {
@@ -10,13 +10,7 @@ expectError(disconnectWatchtower());
10
10
  expectError(disconnectWatchtower({}));
11
11
  expectError(disconnectWatchtower({lnd}));
12
12
  expectError(disconnectWatchtower({public_key}));
13
- expectError(disconnectWatchtower({retry_delay}));
14
- expectError(disconnectWatchtower({lnd, retry_delay}));
15
13
 
16
14
  expectType<void>(await disconnectWatchtower({lnd, public_key}));
17
- expectType<void>(await disconnectWatchtower({lnd, public_key, retry_delay}));
18
15
 
19
16
  expectType<void>(disconnectWatchtower({lnd, public_key}, () => {}));
20
- expectType<void>(
21
- disconnectWatchtower({lnd, public_key, retry_delay}, () => {})
22
- );