lightning 5.8.3 → 5.8.6
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 +4 -0
- package/grpc/protos/lightning.proto +42 -2
- package/grpc/protos/walletkit.proto +11 -1
- package/lnd_methods/info/get_wallet_info.d.ts +2 -0
- package/lnd_methods/offchain/pay_via_payment_details.d.ts +1 -1
- package/lnd_methods/offchain/pay_via_payment_details.js +1 -1
- package/lnd_methods/onchain/subscribe_to_chain_address.js +1 -1
- package/package.json +8 -8
- package/test/lnd_methods/onchain/test_fund_pending_channels.js +30 -0
- package/test/lnd_methods/onchain/test_open_channels.js +53 -0
- package/test/typescript/pay_via_payment_details.test-d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -620,6 +620,38 @@ message Utxo {
|
|
|
620
620
|
int64 confirmations = 6;
|
|
621
621
|
}
|
|
622
622
|
|
|
623
|
+
enum OutputScriptType {
|
|
624
|
+
SCRIPT_TYPE_PUBKEY_HASH = 0;
|
|
625
|
+
SCRIPT_TYPE_SCRIPT_HASH = 1;
|
|
626
|
+
SCRIPT_TYPE_WITNESS_V0_PUBKEY_HASH = 2;
|
|
627
|
+
SCRIPT_TYPE_WITNESS_V0_SCRIPT_HASH = 3;
|
|
628
|
+
SCRIPT_TYPE_PUBKEY = 4;
|
|
629
|
+
SCRIPT_TYPE_MULTISIG = 5;
|
|
630
|
+
SCRIPT_TYPE_NULLDATA = 6;
|
|
631
|
+
SCRIPT_TYPE_NON_STANDARD = 7;
|
|
632
|
+
SCRIPT_TYPE_WITNESS_UNKNOWN = 8;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
message OutputDetail {
|
|
636
|
+
// The type of the output
|
|
637
|
+
OutputScriptType output_type = 1;
|
|
638
|
+
|
|
639
|
+
// The address
|
|
640
|
+
string address = 2;
|
|
641
|
+
|
|
642
|
+
// The pkscript in hex
|
|
643
|
+
string pk_script = 3;
|
|
644
|
+
|
|
645
|
+
// The output index used in the raw transaction
|
|
646
|
+
int64 output_index = 4;
|
|
647
|
+
|
|
648
|
+
// The value of the output coin in satoshis
|
|
649
|
+
int64 amount = 5;
|
|
650
|
+
|
|
651
|
+
// Denotes if the output is controlled by the internal wallet
|
|
652
|
+
bool is_our_address = 6;
|
|
653
|
+
}
|
|
654
|
+
|
|
623
655
|
message Transaction {
|
|
624
656
|
// The transaction hash
|
|
625
657
|
string tx_hash = 1;
|
|
@@ -642,8 +674,12 @@ message Transaction {
|
|
|
642
674
|
// Fees paid for this transaction
|
|
643
675
|
int64 total_fees = 7;
|
|
644
676
|
|
|
645
|
-
// Addresses that received funds for this transaction
|
|
646
|
-
|
|
677
|
+
// Addresses that received funds for this transaction. Deprecated as it is
|
|
678
|
+
// now incorporated in the output_details field.
|
|
679
|
+
repeated string dest_addresses = 8 [deprecated = true];
|
|
680
|
+
|
|
681
|
+
// Outputs that received funds for this transaction
|
|
682
|
+
repeated OutputDetail output_details = 11;
|
|
647
683
|
|
|
648
684
|
// The raw transaction hex.
|
|
649
685
|
string raw_tx_hex = 9;
|
|
@@ -2502,6 +2538,10 @@ message WalletBalanceResponse {
|
|
|
2502
2538
|
// The unconfirmed balance of a wallet(with 0 confirmations)
|
|
2503
2539
|
int64 unconfirmed_balance = 3;
|
|
2504
2540
|
|
|
2541
|
+
// The total amount of wallet UTXOs held in outputs that are locked for
|
|
2542
|
+
// other usage.
|
|
2543
|
+
int64 locked_balance = 5;
|
|
2544
|
+
|
|
2505
2545
|
// A mapping of each wallet account's name to its balance.
|
|
2506
2546
|
map<string, WalletAccountBalance> account_balance = 4;
|
|
2507
2547
|
}
|
|
@@ -12,7 +12,9 @@ option go_package = "github.com/lightningnetwork/lnd/lnrpc/walletrpc";
|
|
|
12
12
|
service WalletKit {
|
|
13
13
|
/*
|
|
14
14
|
ListUnspent returns a list of all utxos spendable by the wallet with a
|
|
15
|
-
number of confirmations between the specified minimum and maximum.
|
|
15
|
+
number of confirmations between the specified minimum and maximum. By
|
|
16
|
+
default, all utxos are listed. To list only the unconfirmed utxos, set
|
|
17
|
+
the unconfirmed_only to true.
|
|
16
18
|
*/
|
|
17
19
|
rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse);
|
|
18
20
|
|
|
@@ -240,6 +242,14 @@ message ListUnspentRequest {
|
|
|
240
242
|
|
|
241
243
|
// An optional filter to only include outputs belonging to an account.
|
|
242
244
|
string account = 3;
|
|
245
|
+
|
|
246
|
+
/*
|
|
247
|
+
When min_confs and max_confs are zero, setting false implicitly
|
|
248
|
+
overrides max_confs to be MaxInt32, otherwise max_confs remains
|
|
249
|
+
zero. An error is returned if the value is true and both min_confs
|
|
250
|
+
and max_confs are non-zero. (default: false)
|
|
251
|
+
*/
|
|
252
|
+
bool unconfirmed_only = 4;
|
|
243
253
|
}
|
|
244
254
|
|
|
245
255
|
message ListUnspentResponse {
|
|
@@ -42,7 +42,7 @@ export type PayViaPaymentDetailsArgs = AuthenticatedLightningArgs<{
|
|
|
42
42
|
pathfinding_timeout?: number;
|
|
43
43
|
/** Payment Identifier Hex String */
|
|
44
44
|
payment?: string;
|
|
45
|
-
routes
|
|
45
|
+
routes?: {
|
|
46
46
|
/** Base Routing Fee In Millitokens */
|
|
47
47
|
base_fee_mtokens?: string;
|
|
48
48
|
/** Standard Format Channel Id */
|
|
@@ -42,7 +42,7 @@ const type = 'router';
|
|
|
42
42
|
[outgoing_channels]: [<Pay Out of Outgoing Channel Ids String>]
|
|
43
43
|
[pathfinding_timeout]: <Time to Spend Finding a Route Milliseconds Number>
|
|
44
44
|
[payment]: <Payment Identifier Hex String>
|
|
45
|
-
routes: [[{
|
|
45
|
+
[routes]: [[{
|
|
46
46
|
[base_fee_mtokens]: <Base Routing Fee In Millitokens String>
|
|
47
47
|
[channel]: <Standard Format Channel Id String>
|
|
48
48
|
[cltv_delta]: <CLTV Blocks Delta Number>
|
package/package.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"url": "https://github.com/alexbosworth/lightning/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@grpc/grpc-js": "1.
|
|
10
|
+
"@grpc/grpc-js": "1.6.1",
|
|
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.23",
|
|
14
14
|
"@types/request": "2.48.8",
|
|
15
|
-
"@types/ws": "8.5.
|
|
15
|
+
"@types/ws": "8.5.3",
|
|
16
16
|
"async": "3.2.3",
|
|
17
17
|
"asyncjs-util": "1.2.8",
|
|
18
18
|
"bitcoinjs-lib": "6.0.1",
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"invoices": "2.0.4",
|
|
27
27
|
"psbt": "2.0.0",
|
|
28
28
|
"tiny-secp256k1": "2.2.1",
|
|
29
|
-
"type-fest": "2.12.
|
|
29
|
+
"type-fest": "2.12.2"
|
|
30
30
|
},
|
|
31
31
|
"description": "Lightning Network client library",
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@alexbosworth/node-fetch": "2.6.2",
|
|
34
|
-
"@alexbosworth/tap": "15.0.
|
|
35
|
-
"tsd": "0.
|
|
36
|
-
"typescript": "4.6.
|
|
34
|
+
"@alexbosworth/tap": "15.0.11",
|
|
35
|
+
"tsd": "0.20.0",
|
|
36
|
+
"typescript": "4.6.3",
|
|
37
37
|
"ws": "8.5.0"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"directory": "test/typescript"
|
|
60
60
|
},
|
|
61
61
|
"types": "index.d.ts",
|
|
62
|
-
"version": "5.8.
|
|
62
|
+
"version": "5.8.6"
|
|
63
63
|
}
|
|
@@ -3,6 +3,7 @@ const {test} = require('@alexbosworth/tap');
|
|
|
3
3
|
const {fundPendingChannels} = require('./../../../lnd_methods');
|
|
4
4
|
|
|
5
5
|
const id = Buffer.alloc(32).toString('hex');
|
|
6
|
+
const id2 = Buffer.alloc(32, 1).toString('hex');
|
|
6
7
|
|
|
7
8
|
const makeLnd = ({finalizeErr, verifyErr}) => {
|
|
8
9
|
return {
|
|
@@ -75,6 +76,35 @@ const tests = [
|
|
|
75
76
|
args: makeArgs({}),
|
|
76
77
|
description: 'Channel funding is executed',
|
|
77
78
|
},
|
|
79
|
+
{
|
|
80
|
+
args: makeArgs({
|
|
81
|
+
channels: [id, id2],
|
|
82
|
+
lnd: {
|
|
83
|
+
default: {
|
|
84
|
+
fundingStateStep: (args, cbk) => {
|
|
85
|
+
const finalize = args.psbt_finalize;
|
|
86
|
+
|
|
87
|
+
if (!finalize) {
|
|
88
|
+
return cbk();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const pendingId = finalize.pending_chan_id.toString('hex');
|
|
92
|
+
|
|
93
|
+
if (pendingId === id && finalize.no_publish !== true) {
|
|
94
|
+
return cbk('ExpectedFirstChannelIsNoPublish');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (pendingId === id2 && finalize.no_publish !== false) {
|
|
98
|
+
return cbk('ExpectedLastChannelIsNotNoPublish');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return cbk();
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
}),
|
|
106
|
+
description: 'Channel funding across multiple channels is executed',
|
|
107
|
+
},
|
|
78
108
|
];
|
|
79
109
|
|
|
80
110
|
tests.forEach(({args, description, error, expected}) => {
|
|
@@ -5,6 +5,8 @@ const {test} = require('@alexbosworth/tap');
|
|
|
5
5
|
const {openChannels} = require('./../../../lnd_methods');
|
|
6
6
|
|
|
7
7
|
const emitter = new EventEmitter();
|
|
8
|
+
const nodeKey1 = Buffer.alloc(33).toString('hex');
|
|
9
|
+
const nodeKey2 = Buffer.alloc(33, 2).toString('hex');
|
|
8
10
|
|
|
9
11
|
const makeChannels = ({}) => {
|
|
10
12
|
return [{
|
|
@@ -128,6 +130,57 @@ const tests = [
|
|
|
128
130
|
description: 'Channels are pending',
|
|
129
131
|
expected: {pending: {address: 'funding_address', tokens: 1}},
|
|
130
132
|
},
|
|
133
|
+
{
|
|
134
|
+
args: {
|
|
135
|
+
channels: [
|
|
136
|
+
{capacity: 1, partner_public_key: nodeKey1},
|
|
137
|
+
{capacity: 2, partner_public_key: nodeKey2},
|
|
138
|
+
],
|
|
139
|
+
lnd: {
|
|
140
|
+
default: {
|
|
141
|
+
fundingStateStep: ({}, cbk) => cbk(),
|
|
142
|
+
openChannel: args => {
|
|
143
|
+
const eventEmitter = new EventEmitter();
|
|
144
|
+
|
|
145
|
+
const key = args.node_pubkey.toString('hex');
|
|
146
|
+
|
|
147
|
+
if (key === nodeKey1 && !args.funding_shim.psbt_shim.no_publish) {
|
|
148
|
+
throw new Error('ExpectedFirstKeyIsNoPublish');
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (key === nodeKey2 && !!args.funding_shim.psbt_shim.no_publish) {
|
|
152
|
+
throw new Error('TheSecondChannelShouldPublish');
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
process.nextTick(() => {
|
|
156
|
+
eventEmitter.emit('data', {});
|
|
157
|
+
|
|
158
|
+
eventEmitter.emit('data', {
|
|
159
|
+
psbt_fund: {
|
|
160
|
+
funding_address: 'funding_address',
|
|
161
|
+
funding_amount: '1',
|
|
162
|
+
},
|
|
163
|
+
update: 'psbt_fund',
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Emit twice to make sure that cbk isn't called twice
|
|
167
|
+
eventEmitter.emit('data', {
|
|
168
|
+
psbt_fund: {
|
|
169
|
+
funding_address: 'funding_address',
|
|
170
|
+
funding_amount: '1',
|
|
171
|
+
},
|
|
172
|
+
update: 'psbt_fund',
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
return eventEmitter;
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
description: 'Multiple channels are pending',
|
|
182
|
+
expected: {pending: {address: 'funding_address', tokens: 1}},
|
|
183
|
+
},
|
|
131
184
|
];
|
|
132
185
|
|
|
133
186
|
tests.forEach(({args, description, error, expected}) => {
|
|
@@ -44,7 +44,6 @@ expectError(payViaPaymentDetails({destination}));
|
|
|
44
44
|
expectError(payViaPaymentDetails({destination, routes}));
|
|
45
45
|
expectError(payViaPaymentDetails({routes}));
|
|
46
46
|
expectError(payViaPaymentDetails({lnd}));
|
|
47
|
-
expectError(payViaPaymentDetails({lnd, destination}));
|
|
48
47
|
expectError(payViaPaymentDetails({lnd, routes}));
|
|
49
48
|
|
|
50
49
|
expectType<PayViaPaymentDetailsResult>(
|