ln-service 56.14.0 → 57.0.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 +9 -0
- package/README.md +1 -53
- package/package.json +6 -9
- package/routers/grpc_proxy_server.js +0 -76
- package/routers/index.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 57.0.0
|
|
4
|
+
|
|
5
|
+
- Add support for LND 0.17.0
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- End support for node.js 16, require 18 or higher
|
|
10
|
+
- Remove method `grpcProxyServer`
|
|
11
|
+
|
|
3
12
|
## 56.14.0
|
|
4
13
|
|
|
5
14
|
- `openChannel`: Add `is_allowing_minimal_reserve` to allow no reserve on peer
|
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ through npm.
|
|
|
9
9
|
|
|
10
10
|
Supported LND versions:
|
|
11
11
|
|
|
12
|
+
- v0.17.0-beta
|
|
12
13
|
- v0.16.0-beta to v0.16.4-beta
|
|
13
14
|
- v0.15.2-beta to v0.15.5-beta
|
|
14
15
|
- v0.14.4-beta to v0.14.5-beta
|
|
@@ -3606,59 +3607,6 @@ const createInvoices = authenticatedLndGrpc({cert, macaroon, socket});
|
|
|
3606
3607
|
const {request} = await createInvoice({lnd: createInvoices.lnd, tokens: 1});
|
|
3607
3608
|
```
|
|
3608
3609
|
|
|
3609
|
-
### grpcProxyServer
|
|
3610
|
-
|
|
3611
|
-
Get a gRPC proxy server
|
|
3612
|
-
|
|
3613
|
-
{
|
|
3614
|
-
[bind]: <Bind to Address String>
|
|
3615
|
-
[cert]: <LND Cert Base64 String>
|
|
3616
|
-
log: <Log Function>
|
|
3617
|
-
path: <Router Path String>
|
|
3618
|
-
port: <Listen Port Number>
|
|
3619
|
-
socket: <LND Socket String>
|
|
3620
|
-
stream: <Log Write Stream Object>
|
|
3621
|
-
}
|
|
3622
|
-
|
|
3623
|
-
@returns
|
|
3624
|
-
{
|
|
3625
|
-
app: <Express Application Object>
|
|
3626
|
-
server: <Web Server Object>
|
|
3627
|
-
wss: <WebSocket Server Object>
|
|
3628
|
-
}
|
|
3629
|
-
|
|
3630
|
-
```node
|
|
3631
|
-
const {getWalletInfo} = require('ln-service');
|
|
3632
|
-
const {lndGateway} = require('lightning');
|
|
3633
|
-
const request = require('@alexbosworth/request');
|
|
3634
|
-
const websocket = require('ws');
|
|
3635
|
-
const {Writable} = require('stream');
|
|
3636
|
-
|
|
3637
|
-
const log = output => log(output);
|
|
3638
|
-
const path = '/lnd/';
|
|
3639
|
-
const port = 8050;
|
|
3640
|
-
|
|
3641
|
-
const {app, server, wss} = grpcProxyServer({
|
|
3642
|
-
log,
|
|
3643
|
-
path,
|
|
3644
|
-
port,
|
|
3645
|
-
cert: base64Encoded64TlsCertFileString,
|
|
3646
|
-
socket: 'localhost:10009',
|
|
3647
|
-
stream: new Writable({write: (chunk, encoding, cbk) => cbk()}),
|
|
3648
|
-
});
|
|
3649
|
-
|
|
3650
|
-
// Create an authenticated LND for the gRPC REST gateway
|
|
3651
|
-
const {lnd} = lndGateway({
|
|
3652
|
-
request,
|
|
3653
|
-
websocket,
|
|
3654
|
-
macaroon: base64EncodedMacaroonFileString,
|
|
3655
|
-
url: `http://localhost:${port}${path}`,
|
|
3656
|
-
});
|
|
3657
|
-
|
|
3658
|
-
// Make a request to a gRPC method through the REST proxy
|
|
3659
|
-
const nodeInfo = await getWalletInfo({lnd});
|
|
3660
|
-
```
|
|
3661
|
-
|
|
3662
3610
|
### isDestinationPayable
|
|
3663
3611
|
|
|
3664
3612
|
Determine if a payment destination is actually payable by probing it
|
package/package.json
CHANGED
|
@@ -8,13 +8,9 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"bolt07": "1.8.4",
|
|
11
|
-
"cors": "2.8.5",
|
|
12
|
-
"express": "4.18.2",
|
|
13
11
|
"invoices": "3.0.0",
|
|
14
|
-
"lightning": "
|
|
15
|
-
"macaroon": "3.0.4"
|
|
16
|
-
"morgan": "1.10.0",
|
|
17
|
-
"ws": "8.14.2"
|
|
12
|
+
"lightning": "10.0.0",
|
|
13
|
+
"macaroon": "3.0.4"
|
|
18
14
|
},
|
|
19
15
|
"description": "Interaction helper for your Lightning Network daemon",
|
|
20
16
|
"devDependencies": {
|
|
@@ -28,7 +24,7 @@
|
|
|
28
24
|
"bn.js": "5.2.1",
|
|
29
25
|
"bs58check": "3.0.1",
|
|
30
26
|
"ecpair": "2.1.0",
|
|
31
|
-
"ln-docker-daemons": "
|
|
27
|
+
"ln-docker-daemons": "6.0.1",
|
|
32
28
|
"p2tr": "2.0.0",
|
|
33
29
|
"portfinder": "1.0.32",
|
|
34
30
|
"psbt": "3.0.0",
|
|
@@ -39,7 +35,7 @@
|
|
|
39
35
|
"varuint-bitcoin": "1.1.2"
|
|
40
36
|
},
|
|
41
37
|
"engines": {
|
|
42
|
-
"node": ">=
|
|
38
|
+
"node": ">=18"
|
|
43
39
|
},
|
|
44
40
|
"keywords": [
|
|
45
41
|
"bitcoin",
|
|
@@ -56,6 +52,7 @@
|
|
|
56
52
|
"url": "https://github.com/alexbosworth/ln-service.git"
|
|
57
53
|
},
|
|
58
54
|
"scripts": {
|
|
55
|
+
"integration-test-0.17.0": "DOCKER_LND_VERSION=v0.17.0-beta npm run test",
|
|
59
56
|
"integration-test-0.16.4": "DOCKER_LND_VERSION=v0.16.4-beta npm run test",
|
|
60
57
|
"integration-test-0.16.3": "DOCKER_LND_VERSION=v0.16.3-beta npm run test",
|
|
61
58
|
"integration-test-0.16.2": "DOCKER_LND_VERSION=v0.16.2-beta npm run test",
|
|
@@ -69,5 +66,5 @@
|
|
|
69
66
|
"integration-test-0.14.4": "DOCKER_LND_VERSION=v0.14.4-beta npm run test",
|
|
70
67
|
"test": "echo $DOCKER_LND_VERSION && node test/runner"
|
|
71
68
|
},
|
|
72
|
-
"version": "
|
|
69
|
+
"version": "57.0.0"
|
|
73
70
|
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
const {createServer} = require('https');
|
|
2
|
-
|
|
3
|
-
const cors = require('cors');
|
|
4
|
-
const {emitGrpcEvents} = require('lightning');
|
|
5
|
-
const express = require('express');
|
|
6
|
-
const {grpcRouter} = require('lightning');
|
|
7
|
-
const logger = require('morgan');
|
|
8
|
-
const {Server} = require('ws');
|
|
9
|
-
|
|
10
|
-
const defaultBind = '127.0.0.1';
|
|
11
|
-
const hexAsBuffer = hex => Buffer.from(hex, 'hex');
|
|
12
|
-
const logFormat = ':method :url :status - :response-time ms - :user-agent';
|
|
13
|
-
const makeServer = (app, cert, key) => createServer({cert, key}, app);
|
|
14
|
-
|
|
15
|
-
/** Get a gRPC proxy server
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
[bind]: <Bind to Address String>
|
|
19
|
-
[cert]: <LND Cert Base64 String>
|
|
20
|
-
log: <Log Function>
|
|
21
|
-
path: <Router Path String>
|
|
22
|
-
port: <Listen Port Number>
|
|
23
|
-
socket: <LND Socket String>
|
|
24
|
-
stream: <Log Write Stream Object>
|
|
25
|
-
[tls]: {
|
|
26
|
-
cert: <Server Cert Hex String>
|
|
27
|
-
key: <Server Key Hex String>
|
|
28
|
-
port: <TLS Server Port Number>
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@returns
|
|
33
|
-
{
|
|
34
|
-
app: <Express Application Object>
|
|
35
|
-
[secure]: {
|
|
36
|
-
server: <HTTPS Server Object>
|
|
37
|
-
wss: <HTTPS WebSocket Server Object>
|
|
38
|
-
}
|
|
39
|
-
server: <Web Server Object>
|
|
40
|
-
wss: <WebSocket Server Object>
|
|
41
|
-
}
|
|
42
|
-
*/
|
|
43
|
-
module.exports = ({bind, cert, log, path, port, socket, stream, tls}) => {
|
|
44
|
-
const app = express();
|
|
45
|
-
|
|
46
|
-
const server = app
|
|
47
|
-
.listen(port, () => log(null, `Listening: ${port}`))
|
|
48
|
-
.on('error', err => log([500, 'ListenError', err]));
|
|
49
|
-
|
|
50
|
-
if (!!tls) {
|
|
51
|
-
const tlsCert = hexAsBuffer(tls.cert);
|
|
52
|
-
const tlsKey = hexAsBuffer(tls.key);
|
|
53
|
-
|
|
54
|
-
const secure = makeServer(app, tlsCert, tlsKey);
|
|
55
|
-
|
|
56
|
-
const secureWss = new Server({server: secure});
|
|
57
|
-
|
|
58
|
-
secureWss.on('connection', ws => emitGrpcEvents({cert, socket, ws}));
|
|
59
|
-
|
|
60
|
-
secure.listen(tls.port);
|
|
61
|
-
|
|
62
|
-
log(null, `Listening for TLS: ${tls.port}`);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
app.use(cors());
|
|
66
|
-
app.use(logger(logFormat, {stream}));
|
|
67
|
-
|
|
68
|
-
app.use(path, grpcRouter({cert, socket}));
|
|
69
|
-
|
|
70
|
-
const wss = new Server({server});
|
|
71
|
-
|
|
72
|
-
wss.on('connection', ws => emitGrpcEvents({cert, socket, ws}));
|
|
73
|
-
wss.on('listening', () => {});
|
|
74
|
-
|
|
75
|
-
return {app, server, wss};
|
|
76
|
-
};
|
package/routers/index.js
DELETED