lightning 9.1.0 → 9.2.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/offchain/get_channels.d.ts +2 -0
- package/lnd_methods/offchain/get_channels.js +1 -0
- package/lnd_methods/offchain/subscribe_to_channels.d.ts +2 -0
- package/lnd_methods/offchain/subscribe_to_channels.js +1 -0
- package/lnd_responses/rpc_channel_as_channel.js +7 -2
- package/package.json +2 -2
- package/test/lnd_methods/offchain/test_get_channels.js +8 -2
- package/test/lnd_methods/offchain/test_subscribe_to_channels.js +2 -1
- package/test/lnd_responses/test_rpc_channel_as_channel.js +8 -2
package/CHANGELOG.md
CHANGED
|
@@ -114,6 +114,8 @@ export type GetChannelsResult = {
|
|
|
114
114
|
transaction_id: string;
|
|
115
115
|
/** Blockchain Transaction Vout */
|
|
116
116
|
transaction_vout: number;
|
|
117
|
+
/** Channel Commitment Transaction Type */
|
|
118
|
+
type?: string;
|
|
117
119
|
/** Unsettled Balance Tokens */
|
|
118
120
|
unsettled_balance: number;
|
|
119
121
|
}[];
|
|
@@ -78,6 +78,7 @@ const type = 'default';
|
|
|
78
78
|
[time_online]: <Monitoring Uptime Channel Up Milliseconds Number>
|
|
79
79
|
transaction_id: <Blockchain Transaction Id String>
|
|
80
80
|
transaction_vout: <Blockchain Transaction Vout Number>
|
|
81
|
+
[type]: <Channel Commitment Transaction Type String>
|
|
81
82
|
unsettled_balance: <Unsettled Balance Tokens Number>
|
|
82
83
|
}]
|
|
83
84
|
}
|
|
@@ -127,6 +127,8 @@ export type SubscribeToChannelsChannelOpenedEvent = {
|
|
|
127
127
|
transaction_id: string;
|
|
128
128
|
/** Blockchain Transaction Vout */
|
|
129
129
|
transaction_vout: number;
|
|
130
|
+
/** Channel Commitment Transaction Type */
|
|
131
|
+
type?: string;
|
|
130
132
|
/** Unsettled Balance Tokens */
|
|
131
133
|
unsettled_balance: number;
|
|
132
134
|
};
|
|
@@ -109,6 +109,7 @@ const updateOpening = 'pending_open_channel';
|
|
|
109
109
|
sent: <Sent Tokens Number>
|
|
110
110
|
transaction_id: <Blockchain Transaction Id String>
|
|
111
111
|
transaction_vout: <Blockchain Transaction Vout Number>
|
|
112
|
+
[type]: <Channel Commitment Transaction Type String>
|
|
112
113
|
unsettled_balance: <Unsettled Balance Tokens Number>
|
|
113
114
|
}
|
|
114
115
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const {chanFormat} = require('bolt07');
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const {channelTypes} = require('./constants');
|
|
4
4
|
const parseThawHeight = require('./parse_thaw_height');
|
|
5
5
|
const rpcHtlcAsPayment = require('./rpc_htlc_as_payment');
|
|
6
6
|
|
|
@@ -118,6 +118,7 @@ const outpointDelimiter = ':';
|
|
|
118
118
|
time_online: <Monitoring Uptime Channel Up Milliseconds Number>
|
|
119
119
|
transaction_id: <Blockchain Transaction Id String>
|
|
120
120
|
transaction_vout: <Blockchain Transaction Vout Number>
|
|
121
|
+
[type]: <Channel Commitment Transaction Type String>
|
|
121
122
|
unsettled_balance: <Unsettled Balance Tokens Number>
|
|
122
123
|
}
|
|
123
124
|
*/
|
|
@@ -150,6 +151,10 @@ module.exports = args => {
|
|
|
150
151
|
throw new Error('ExpectedCommitWeightInChannelMessage');
|
|
151
152
|
}
|
|
152
153
|
|
|
154
|
+
if (!args.commitment_type) {
|
|
155
|
+
throw new Error('ExpectedChannelCommitmentTypeInChannelMessage');
|
|
156
|
+
}
|
|
157
|
+
|
|
153
158
|
if (args.fee_per_kw === undefined) {
|
|
154
159
|
throw new Error('ExpectedFeePerKwInChannelMessage');
|
|
155
160
|
}
|
|
@@ -210,7 +215,6 @@ module.exports = args => {
|
|
|
210
215
|
throw new Error('ExpectedUnsettledBalanceInChannelMessage');
|
|
211
216
|
}
|
|
212
217
|
|
|
213
|
-
const chanType = args.commitment_type;
|
|
214
218
|
const commitWeight = Number(args.commit_weight);
|
|
215
219
|
const {height} = parseThawHeight({id: args.chan_id, thaw: args.thaw_height});
|
|
216
220
|
const own = args.local_constraints;
|
|
@@ -266,6 +270,7 @@ module.exports = args => {
|
|
|
266
270
|
time_online: uptime,
|
|
267
271
|
transaction_id: transactionId,
|
|
268
272
|
transaction_vout: Number(vout),
|
|
273
|
+
type: channelTypes[args.commitment_type],
|
|
269
274
|
unsettled_balance: Number(args.unsettled_balance),
|
|
270
275
|
};
|
|
271
276
|
};
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@grpc/grpc-js": "1.8.14",
|
|
11
11
|
"@grpc/proto-loader": "0.7.6",
|
|
12
12
|
"@types/express": "4.17.17",
|
|
13
|
-
"@types/node": "18.16.
|
|
13
|
+
"@types/node": "18.16.2",
|
|
14
14
|
"@types/request": "2.48.8",
|
|
15
15
|
"@types/ws": "8.5.4",
|
|
16
16
|
"async": "3.2.4",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"directory": "test/typescript"
|
|
60
60
|
},
|
|
61
61
|
"types": "index.d.ts",
|
|
62
|
-
"version": "9.
|
|
62
|
+
"version": "9.2.0"
|
|
63
63
|
}
|
|
@@ -53,6 +53,7 @@ const makeExpected = overrides => {
|
|
|
53
53
|
time_online: 1000,
|
|
54
54
|
transaction_id: '00',
|
|
55
55
|
transaction_vout: 1,
|
|
56
|
+
type: 'anchor',
|
|
56
57
|
unsettled_balance: 1,
|
|
57
58
|
};
|
|
58
59
|
|
|
@@ -71,7 +72,7 @@ const makeLnd = overrides => {
|
|
|
71
72
|
close_address: 'cooperative_close_address',
|
|
72
73
|
commit_fee: '1',
|
|
73
74
|
commit_weight: '1',
|
|
74
|
-
commitment_type: '
|
|
75
|
+
commitment_type: 'ANCHORS',
|
|
75
76
|
fee_per_kw: '1',
|
|
76
77
|
initiator: true,
|
|
77
78
|
lifetime: 1,
|
|
@@ -174,6 +175,11 @@ const tests = [
|
|
|
174
175
|
description: 'Channel commit weight is expected',
|
|
175
176
|
error: [503, 'ExpectedCommitWeight'],
|
|
176
177
|
},
|
|
178
|
+
{
|
|
179
|
+
args: {lnd: makeLnd({commitment_type: undefined})},
|
|
180
|
+
description: 'Channel commit type is expected',
|
|
181
|
+
error: [503, 'ExpectedChannelCommitmentTypeInChannelMessage'],
|
|
182
|
+
},
|
|
177
183
|
{
|
|
178
184
|
args: {lnd: makeLnd({fee_per_kw: undefined})},
|
|
179
185
|
description: 'Channel fee per kw is expected',
|
|
@@ -242,7 +248,7 @@ const tests = [
|
|
|
242
248
|
{
|
|
243
249
|
args: {
|
|
244
250
|
lnd: makeLnd({
|
|
245
|
-
commitment_type: '
|
|
251
|
+
commitment_type: 'ANCHORS',
|
|
246
252
|
thaw_height: 1,
|
|
247
253
|
}),
|
|
248
254
|
},
|
|
@@ -66,7 +66,7 @@ const makeLnd = ({data, err}) => {
|
|
|
66
66
|
close_address: '',
|
|
67
67
|
commit_fee: '1',
|
|
68
68
|
commit_weight: '1',
|
|
69
|
-
commitment_type: '
|
|
69
|
+
commitment_type: 'ANCHORS',
|
|
70
70
|
csv_delay: 1,
|
|
71
71
|
fee_per_kw: '1',
|
|
72
72
|
initiator: true,
|
|
@@ -278,6 +278,7 @@ const tests = [
|
|
|
278
278
|
time_online: 1000,
|
|
279
279
|
transaction_id: '0000000000000000000000000000000000000000000000000000000000000000',
|
|
280
280
|
transaction_vout: 0,
|
|
281
|
+
type: 'anchor',
|
|
281
282
|
unsettled_balance: 1,
|
|
282
283
|
},
|
|
283
284
|
},
|
|
@@ -13,7 +13,7 @@ const makeArgs = overrides => {
|
|
|
13
13
|
close_address: undefined,
|
|
14
14
|
commit_fee: '1',
|
|
15
15
|
commit_weight: '1',
|
|
16
|
-
commitment_type: '
|
|
16
|
+
commitment_type: 'ANCHORS',
|
|
17
17
|
csv_delay: 1,
|
|
18
18
|
fee_per_kw: '1',
|
|
19
19
|
initiator: false,
|
|
@@ -112,6 +112,7 @@ const makeExpected = overrides => {
|
|
|
112
112
|
time_online: 1000,
|
|
113
113
|
transaction_id: '00',
|
|
114
114
|
transaction_vout: 1,
|
|
115
|
+
type: 'anchor',
|
|
115
116
|
unsettled_balance: 1,
|
|
116
117
|
};
|
|
117
118
|
|
|
@@ -156,6 +157,11 @@ const tests = [
|
|
|
156
157
|
description: 'Channel commit weight is expected',
|
|
157
158
|
error: 'ExpectedCommitWeightInChannelMessage',
|
|
158
159
|
},
|
|
160
|
+
{
|
|
161
|
+
args: makeArgs({commitment_type: undefined}),
|
|
162
|
+
description: 'Channel commit type is expected',
|
|
163
|
+
error: 'ExpectedChannelCommitmentTypeInChannelMessage',
|
|
164
|
+
},
|
|
159
165
|
{
|
|
160
166
|
args: makeArgs({fee_per_kw: undefined}),
|
|
161
167
|
description: 'Channel fee per kw is expected',
|
|
@@ -242,7 +248,7 @@ const tests = [
|
|
|
242
248
|
expected: makeExpected({id: '0x0x2', other_ids: ['0x0x3']}),
|
|
243
249
|
},
|
|
244
250
|
{
|
|
245
|
-
args: makeArgs({commitment_type: '
|
|
251
|
+
args: makeArgs({commitment_type: 'ANCHORS', initiator: true}),
|
|
246
252
|
description: 'Initiated RPC channel is mapped to channel',
|
|
247
253
|
expected: makeExpected({
|
|
248
254
|
is_partner_initiated: false,
|