lightning 10.10.3 → 10.11.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,6 +1,11 @@
1
1
  # Versions
2
2
 
3
- ## 10.10.3
3
+ ## 10.11.0
4
+
5
+ - `getChannel`, `getNetworkGraph`, `getNode`: Add
6
+ `inbound_base_discount_mtokens` and `inbound_rate_discount`
7
+
8
+ ## 10.10.4
4
9
 
5
10
  - `getPeers`: Set minimum possible peer ping time to positive zero
6
11
 
@@ -12,6 +12,9 @@ const edgeNotFoundErrorMessage = 'edge not found';
12
12
 
13
13
  Requires `info:read` permission
14
14
 
15
+ `inbound_base_discount_mtokens` is not supported on LND 0.17.5 and below
16
+ `inbound_rate_discount` is not supported on LND 0.17.5 and below
17
+
15
18
  {
16
19
  id: <Standard Format Channel Id String>
17
20
  lnd: <Authenticated LND API Object>
@@ -25,6 +28,8 @@ const edgeNotFoundErrorMessage = 'edge not found';
25
28
  [base_fee_mtokens]: <Base Fee Millitokens String>
26
29
  [cltv_delta]: <Locktime Delta Number>
27
30
  [fee_rate]: <Fees Charged in Millitokens Per Million Number>
31
+ [inbound_base_discount_mtokens]: <Source Based Base Fee Reduction String>
32
+ [inbound_rate_discount]: <Source Based Per Million Rate Reduction Number>
28
33
  [is_disabled]: <Channel Is Disabled Bool>
29
34
  [max_htlc_mtokens]: <Maximum HTLC Millitokens Value String>
30
35
  [min_htlc_mtokens]: <Minimum HTLC Millitokens Value String>
@@ -16,6 +16,9 @@ const type = 'default';
16
16
 
17
17
  Requires `info:read` permission
18
18
 
19
+ `inbound_base_discount_mtokens` is not supported on LND 0.17.5 and below
20
+ `inbound_rate_discount` is not supported on LND 0.17.5 and below
21
+
19
22
  {
20
23
  lnd: <Authenticated LND API Object>
21
24
  }
@@ -29,6 +32,8 @@ const type = 'default';
29
32
  [base_fee_mtokens]: <Bae Fee Millitokens String>
30
33
  [cltv_delta]: <CLTV Height Delta Number>
31
34
  [fee_rate]: <Fee Rate In Millitokens Per Million Number>
35
+ [inbound_base_discount_mtokens]: <Source Base Fee Reduction String>
36
+ [inbound_rate_discount]: <Source Per Million Rate Reduction Number>
32
37
  [is_disabled]: <Edge is Disabled Bool>
33
38
  [max_htlc_mtokens]: <Maximum HTLC Millitokens String>
34
39
  [min_htlc_mtokens]: <Minimum HTLC Millitokens String>
@@ -22,6 +22,9 @@ const type = 'default';
22
22
 
23
23
  Requires `info:read` permission
24
24
 
25
+ `inbound_base_discount_mtokens` is not supported on LND 0.17.5 and below
26
+ `inbound_rate_discount` is not supported on LND 0.17.5 and below
27
+
25
28
  {
26
29
  [is_omitting_channels]: <Omit Channels from Node Bool>
27
30
  lnd: <Authenticated LND API Object>
@@ -40,6 +43,8 @@ const type = 'default';
40
43
  [base_fee_mtokens]: <Base Fee Millitokens String>
41
44
  [cltv_delta]: <Locktime Delta Number>
42
45
  [fee_rate]: <Fees Charged in Millitokens Per Million Number>
46
+ [inbound_base_discount_mtokens]: <Source Base Fee Reduction String>
47
+ [inbound_rate_discount]: <Source Per Million Rate Reduction Number>
43
48
  [is_disabled]: <Channel Is Disabled Bool>
44
49
  [max_htlc_mtokens]: <Maximum HTLC Millitokens Value String>
45
50
  [min_htlc_mtokens]: <Minimum HTLC Millitokens Value String>
@@ -11,6 +11,7 @@ const feeRatio = 1e6;
11
11
  const {floor} = Math;
12
12
  const {isArray} = Array;
13
13
  const method = 'updateChannelPolicy';
14
+ const surcharge = discount => discount === undefined ? undefined : -discount;
14
15
  const tokensAsMtokens = tokens => (BigInt(tokens) * BigInt(1e3)).toString();
15
16
  const type = 'default';
16
17
 
@@ -29,6 +30,8 @@ const type = 'default';
29
30
  [base_fee_tokens]: <Base Fee Tokens Charged Number>
30
31
  [cltv_delta]: <HTLC CLTV Delta Number>
31
32
  [fee_rate]: <Fee Rate In Millitokens Per Million Number>
33
+ [inbound_base_discount_mtokens]: <Inbound Fee Millitokens Reduction String>
34
+ [inbound_rate_discount]: <Source Millitokens Per Million Discount Number>
32
35
  lnd: <Authenticated LND API Object>
33
36
  [max_htlc_mtokens]: <Maximum HTLC Millitokens to Forward String>
34
37
  [min_htlc_mtokens]: <Minimum HTLC Millitokens to Forward String>
@@ -105,6 +108,8 @@ module.exports = (args, cbk) => {
105
108
  chan_point: !isGlobal ? chan : undefined,
106
109
  fee_rate: rate / feeRatio,
107
110
  global: isGlobal || undefined,
111
+ inbound_base_fee_msat: surcharge(args.inbound_base_discount_mtokens),
112
+ inbound_fee_rate_ppm: surcharge(args.inbound_rate_discount),
108
113
  max_htlc_msat: args.max_htlc_mtokens || undefined,
109
114
  min_htlc_msat: args.min_htlc_mtokens || undefined,
110
115
  min_htlc_msat_specified: !!args.min_htlc_mtokens,
@@ -69,7 +69,6 @@ module.exports = (args, cbk) => {
69
69
  request: ['feeRate', ({feeRate}, cbk) => {
70
70
  return args.lnd[type][method]({
71
71
  force: true,
72
- immediate: true,
73
72
  outpoint: {
74
73
  output_index: args.transaction_vout,
75
74
  txid_str: args.transaction_id,
@@ -1,4 +1,6 @@
1
1
  const asDate = epochTime => new Date(epochTime * 1e3).toISOString();
2
+ const discount = fee => (!fee ? 0 : -fee).toString();
3
+ const inverse = rate => !rate ? 0 : -rate;
2
4
 
3
5
  /** Convert raw channel policy to standard channel policy
4
6
 
@@ -7,6 +9,8 @@ const asDate = epochTime => new Date(epochTime * 1e3).toISOString();
7
9
  disabled: <Forwarding is Disabled Bool>
8
10
  fee_base_msat: <Base Fee Tokens String>
9
11
  fee_rate_milli_msat: <Fee Rate Number String>
12
+ inbound_fee_base_msat: <Inbound Fee Base Number>
13
+ inbound_fee_rate_milli_msat: <Inbound Fee Rate Number>
10
14
  last_update: <Last Update Epoch Time Seconds Number>
11
15
  max_htlc_msat: <Maximum HTLC Millitokens String>
12
16
  min_htlc: <Minimum HTLC Millitokens String>
@@ -23,6 +27,8 @@ const asDate = epochTime => new Date(epochTime * 1e3).toISOString();
23
27
  base_fee_mtokens: <Base Fee Millitokens String>
24
28
  cltv_delta: <Forward CLTV Delta Number>
25
29
  fee_rate: <Fee Rate in Parts Per Millitoken Number>
30
+ inbound_base_discount_mtokens: <Source Specific Base Fee Reduction String>
31
+ inbound_rate_discount: <Source Specific Per Million Rate Reduction Number>
26
32
  is_disabled: <Forwarding Is Disabled Bool>
27
33
  max_htlc_mtokens: <Maximum Forward Millitokens String>
28
34
  min_htlc_mtokens: <Minimum Forward Millitokens String>
@@ -72,6 +78,8 @@ module.exports = args => {
72
78
  base_fee_mtokens: args.policy.fee_base_msat,
73
79
  cltv_delta: args.policy.time_lock_delta,
74
80
  fee_rate: Number(args.policy.fee_rate_milli_msat),
81
+ inbound_base_discount_mtokens: discount(args.policy.inbound_fee_base_msat),
82
+ inbound_rate_discount: inverse(args.policy.inbound_fee_rate_milli_msat),
75
83
  is_disabled: args.policy.disabled,
76
84
  max_htlc_mtokens: args.policy.max_htlc_msat,
77
85
  min_htlc_mtokens: args.policy.min_htlc,
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "dependencies": {
10
10
  "@grpc/grpc-js": "1.10.7",
11
11
  "@grpc/proto-loader": "0.7.13",
12
- "@types/node": "20.12.8",
12
+ "@types/node": "20.12.10",
13
13
  "@types/request": "2.48.12",
14
14
  "@types/ws": "8.5.10",
15
15
  "async": "3.2.5",
@@ -22,7 +22,7 @@
22
22
  "invoices": "3.0.0",
23
23
  "psbt": "3.0.0",
24
24
  "tiny-secp256k1": "2.2.3",
25
- "type-fest": "4.18.1"
25
+ "type-fest": "4.18.2"
26
26
  },
27
27
  "description": "Lightning Network client library",
28
28
  "devDependencies": {
@@ -53,5 +53,5 @@
53
53
  "directory": "test/typescript"
54
54
  },
55
55
  "types": "index.d.ts",
56
- "version": "10.10.3"
56
+ "version": "10.11.0"
57
57
  }
@@ -128,6 +128,8 @@ const tests = [
128
128
  base_fee_mtokens: '1',
129
129
  cltv_delta: 1,
130
130
  fee_rate: 1,
131
+ inbound_base_discount_mtokens: '0',
132
+ inbound_rate_discount: 0,
131
133
  is_disabled: true,
132
134
  max_htlc_mtokens: '1',
133
135
  min_htlc_mtokens: '1',
@@ -138,6 +140,8 @@ const tests = [
138
140
  base_fee_mtokens: '2',
139
141
  cltv_delta: 2,
140
142
  fee_rate: 2,
143
+ inbound_base_discount_mtokens: '0',
144
+ inbound_rate_discount: 0,
141
145
  is_disabled: false,
142
146
  max_htlc_mtokens: '2',
143
147
  min_htlc_mtokens: '2',
@@ -117,6 +117,8 @@ const tests = [
117
117
  base_fee_mtokens: '1000',
118
118
  cltv_delta: 1,
119
119
  fee_rate: 1,
120
+ inbound_base_discount_mtokens: '0',
121
+ inbound_rate_discount: 0,
120
122
  is_disabled: false,
121
123
  max_htlc_mtokens: '1000',
122
124
  min_htlc_mtokens: '1000',
@@ -127,6 +129,8 @@ const tests = [
127
129
  base_fee_mtokens: '2',
128
130
  cltv_delta: 2,
129
131
  fee_rate: 2,
132
+ inbound_base_discount_mtokens: '0',
133
+ inbound_rate_discount: 0,
130
134
  is_disabled: true,
131
135
  max_htlc_mtokens: '2',
132
136
  min_htlc_mtokens: '2',
@@ -98,6 +98,8 @@ const makeExpected = ({}) => {
98
98
  base_fee_mtokens: '1',
99
99
  cltv_delta: 1,
100
100
  fee_rate: 1,
101
+ inbound_base_discount_mtokens: '0',
102
+ inbound_rate_discount: 0,
101
103
  is_disabled: true,
102
104
  max_htlc_mtokens: '1',
103
105
  min_htlc_mtokens: '1',
@@ -108,6 +110,8 @@ const makeExpected = ({}) => {
108
110
  base_fee_mtokens: '2',
109
111
  cltv_delta: 2,
110
112
  fee_rate: 2,
113
+ inbound_base_discount_mtokens: '0',
114
+ inbound_rate_discount: 0,
111
115
  is_disabled: false,
112
116
  max_htlc_mtokens: '2',
113
117
  min_htlc_mtokens: '2',
@@ -60,6 +60,8 @@ const tests = [
60
60
  base_fee_mtokens: '1',
61
61
  cltv_delta: 1,
62
62
  fee_rate: 1,
63
+ inbound_base_discount_mtokens: '0',
64
+ inbound_rate_discount: 0,
63
65
  is_disabled: true,
64
66
  max_htlc_mtokens: '1',
65
67
  min_htlc_mtokens: '1',
@@ -70,6 +72,8 @@ const tests = [
70
72
  base_fee_mtokens: '2',
71
73
  cltv_delta: 2,
72
74
  fee_rate: 2,
75
+ inbound_base_discount_mtokens: '0',
76
+ inbound_rate_discount: 0,
73
77
  is_disabled: false,
74
78
  max_htlc_mtokens: '2',
75
79
  min_htlc_mtokens: '2',
@@ -4,6 +4,25 @@ const {throws} = require('node:assert').strict;
4
4
 
5
5
  const chanPolicyAsPolicy = require('./../../lnd_responses/channel_policy_as_policy');
6
6
 
7
+ const makeExpected = overrides => {
8
+ const expected = {
9
+ base_fee_mtokens: '1',
10
+ cltv_delta: 1,
11
+ fee_rate: 1,
12
+ inbound_base_discount_mtokens: '0',
13
+ inbound_rate_discount: 0,
14
+ is_disabled: false,
15
+ max_htlc_mtokens: '1',
16
+ min_htlc_mtokens: '1',
17
+ public_key: '00',
18
+ updated_at: new Date(1000).toISOString(),
19
+ };
20
+
21
+ Object.keys(overrides || {}).forEach(key => expected[key] = overrides[key]);
22
+
23
+ return expected;
24
+ };
25
+
7
26
  const tests = [
8
27
  {
9
28
  args: {},
@@ -94,16 +113,28 @@ const tests = [
94
113
  },
95
114
  },
96
115
  description: 'Policy mapped',
97
- expected: {
98
- base_fee_mtokens: '1',
99
- cltv_delta: 1,
100
- fee_rate: 1,
101
- is_disabled: false,
102
- max_htlc_mtokens: '1',
103
- min_htlc_mtokens: '1',
116
+ expected: makeExpected({}),
117
+ },
118
+ {
119
+ args: {
104
120
  public_key: '00',
105
- updated_at: new Date(1000).toISOString(),
121
+ policy: {
122
+ disabled: false,
123
+ fee_base_msat: '1',
124
+ fee_rate_milli_msat: '1',
125
+ inbound_fee_base_msat: -1,
126
+ inbound_fee_rate_milli_msat: -1,
127
+ last_update: 1,
128
+ max_htlc_msat: '1',
129
+ min_htlc: '1',
130
+ time_lock_delta: 1,
131
+ },
106
132
  },
133
+ description: 'Policy mapped',
134
+ expected: makeExpected({
135
+ inbound_base_discount_mtokens: '1',
136
+ inbound_rate_discount: 1,
137
+ }),
107
138
  },
108
139
  ];
109
140
 
@@ -75,6 +75,8 @@ const makeExpected = overrides => {
75
75
  base_fee_mtokens: '1',
76
76
  cltv_delta: 1,
77
77
  fee_rate: 1,
78
+ inbound_base_discount_mtokens: '0',
79
+ inbound_rate_discount: 0,
78
80
  is_disabled: true,
79
81
  max_htlc_mtokens: '1',
80
82
  min_htlc_mtokens: '1',
@@ -85,6 +87,8 @@ const makeExpected = overrides => {
85
87
  base_fee_mtokens: '2',
86
88
  cltv_delta: 2,
87
89
  fee_rate: 2,
90
+ inbound_base_discount_mtokens: '0',
91
+ inbound_rate_discount: 0,
88
92
  is_disabled: false,
89
93
  max_htlc_mtokens: '2',
90
94
  min_htlc_mtokens: '2',
@@ -30,7 +30,6 @@ const makePeer = overrides => {
30
30
  return response;
31
31
  };
32
32
 
33
-
34
33
  const makeExpected = overrides => {
35
34
  const expected = {
36
35
  bytes_received: 1,