lightning 10.12.0 → 10.13.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 +5 -0
- package/lnd_methods/info/subscribe_to_graph.d.ts +4 -0
- package/lnd_methods/info/subscribe_to_graph.js +5 -0
- package/lnd_responses/rpc_channel_update_as_update.js +9 -0
- package/package.json +3 -3
- package/test/lnd_methods/info/test_subscribe_to_graph.js +2 -0
- package/test/lnd_responses/test_rpc_channel_update_as_update.js +17 -0
package/CHANGELOG.md
CHANGED
|
@@ -19,6 +19,10 @@ export type SubscribeToGraphChannelUpdatedEvent = {
|
|
|
19
19
|
min_htlc_mtokens: string;
|
|
20
20
|
/** Announcing Public Key, Target Public Key */
|
|
21
21
|
public_keys: [string, string];
|
|
22
|
+
/** Source Base Fee Reduction String */
|
|
23
|
+
inbound_base_discount_mtokens: string;
|
|
24
|
+
/** Source Per Million Rate Reduction Number */
|
|
25
|
+
inbound_rate_discount: number;
|
|
22
26
|
/** Channel Transaction Id */
|
|
23
27
|
transaction_id: string;
|
|
24
28
|
/** Channel Transaction Output Index */
|
|
@@ -18,6 +18,9 @@ const type = 'default';
|
|
|
18
18
|
|
|
19
19
|
Requires `info:read` permission
|
|
20
20
|
|
|
21
|
+
`inbound_base_discount_mtokens` is not supported on LND 0.17.5 and below
|
|
22
|
+
`inbound_rate_discount` is not supported on LND 0.17.5 and below
|
|
23
|
+
|
|
21
24
|
{
|
|
22
25
|
lnd: <Authenticated LND API Object>
|
|
23
26
|
}
|
|
@@ -45,6 +48,8 @@ const type = 'default';
|
|
|
45
48
|
cltv_delta: <Channel CLTV Delta Number>
|
|
46
49
|
fee_rate: <Channel Fee Rate In Millitokens Per Million Number>
|
|
47
50
|
id: <Standard Format Channel Id String>
|
|
51
|
+
inbound_base_discount_mtokens: <Source Specific Base Fee Reduction String>
|
|
52
|
+
inbound_rate_discount: <Source Specific Per Million Rate Reduction Number>
|
|
48
53
|
is_disabled: <Channel Is Disabled Bool>
|
|
49
54
|
[max_htlc_mtokens]: <Channel Maximum HTLC Millitokens String>
|
|
50
55
|
min_htlc_mtokens: <Channel Minimum HTLC Millitokens String>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const {chanFormat} = require('bolt07');
|
|
2
2
|
|
|
3
|
+
const asDiscount = fee => !fee ? 0 : -fee;
|
|
3
4
|
const bufferAsHex = buffer => buffer.toString('hex');
|
|
4
5
|
const emptyTxId = Buffer.alloc(32);
|
|
5
6
|
const {isBuffer} = Buffer;
|
|
@@ -20,6 +21,8 @@ const now = () => new Date().toISOString();
|
|
|
20
21
|
disabled: <Forwarding is Disabled Bool>
|
|
21
22
|
fee_base_msat: <Forwarding Base Fee Millitokens String>
|
|
22
23
|
fee_rate_milli_msat: <Forwarding Fee Rate Per Million String>
|
|
24
|
+
inbound_fee_base_msat: <Inbound Fee Base Number>
|
|
25
|
+
inbound_fee_rate_milli_msat: <Inbound Fee Base Number>
|
|
23
26
|
max_htlc_msat: <Maximum HTLC Size Millitokens String>
|
|
24
27
|
min_htlc: <Minimum HTLC Size Millitokens String>
|
|
25
28
|
time_lock_delta: <Forwarding CLTV Delta Number>
|
|
@@ -36,6 +39,8 @@ const now = () => new Date().toISOString();
|
|
|
36
39
|
cltv_delta: <Channel CLTV Delta Number>
|
|
37
40
|
fee_rate: <Channel Fee Rate In Millitokens Per Million Number>
|
|
38
41
|
id: <Standard Format Channel Id String>
|
|
42
|
+
inbound_base_discount_mtokens: <Source Fee Discount Millitokens String>
|
|
43
|
+
inbound_rate_discount: <Source Based PPM Fee Discount Number>
|
|
39
44
|
is_disabled: <Channel Is Disabled Bool>
|
|
40
45
|
[max_htlc_mtokens]: <Channel Maximum HTLC Millitokens String>
|
|
41
46
|
min_htlc_mtokens: <Channel Minimum HTLC Millitokens String>
|
|
@@ -112,6 +117,8 @@ module.exports = update => {
|
|
|
112
117
|
throw new Error('ExpectedValidChannelId');
|
|
113
118
|
}
|
|
114
119
|
|
|
120
|
+
const inBase = asDiscount(update.routing_policy.inbound_fee_base_msat);
|
|
121
|
+
const inRate = asDiscount(update.routing_policy.inbound_fee_rate_milli_msat);
|
|
115
122
|
const maxHtlc = update.routing_policy.max_htlc_msat;
|
|
116
123
|
const transactionId = update.chan_point.funding_txid_bytes.reverse();
|
|
117
124
|
|
|
@@ -123,6 +130,8 @@ module.exports = update => {
|
|
|
123
130
|
cltv_delta: update.routing_policy.time_lock_delta,
|
|
124
131
|
fee_rate: Number(update.routing_policy.fee_rate_milli_msat),
|
|
125
132
|
id: chanFormat({number: update.chan_id}).channel,
|
|
133
|
+
inbound_base_discount_mtokens: inBase.toString(),
|
|
134
|
+
inbound_rate_discount: inRate,
|
|
126
135
|
is_disabled: update.routing_policy.disabled,
|
|
127
136
|
max_htlc_mtokens: maxHtlc !== Number().toString() ? maxHtlc : undefined,
|
|
128
137
|
min_htlc_mtokens: update.routing_policy.min_htlc,
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@grpc/grpc-js": "1.10.8",
|
|
11
11
|
"@grpc/proto-loader": "0.7.13",
|
|
12
|
-
"@types/node": "20.12.
|
|
12
|
+
"@types/node": "20.12.13",
|
|
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.
|
|
25
|
+
"type-fest": "4.18.3"
|
|
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.
|
|
56
|
+
"version": "10.13.0"
|
|
57
57
|
}
|
|
@@ -9,6 +9,8 @@ const makeRoutingPolicy = overrides => {
|
|
|
9
9
|
disabled: false,
|
|
10
10
|
fee_base_msat: '1',
|
|
11
11
|
fee_rate_milli_msat: '1',
|
|
12
|
+
inbound_fee_base_msat: 0,
|
|
13
|
+
inbound_fee_rate_milli_msat: 0,
|
|
12
14
|
max_htlc_msat: '1',
|
|
13
15
|
min_htlc: '1',
|
|
14
16
|
time_lock_delta: 1,
|
|
@@ -44,6 +46,8 @@ const makeExpected = overrides => {
|
|
|
44
46
|
cltv_delta: 1,
|
|
45
47
|
fee_rate: 1,
|
|
46
48
|
id: '0x0x1',
|
|
49
|
+
inbound_base_discount_mtokens: '0',
|
|
50
|
+
inbound_rate_discount: 0,
|
|
47
51
|
is_disabled: false,
|
|
48
52
|
max_htlc_mtokens: '1',
|
|
49
53
|
min_htlc_mtokens: '1',
|
|
@@ -156,6 +160,19 @@ const tests = [
|
|
|
156
160
|
description: 'RPC channel update is mapped to update',
|
|
157
161
|
expected: makeExpected({}),
|
|
158
162
|
},
|
|
163
|
+
{
|
|
164
|
+
args: makeArgs({
|
|
165
|
+
routing_policy: makeRoutingPolicy({
|
|
166
|
+
inbound_fee_base_msat: -1,
|
|
167
|
+
inbound_fee_rate_milli_msat: -1,
|
|
168
|
+
}),
|
|
169
|
+
}),
|
|
170
|
+
description: 'RPC channel with inbound rates is mapped',
|
|
171
|
+
expected: makeExpected({
|
|
172
|
+
inbound_base_discount_mtokens: '1',
|
|
173
|
+
inbound_rate_discount: 1,
|
|
174
|
+
}),
|
|
175
|
+
},
|
|
159
176
|
{
|
|
160
177
|
args: makeArgs({
|
|
161
178
|
capacity: '0',
|