lightning 10.3.1 → 10.5.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/walletkit.proto +94 -2
- package/grpc/protos/wtclient.proto +3 -0
- package/lnd_methods/info/get_configuration.d.ts +1 -1
- package/lnd_methods/info/get_configuration.js +1 -1
- package/lnd_methods/offchain/get_connected_watchtowers.d.ts +4 -0
- package/lnd_methods/offchain/get_connected_watchtowers.js +46 -33
- package/lnd_methods/onchain/delete_chain_transaction.d.ts +1 -1
- package/lnd_methods/onchain/delete_chain_transaction.js +1 -1
- package/lnd_methods/onchain/get_chain_transaction.d.ts +1 -1
- package/lnd_methods/onchain/get_chain_transaction.js +1 -1
- package/lnd_methods/onchain/get_sweep_transactions.d.ts +8 -1
- package/lnd_methods/onchain/get_sweep_transactions.js +5 -2
- package/package.json +4 -4
- package/test/lnd_methods/offchain/test_get_connected_watchtowers.js +1 -1
- package/test/typescript/get_connected_watchtowers.test-d.ts +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 10.5.0
|
|
4
|
+
|
|
5
|
+
- `getSweepTransactions`: Add `after` to scope sweep result set
|
|
6
|
+
|
|
7
|
+
## 10.4.0
|
|
8
|
+
|
|
9
|
+
- `getConnectedWatchtowers`: Add `is_taproot` to get P2TR channels
|
|
10
|
+
|
|
3
11
|
## 10.3.1
|
|
4
12
|
|
|
5
13
|
- `getConfiguration`: Add method to get the configuration file options
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
syntax = "proto3";
|
|
2
2
|
|
|
3
|
+
package walletrpc;
|
|
4
|
+
|
|
3
5
|
import "lightning.proto";
|
|
4
6
|
import "signer.proto";
|
|
5
7
|
|
|
6
|
-
package walletrpc;
|
|
7
|
-
|
|
8
8
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc/walletrpc";
|
|
9
9
|
|
|
10
10
|
/*
|
|
@@ -976,6 +976,91 @@ enum WitnessType {
|
|
|
976
976
|
to an output which is under complete control of the backing wallet.
|
|
977
977
|
*/
|
|
978
978
|
TAPROOT_PUB_KEY_SPEND = 22;
|
|
979
|
+
|
|
980
|
+
/*
|
|
981
|
+
A witness type that allows us to spend our settled local commitment after a
|
|
982
|
+
CSV delay when we force close the channel.
|
|
983
|
+
*/
|
|
984
|
+
TAPROOT_LOCAL_COMMIT_SPEND = 23;
|
|
985
|
+
|
|
986
|
+
/*
|
|
987
|
+
A witness type that allows us to spend our settled local commitment after
|
|
988
|
+
a CSV delay when the remote party has force closed the channel.
|
|
989
|
+
*/
|
|
990
|
+
TAPROOT_REMOTE_COMMIT_SPEND = 24;
|
|
991
|
+
|
|
992
|
+
/*
|
|
993
|
+
A witness type that we'll use for spending our own anchor output.
|
|
994
|
+
*/
|
|
995
|
+
TAPROOT_ANCHOR_SWEEP_SPEND = 25;
|
|
996
|
+
|
|
997
|
+
/*
|
|
998
|
+
A witness that allows us to timeout an HTLC we offered to the remote party
|
|
999
|
+
on our commitment transaction. We use this when we need to go on chain to
|
|
1000
|
+
time out an HTLC.
|
|
1001
|
+
*/
|
|
1002
|
+
TAPROOT_HTLC_OFFERED_TIMEOUT_SECOND_LEVEL = 26;
|
|
1003
|
+
|
|
1004
|
+
/*
|
|
1005
|
+
A witness type that allows us to sweep an HTLC we accepted on our commitment
|
|
1006
|
+
transaction after we go to the second level on chain.
|
|
1007
|
+
*/
|
|
1008
|
+
TAPROOT_HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL = 27;
|
|
1009
|
+
|
|
1010
|
+
/*
|
|
1011
|
+
A witness that allows us to sweep an HTLC on the revoked transaction of the
|
|
1012
|
+
remote party that goes to the second level.
|
|
1013
|
+
*/
|
|
1014
|
+
TAPROOT_HTLC_SECOND_LEVEL_REVOKE = 28;
|
|
1015
|
+
|
|
1016
|
+
/*
|
|
1017
|
+
A witness that allows us to sweep an HTLC sent to us by the remote party
|
|
1018
|
+
in the event that they broadcast a revoked state.
|
|
1019
|
+
*/
|
|
1020
|
+
TAPROOT_HTLC_ACCEPTED_REVOKE = 29;
|
|
1021
|
+
|
|
1022
|
+
/*
|
|
1023
|
+
A witness that allows us to sweep an HTLC we offered to the remote party if
|
|
1024
|
+
they broadcast a revoked commitment.
|
|
1025
|
+
*/
|
|
1026
|
+
TAPROOT_HTLC_OFFERED_REVOKE = 30;
|
|
1027
|
+
|
|
1028
|
+
/*
|
|
1029
|
+
A witness that allows us to sweep an HTLC we offered to the remote party
|
|
1030
|
+
that lies on the commitment transaction for the remote party. We can spend
|
|
1031
|
+
this output after the absolute CLTV timeout of the HTLC as passed.
|
|
1032
|
+
*/
|
|
1033
|
+
TAPROOT_HTLC_OFFERED_REMOTE_TIMEOUT = 31;
|
|
1034
|
+
|
|
1035
|
+
/*
|
|
1036
|
+
A witness type that allows us to sign the second level HTLC timeout
|
|
1037
|
+
transaction when spending from an HTLC residing on our local commitment
|
|
1038
|
+
transaction.
|
|
1039
|
+
This is used by the sweeper to re-sign inputs if it needs to aggregate
|
|
1040
|
+
several second level HTLCs.
|
|
1041
|
+
*/
|
|
1042
|
+
TAPROOT_HTLC_LOCAL_OFFERED_TIMEOUT = 32;
|
|
1043
|
+
|
|
1044
|
+
/*
|
|
1045
|
+
A witness that allows us to sweep an HTLC that was offered to us by the
|
|
1046
|
+
remote party for a taproot channels. We use this witness in the case that
|
|
1047
|
+
the remote party goes to chain, and we know the pre-image to the HTLC. We
|
|
1048
|
+
can sweep this without any additional timeout.
|
|
1049
|
+
*/
|
|
1050
|
+
TAPROOT_HTLC_ACCEPTED_REMOTE_SUCCESS = 33;
|
|
1051
|
+
|
|
1052
|
+
/*
|
|
1053
|
+
A witness type that allows us to sweep the HTLC offered to us on our local
|
|
1054
|
+
commitment transaction. We'll use this when we need to go on chain to sweep
|
|
1055
|
+
the HTLC. In this case, this is the second level HTLC success transaction.
|
|
1056
|
+
*/
|
|
1057
|
+
TAPROOT_HTLC_ACCEPTED_LOCAL_SUCCESS = 34;
|
|
1058
|
+
|
|
1059
|
+
/*
|
|
1060
|
+
A witness that allows us to sweep the settled output of a malicious
|
|
1061
|
+
counterparty's who broadcasts a revoked taproot commitment transaction.
|
|
1062
|
+
*/
|
|
1063
|
+
TAPROOT_COMMITMENT_REVOKE = 35;
|
|
979
1064
|
}
|
|
980
1065
|
|
|
981
1066
|
message PendingSweep {
|
|
@@ -1078,6 +1163,13 @@ message ListSweepsRequest {
|
|
|
1078
1163
|
replaced-by-fee, so will not be included in this output.
|
|
1079
1164
|
*/
|
|
1080
1165
|
bool verbose = 1;
|
|
1166
|
+
|
|
1167
|
+
/*
|
|
1168
|
+
The start height to use when fetching sweeps. If not specified (0), the
|
|
1169
|
+
result will start from the earliest sweep. If set to -1 the result will
|
|
1170
|
+
only include unconfirmed sweeps (at the time of the call).
|
|
1171
|
+
*/
|
|
1172
|
+
int32 start_height = 2;
|
|
1081
1173
|
}
|
|
1082
1174
|
|
|
1083
1175
|
message ListSweepsResponse {
|
|
@@ -22,7 +22,7 @@ export type GetConfigurationResult = {
|
|
|
22
22
|
* Requires `info:read`, `offchain:read`, `onchain:read`, `peers:read`
|
|
23
23
|
permissions
|
|
24
24
|
*
|
|
25
|
-
* This method is not supported on LND 0.17.
|
|
25
|
+
* This method is not supported on LND 0.17.4 and below
|
|
26
26
|
*/
|
|
27
27
|
export const getConfiguration: AuthenticatedLightningMethod<
|
|
28
28
|
GetConfigurationArgs,
|
|
@@ -17,7 +17,7 @@ const {values} = Object;
|
|
|
17
17
|
Requires `info:read`, `offchain:read`, `onchain:read`, `peers:read`
|
|
18
18
|
permissions
|
|
19
19
|
|
|
20
|
-
This method is not supported on LND 0.17.
|
|
20
|
+
This method is not supported on LND 0.17.4 and below
|
|
21
21
|
|
|
22
22
|
{
|
|
23
23
|
lnd: <Authenticated LND API Object>
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
export type GetConnectedWatchTowersArgs = AuthenticatedLightningArgs<{
|
|
7
7
|
/** Get Anchor Type Tower Info Bool */
|
|
8
8
|
is_anchor?: boolean;
|
|
9
|
+
/** Get Taproot Type Tower Info Bool */
|
|
10
|
+
is_taproot?: boolean;
|
|
9
11
|
}>;
|
|
10
12
|
|
|
11
13
|
export type GetConnectedWatchTowersResult = {
|
|
@@ -53,6 +55,8 @@ export type GetConnectedWatchTowersResult = {
|
|
|
53
55
|
* Requires `offchain:read` permission
|
|
54
56
|
*
|
|
55
57
|
* `is_anchor` flag is not supported on LND 0.11.1 and below
|
|
58
|
+
*
|
|
59
|
+
* `is_taproot` flag is not supported on LND 0.17.4 and below
|
|
56
60
|
*/
|
|
57
61
|
export const getConnectedWatchtowers: AuthenticatedLightningMethod<
|
|
58
62
|
GetConnectedWatchTowersArgs,
|
|
@@ -18,8 +18,11 @@ const unimplementedError = '12 UNIMPLEMENTED: unknown service wtclientrpc.Watcht
|
|
|
18
18
|
|
|
19
19
|
`is_anchor` flag is not supported on LND 0.11.1 and below
|
|
20
20
|
|
|
21
|
+
`is_taproot` flag is not supported on LND 0.17.4 and below
|
|
22
|
+
|
|
21
23
|
{
|
|
22
24
|
[is_anchor]: <Get Anchor Type Tower Info Bool>
|
|
25
|
+
[is_taproot]: <Get Taproot Type Tower Info Bool>
|
|
23
26
|
lnd: <Authenticated LND API Object>
|
|
24
27
|
}
|
|
25
28
|
|
|
@@ -57,39 +60,6 @@ module.exports = (args, cbk) => {
|
|
|
57
60
|
return cbk();
|
|
58
61
|
},
|
|
59
62
|
|
|
60
|
-
// Get policy
|
|
61
|
-
getPolicy: ['validate', ({}, cbk) => {
|
|
62
|
-
return args.lnd[type].policy({
|
|
63
|
-
policy_type: !!args.is_anchor ? 'ANCHOR' : 'LEGACY',
|
|
64
|
-
},
|
|
65
|
-
(err, res) => {
|
|
66
|
-
if (!!err && err.message === unimplementedError) {
|
|
67
|
-
return cbk([503, 'ExpectedWatchtowerClientLndToGetPolicy']);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (!!err) {
|
|
71
|
-
return cbk([503, 'UnexpectedErrorGettingWatchtowerPolicy', {err}]);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (!res) {
|
|
75
|
-
return cbk([503, 'ExpectedResultForWatchtowerPolicy']);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (res.max_updates === undefined) {
|
|
79
|
-
return cbk([503, 'ExpectedMaxUpdateCountInWatchtowerPolicyInfo']);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (res.sweep_sat_per_byte === undefined) {
|
|
83
|
-
return cbk([503, 'ExpectedSweepSatsPerByteInWatchtowerPolicy']);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return cbk(null, {
|
|
87
|
-
max_session_update_count: res.max_updates,
|
|
88
|
-
sweep_tokens_per_vbyte: res.sweep_sat_per_byte,
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
}],
|
|
92
|
-
|
|
93
63
|
// Get stats
|
|
94
64
|
getStats: ['validate', ({}, cbk) => {
|
|
95
65
|
return args.lnd[type].stats({}, (err, res) => {
|
|
@@ -181,6 +151,49 @@ module.exports = (args, cbk) => {
|
|
|
181
151
|
});
|
|
182
152
|
}],
|
|
183
153
|
|
|
154
|
+
// Determine the policy type
|
|
155
|
+
policyType: ['validate', ({}, cbk) => {
|
|
156
|
+
if (!!args.is_anchor) {
|
|
157
|
+
return cbk(null, 'ANCHOR');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (!!args.is_taproot) {
|
|
161
|
+
return cbk(null, 'TAPROOT');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return cbk(null, 'LEGACY');
|
|
165
|
+
}],
|
|
166
|
+
|
|
167
|
+
// Get policy
|
|
168
|
+
getPolicy: ['policyType', ({policyType}, cbk) => {
|
|
169
|
+
return args.lnd[type].policy({policy_type: policyType}, (err, res) => {
|
|
170
|
+
if (!!err && err.message === unimplementedError) {
|
|
171
|
+
return cbk([503, 'ExpectedWatchtowerClientLndToGetPolicy']);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (!!err) {
|
|
175
|
+
return cbk([503, 'UnexpectedErrorGettingWatchtowerPolicy', {err}]);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (!res) {
|
|
179
|
+
return cbk([503, 'ExpectedResultForWatchtowerPolicy']);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (res.max_updates === undefined) {
|
|
183
|
+
return cbk([503, 'ExpectedMaxUpdateCountInWatchtowerPolicyInfo']);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (res.sweep_sat_per_byte === undefined) {
|
|
187
|
+
return cbk([503, 'ExpectedSweepSatsPerByteInWatchtowerPolicy']);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return cbk(null, {
|
|
191
|
+
max_session_update_count: res.max_updates,
|
|
192
|
+
sweep_tokens_per_vbyte: res.sweep_sat_per_byte,
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}],
|
|
196
|
+
|
|
184
197
|
// Connected watchtowers
|
|
185
198
|
watchtowers: [
|
|
186
199
|
'getPolicy',
|
|
@@ -14,6 +14,6 @@ export type DeleteChainTransactionArgs = AuthenticatedLightningArgs<{
|
|
|
14
14
|
*
|
|
15
15
|
* Requires `onchain:write` permission
|
|
16
16
|
*
|
|
17
|
-
* This method is not supported on LND 0.17.
|
|
17
|
+
* This method is not supported on LND 0.17.4 and below
|
|
18
18
|
*/
|
|
19
19
|
export const deleteChainTransaction: AuthenticatedLightningMethod<DeleteChainTransactionArgs>;
|
|
@@ -16,7 +16,7 @@ export type GetChainTransactionResult = ChainTransaction;
|
|
|
16
16
|
*
|
|
17
17
|
* Requires `onchain:read` permission
|
|
18
18
|
*
|
|
19
|
-
* This method is not supported on LND 0.17.
|
|
19
|
+
* This method is not supported on LND 0.17.4 and below
|
|
20
20
|
*/
|
|
21
21
|
export const getChainTransaction: AuthenticatedLightningMethod<
|
|
22
22
|
GetChainTransactionArgs,
|
|
@@ -3,7 +3,10 @@ import {
|
|
|
3
3
|
AuthenticatedLightningMethod,
|
|
4
4
|
} from '../../typescript';
|
|
5
5
|
|
|
6
|
-
export type GetSweepTransactionArgs = AuthenticatedLightningArgs
|
|
6
|
+
export type GetSweepTransactionArgs = AuthenticatedLightningArgs<{
|
|
7
|
+
/** Confirmed After Block Height */
|
|
8
|
+
after?: number;
|
|
9
|
+
}>;
|
|
7
10
|
|
|
8
11
|
export type GetSweepTransactionsResult = {
|
|
9
12
|
transactions: {
|
|
@@ -44,6 +47,10 @@ export type GetSweepTransactionsResult = {
|
|
|
44
47
|
* Get self-transfer spend transactions related to channel closes
|
|
45
48
|
*
|
|
46
49
|
* Requires `onchain:read` permission
|
|
50
|
+
*
|
|
51
|
+
* Requires LND built with `walletrpc` build tag
|
|
52
|
+
*
|
|
53
|
+
* `after` is not supported in LND 0.17.3 or below
|
|
47
54
|
*/
|
|
48
55
|
export const getSweepTransactions: AuthenticatedLightningMethod<
|
|
49
56
|
GetSweepTransactionArgs,
|
|
@@ -17,7 +17,10 @@ const type = 'wallet';
|
|
|
17
17
|
|
|
18
18
|
Requires LND built with `walletrpc` build tag
|
|
19
19
|
|
|
20
|
+
`after` is not supported in LND 0.17.3 or below
|
|
21
|
+
|
|
20
22
|
{
|
|
23
|
+
[after]: <Confirmed After Block Height Number>
|
|
21
24
|
lnd: <Authenticated LND API Object>
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -43,7 +46,7 @@ const type = 'wallet';
|
|
|
43
46
|
}]
|
|
44
47
|
}
|
|
45
48
|
*/
|
|
46
|
-
module.exports = ({lnd}, cbk) => {
|
|
49
|
+
module.exports = ({after, lnd}, cbk) => {
|
|
47
50
|
return new Promise((resolve, reject) => {
|
|
48
51
|
return asyncAuto({
|
|
49
52
|
// Check arguments
|
|
@@ -57,7 +60,7 @@ module.exports = ({lnd}, cbk) => {
|
|
|
57
60
|
|
|
58
61
|
// Get sweep transaction ids
|
|
59
62
|
getSweeps: ['validate', ({}, cbk) => {
|
|
60
|
-
return lnd[type][method]({}, (err, res) => {
|
|
63
|
+
return lnd[type][method]({start_height: after}, (err, res) => {
|
|
61
64
|
if (!!err && err.details === notSupportedError) {
|
|
62
65
|
return cbk([501, 'BackingLndDoesNotSupportListingSweeps']);
|
|
63
66
|
}
|
package/package.json
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
"url": "https://github.com/alexbosworth/lightning/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@grpc/grpc-js": "1.
|
|
10
|
+
"@grpc/grpc-js": "1.10.0",
|
|
11
11
|
"@grpc/proto-loader": "0.7.10",
|
|
12
|
-
"@types/node": "20.11.
|
|
12
|
+
"@types/node": "20.11.16",
|
|
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.
|
|
25
|
+
"type-fest": "4.10.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.
|
|
56
|
+
"version": "10.5.0"
|
|
57
57
|
}
|
|
@@ -198,7 +198,7 @@ const tests = [
|
|
|
198
198
|
error: [503, 'ExpectedResultForWatchtowerListing'],
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
|
-
args: {lnd: makeLnd({towersRes: {}})},
|
|
201
|
+
args: {is_taproot: true, lnd: makeLnd({towersRes: {}})},
|
|
202
202
|
description: 'Towers array is expected',
|
|
203
203
|
error: [503, 'ExpectedArrayOfTowersForWatchtowerListing'],
|
|
204
204
|
},
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
|
|
8
8
|
const lnd = {} as AuthenticatedLnd;
|
|
9
9
|
const is_anchor = true;
|
|
10
|
+
const is_taproot = true;
|
|
10
11
|
|
|
11
12
|
expectError(getConnectedWatchtowers());
|
|
12
13
|
expectError(getConnectedWatchtowers({}));
|
|
@@ -16,6 +17,9 @@ expectType<GetConnectedWatchTowersResult>(await getConnectedWatchtowers({lnd}));
|
|
|
16
17
|
expectType<GetConnectedWatchTowersResult>(
|
|
17
18
|
await getConnectedWatchtowers({lnd, is_anchor})
|
|
18
19
|
);
|
|
20
|
+
expectType<GetConnectedWatchTowersResult>(
|
|
21
|
+
await getConnectedWatchtowers({lnd, is_taproot})
|
|
22
|
+
);
|
|
19
23
|
|
|
20
24
|
expectType<void>(
|
|
21
25
|
getConnectedWatchtowers({lnd}, (error, result) => {
|
|
@@ -27,3 +31,8 @@ expectType<void>(
|
|
|
27
31
|
expectType<GetConnectedWatchTowersResult>(result);
|
|
28
32
|
})
|
|
29
33
|
);
|
|
34
|
+
expectType<void>(
|
|
35
|
+
getConnectedWatchtowers({lnd, is_taproot}, (error, result) => {
|
|
36
|
+
expectType<GetConnectedWatchTowersResult>(result);
|
|
37
|
+
})
|
|
38
|
+
);
|