lightning 5.3.2 → 5.3.3

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
- ## 5.3.2
3
+ ## 5.3.3
4
4
 
5
5
  - `pay`, `payViaPaymentRequest`: Fix support for `outgoing_channels` constraint
6
6
 
@@ -3,6 +3,8 @@ const {returnResult} = require('asyncjs-util');
3
3
 
4
4
  const {isLnd} = require('./../../lnd_requests');
5
5
 
6
+ const bufferAsBase64 = buffer => buffer.toString('base64');
7
+ const {isBuffer} = Buffer;
6
8
  const method = 'initWallet';
7
9
  const type = 'unlocker';
8
10
  const utf8AsBuf = utf8 => Buffer.from(utf8, 'utf8');
@@ -19,6 +21,9 @@ const utf8AsBuf = utf8 => Buffer.from(utf8, 'utf8');
19
21
  }
20
22
 
21
23
  @returns via cbk or Promise
24
+ {
25
+ macaroon: <Base64 Encoded Admin Macaroon String>
26
+ }
22
27
  */
23
28
  module.exports = ({lnd, passphrase, password, seed}, cbk) => {
24
29
  return new Promise((resolve, reject) => {
@@ -47,12 +52,20 @@ module.exports = ({lnd, passphrase, password, seed}, cbk) => {
47
52
  cipher_seed_mnemonic: seed.split(' '),
48
53
  wallet_password: utf8AsBuf(password),
49
54
  },
50
- err => {
55
+ (err, res) => {
51
56
  if (!!err) {
52
57
  return cbk([503, 'UnexpectedInitWalletError', {err}]);
53
58
  }
54
59
 
55
- return cbk();
60
+ if (!res) {
61
+ return cbk([503, 'ExpectedResponseForInitWallet']);
62
+ }
63
+
64
+ if (!isBuffer(res.admin_macaroon)) {
65
+ return cbk([503, 'ExpectedAdminMacaroonToCrateWallet']);
66
+ }
67
+
68
+ return cbk(null, bufferAsBase64(res.admin_macaroon));
56
69
  });
57
70
  }],
58
71
  },
package/package.json CHANGED
@@ -57,5 +57,5 @@
57
57
  "directory": "test/typescript"
58
58
  },
59
59
  "types": "index.d.ts",
60
- "version": "5.3.2"
60
+ "version": "5.3.3"
61
61
  }
@@ -30,7 +30,13 @@ const tests = [
30
30
  },
31
31
  {
32
32
  args: {
33
- lnd: {unlocker: {initWallet: ({}, cbk) => cbk()}},
33
+ lnd: {
34
+ unlocker: {
35
+ initWallet: ({}, cbk) => cbk(null, {
36
+ admin_macaroon: Buffer.alloc(1),
37
+ }),
38
+ },
39
+ },
34
40
  password: 'pass',
35
41
  seed: 'seed',
36
42
  },