lightning 10.14.4 → 10.15.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,10 @@
1
1
  # Versions
2
2
 
3
+ ## 10.15.0
4
+
5
+ - `authenticatedLndGrpc`, `unauthenticatedLndGrpc`: Add `path` to specify the
6
+ protos directory
7
+
3
8
  ## 10.14.4
4
9
 
5
10
  - `getChannel`: Add support for specifying `transaction_id` and
@@ -24,6 +24,7 @@ const pathForProto = proto => join(__dirname, protosDir, proto);
24
24
  {
25
25
  [cert]: <Base64 or Hex Serialized LND TLS Cert>
26
26
  [macaroon]: <Base64 or Hex Serialized Macaroon String>
27
+ [path]: <Path to Proto Files Directory String>
27
28
  [socket]: <Host:Port Network Address String>
28
29
  }
29
30
 
@@ -47,7 +48,7 @@ const pathForProto = proto => join(__dirname, protosDir, proto);
47
48
  }
48
49
  }
49
50
  */
50
- module.exports = ({cert, macaroon, socket}) => {
51
+ module.exports = ({cert, macaroon, path, socket}) => {
51
52
  const {credentials} = grpcCredentials({cert, macaroon});
52
53
  const lndSocket = socket || defaultSocket;
53
54
 
@@ -65,11 +66,13 @@ module.exports = ({cert, macaroon, socket}) => {
65
66
  lnd: keys(serviceTypes).reduce((services, type) => {
66
67
  const service = serviceTypes[type];
67
68
 
69
+ const file = protoFiles[service];
70
+
68
71
  services[type] = apiForProto({
69
72
  credentials,
70
73
  params,
71
74
  service,
72
- path: pathForProto(protoFiles[service]),
75
+ path: !!path ? join(path, file) : pathForProto(file),
73
76
  socket: lndSocket,
74
77
  type: packageTypes[service],
75
78
  });
@@ -1,6 +1,8 @@
1
1
  export type LndAuthentication = {
2
2
  /** Base64 or Hex Serialized LND TLS Cert String */
3
3
  cert?: string;
4
+ /** Path to proto files */
5
+ path?: string;
4
6
  /** Host:Port String */
5
7
  socket?: string;
6
8
  };
@@ -14,6 +14,7 @@ const {unauthenticatedServiceTypes} = require('./../grpc');
14
14
 
15
15
  const {GRPC_SSL_CIPHER_SUITES} = process.env;
16
16
  const {keys} = Object;
17
+ const pathToProto = file => join(__dirname, protosDir, file);
17
18
 
18
19
  /** Unauthenticated gRPC interface to the Lightning Network Daemon (lnd).
19
20
 
@@ -21,6 +22,7 @@ const {keys} = Object;
21
22
 
22
23
  {
23
24
  [cert]: <Base64 or Hex Serialized LND TLS Cert String>
25
+ [path]: <Path to Proto Files Directory String>
24
26
  [socket]: <Host:Port String>
25
27
  }
26
28
 
@@ -35,7 +37,7 @@ const {keys} = Object;
35
37
  }
36
38
  }
37
39
  */
38
- module.exports = ({cert, socket}) => {
40
+ module.exports = ({cert, path, socket}) => {
39
41
  const credentials = grpcSsl({cert}).ssl;
40
42
  const lndSocket = socket || defaultSocket;
41
43
 
@@ -48,7 +50,9 @@ module.exports = ({cert, socket}) => {
48
50
  lnd: keys(unauthenticatedServiceTypes).reduce((services, type) => {
49
51
  const service = unauthenticatedServiceTypes[type];
50
52
 
51
- const protoPath = join(__dirname, protosDir, protoFiles[service]);
53
+ const file = protoFiles[service];
54
+
55
+ const protoPath = !!path ? join(path, file) : pathToProto(file);
52
56
 
53
57
  const rpc = grpc.loadPackageDefinition(loadSync(protoPath, grpcOptions));
54
58
 
package/package.json CHANGED
@@ -7,9 +7,9 @@
7
7
  "url": "https://github.com/alexbosworth/lightning/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@grpc/grpc-js": "1.10.10",
10
+ "@grpc/grpc-js": "1.10.11",
11
11
  "@grpc/proto-loader": "0.7.13",
12
- "@types/node": "20.14.9",
12
+ "@types/node": "20.14.10",
13
13
  "@types/request": "2.48.12",
14
14
  "@types/ws": "8.5.10",
15
15
  "async": "3.2.5",
@@ -53,5 +53,5 @@
53
53
  "directory": "test/typescript"
54
54
  },
55
55
  "types": "index.d.ts",
56
- "version": "10.14.4"
56
+ "version": "10.15.0"
57
57
  }
@@ -1,5 +1,6 @@
1
1
  const {deepStrictEqual} = require('node:assert').strict;
2
2
  const {equal} = require('node:assert').strict;
3
+ const {join} = require('path');
3
4
  const test = require('node:test');
4
5
 
5
6
  const {authenticatedLndGrpc} = require('./../../');
@@ -30,6 +31,11 @@ const tests = [
30
31
  description: 'Passing a cert for the authenticated LND grpc is supported',
31
32
  expected: {services: expectedServices},
32
33
  },
34
+ {
35
+ args: {path: join(__dirname, '../../grpc/protos')},
36
+ description: 'The path can be specified',
37
+ expected: {services: expectedServices},
38
+ },
33
39
  ];
34
40
 
35
41
  tests.forEach(({args, description, expected}) => {
@@ -1,5 +1,6 @@
1
1
  const {deepStrictEqual} = require('node:assert').strict;
2
2
  const {equal} = require('node:assert').strict;
3
+ const {join} = require('path');
3
4
  const test = require('node:test');
4
5
 
5
6
  const {unauthenticatedLndGrpc} = require('./../../');
@@ -17,6 +18,11 @@ const tests = [
17
18
  description: 'Passing a cert for the authenticated LND grpc is supported',
18
19
  expected: {services: expectedServices},
19
20
  },
21
+ {
22
+ args: {path: join(__dirname, '../../grpc/protos')},
23
+ description: 'The path can be specified',
24
+ expected: {services: expectedServices},
25
+ },
20
26
  ];
21
27
 
22
28
  tests.forEach(({args, description, expected}) => {