lightning 7.1.8 → 8.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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # Versions
2
2
 
3
+ ## 8.0.0
4
+
5
+ - `openChannel`: Add `is_max_funding` to fund a channel maximally
6
+ - `subscribeToRpcRequests`: Add support for returning `is_max_funding` in
7
+ `open_channel_request`
8
+
9
+ ### Breaking Changes
10
+
11
+ - `subscribeToRpcRequests`: `open_channel_request`: `local_tokens` is now an
12
+ optional value
13
+
14
+ ## 7.1.9
15
+
16
+ - `getPeers`: Correct feature bit returned as string and not number
17
+
3
18
  ## 7.1.8
4
19
 
5
20
  - `signChainAddressMessage`: Add method to sign a message given a chain address
@@ -2265,6 +2265,13 @@ message OpenChannelRequest {
2265
2265
  capacity.
2266
2266
  */
2267
2267
  uint64 remote_chan_reserve_sat = 25;
2268
+
2269
+ /*
2270
+ If set, then lnd will attempt to commit all the coins under control of the
2271
+ internal wallet to open the channel, and the LocalFundingAmount field must
2272
+ be zero and is ignored.
2273
+ */
2274
+ bool fund_max = 26;
2268
2275
  }
2269
2276
  message OpenStatusUpdate {
2270
2277
  oneof update {
@@ -7,6 +7,7 @@ const minConfs = (isZero, confs) => isZero ? Number() : (confs || undefined);
7
7
  base_fee: <Set Channel Base Fee Millitokens String>
8
8
  close_address: <Cooperative Close Address String>
9
9
  fee_rate: <Set Channel Routing Fee Rate Millitoken Per Millitokens String>
10
+ fund_max: <Use Maximal Funding Bool>
10
11
  local_funding_amount: <Channel Capacity Tokens String>
11
12
  min_htlc_msat: <Minimum HTLC Millitokens String>
12
13
  node_pubkey: <Node Public Key Buffer Object>
@@ -29,8 +30,9 @@ const minConfs = (isZero, confs) => isZero ? Number() : (confs || undefined);
29
30
  [cooperative_close_address]: <Restrict Cooperative Close To Address String>
30
31
  [fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
31
32
  [give_tokens]: <Tokens to Gift To Partner Number>
33
+ [is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
32
34
  [is_private]: <Channel is Private Bool>
33
- local_tokens: <Local Tokens Number>
35
+ [local_tokens]: <Local Tokens Number>
34
36
  [min_confirmations]: <Spend UTXOs With Minimum Confirmations Number>
35
37
  [min_htlc_mtokens]: <Minimum HTLC Millitokens String>
36
38
  partner_public_key: <Public Key Hex String>
@@ -40,6 +42,7 @@ const minConfs = (isZero, confs) => isZero ? Number() : (confs || undefined);
40
42
  module.exports = args => {
41
43
  const chainFeeRate = Number(args.sat_per_vbyte) || Number(args.sat_per_byte);
42
44
  const hasMinHtlc = args.min_htlc_msat !== Number().toString();
45
+ const normalFunded = !args.fund_max;
43
46
  const publicKey = bufferAsHex(args.node_pubkey) || args.node_pubkey_string;
44
47
  const utxoConfs = minConfs(args.spend_unconfirmed, args.min_confirmations);
45
48
 
@@ -49,8 +52,9 @@ module.exports = args => {
49
52
  cooperative_close_address: args.close_address || undefined,
50
53
  fee_rate: !!args.use_fee_rate ? Number(args.fee_rate) : undefined,
51
54
  give_tokens: Number(args.push_sat) || undefined,
55
+ is_max_funding: !!args.fund_max || undefined,
52
56
  is_private: args.private || undefined,
53
- local_tokens: Number(args.local_funding_amount),
57
+ local_tokens: normalFunded ? Number(args.local_funding_amount) : undefined,
54
58
  min_confirmations: utxoConfs,
55
59
  min_htlc_mtokens: hasMinHtlc ? args.min_htlc_msat : undefined,
56
60
  partner_public_key: publicKey,
@@ -69,8 +69,9 @@ const type = 'default';
69
69
  [cooperative_close_address]: <Prefer Cooperative Close To Address String>
70
70
  [fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
71
71
  [give_tokens]: <Tokens to Gift To Partner Number>
72
+ [is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
72
73
  [is_private]: <Channel is Private Bool>
73
- local_tokens: <Local Tokens Number>
74
+ [local_tokens]: <Local Tokens Number>
74
75
  [min_confirmations]: <Spend UTXOs With Minimum Confirmations Number>
75
76
  [min_htlc_mtokens]: <Minimum HTLC Millitokens String>
76
77
  partner_public_key: <Public Key Hex String>
@@ -23,15 +23,18 @@ const type = 'default';
23
23
  `base_fee_mtokens` is not supported on LND 0.15.5 and below
24
24
  `fee_rate` is not supported on LND 0.15.5 and below
25
25
 
26
+ `is_max_funding` is not supported on LND 0.16.0 and below
27
+
26
28
  {
27
29
  [base_fee_mtokens]: <Routing Base Fee Millitokens Charged String>
28
30
  [chain_fee_tokens_per_vbyte]: <Chain Fee Tokens Per VByte Number>
29
31
  [cooperative_close_address]: <Restrict Cooperative Close To Address String>
30
32
  [fee_rate]: <Routing Fee Rate In Millitokens Per Million Number>
31
33
  [give_tokens]: <Tokens to Gift To Partner Number> // Defaults to zero
34
+ [is_max_funding]: <Use Maximal Chain Funds For Local Funding Bool>
32
35
  [is_private]: <Channel is Private Bool> // Defaults to false
33
36
  lnd: <Authenticated LND API Object>
34
- local_tokens: <Total Channel Capacity Tokens Number>
37
+ [local_tokens]: <Total Channel Capacity Tokens Number>
35
38
  [min_confirmations]: <Spend UTXOs With Minimum Confirmations Number>
36
39
  [min_htlc_mtokens]: <Minimum HTLC Millitokens String>
37
40
  [partner_csv_delay]: <Peer Output CSV Delay Number>
@@ -54,11 +57,11 @@ module.exports = (args, cbk) => {
54
57
  return cbk([400, 'ExpectedLndForChannelOpen']);
55
58
  }
56
59
 
57
- if (!args.local_tokens) {
60
+ if (!args.local_tokens && !args.is_max_funding) {
58
61
  return cbk([400, 'ExpectedLocalTokensNumberToOpenChannelWith']);
59
62
  }
60
63
 
61
- if (args.local_tokens < minChannelTokens) {
64
+ if (!args.is_max_funding && args.local_tokens < minChannelTokens) {
62
65
  return cbk([400, 'ExpectedLargerChannelSizeForChannelOpen']);
63
66
  }
64
67
 
@@ -99,6 +102,7 @@ module.exports = (args, cbk) => {
99
102
  const options = {
100
103
  base_fee: args.base_fee_mtokens || undefined,
101
104
  fee_rate: args.fee_rate,
105
+ fund_max: args.is_max_funding || undefined,
102
106
  local_funding_amount: args.local_tokens,
103
107
  min_confs: minConfs,
104
108
  min_htlc_msat: args.min_htlc_mtokens || defaultMinHtlcMtokens,
@@ -116,7 +116,7 @@ module.exports = peer => {
116
116
  bytes_received: Number(peer.bytes_recv),
117
117
  bytes_sent: Number(peer.bytes_sent),
118
118
  features: keys(peer.features).map(bit => ({
119
- bit,
119
+ bit: Number(bit),
120
120
  is_known: peer.features[bit].is_known,
121
121
  is_required: peer.features[bit].is_required,
122
122
  type: featureFlagDetails({bit}).type,
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/alexbosworth/lightning/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@grpc/grpc-js": "1.8.13",
10
+ "@grpc/grpc-js": "1.8.14",
11
11
  "@grpc/proto-loader": "0.7.6",
12
12
  "@types/express": "4.17.17",
13
13
  "@types/node": "18.15.11",
@@ -33,7 +33,7 @@
33
33
  "@alexbosworth/node-fetch": "2.6.2",
34
34
  "@alexbosworth/tap": "15.0.12",
35
35
  "tsd": "0.28.1",
36
- "typescript": "5.0.3",
36
+ "typescript": "5.0.4",
37
37
  "ws": "8.13.0"
38
38
  },
39
39
  "engines": {
@@ -59,5 +59,5 @@
59
59
  "directory": "test/typescript"
60
60
  },
61
61
  "types": "index.d.ts",
62
- "version": "7.1.8"
62
+ "version": "8.0.0"
63
63
  }
@@ -30,6 +30,7 @@ const makeExpected = overrides => {
30
30
  cooperative_close_address: 'close_address',
31
31
  fee_rate: undefined,
32
32
  give_tokens: 1,
33
+ is_max_funding: undefined,
33
34
  is_private: undefined,
34
35
  local_tokens: 1,
35
36
  min_confirmations: 0,
@@ -105,6 +105,7 @@ const tests = [
105
105
  cooperative_close_address: 'close_address',
106
106
  fee_rate: undefined,
107
107
  give_tokens: 1,
108
+ is_max_funding: undefined,
108
109
  is_private: undefined,
109
110
  local_tokens: 1,
110
111
  min_confirmations: 0,
@@ -196,6 +196,7 @@ const tests = [
196
196
  cooperative_close_address: 'close_address',
197
197
  fee_rate: undefined,
198
198
  give_tokens: 1,
199
+ is_max_funding: undefined,
199
200
  is_private: undefined,
200
201
  local_tokens: 1,
201
202
  min_confirmations: 0,
@@ -34,7 +34,7 @@ const makeExpected = overrides => {
34
34
  bytes_received: 1,
35
35
  bytes_sent: 1,
36
36
  features: [{
37
- bit: '1',
37
+ bit: 1,
38
38
  is_known: true,
39
39
  is_required: false,
40
40
  type: 'data_loss_protection',