lightning 9.3.1 → 9.4.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 +8 -0
- package/grpc/protos/lightning.proto +14 -0
- package/lnd_messages/open_channel_request.js +3 -0
- package/lnd_methods/macaroon/subscribe_to_rpc_requests.js +3 -0
- package/lnd_methods/offchain/get_channels.js +3 -0
- package/lnd_methods/offchain/subscribe_to_channels.js +3 -0
- package/lnd_methods/onchain/open_channel.d.ts +2 -0
- package/lnd_methods/onchain/open_channel.js +14 -1
- package/lnd_methods/onchain/open_channels.d.ts +1 -0
- package/lnd_methods/onchain/open_channels.js +5 -0
- package/lnd_methods/onchain/propose_channel.d.ts +2 -0
- package/lnd_methods/onchain/propose_channel.js +4 -0
- package/lnd_responses/rpc_channel_as_channel.js +3 -0
- package/package.json +4 -4
- package/test/lnd_messages/test_open_channel_request.js +1 -0
- package/test/lnd_methods/macaroon/test_handle_rpc_request_update.js +1 -0
- package/test/lnd_methods/macaroon/test_subscribe_to_rpc_requests.js +1 -0
- package/test/lnd_methods/offchain/test_get_channels.js +1 -0
- package/test/lnd_methods/offchain/test_subscribe_to_channels.js +1 -0
- package/test/lnd_responses/test_rpc_channel_as_channel.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 9.4.0
|
|
4
|
+
|
|
5
|
+
- `getChannels`: Add `description` to show the channel description
|
|
6
|
+
- `openChannel`, `openChannels`, `proposeChannel`: Add `description` to set
|
|
7
|
+
the channel description
|
|
8
|
+
- `subscribeToChannels`: Add `description` to `channel_opened`
|
|
9
|
+
- `subscribeToRpcRequests`: Add `description` to `open_channel_request`
|
|
10
|
+
|
|
3
11
|
## 9.3.1
|
|
4
12
|
|
|
5
13
|
- `subscribeToPastPayment`, `subscribeToPayViaDetails`,
|
|
@@ -1543,6 +1543,13 @@ message Channel {
|
|
|
1543
1543
|
|
|
1544
1544
|
// This is the peer SCID alias.
|
|
1545
1545
|
uint64 peer_scid_alias = 35 [jstype = JS_STRING];
|
|
1546
|
+
|
|
1547
|
+
/*
|
|
1548
|
+
An optional note-to-self to go along with the channel containing some
|
|
1549
|
+
useful information. This is only ever stored locally and in no way impacts
|
|
1550
|
+
the channel's operation.
|
|
1551
|
+
*/
|
|
1552
|
+
string memo = 36;
|
|
1546
1553
|
}
|
|
1547
1554
|
|
|
1548
1555
|
message ListChannelsRequest {
|
|
@@ -2272,6 +2279,13 @@ message OpenChannelRequest {
|
|
|
2272
2279
|
be zero and is ignored.
|
|
2273
2280
|
*/
|
|
2274
2281
|
bool fund_max = 26;
|
|
2282
|
+
|
|
2283
|
+
/*
|
|
2284
|
+
An optional note-to-self to go along with the channel containing some
|
|
2285
|
+
useful information. This is only ever stored locally and in no way impacts
|
|
2286
|
+
the channel's operation.
|
|
2287
|
+
*/
|
|
2288
|
+
string memo = 27;
|
|
2275
2289
|
}
|
|
2276
2290
|
message OpenStatusUpdate {
|
|
2277
2291
|
oneof update {
|
|
@@ -9,6 +9,7 @@ const minConfs = (isZero, confs) => isZero ? Number() : (confs || undefined);
|
|
|
9
9
|
fee_rate: <Set Channel Routing Fee Rate Millitoken Per Millitokens String>
|
|
10
10
|
fund_max: <Use Maximal Funding Bool>
|
|
11
11
|
local_funding_amount: <Channel Capacity Tokens String>
|
|
12
|
+
memo: <Channel Description String>
|
|
12
13
|
min_htlc_msat: <Minimum HTLC Millitokens String>
|
|
13
14
|
node_pubkey: <Node Public Key Buffer Object>
|
|
14
15
|
node_pubkey_string: <Node Public Key Hex String>
|
|
@@ -28,6 +29,7 @@ const minConfs = (isZero, confs) => isZero ? Number() : (confs || undefined);
|
|
|
28
29
|
[base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
|
|
29
30
|
[chain_fee_tokens_per_vbyte]: <Chain Fee Tokens Per VByte Number>
|
|
30
31
|
[cooperative_close_address]: <Restrict Cooperative Close To Address String>
|
|
32
|
+
[description]: <Channel Description String>
|
|
31
33
|
[fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
|
|
32
34
|
[give_tokens]: <Tokens to Gift To Partner Number>
|
|
33
35
|
[is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
|
|
@@ -50,6 +52,7 @@ module.exports = args => {
|
|
|
50
52
|
base_fee_mtokens: !!args.use_fee_rate ? args.base_fee : undefined,
|
|
51
53
|
chain_fee_tokens_per_vbyte: chainFeeRate || undefined,
|
|
52
54
|
cooperative_close_address: args.close_address || undefined,
|
|
55
|
+
description: args.memo || undefined,
|
|
53
56
|
fee_rate: !!args.use_fee_rate ? Number(args.fee_rate) : undefined,
|
|
54
57
|
give_tokens: Number(args.push_sat) || undefined,
|
|
55
58
|
is_max_funding: !!args.fund_max || undefined,
|
|
@@ -24,6 +24,8 @@ const type = 'default';
|
|
|
24
24
|
|
|
25
25
|
This method is not supported in LND 0.13.4 and below
|
|
26
26
|
|
|
27
|
+
`description` is not supported on LND 0.16.3 and below
|
|
28
|
+
|
|
27
29
|
{
|
|
28
30
|
[id]: <RPC Middleware Interception Name String>
|
|
29
31
|
[is_intercepting_close_channel_requests]: <Intercept Channel Closes Bool>
|
|
@@ -67,6 +69,7 @@ const type = 'default';
|
|
|
67
69
|
[base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
|
|
68
70
|
[chain_fee_tokens_per_vbyte]: <Chain Fee Tokens Per VByte Number>
|
|
69
71
|
[cooperative_close_address]: <Prefer Cooperative Close To Address String>
|
|
72
|
+
[description]: <Immutable Channel Description String>
|
|
70
73
|
[fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
|
|
71
74
|
[give_tokens]: <Tokens to Gift To Partner Number>
|
|
72
75
|
[is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
|
|
@@ -17,6 +17,8 @@ const type = 'default';
|
|
|
17
17
|
|
|
18
18
|
`is_trusted_funding` is not supported on LND 0.15.0 and below
|
|
19
19
|
|
|
20
|
+
`description` is not supported on LND 0.16.3 and below
|
|
21
|
+
|
|
20
22
|
{
|
|
21
23
|
[is_active]: <Limit Results To Only Active Channels Bool> // false
|
|
22
24
|
[is_offline]: <Limit Results To Only Offline Channels Bool> // false
|
|
@@ -34,6 +36,7 @@ const type = 'default';
|
|
|
34
36
|
commit_transaction_weight: <Commit Transaction Weight Number>
|
|
35
37
|
[cooperative_close_address]: <Coop Close Restricted to Address String>
|
|
36
38
|
[cooperative_close_delay_height]: <Deny Coop Close Until Height Number>
|
|
39
|
+
[description]: <Channel Description String>
|
|
37
40
|
id: <Standard Format Channel Id String>
|
|
38
41
|
is_active: <Channel Active Bool>
|
|
39
42
|
is_closing: <Channel Is Closing Bool>
|
|
@@ -31,6 +31,8 @@ const updateOpening = 'pending_open_channel';
|
|
|
31
31
|
|
|
32
32
|
`is_trusted_funding`, `other_ids` are not supported on LND 0.15.0 and below
|
|
33
33
|
|
|
34
|
+
`description` is not supported on LND 0.16.3 and below
|
|
35
|
+
|
|
34
36
|
@throws
|
|
35
37
|
<Error>
|
|
36
38
|
|
|
@@ -84,6 +86,7 @@ const updateOpening = 'pending_open_channel';
|
|
|
84
86
|
commit_transaction_weight: <Commit Transaction Weight Number>
|
|
85
87
|
[cooperative_close_address]: <Coop Close Restricted to Address String>
|
|
86
88
|
[cooperative_close_delay_height]: <Prevent Coop Close Until Height Number>
|
|
89
|
+
[description]: <Channel Description String>
|
|
87
90
|
id: <Standard Format Channel Id String>
|
|
88
91
|
is_active: <Channel Active Bool>
|
|
89
92
|
is_closing: <Channel Is Closing Bool>
|
|
@@ -10,6 +10,8 @@ export type ChannelOpenOptions = {
|
|
|
10
10
|
chain_fee_tokens_per_vbyte?: number;
|
|
11
11
|
/** Restrict Cooperative Close To Address */
|
|
12
12
|
cooperative_close_address?: string;
|
|
13
|
+
/** Immutable Channel Description */
|
|
14
|
+
description?: string;
|
|
13
15
|
/** Routing Fee Rate In Millitokens Per Million Number */
|
|
14
16
|
fee_rate?: number;
|
|
15
17
|
/** Tokens to Gift To Partner */
|
|
@@ -6,6 +6,7 @@ const {isLnd} = require('./../../lnd_requests');
|
|
|
6
6
|
|
|
7
7
|
const defaultMinConfs = 1;
|
|
8
8
|
const defaultMinHtlcMtokens = '1';
|
|
9
|
+
const errMemoLength = /^provided memo \(.*\) is of length \d*, exceeds (\d*)$/;
|
|
9
10
|
const minChannelTokens = 20000;
|
|
10
11
|
const method = 'openChannel';
|
|
11
12
|
const type = 'default';
|
|
@@ -23,12 +24,15 @@ const type = 'default';
|
|
|
23
24
|
`base_fee_mtokens` is not supported on LND 0.15.5 and below
|
|
24
25
|
`fee_rate` is not supported on LND 0.15.5 and below
|
|
25
26
|
|
|
26
|
-
`is_max_funding` is not supported on LND 0.16.
|
|
27
|
+
`is_max_funding` is not supported on LND 0.16.3 and below
|
|
28
|
+
|
|
29
|
+
`description` is not supported on LND 0.16.3 and below
|
|
27
30
|
|
|
28
31
|
{
|
|
29
32
|
[base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
|
|
30
33
|
[chain_fee_tokens_per_vbyte]: <Chain Fee Tokens Per VByte Number>
|
|
31
34
|
[cooperative_close_address]: <Restrict Cooperative Close To Address String>
|
|
35
|
+
[description]: <Immutable Channel Description String>
|
|
32
36
|
[fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
|
|
33
37
|
[give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
|
|
34
38
|
[is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
|
|
@@ -104,6 +108,7 @@ module.exports = (args, cbk) => {
|
|
|
104
108
|
fee_rate: args.fee_rate,
|
|
105
109
|
fund_max: args.is_max_funding || undefined,
|
|
106
110
|
local_funding_amount: args.local_tokens,
|
|
111
|
+
memo: args.description || undefined,
|
|
107
112
|
min_confs: minConfs,
|
|
108
113
|
min_htlc_msat: args.min_htlc_mtokens || defaultMinHtlcMtokens,
|
|
109
114
|
node_pubkey: Buffer.from(args.partner_public_key, 'hex'),
|
|
@@ -197,6 +202,14 @@ module.exports = (args, cbk) => {
|
|
|
197
202
|
return cbk([503, 'ChainUnsupported']);
|
|
198
203
|
}
|
|
199
204
|
|
|
205
|
+
if (errMemoLength.test(n.details)) {
|
|
206
|
+
const [, maxLength] = n.details.match(errMemoLength);
|
|
207
|
+
|
|
208
|
+
const max = Number(maxLength);
|
|
209
|
+
|
|
210
|
+
return cbk([400, 'MaxChannelDescriptionLengthExceeded', {max}]);
|
|
211
|
+
}
|
|
212
|
+
|
|
200
213
|
switch (n.details.toLowerCase()) {
|
|
201
214
|
case 'cannot open channel to self':
|
|
202
215
|
return cbk([400, 'CannotOpenChannelToOwnNode']);
|
|
@@ -40,11 +40,14 @@ const type = 'default';
|
|
|
40
40
|
`base_fee_mtokens` is not supported on LND 0.15.5 and below
|
|
41
41
|
`fee_rate` is not supported on LND 0.15.5 and below
|
|
42
42
|
|
|
43
|
+
`description` is not supported on LND 0.16.3 and below
|
|
44
|
+
|
|
43
45
|
{
|
|
44
46
|
channels: [{
|
|
45
47
|
[base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
|
|
46
48
|
capacity: <Channel Capacity Tokens Number>
|
|
47
49
|
[cooperative_close_address]: <Restrict Coop Close To Address String>
|
|
50
|
+
[description]: <Immutable Channel Description String>
|
|
48
51
|
[fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
|
|
49
52
|
[give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
|
|
50
53
|
[is_private]: <Channel is Private Bool> // Defaults to false
|
|
@@ -99,6 +102,7 @@ module.exports = (args, cbk) => {
|
|
|
99
102
|
return cbk(null, args.channels.map(channel => ({
|
|
100
103
|
base_fee_mtokens: channel.base_fee_mtokens,
|
|
101
104
|
capacity: channel.capacity,
|
|
105
|
+
description: channel.description,
|
|
102
106
|
fee_rate: channel.fee_rate,
|
|
103
107
|
id: makeId(),
|
|
104
108
|
cooperative_close_address: channel.cooperative_close_address,
|
|
@@ -131,6 +135,7 @@ module.exports = (args, cbk) => {
|
|
|
131
135
|
},
|
|
132
136
|
},
|
|
133
137
|
local_funding_amount: channel.capacity,
|
|
138
|
+
memo: channel.description || undefined,
|
|
134
139
|
min_htlc_msat: channel.min_htlc_mtokens || defaultMinHtlcMtokens,
|
|
135
140
|
node_pubkey: bufferFromHex(channel.partner_public_key),
|
|
136
141
|
private: !!channel.is_private,
|
|
@@ -10,6 +10,8 @@ export type ProposeChannelArgs = AuthenticatedLightningArgs<{
|
|
|
10
10
|
cooperative_close_address?: string;
|
|
11
11
|
/** Cooperative Close Relative Delay */
|
|
12
12
|
cooperative_close_delay?: number;
|
|
13
|
+
/** Immutable Channel Description */
|
|
14
|
+
description?: string;
|
|
13
15
|
/** Tokens to Gift To Partner */
|
|
14
16
|
give_tokens?: number;
|
|
15
17
|
/** Pending Channel Id Hex */
|
|
@@ -19,10 +19,13 @@ const type = 'default';
|
|
|
19
19
|
|
|
20
20
|
Requires LND compiled with `walletrpc` build tag
|
|
21
21
|
|
|
22
|
+
`description` is not supported on LND 0.16.3 and below
|
|
23
|
+
|
|
22
24
|
{
|
|
23
25
|
capacity: <Channel Capacity Tokens Number>
|
|
24
26
|
[cooperative_close_address]: <Restrict Cooperative Close To Address String>
|
|
25
27
|
[cooperative_close_delay]: <Cooperative Close Relative Delay Number>
|
|
28
|
+
[description]: <Immutable Channel Description String>
|
|
26
29
|
[give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
|
|
27
30
|
id: <Pending Channel Id Hex String>
|
|
28
31
|
[is_private]: <Channel is Private Bool> // Defaults to false
|
|
@@ -109,6 +112,7 @@ module.exports = (args, cbk) => {
|
|
|
109
112
|
},
|
|
110
113
|
},
|
|
111
114
|
local_funding_amount: args.capacity.toString(),
|
|
115
|
+
memo: args.description || undefined,
|
|
112
116
|
node_pubkey: hexAsBuffer(args.partner_public_key),
|
|
113
117
|
private: !!args.is_private,
|
|
114
118
|
push_sat: (args.give_tokens || Number()).toString(),
|
|
@@ -35,6 +35,7 @@ const outpointDelimiter = ':';
|
|
|
35
35
|
min_htlc_msat: <Minimum Millitokens HTLC String>
|
|
36
36
|
}
|
|
37
37
|
num_updates: <Updated Channel Count String>
|
|
38
|
+
memo: <Channel Description String>
|
|
38
39
|
pending_htlcs: [{
|
|
39
40
|
amount: <HTLC Tokens Amount String>
|
|
40
41
|
expiration_height: <CLTV Timeout Block Height Number>
|
|
@@ -74,6 +75,7 @@ const outpointDelimiter = ':';
|
|
|
74
75
|
commit_transaction_weight: <Commit Transaction Weight Number>
|
|
75
76
|
[cooperative_close_address]: <Coop Close Restricted to Address String>
|
|
76
77
|
[cooperative_close_delay_height]: <Prevent Coop Close Until Height Number>
|
|
78
|
+
[description]: <Channel Description String>
|
|
77
79
|
id: <Standard Format Channel Id String>
|
|
78
80
|
is_active: <Channel Active Bool>
|
|
79
81
|
is_closing: <Channel Is Closing Bool>
|
|
@@ -237,6 +239,7 @@ module.exports = args => {
|
|
|
237
239
|
commit_transaction_weight: commitWeight,
|
|
238
240
|
cooperative_close_address: args.close_address || undefined,
|
|
239
241
|
cooperative_close_delay_height: height,
|
|
242
|
+
description: args.memo || undefined,
|
|
240
243
|
id: chanFormat({number: channelId}).channel,
|
|
241
244
|
is_active: args.active,
|
|
242
245
|
is_closing: false,
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@grpc/grpc-js": "1.8.14",
|
|
11
11
|
"@grpc/proto-loader": "0.7.7",
|
|
12
12
|
"@types/express": "4.17.17",
|
|
13
|
-
"@types/node": "20.
|
|
13
|
+
"@types/node": "20.2.3",
|
|
14
14
|
"@types/request": "2.48.8",
|
|
15
15
|
"@types/ws": "8.5.4",
|
|
16
16
|
"async": "3.2.4",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"body-parser": "1.20.2",
|
|
21
21
|
"bolt07": "1.8.3",
|
|
22
22
|
"bolt09": "0.2.5",
|
|
23
|
-
"cbor": "
|
|
23
|
+
"cbor": "9.0.0",
|
|
24
24
|
"ecpair": "2.1.0",
|
|
25
25
|
"express": "4.18.2",
|
|
26
26
|
"invoices": "2.2.3",
|
|
27
27
|
"psbt": "2.7.2",
|
|
28
28
|
"tiny-secp256k1": "2.2.1",
|
|
29
|
-
"type-fest": "3.
|
|
29
|
+
"type-fest": "3.11.0"
|
|
30
30
|
},
|
|
31
31
|
"description": "Lightning Network client library",
|
|
32
32
|
"devDependencies": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"directory": "test/typescript"
|
|
60
60
|
},
|
|
61
61
|
"types": "index.d.ts",
|
|
62
|
-
"version": "9.
|
|
62
|
+
"version": "9.4.0"
|
|
63
63
|
}
|