lightning 10.14.3 → 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 +6 -1
- package/grpc/protos/invoices.proto +52 -1
- package/grpc/protos/router.proto +9 -0
- package/lnd_grpc/authenticated_lnd_grpc.js +5 -2
- package/lnd_grpc/unauthenticated_lnd_grpc.d.ts +2 -0
- package/lnd_grpc/unauthenticated_lnd_grpc.js +6 -2
- package/lnd_methods/offchain/subscribe_to_pay.js +1 -0
- package/package.json +5 -5
- package/test/lnd_grpc/test_authenticated_lnd_grpc.js +6 -0
- package/test/lnd_grpc/test_unauthenticated_lnd_grpc.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
-
## 10.
|
|
3
|
+
## 10.15.0
|
|
4
|
+
|
|
5
|
+
- `authenticatedLndGrpc`, `unauthenticatedLndGrpc`: Add `path` to specify the
|
|
6
|
+
protos directory
|
|
7
|
+
|
|
8
|
+
## 10.14.4
|
|
4
9
|
|
|
5
10
|
- `getChannel`: Add support for specifying `transaction_id` and
|
|
6
11
|
`transaction_vout` instead of `id`
|
|
@@ -55,10 +55,19 @@ service Invoices {
|
|
|
55
55
|
rpc SettleInvoice (SettleInvoiceMsg) returns (SettleInvoiceResp);
|
|
56
56
|
|
|
57
57
|
/*
|
|
58
|
-
LookupInvoiceV2 attempts to look up at invoice. An invoice can be
|
|
58
|
+
LookupInvoiceV2 attempts to look up at invoice. An invoice can be referenced
|
|
59
59
|
using either its payment hash, payment address, or set ID.
|
|
60
60
|
*/
|
|
61
61
|
rpc LookupInvoiceV2 (LookupInvoiceMsg) returns (lnrpc.Invoice);
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
HtlcModifier is a bidirectional streaming RPC that allows a client to
|
|
65
|
+
intercept and modify the HTLCs that attempt to settle the given invoice. The
|
|
66
|
+
server will send HTLCs of invoices to the client and the client can modify
|
|
67
|
+
some aspects of the HTLC in order to pass the invoice acceptance tests.
|
|
68
|
+
*/
|
|
69
|
+
rpc HtlcModifier (stream HtlcModifyResponse)
|
|
70
|
+
returns (stream HtlcModifyRequest);
|
|
62
71
|
}
|
|
63
72
|
|
|
64
73
|
message CancelInvoiceMsg {
|
|
@@ -191,4 +200,46 @@ message LookupInvoiceMsg {
|
|
|
191
200
|
}
|
|
192
201
|
|
|
193
202
|
LookupModifier lookup_modifier = 4;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// CircuitKey is a unique identifier for an HTLC.
|
|
206
|
+
message CircuitKey {
|
|
207
|
+
/// The id of the channel that the is part of this circuit.
|
|
208
|
+
uint64 chan_id = 1;
|
|
209
|
+
|
|
210
|
+
/// The index of the incoming htlc in the incoming channel.
|
|
211
|
+
uint64 htlc_id = 2;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
message HtlcModifyRequest {
|
|
215
|
+
// The invoice the intercepted HTLC is attempting to settle. The HTLCs in
|
|
216
|
+
// the invoice are only HTLCs that have already been accepted or settled,
|
|
217
|
+
// not including the current intercepted HTLC.
|
|
218
|
+
lnrpc.Invoice invoice = 1;
|
|
219
|
+
|
|
220
|
+
// The unique identifier of the HTLC of this intercepted HTLC.
|
|
221
|
+
CircuitKey exit_htlc_circuit_key = 2;
|
|
222
|
+
|
|
223
|
+
// The amount in milli-satoshi that the exit HTLC is attempting to pay.
|
|
224
|
+
uint64 exit_htlc_amt = 3;
|
|
225
|
+
|
|
226
|
+
// The absolute expiry height of the exit HTLC.
|
|
227
|
+
uint32 exit_htlc_expiry = 4;
|
|
228
|
+
|
|
229
|
+
// The current block height.
|
|
230
|
+
uint32 current_height = 5;
|
|
231
|
+
|
|
232
|
+
// The wire message custom records of the exit HTLC.
|
|
233
|
+
map<uint64, bytes> exit_htlc_wire_custom_records = 6;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
message HtlcModifyResponse {
|
|
237
|
+
// The circuit key of the HTLC that the client wants to modify.
|
|
238
|
+
CircuitKey circuit_key = 1;
|
|
239
|
+
|
|
240
|
+
// The modified amount in milli-satoshi that the exit HTLC is paying. This
|
|
241
|
+
// value can be different from the actual on-chain HTLC amount, in case the
|
|
242
|
+
// HTLC carries other valuable items, as can be the case with custom channel
|
|
243
|
+
// types. In order to not modify this value, the client should set it zero.
|
|
244
|
+
uint64 amt_paid = 2;
|
|
194
245
|
}
|
package/grpc/protos/router.proto
CHANGED
|
@@ -330,6 +330,15 @@ message SendPaymentRequest {
|
|
|
330
330
|
only, to 1 to optimize for reliability only or a value inbetween for a mix.
|
|
331
331
|
*/
|
|
332
332
|
double time_pref = 23;
|
|
333
|
+
|
|
334
|
+
/*
|
|
335
|
+
If set, the payment loop can be interrupted by manually canceling the
|
|
336
|
+
payment context, even before the payment timeout is reached. Note that the
|
|
337
|
+
payment may still succeed after cancellation, as in-flight attempts can
|
|
338
|
+
still settle afterwards. Canceling will only prevent further attempts from
|
|
339
|
+
being sent.
|
|
340
|
+
*/
|
|
341
|
+
bool cancelable = 24;
|
|
333
342
|
}
|
|
334
343
|
|
|
335
344
|
message TrackPaymentRequest {
|
|
@@ -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(
|
|
75
|
+
path: !!path ? join(path, file) : pathForProto(file),
|
|
73
76
|
socket: lndSocket,
|
|
74
77
|
type: packageTypes[service],
|
|
75
78
|
});
|
|
@@ -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
|
|
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
|
|
|
@@ -409,6 +409,7 @@ module.exports = args => {
|
|
|
409
409
|
allow_self_payment: true,
|
|
410
410
|
amt: amounts.tokens,
|
|
411
411
|
amt_msat: amounts.mtokens,
|
|
412
|
+
cancelable: true,
|
|
412
413
|
cltv_limit: !!args.max_timeout_height ? maxCltvDelta : undefined,
|
|
413
414
|
dest: !args.destination ? undefined : hexToBuf(args.destination),
|
|
414
415
|
dest_custom_records: !messages.length ? undefined : destTlv,
|
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
|
+
"@grpc/grpc-js": "1.10.11",
|
|
11
11
|
"@grpc/proto-loader": "0.7.13",
|
|
12
|
-
"@types/node": "20.14.
|
|
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",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"invoices": "3.0.0",
|
|
23
23
|
"psbt": "3.0.0",
|
|
24
24
|
"tiny-secp256k1": "2.2.3",
|
|
25
|
-
"type-fest": "4.
|
|
25
|
+
"type-fest": "4.21.0"
|
|
26
26
|
},
|
|
27
27
|
"description": "Lightning Network client library",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tsd": "0.31.1",
|
|
30
|
-
"typescript": "5.5.
|
|
30
|
+
"typescript": "5.5.3"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=18"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"directory": "test/typescript"
|
|
54
54
|
},
|
|
55
55
|
"types": "index.d.ts",
|
|
56
|
-
"version": "10.
|
|
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}) => {
|