lightning 5.10.1 → 5.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 +14 -0
- package/README.md +12 -12
- package/grpc/grpc_services.json +3 -0
- package/grpc/protos/peers.proto +94 -0
- package/index.js +8 -0
- package/lnd_grpc/authenticated_lnd_grpc.js +1 -0
- package/lnd_methods/index.js +8 -0
- package/lnd_methods/info/constants.json +1 -0
- package/lnd_methods/info/get_wallet_info.js +2 -0
- package/lnd_methods/macaroon/methods.json +19 -3
- package/lnd_methods/onchain/partially_sign_psbt.d.ts +1 -1
- package/lnd_methods/onchain/partially_sign_psbt.js +1 -1
- package/lnd_methods/peers/add_external_socket.js +62 -0
- package/lnd_methods/peers/index.js +14 -1
- package/lnd_methods/peers/remove_external_socket.js +62 -0
- package/lnd_methods/peers/update_alias.js +58 -0
- package/lnd_methods/peers/update_color.js +58 -0
- package/lnd_methods/signer/sign_transaction.d.ts +8 -0
- package/package.json +4 -4
- package/test/lnd_grpc/test_authenticated_lnd_grpc.js +1 -0
- package/test/lnd_methods/peers/test_add_external_socket.js +56 -0
- package/test/lnd_methods/peers/test_remove_external_socket.js +56 -0
- package/test/lnd_methods/peers/test_update_alias.js +56 -0
- package/test/lnd_methods/peers/test_update_color.js +56 -0
- package/test/typescript/sign_transaction.test-d.ts +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 5.13.0
|
|
4
|
+
|
|
5
|
+
- `addExternalSocket`: Add method to add a socket to graph announcements
|
|
6
|
+
- `removeExternalSocket`: Add method to remove sockets from graph announcements
|
|
7
|
+
|
|
8
|
+
## 5.12.0
|
|
9
|
+
|
|
10
|
+
- `getWalletVersion`: Add support for LND 0.14.3-beta
|
|
11
|
+
|
|
12
|
+
## 5.11.0
|
|
13
|
+
|
|
14
|
+
- `updateAlias`: Add method to update the node graph announcement alias
|
|
15
|
+
- `updateColor`: Add method to update the node graph announcement color
|
|
16
|
+
|
|
3
17
|
## 5.10.1
|
|
4
18
|
|
|
5
19
|
- Always use TLV when paying along routes
|
package/README.md
CHANGED
|
@@ -9,28 +9,28 @@ Methods for working with the Lightning Network
|
|
|
9
9
|
- [bitpay.com crypto-rpc](https://bitpay.com/) -
|
|
10
10
|
https://github.com/bitpay/crypto-rpc
|
|
11
11
|
- [coinos.io](https://coinos.io/) - https://github.com/coinos/coinos-server
|
|
12
|
+
- [Galoy](https://galoy.io/) - https://github.com/GaloyMoney/galoy
|
|
13
|
+
- [Lightning Poker](https://lightning-poker.com/) -
|
|
14
|
+
https://github.com/igreshev/lightning-poker
|
|
15
|
+
- [Lightning Roulette](https://lightning-roulette.com/) -
|
|
16
|
+
https://github.com/igreshev/lightning-roulette
|
|
12
17
|
- [Lightning Shell](https://lightningshell.app/) -
|
|
13
18
|
https://github.com/ibz/lightning-shell
|
|
14
19
|
- [LNMarkets](https://twitter.com/lnmarkets) -
|
|
15
20
|
https://github.com/lnmarkets/umbrel
|
|
16
|
-
- [Galoy](https://galoy.io/) - https://github.com/GaloyMoney/galoy
|
|
17
|
-
- [Tarnhelm](https://www.tarnhelm.app/) - https://github.com/bkiac/tarnhelm
|
|
18
|
-
- [tbtcswaps](https://tbtcswaps.com/) -
|
|
19
|
-
https://github.com/keep-community/tbtcswaps
|
|
20
|
-
- [stackernews](https://stacker.news/) -
|
|
21
|
-
https://github.com/stackernews/stacker.news
|
|
22
|
-
- [Thunderhub](https://www.thunderhub.io/) -
|
|
23
|
-
https://github.com/apotdevin/thunderhub
|
|
24
|
-
- [Lightning Roulette](https://lightning-roulette.com/) -
|
|
25
|
-
https://github.com/igreshev/lightning-roulette
|
|
26
|
-
- [Lightning Poker](https://lightning-poker.com/) -
|
|
27
|
-
https://github.com/igreshev/lightning-poker
|
|
28
21
|
- [p2plnbot](https://telegram.me/lnp2pbot) - https://github.com/grunch/p2plnbot
|
|
29
22
|
- [rekr](https://rekr.app/) - https://github.com/ryan-lingle/rekr
|
|
23
|
+
- [stackernews](https://stacker.news/) -
|
|
24
|
+
https://github.com/stackernews/stacker.news
|
|
30
25
|
- [Suredbits API](https://suredbits.com/) -
|
|
31
26
|
https://github.com/Suredbits/sb-api-lnd
|
|
32
27
|
- [Synonym demo server](https://synonym.to) -
|
|
33
28
|
https://github.com/synonymdev/slash-pay-demo-server
|
|
29
|
+
- [Tarnhelm](https://www.tarnhelm.app/) - https://github.com/bkiac/tarnhelm
|
|
30
|
+
- [tbtcswaps](https://tbtcswaps.com/) -
|
|
31
|
+
https://github.com/keep-community/tbtcswaps
|
|
32
|
+
- [Thunderhub](https://www.thunderhub.io/) -
|
|
33
|
+
https://github.com/apotdevin/thunderhub
|
|
34
34
|
|
|
35
35
|
## LND Authentication
|
|
36
36
|
|
package/grpc/grpc_services.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"ChainNotifier": "chainrpc",
|
|
8
8
|
"Invoices": "invoicesrpc",
|
|
9
9
|
"Lightning": "lnrpc",
|
|
10
|
+
"Peers": "peersrpc",
|
|
10
11
|
"Router": "routerrpc",
|
|
11
12
|
"Signer": "signrpc",
|
|
12
13
|
"State": "lnrpc",
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
"ChainNotifier": "chainnotifier.proto",
|
|
22
23
|
"Invoices": "invoices.proto",
|
|
23
24
|
"Lightning": "lightning.proto",
|
|
25
|
+
"Peers": "peers.proto",
|
|
24
26
|
"Router": "router.proto",
|
|
25
27
|
"Signer": "signer.proto",
|
|
26
28
|
"State": "stateservice.proto",
|
|
@@ -36,6 +38,7 @@
|
|
|
36
38
|
"chain": "ChainNotifier",
|
|
37
39
|
"default": "Lightning",
|
|
38
40
|
"invoices": "Invoices",
|
|
41
|
+
"peers": "Peers",
|
|
39
42
|
"router": "Router",
|
|
40
43
|
"signer": "Signer",
|
|
41
44
|
"tower_client": "WatchtowerClient",
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
import "lightning.proto";
|
|
4
|
+
|
|
5
|
+
package peersrpc;
|
|
6
|
+
|
|
7
|
+
option go_package = "github.com/lightningnetwork/lnd/lnrpc/peersrpc";
|
|
8
|
+
|
|
9
|
+
// Peers is a service that can be used to get information and interact
|
|
10
|
+
// with the other nodes of the newtwork.
|
|
11
|
+
service Peers {
|
|
12
|
+
/* lncli: peers updatenodeannouncement
|
|
13
|
+
UpdateNodeAnnouncement allows the caller to update the node parameters
|
|
14
|
+
and broadcasts a new version of the node announcement to its peers.
|
|
15
|
+
*/
|
|
16
|
+
rpc UpdateNodeAnnouncement (NodeAnnouncementUpdateRequest)
|
|
17
|
+
returns (NodeAnnouncementUpdateResponse);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// UpdateAction is used to determine the kind of action we are referring to.
|
|
21
|
+
enum UpdateAction {
|
|
22
|
+
// ADD indicates this is an "insertion" kind of action.
|
|
23
|
+
ADD = 0;
|
|
24
|
+
|
|
25
|
+
// REMOVE indicates this is a "deletion" kind of action.
|
|
26
|
+
REMOVE = 1;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
enum FeatureSet {
|
|
30
|
+
/*
|
|
31
|
+
SET_INIT identifies features that should be sent in an Init message to
|
|
32
|
+
a remote peer.
|
|
33
|
+
*/
|
|
34
|
+
SET_INIT = 0;
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
SET_LEGACY_GLOBAL identifies features that should be set in the legacy
|
|
38
|
+
GlobalFeatures field of an Init message, which maintains backwards
|
|
39
|
+
compatibility with nodes that haven't implemented flat features.
|
|
40
|
+
*/
|
|
41
|
+
SET_LEGACY_GLOBAL = 1;
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
SET_NODE_ANN identifies features that should be advertised on node
|
|
45
|
+
announcements.
|
|
46
|
+
*/
|
|
47
|
+
SET_NODE_ANN = 2;
|
|
48
|
+
|
|
49
|
+
/*
|
|
50
|
+
SET_INVOICE identifies features that should be advertised on invoices
|
|
51
|
+
generated by the daemon.
|
|
52
|
+
*/
|
|
53
|
+
SET_INVOICE = 3;
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
SET_INVOICE_AMP identifies the features that should be advertised on
|
|
57
|
+
AMP invoices generated by the daemon.
|
|
58
|
+
*/
|
|
59
|
+
SET_INVOICE_AMP = 4;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
message UpdateAddressAction {
|
|
63
|
+
// Determines the kind of action.
|
|
64
|
+
UpdateAction action = 1;
|
|
65
|
+
|
|
66
|
+
// The address used to apply the update action.
|
|
67
|
+
string address = 2;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
message UpdateFeatureAction {
|
|
71
|
+
// Determines the kind of action.
|
|
72
|
+
UpdateAction action = 1;
|
|
73
|
+
|
|
74
|
+
// The feature bit used to apply the update action.
|
|
75
|
+
lnrpc.FeatureBit feature_bit = 2;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message NodeAnnouncementUpdateRequest {
|
|
79
|
+
// Set of changes for the features that the node supports.
|
|
80
|
+
repeated UpdateFeatureAction feature_updates = 1;
|
|
81
|
+
|
|
82
|
+
// Color is the node's color in hex code format.
|
|
83
|
+
string color = 2;
|
|
84
|
+
|
|
85
|
+
// Alias or nick name of the node.
|
|
86
|
+
string alias = 3;
|
|
87
|
+
|
|
88
|
+
// Set of changes for the node's known addresses.
|
|
89
|
+
repeated UpdateAddressAction address_updates = 4;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
message NodeAnnouncementUpdateResponse {
|
|
93
|
+
repeated lnrpc.Op ops = 1;
|
|
94
|
+
}
|
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const {addExternalSocket} = require('./lnd_methods');
|
|
1
2
|
const {addPeer} = require('./lnd_methods');
|
|
2
3
|
const {authenticatedLndGrpc} = require('./lnd_grpc');
|
|
3
4
|
const {broadcastChainTransaction} = require('./lnd_methods');
|
|
@@ -88,6 +89,7 @@ const {probeForRoute} = require('./lnd_methods');
|
|
|
88
89
|
const {proposeChannel} = require('./lnd_methods');
|
|
89
90
|
const {recoverFundsFromChannel} = require('./lnd_methods');
|
|
90
91
|
const {recoverFundsFromChannels} = require('./lnd_methods');
|
|
92
|
+
const {removeExternalSocket} = require('./lnd_methods');
|
|
91
93
|
const {removePeer} = require('./lnd_methods');
|
|
92
94
|
const {requestChainFeeIncrease} = require('./lnd_methods');
|
|
93
95
|
const {revokeAccess} = require('./lnd_methods');
|
|
@@ -127,7 +129,9 @@ const {subscribeToWalletStatus} = require('./lnd_methods');
|
|
|
127
129
|
const {unauthenticatedLndGrpc} = require('./lnd_grpc');
|
|
128
130
|
const {unlockUtxo} = require('./lnd_methods');
|
|
129
131
|
const {unlockWallet} = require('./lnd_methods');
|
|
132
|
+
const {updateAlias} = require('./lnd_methods');
|
|
130
133
|
const {updateChainTransaction} = require('./lnd_methods');
|
|
134
|
+
const {updateColor} = require('./lnd_methods');
|
|
131
135
|
const {updateConnectedWatchtower} = require('./lnd_methods');
|
|
132
136
|
const {updatePathfindingSettings} = require('./lnd_methods');
|
|
133
137
|
const {updateRoutingFees} = require('./lnd_methods');
|
|
@@ -138,6 +142,7 @@ const {verifyBytesSignature} = require('./lnd_methods');
|
|
|
138
142
|
const {verifyMessage} = require('./lnd_methods');
|
|
139
143
|
|
|
140
144
|
module.exports = {
|
|
145
|
+
addExternalSocket,
|
|
141
146
|
addPeer,
|
|
142
147
|
authenticatedLndGrpc,
|
|
143
148
|
broadcastChainTransaction,
|
|
@@ -228,6 +233,7 @@ module.exports = {
|
|
|
228
233
|
proposeChannel,
|
|
229
234
|
recoverFundsFromChannel,
|
|
230
235
|
recoverFundsFromChannels,
|
|
236
|
+
removeExternalSocket,
|
|
231
237
|
removePeer,
|
|
232
238
|
requestChainFeeIncrease,
|
|
233
239
|
revokeAccess,
|
|
@@ -267,6 +273,8 @@ module.exports = {
|
|
|
267
273
|
unauthenticatedLndGrpc,
|
|
268
274
|
unlockUtxo,
|
|
269
275
|
unlockWallet,
|
|
276
|
+
updateAlias,
|
|
277
|
+
updateColor,
|
|
270
278
|
updateChainTransaction,
|
|
271
279
|
updateConnectedWatchtower,
|
|
272
280
|
updatePathfindingSettings,
|
|
@@ -37,6 +37,7 @@ const pathForProto = proto => join(__dirname, protosDir, proto);
|
|
|
37
37
|
chain: <ChainNotifier API Methods Object>
|
|
38
38
|
default: <Default API Methods Object>
|
|
39
39
|
invoices: <Invoices API Methods Object>
|
|
40
|
+
peers: <Peers API Methods Object>
|
|
40
41
|
router: <Router API Methods Object>
|
|
41
42
|
signer: <Signer Methods API Object>
|
|
42
43
|
tower_client: <Watchtower Client Methods Object>
|
package/lnd_methods/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const {addExternalSocket} = require('./peers');
|
|
1
2
|
const {addPeer} = require('./peers');
|
|
2
3
|
const {broadcastChainTransaction} = require('./onchain');
|
|
3
4
|
const {cancelHodlInvoice} = require('./invoices');
|
|
@@ -85,6 +86,7 @@ const {probeForRoute} = require('./offchain');
|
|
|
85
86
|
const {proposeChannel} = require('./onchain');
|
|
86
87
|
const {recoverFundsFromChannel} = require('./offchain');
|
|
87
88
|
const {recoverFundsFromChannels} = require('./offchain');
|
|
89
|
+
const {removeExternalSocket} = require('./peers');
|
|
88
90
|
const {removePeer} = require('./peers');
|
|
89
91
|
const {requestChainFeeIncrease} = require('./onchain');
|
|
90
92
|
const {revokeAccess} = require('./macaroon');
|
|
@@ -123,7 +125,9 @@ const {subscribeToTransactions} = require('./onchain');
|
|
|
123
125
|
const {subscribeToWalletStatus} = require('./unauthenticated');
|
|
124
126
|
const {unlockUtxo} = require('./onchain');
|
|
125
127
|
const {unlockWallet} = require('./unauthenticated');
|
|
128
|
+
const {updateAlias} = require('./peers');
|
|
126
129
|
const {updateChainTransaction} = require('./onchain');
|
|
130
|
+
const {updateColor} = require('./peers');
|
|
127
131
|
const {updateConnectedWatchtower} = require('./offchain');
|
|
128
132
|
const {updatePathfindingSettings} = require('./offchain');
|
|
129
133
|
const {updateRoutingFees} = require('./offchain');
|
|
@@ -134,6 +138,7 @@ const {verifyBytesSignature} = require('./signer');
|
|
|
134
138
|
const {verifyMessage} = require('./message');
|
|
135
139
|
|
|
136
140
|
module.exports = {
|
|
141
|
+
addExternalSocket,
|
|
137
142
|
addPeer,
|
|
138
143
|
broadcastChainTransaction,
|
|
139
144
|
cancelHodlInvoice,
|
|
@@ -221,6 +226,7 @@ module.exports = {
|
|
|
221
226
|
proposeChannel,
|
|
222
227
|
recoverFundsFromChannel,
|
|
223
228
|
recoverFundsFromChannels,
|
|
229
|
+
removeExternalSocket,
|
|
224
230
|
removePeer,
|
|
225
231
|
requestChainFeeIncrease,
|
|
226
232
|
revokeAccess,
|
|
@@ -259,7 +265,9 @@ module.exports = {
|
|
|
259
265
|
subscribeToWalletStatus,
|
|
260
266
|
unlockUtxo,
|
|
261
267
|
unlockWallet,
|
|
268
|
+
updateAlias,
|
|
262
269
|
updateChainTransaction,
|
|
270
|
+
updateColor,
|
|
263
271
|
updateConnectedWatchtower,
|
|
264
272
|
updatePathfindingSettings,
|
|
265
273
|
updateRoutingFees,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"7f34774529fa0964d47fc418d4d2965435cbfdc0": "0.11.1-beta",
|
|
32
32
|
"86d3dec7b939b21bb10f2cd1ff56970c392a1c69": "0.13.2-beta",
|
|
33
33
|
"86114c575c2dff9dff1e1bb4df961c64aea9fc1c": "0.10.4-beta",
|
|
34
|
+
"bd0c46b4fcb027af1915bd67a3da70e8ca5c6efe": "0.14.3-beta",
|
|
34
35
|
"d176d2d65fc06e6631c4dc9478592be8545a21de": "0.12.0-beta",
|
|
35
36
|
"d233f61383f2f950aa06f5b09da5b0e78e784fae": "0.12.1-beta",
|
|
36
37
|
"d62c575f8499a314eb27f12462d20500b6bda2c7": "0.10.3-beta",
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"addExternalSocket": {
|
|
3
|
+
"method": "updateNodeAnnouncement",
|
|
4
|
+
"type": "peers"
|
|
5
|
+
},
|
|
2
6
|
"addPeer": {
|
|
3
7
|
"method": "ConnectPeer",
|
|
4
8
|
"type": "default"
|
|
@@ -338,6 +342,10 @@
|
|
|
338
342
|
"method": "restoreChannelBackups",
|
|
339
343
|
"type": "default"
|
|
340
344
|
},
|
|
345
|
+
"removeExternalSocket": {
|
|
346
|
+
"method": "updateNodeAnnouncement",
|
|
347
|
+
"type": "peers"
|
|
348
|
+
},
|
|
341
349
|
"removePeer": {
|
|
342
350
|
"method": "DisconnectPeer",
|
|
343
351
|
"type": "default"
|
|
@@ -490,14 +498,22 @@
|
|
|
490
498
|
"method": "releaseOutput",
|
|
491
499
|
"type": "wallet"
|
|
492
500
|
},
|
|
493
|
-
"
|
|
494
|
-
"
|
|
495
|
-
"type": "
|
|
501
|
+
"updateAlias": {
|
|
502
|
+
"method": "updateNodeAnnouncement",
|
|
503
|
+
"type": "peers"
|
|
496
504
|
},
|
|
497
505
|
"updateChainTransaction": {
|
|
498
506
|
"method": "LabelTransaction",
|
|
499
507
|
"type": "wallet"
|
|
500
508
|
},
|
|
509
|
+
"updateColor": {
|
|
510
|
+
"method": "updateNodeAnnouncement",
|
|
511
|
+
"type": "peers"
|
|
512
|
+
},
|
|
513
|
+
"updateConnectedWatchtower": {
|
|
514
|
+
"methods": ["AddTower", "RemoveTower"],
|
|
515
|
+
"type": "tower_client"
|
|
516
|
+
},
|
|
501
517
|
"updatePathfindingSettings": {
|
|
502
518
|
"method": "SetMissionControlConfig",
|
|
503
519
|
"type": "router"
|
|
@@ -20,7 +20,7 @@ export type PartiallySignPsbtResult = {
|
|
|
20
20
|
*
|
|
21
21
|
* Requires LND built with `walletrpc` tag
|
|
22
22
|
*
|
|
23
|
-
* This method is not supported in LND 0.14.
|
|
23
|
+
* This method is not supported in LND 0.14.1 and below
|
|
24
24
|
*/
|
|
25
25
|
export const partiallySignPsbt: AuthenticatedLightningMethod<
|
|
26
26
|
PartiallySignPsbtArgs,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const asyncAuto = require('async/auto');
|
|
2
|
+
const {returnResult} = require('asyncjs-util');
|
|
3
|
+
|
|
4
|
+
const {isLnd} = require('./../../lnd_requests');
|
|
5
|
+
|
|
6
|
+
const action = 0;
|
|
7
|
+
const errorUnimplemented = 'unknown service peersrpc.Peers';
|
|
8
|
+
const method = 'updateNodeAnnouncement';
|
|
9
|
+
const type = 'peers';
|
|
10
|
+
|
|
11
|
+
/** Add a new advertised p2p socket address
|
|
12
|
+
|
|
13
|
+
Note: this method is not supported in LND versions 0.14.3 and below
|
|
14
|
+
|
|
15
|
+
Requires LND built with `peersrpc` build tag
|
|
16
|
+
|
|
17
|
+
Requires `peers:write` permissions
|
|
18
|
+
|
|
19
|
+
{
|
|
20
|
+
lnd: <Authenticated LND API Object>
|
|
21
|
+
socket: <Add Socket Address String>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@returns via cbk or Promise
|
|
25
|
+
*/
|
|
26
|
+
module.exports = ({lnd, socket}, cbk) => {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
return asyncAuto({
|
|
29
|
+
// Check arguments
|
|
30
|
+
validate: cbk => {
|
|
31
|
+
if (!isLnd({lnd, method, type})) {
|
|
32
|
+
return cbk([400, 'ExpectedLndToAddExternalSocket']);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!socket) {
|
|
36
|
+
return cbk([400, 'ExpectedHostAndPortOfSocketToAdd']);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return cbk();
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// Add external socket to be advertised
|
|
43
|
+
add: ['validate', ({}, cbk) => {
|
|
44
|
+
return lnd[type][method]({
|
|
45
|
+
address_updates: [{action, address: socket}],
|
|
46
|
+
},
|
|
47
|
+
err => {
|
|
48
|
+
if (!!err && err.details === errorUnimplemented) {
|
|
49
|
+
return cbk([400, 'ExpectedPeersRpcLndBuildTagToAddSocket']);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!!err) {
|
|
53
|
+
return cbk([503, 'UnexpectedErrorAddingExternalSocket', {err}]);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return cbk();
|
|
57
|
+
});
|
|
58
|
+
}],
|
|
59
|
+
},
|
|
60
|
+
returnResult({reject, resolve}, cbk));
|
|
61
|
+
});
|
|
62
|
+
};
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
const addExternalSocket = require('./add_external_socket');
|
|
1
2
|
const addPeer = require('./add_peer');
|
|
2
3
|
const getPeers = require('./get_peers');
|
|
4
|
+
const removeExternalSocket = require('./remove_external_socket');
|
|
3
5
|
const removePeer = require('./remove_peer');
|
|
4
6
|
const subscribeToPeers = require('./subscribe_to_peers');
|
|
7
|
+
const updateAlias = require('./update_alias');
|
|
8
|
+
const updateColor = require('./update_color');
|
|
5
9
|
|
|
6
|
-
module.exports = {
|
|
10
|
+
module.exports = {
|
|
11
|
+
addExternalSocket,
|
|
12
|
+
addPeer,
|
|
13
|
+
getPeers,
|
|
14
|
+
removeExternalSocket,
|
|
15
|
+
removePeer,
|
|
16
|
+
subscribeToPeers,
|
|
17
|
+
updateAlias,
|
|
18
|
+
updateColor,
|
|
19
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const asyncAuto = require('async/auto');
|
|
2
|
+
const {returnResult} = require('asyncjs-util');
|
|
3
|
+
|
|
4
|
+
const {isLnd} = require('./../../lnd_requests');
|
|
5
|
+
|
|
6
|
+
const action = 1;
|
|
7
|
+
const errorUnimplemented = 'unknown service peersrpc.Peers';
|
|
8
|
+
const method = 'updateNodeAnnouncement';
|
|
9
|
+
const type = 'peers';
|
|
10
|
+
|
|
11
|
+
/** Remove an existing advertised p2p socket address
|
|
12
|
+
|
|
13
|
+
Note: this method is not supported in LND versions 0.14.3 and below
|
|
14
|
+
|
|
15
|
+
Requires LND built with `peersrpc` build tag
|
|
16
|
+
|
|
17
|
+
Requires `peers:write` permissions
|
|
18
|
+
|
|
19
|
+
{
|
|
20
|
+
lnd: <Authenticated LND API Object>
|
|
21
|
+
socket: <Remove Socket Address String>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@returns via cbk or Promise
|
|
25
|
+
*/
|
|
26
|
+
module.exports = ({lnd, socket}, cbk) => {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
return asyncAuto({
|
|
29
|
+
// Check arguments
|
|
30
|
+
validate: cbk => {
|
|
31
|
+
if (!isLnd({lnd, method, type})) {
|
|
32
|
+
return cbk([400, 'ExpectedLndToRemoveExternalSocket']);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!socket) {
|
|
36
|
+
return cbk([400, 'ExpectedHostAndPortOfSocketToRemove']);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return cbk();
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
// Stop external socket from being advertised
|
|
43
|
+
add: ['validate', ({}, cbk) => {
|
|
44
|
+
return lnd[type][method]({
|
|
45
|
+
address_updates: [{action, address: socket}],
|
|
46
|
+
},
|
|
47
|
+
err => {
|
|
48
|
+
if (!!err && err.details === errorUnimplemented) {
|
|
49
|
+
return cbk([400, 'ExpectedPeersRpcLndBuildTagToRemoveSocket']);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!!err) {
|
|
53
|
+
return cbk([503, 'UnexpectedErrorRemovingExternalSocket', {err}]);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return cbk();
|
|
57
|
+
});
|
|
58
|
+
}],
|
|
59
|
+
},
|
|
60
|
+
returnResult({reject, resolve}, cbk));
|
|
61
|
+
});
|
|
62
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const asyncAuto = require('async/auto');
|
|
2
|
+
const {returnResult} = require('asyncjs-util');
|
|
3
|
+
|
|
4
|
+
const {isLnd} = require('./../../lnd_requests');
|
|
5
|
+
|
|
6
|
+
const errorUnimplemented = 'unknown service peersrpc.Peers';
|
|
7
|
+
const method = 'updateNodeAnnouncement';
|
|
8
|
+
const type = 'peers';
|
|
9
|
+
|
|
10
|
+
/** Update the node alias as advertised in the graph
|
|
11
|
+
|
|
12
|
+
Note: this method is not supported in LND versions 0.14.3 and below
|
|
13
|
+
|
|
14
|
+
Requires LND built with `peersrpc` build tag
|
|
15
|
+
|
|
16
|
+
Requires `peers:write` permissions
|
|
17
|
+
|
|
18
|
+
{
|
|
19
|
+
alias: <Node Alias String>
|
|
20
|
+
lnd: <Authenticated LND API Object>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@returns via cbk or Promise
|
|
24
|
+
*/
|
|
25
|
+
module.exports = ({alias, lnd}, cbk) => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
return asyncAuto({
|
|
28
|
+
// Check arguments
|
|
29
|
+
validate: cbk => {
|
|
30
|
+
if (alias === undefined) {
|
|
31
|
+
return cbk([400, 'ExpectedAliasToUpdateNodeAnnouncementAlias']);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!isLnd({lnd, method, type})) {
|
|
35
|
+
return cbk([400, 'ExpectedLndToUpdateNodeAnnouncementAlias']);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return cbk();
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
// Update the node alias with the updated alias
|
|
42
|
+
updateAlias: ['validate', ({}, cbk) => {
|
|
43
|
+
return lnd[type][method]({alias}, (err, res) => {
|
|
44
|
+
if (!!err && err.details === errorUnimplemented) {
|
|
45
|
+
return cbk([400, 'ExpectedPeersRpcLndBuildTagToUpdateAlias']);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!!err) {
|
|
49
|
+
return cbk([503, 'UnexpectedErrorUpdatingNodeAlias', {err}]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return cbk();
|
|
53
|
+
});
|
|
54
|
+
}],
|
|
55
|
+
},
|
|
56
|
+
returnResult({reject, resolve}, cbk));
|
|
57
|
+
});
|
|
58
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const asyncAuto = require('async/auto');
|
|
2
|
+
const {returnResult} = require('asyncjs-util');
|
|
3
|
+
|
|
4
|
+
const {isLnd} = require('./../../lnd_requests');
|
|
5
|
+
|
|
6
|
+
const errorUnimplemented = 'unknown service peersrpc.Peers';
|
|
7
|
+
const method = 'updateNodeAnnouncement';
|
|
8
|
+
const type = 'peers';
|
|
9
|
+
|
|
10
|
+
/** Update the node color as advertised in the graph
|
|
11
|
+
|
|
12
|
+
Note: this method is not supported in LND versions 0.14.3 and below
|
|
13
|
+
|
|
14
|
+
Requires LND built with `peersrpc` build tag
|
|
15
|
+
|
|
16
|
+
Requires `peers:write` permissions
|
|
17
|
+
|
|
18
|
+
{
|
|
19
|
+
color: <Node Color String>
|
|
20
|
+
lnd: <Authenticated LND API Object>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@returns via cbk or Promise
|
|
24
|
+
*/
|
|
25
|
+
module.exports = ({color, lnd}, cbk) => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
return asyncAuto({
|
|
28
|
+
// Check arguments
|
|
29
|
+
validate: cbk => {
|
|
30
|
+
if (!color) {
|
|
31
|
+
return cbk([400, 'ExpectedColorToUpdateNodeAnnouncementColor']);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!isLnd({lnd, method, type})) {
|
|
35
|
+
return cbk([400, 'ExpectedLndToUpdateNodeAnnouncementColor']);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return cbk();
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
// Update the node alias with the updated alias
|
|
42
|
+
updateAlias: ['validate', ({}, cbk) => {
|
|
43
|
+
return lnd[type][method]({color}, (err, res) => {
|
|
44
|
+
if (!!err && err.details === errorUnimplemented) {
|
|
45
|
+
return cbk([400, 'ExpectedPeersRpcLndBuildTagToUpdateColor']);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!!err) {
|
|
49
|
+
return cbk([503, 'UnexpectedErrorUpdatingNodeColor', {err}]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return cbk();
|
|
53
|
+
});
|
|
54
|
+
}],
|
|
55
|
+
},
|
|
56
|
+
returnResult({reject, resolve}, cbk));
|
|
57
|
+
});
|
|
58
|
+
};
|
|
@@ -20,6 +20,12 @@ export type SignTransactionArgs = AuthenticatedLightningArgs<{
|
|
|
20
20
|
/** Witness Script Hex String */
|
|
21
21
|
witness_script: string;
|
|
22
22
|
}[];
|
|
23
|
+
spending?: {
|
|
24
|
+
/** Non-Internal Spend Output Script Hex String */
|
|
25
|
+
output_script: string;
|
|
26
|
+
/** Non-Internal Spend Output Tokens Number */
|
|
27
|
+
output_tokens: number;
|
|
28
|
+
}[];
|
|
23
29
|
/** Unsigned Transaction Hex String */
|
|
24
30
|
transaction: string;
|
|
25
31
|
}>;
|
|
@@ -35,6 +41,8 @@ export type SignTransactionResult = {
|
|
|
35
41
|
* Requires LND built with `signrpc` build tag
|
|
36
42
|
*
|
|
37
43
|
* Requires `signer:generate` permission
|
|
44
|
+
*
|
|
45
|
+
* `spending` is not supported in LND 0.14.3 and below
|
|
38
46
|
*/
|
|
39
47
|
export const signTransaction: AuthenticatedLightningMethod<
|
|
40
48
|
SignTransactionArgs,
|
package/package.json
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
"url": "https://github.com/alexbosworth/lightning/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@grpc/grpc-js": "1.6.
|
|
10
|
+
"@grpc/grpc-js": "1.6.7",
|
|
11
11
|
"@grpc/proto-loader": "0.6.9",
|
|
12
12
|
"@types/express": "4.17.13",
|
|
13
|
-
"@types/node": "17.0.
|
|
13
|
+
"@types/node": "17.0.25",
|
|
14
14
|
"@types/request": "2.48.8",
|
|
15
15
|
"@types/ws": "8.5.3",
|
|
16
16
|
"async": "3.2.3",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"cbor": "8.1.0",
|
|
24
24
|
"ecpair": "2.0.1",
|
|
25
25
|
"express": "4.17.3",
|
|
26
|
-
"invoices": "2.0.
|
|
26
|
+
"invoices": "2.0.6",
|
|
27
27
|
"psbt": "2.0.1",
|
|
28
28
|
"tiny-secp256k1": "2.2.1",
|
|
29
29
|
"type-fest": "2.12.2"
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"directory": "test/typescript"
|
|
60
60
|
},
|
|
61
61
|
"types": "index.d.ts",
|
|
62
|
-
"version": "5.
|
|
62
|
+
"version": "5.13.0"
|
|
63
63
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const {test} = require('@alexbosworth/tap');
|
|
2
|
+
|
|
3
|
+
const {addExternalSocket} = require('./../../../');
|
|
4
|
+
|
|
5
|
+
const makeLnd = ({err}) => {
|
|
6
|
+
return {peers: {updateNodeAnnouncement: (args, cbk) => cbk(err)}};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const makeArgs = overrides => {
|
|
10
|
+
const args = {lnd: makeLnd({}), socket: '127.0.0.1:9735'};
|
|
11
|
+
|
|
12
|
+
Object.keys(overrides).forEach(key => args[key] = overrides[key]);
|
|
13
|
+
|
|
14
|
+
return args;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const tests = [
|
|
18
|
+
{
|
|
19
|
+
args: makeArgs({lnd: undefined}),
|
|
20
|
+
description: 'LND is required to add an external socket',
|
|
21
|
+
error: [400, 'ExpectedLndToAddExternalSocket'],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
args: makeArgs({socket: undefined}),
|
|
25
|
+
description: 'A socket is required to add an external socket',
|
|
26
|
+
error: [400, 'ExpectedHostAndPortOfSocketToAdd'],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
args: makeArgs({
|
|
30
|
+
lnd: makeLnd({err: {details: 'unknown service peersrpc.Peers'}}),
|
|
31
|
+
}),
|
|
32
|
+
description: 'LND with peersrpc is required to add an external socket',
|
|
33
|
+
error: [400, 'ExpectedPeersRpcLndBuildTagToAddSocket'],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
args: makeArgs({lnd: makeLnd({err: 'err'})}),
|
|
37
|
+
description: 'LND error is returned',
|
|
38
|
+
error: [503, 'UnexpectedErrorAddingExternalSocket', {err: 'err'}],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
args: makeArgs({}),
|
|
42
|
+
description: 'Socket added successfully',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
tests.forEach(({args, description, error, expected}) => {
|
|
47
|
+
return test(description, async ({deepEqual, end, equal, rejects}) => {
|
|
48
|
+
if (!!error) {
|
|
49
|
+
await rejects(() => addExternalSocket(args), error, 'Got error');
|
|
50
|
+
} else {
|
|
51
|
+
await addExternalSocket(args);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return end();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const {test} = require('@alexbosworth/tap');
|
|
2
|
+
|
|
3
|
+
const {removeExternalSocket} = require('./../../../');
|
|
4
|
+
|
|
5
|
+
const makeLnd = ({err}) => {
|
|
6
|
+
return {peers: {updateNodeAnnouncement: (args, cbk) => cbk(err)}};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const makeArgs = overrides => {
|
|
10
|
+
const args = {lnd: makeLnd({}), socket: '127.0.0.1:9735'};
|
|
11
|
+
|
|
12
|
+
Object.keys(overrides).forEach(key => args[key] = overrides[key]);
|
|
13
|
+
|
|
14
|
+
return args;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const tests = [
|
|
18
|
+
{
|
|
19
|
+
args: makeArgs({lnd: undefined}),
|
|
20
|
+
description: 'LND is required to remove an external socket',
|
|
21
|
+
error: [400, 'ExpectedLndToRemoveExternalSocket'],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
args: makeArgs({socket: undefined}),
|
|
25
|
+
description: 'A socket is required to remove an external socket',
|
|
26
|
+
error: [400, 'ExpectedHostAndPortOfSocketToRemove'],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
args: makeArgs({
|
|
30
|
+
lnd: makeLnd({err: {details: 'unknown service peersrpc.Peers'}}),
|
|
31
|
+
}),
|
|
32
|
+
description: 'LND with peersrpc is required to add an external socket',
|
|
33
|
+
error: [400, 'ExpectedPeersRpcLndBuildTagToRemoveSocket'],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
args: makeArgs({lnd: makeLnd({err: 'err'})}),
|
|
37
|
+
description: 'LND error is returned',
|
|
38
|
+
error: [503, 'UnexpectedErrorRemovingExternalSocket', {err: 'err'}],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
args: makeArgs({}),
|
|
42
|
+
description: 'Socket removed successfully',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
tests.forEach(({args, description, error, expected}) => {
|
|
47
|
+
return test(description, async ({deepEqual, end, equal, rejects}) => {
|
|
48
|
+
if (!!error) {
|
|
49
|
+
await rejects(() => removeExternalSocket(args), error, 'Got error');
|
|
50
|
+
} else {
|
|
51
|
+
await removeExternalSocket(args);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return end();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const {test} = require('@alexbosworth/tap');
|
|
2
|
+
|
|
3
|
+
const {updateAlias} = require('./../../../');
|
|
4
|
+
|
|
5
|
+
const makeLnd = ({err}) => {
|
|
6
|
+
return {peers: {updateNodeAnnouncement: (args, cbk) => cbk(err)}};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const makeArgs = overrides => {
|
|
10
|
+
const args = {alias: 'alias', lnd: makeLnd({})};
|
|
11
|
+
|
|
12
|
+
Object.keys(overrides).forEach(key => args[key] = overrides[key]);
|
|
13
|
+
|
|
14
|
+
return args;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const tests = [
|
|
18
|
+
{
|
|
19
|
+
args: makeArgs({alias: undefined}),
|
|
20
|
+
description: 'An alias is required to update alias to',
|
|
21
|
+
error: [400, 'ExpectedAliasToUpdateNodeAnnouncementAlias'],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
args: makeArgs({lnd: undefined}),
|
|
25
|
+
description: 'LND is required to update alias',
|
|
26
|
+
error: [400, 'ExpectedLndToUpdateNodeAnnouncementAlias'],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
args: makeArgs({
|
|
30
|
+
lnd: makeLnd({err: {details: 'unknown service peersrpc.Peers'}}),
|
|
31
|
+
}),
|
|
32
|
+
description: 'LND with peersrpc is required to update alias',
|
|
33
|
+
error: [400, 'ExpectedPeersRpcLndBuildTagToUpdateAlias'],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
args: makeArgs({lnd: makeLnd({err: 'err'})}),
|
|
37
|
+
description: 'LND error is returned',
|
|
38
|
+
error: [503, 'UnexpectedErrorUpdatingNodeAlias', {err: 'err'}],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
args: makeArgs({}),
|
|
42
|
+
description: 'Alias updated successfully',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
tests.forEach(({args, description, error, expected}) => {
|
|
47
|
+
return test(description, async ({deepEqual, end, equal, rejects}) => {
|
|
48
|
+
if (!!error) {
|
|
49
|
+
await rejects(() => updateAlias(args), error, 'Got error');
|
|
50
|
+
} else {
|
|
51
|
+
await updateAlias(args);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return end();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const {test} = require('@alexbosworth/tap');
|
|
2
|
+
|
|
3
|
+
const {updateColor} = require('./../../../');
|
|
4
|
+
|
|
5
|
+
const makeLnd = ({err}) => {
|
|
6
|
+
return {peers: {updateNodeAnnouncement: (args, cbk) => cbk(err)}};
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const makeArgs = overrides => {
|
|
10
|
+
const args = {color: '#012345', lnd: makeLnd({})};
|
|
11
|
+
|
|
12
|
+
Object.keys(overrides).forEach(key => args[key] = overrides[key]);
|
|
13
|
+
|
|
14
|
+
return args;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const tests = [
|
|
18
|
+
{
|
|
19
|
+
args: makeArgs({color: undefined}),
|
|
20
|
+
description: 'A color is required to update color to',
|
|
21
|
+
error: [400, 'ExpectedColorToUpdateNodeAnnouncementColor'],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
args: makeArgs({lnd: undefined}),
|
|
25
|
+
description: 'LND is required to update color',
|
|
26
|
+
error: [400, 'ExpectedLndToUpdateNodeAnnouncementColor'],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
args: makeArgs({
|
|
30
|
+
lnd: makeLnd({err: {details: 'unknown service peersrpc.Peers'}}),
|
|
31
|
+
}),
|
|
32
|
+
description: 'LND with peersrpc is required to update color',
|
|
33
|
+
error: [400, 'ExpectedPeersRpcLndBuildTagToUpdateColor'],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
args: makeArgs({lnd: makeLnd({err: 'err'})}),
|
|
37
|
+
description: 'LND error is returned',
|
|
38
|
+
error: [503, 'UnexpectedErrorUpdatingNodeColor', {err: 'err'}],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
args: makeArgs({}),
|
|
42
|
+
description: 'Color updated successfully',
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
tests.forEach(({args, description, error, expected}) => {
|
|
47
|
+
return test(description, async ({deepEqual, end, equal, rejects}) => {
|
|
48
|
+
if (!!error) {
|
|
49
|
+
await rejects(() => updateColor(args), error, 'Got error');
|
|
50
|
+
} else {
|
|
51
|
+
await updateColor(args);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return end();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -14,6 +14,12 @@ const inputs = [
|
|
|
14
14
|
witness_script: '00',
|
|
15
15
|
},
|
|
16
16
|
];
|
|
17
|
+
const spending = [
|
|
18
|
+
{
|
|
19
|
+
output_script: 'script',
|
|
20
|
+
output_tokens: 0,
|
|
21
|
+
},
|
|
22
|
+
];
|
|
17
23
|
const transaction = '00';
|
|
18
24
|
|
|
19
25
|
expectError(signTransaction());
|
|
@@ -32,9 +38,22 @@ expectType<SignTransactionResult>(
|
|
|
32
38
|
transaction,
|
|
33
39
|
})
|
|
34
40
|
);
|
|
41
|
+
expectType<SignTransactionResult>(
|
|
42
|
+
await signTransaction({
|
|
43
|
+
lnd,
|
|
44
|
+
inputs,
|
|
45
|
+
transaction,
|
|
46
|
+
spending,
|
|
47
|
+
})
|
|
48
|
+
);
|
|
35
49
|
|
|
36
50
|
expectType<void>(
|
|
37
51
|
signTransaction({lnd, inputs, transaction}, (error, result) => {
|
|
38
52
|
expectType<SignTransactionResult>(result);
|
|
39
53
|
})
|
|
40
54
|
);
|
|
55
|
+
expectType<void>(
|
|
56
|
+
signTransaction({lnd, inputs, transaction, spending}, (error, result) => {
|
|
57
|
+
expectType<SignTransactionResult>(result);
|
|
58
|
+
})
|
|
59
|
+
);
|