lightning 5.19.0 → 5.20.2
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 +12 -0
- package/grpc/protos/chainnotifier.proto +12 -0
- package/grpc/protos/invoices.proto +5 -2
- package/grpc/protos/peers.proto +1 -1
- package/grpc/protos/router.proto +8 -0
- package/grpc/protos/walletkit.proto +10 -0
- package/grpc/protos/walletunlocker.proto +7 -0
- package/lnd_methods/info/constants.json +3 -1
- package/lnd_methods/offchain/get_channels.d.ts +6 -0
- package/lnd_methods/offchain/get_closed_channels.d.ts +4 -0
- package/lnd_methods/offchain/get_ephemeral_channel_ids.d.ts +27 -0
- package/lnd_methods/offchain/index.d.ts +1 -0
- package/lnd_methods/offchain/subscribe_to_channels.d.ts +6 -0
- package/lnd_methods/offchain/subscribe_to_open_requests.d.ts +8 -0
- package/lnd_methods/onchain/close_channel.d.ts +6 -0
- package/lnd_methods/onchain/get_chain_transactions.d.ts +38 -26
- package/lnd_methods/onchain/get_locked_utxos.d.ts +6 -0
- package/lnd_methods/onchain/get_locked_utxos.js +11 -0
- package/lnd_methods/onchain/open_channels.d.ts +9 -0
- package/lnd_methods/onchain/send_to_chain_address.js +5 -0
- package/lnd_methods/onchain/subscribe_to_transactions.d.ts +7 -24
- package/lnd_methods/signer/sign_bytes.d.ts +4 -0
- package/package.json +7 -7
- package/test/lnd_methods/onchain/test_get_locked_utxos.js +21 -0
- package/test/lnd_methods/onchain/test_send_to_chain_address.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 5.20.2
|
|
4
|
+
|
|
5
|
+
- `getWalletInfo`: Add support for detecting lnd versions 0.15.0 and 0.15.1
|
|
6
|
+
|
|
7
|
+
## 5.20.1
|
|
8
|
+
|
|
9
|
+
- Update typescript definitions
|
|
10
|
+
|
|
11
|
+
## 5.20.0
|
|
12
|
+
|
|
13
|
+
- `getLockedUtxos`: Add support for returning script, value of locked utxos
|
|
14
|
+
|
|
3
15
|
## 5.19.0
|
|
4
16
|
|
|
5
17
|
- `closeChannel`: Add support for `max_tokens_per_vbyte` to set max fee rate
|
|
@@ -72,6 +72,12 @@ message ConfRequest {
|
|
|
72
72
|
broadcast height of the transaction/output script.
|
|
73
73
|
*/
|
|
74
74
|
uint32 height_hint = 4;
|
|
75
|
+
|
|
76
|
+
/*
|
|
77
|
+
If true, then the block that mines the specified txid/script will be
|
|
78
|
+
included in eventual the notification event.
|
|
79
|
+
*/
|
|
80
|
+
bool include_block = 5;
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
message ConfDetails {
|
|
@@ -87,6 +93,12 @@ message ConfDetails {
|
|
|
87
93
|
|
|
88
94
|
// The index of the confirmed transaction within the transaction.
|
|
89
95
|
uint32 tx_index = 4;
|
|
96
|
+
|
|
97
|
+
/*
|
|
98
|
+
The raw bytes of the block that mined the transaction. Only included if
|
|
99
|
+
include_block was set in the request.
|
|
100
|
+
*/
|
|
101
|
+
bytes raw_block = 5;
|
|
90
102
|
}
|
|
91
103
|
|
|
92
104
|
message Reorg {
|
|
@@ -44,7 +44,8 @@ service Invoices {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
message CancelInvoiceMsg {
|
|
47
|
-
// Hash corresponding to the (hold) invoice to cancel.
|
|
47
|
+
// Hash corresponding to the (hold) invoice to cancel. When using
|
|
48
|
+
// REST, this field must be encoded as base64.
|
|
48
49
|
bytes payment_hash = 1;
|
|
49
50
|
}
|
|
50
51
|
message CancelInvoiceResp {
|
|
@@ -138,7 +139,8 @@ message SettleInvoiceResp {
|
|
|
138
139
|
message SubscribeSingleInvoiceRequest {
|
|
139
140
|
reserved 1;
|
|
140
141
|
|
|
141
|
-
// Hash corresponding to the (hold) invoice to subscribe to.
|
|
142
|
+
// Hash corresponding to the (hold) invoice to subscribe to. When using
|
|
143
|
+
// REST, this field must be encoded as base64url.
|
|
142
144
|
bytes r_hash = 2;
|
|
143
145
|
}
|
|
144
146
|
|
|
@@ -163,6 +165,7 @@ enum LookupModifier {
|
|
|
163
165
|
|
|
164
166
|
message LookupInvoiceMsg {
|
|
165
167
|
oneof invoice_ref {
|
|
168
|
+
// When using REST, this field must be encoded as base64.
|
|
166
169
|
bytes payment_hash = 1;
|
|
167
170
|
bytes payment_addr = 2;
|
|
168
171
|
bytes set_id = 3;
|
package/grpc/protos/peers.proto
CHANGED
|
@@ -7,7 +7,7 @@ package peersrpc;
|
|
|
7
7
|
option go_package = "github.com/lightningnetwork/lnd/lnrpc/peersrpc";
|
|
8
8
|
|
|
9
9
|
// Peers is a service that can be used to get information and interact
|
|
10
|
-
// with the other nodes of the
|
|
10
|
+
// with the other nodes of the network.
|
|
11
11
|
service Peers {
|
|
12
12
|
/* lncli: peers updatenodeannouncement
|
|
13
13
|
UpdateNodeAnnouncement allows the caller to update the node parameters
|
package/grpc/protos/router.proto
CHANGED
|
@@ -336,6 +336,14 @@ message SendToRouteRequest {
|
|
|
336
336
|
|
|
337
337
|
// Route that should be used to attempt to complete the payment.
|
|
338
338
|
lnrpc.Route route = 2;
|
|
339
|
+
|
|
340
|
+
/*
|
|
341
|
+
Whether the payment should be marked as failed when a temporary error is
|
|
342
|
+
returned from the given route. Set it to true so the payment won't be
|
|
343
|
+
failed unless a terminal error is occurred, such as payment timeout, no
|
|
344
|
+
routes, incorrect payment details, or insufficient funds.
|
|
345
|
+
*/
|
|
346
|
+
bool skip_temp_err = 3;
|
|
339
347
|
}
|
|
340
348
|
|
|
341
349
|
message SendToRouteResponse {
|
|
@@ -844,6 +844,16 @@ message UtxoLease {
|
|
|
844
844
|
The absolute expiration of the output lease represented as a unix timestamp.
|
|
845
845
|
*/
|
|
846
846
|
uint64 expiration = 3;
|
|
847
|
+
|
|
848
|
+
/*
|
|
849
|
+
The public key script of the leased output.
|
|
850
|
+
*/
|
|
851
|
+
bytes pk_script = 4;
|
|
852
|
+
|
|
853
|
+
/*
|
|
854
|
+
The value of the leased output in satoshis.
|
|
855
|
+
*/
|
|
856
|
+
uint64 value = 5;
|
|
847
857
|
}
|
|
848
858
|
|
|
849
859
|
message SignPsbtRequest {
|
|
@@ -185,6 +185,13 @@ message InitWalletRequest {
|
|
|
185
185
|
corresponding private keys and can serve signing RPC requests.
|
|
186
186
|
*/
|
|
187
187
|
WatchOnly watch_only = 9;
|
|
188
|
+
|
|
189
|
+
/*
|
|
190
|
+
macaroon_root_key is an optional 32 byte macaroon root key that can be
|
|
191
|
+
provided when initializing the wallet rather than letting lnd generate one
|
|
192
|
+
on its own.
|
|
193
|
+
*/
|
|
194
|
+
bytes macaroon_root_key = 10;
|
|
188
195
|
}
|
|
189
196
|
message InitWalletResponse {
|
|
190
197
|
/*
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"4f567577db9d85b6f392f960b3aabddcad3cd02c": "0.13.3-beta",
|
|
26
26
|
"52bb3f33707b81972c67937c7a89addcdf00991c": "0.10.1-beta",
|
|
27
27
|
"596fd90ef310cd7abbf2251edaae9ba4d5f8a689": "0.13.1-beta",
|
|
28
|
+
"5c36d96c9cbe8b27c29f9682dcbdab7928ae870f": "0.15.0-beta",
|
|
28
29
|
"6042004edaaa5b3cad0a0808ff23dba4716f7178": "0.14.1-beta",
|
|
29
30
|
"61c34683058f2cc8dc10f49392a0057440d831c4": "0.13.4-beta",
|
|
30
31
|
"725ff104808f49f0a5247bfdb4b6b5da7f488d38": "0.13.0-beta",
|
|
@@ -35,7 +36,8 @@
|
|
|
35
36
|
"d176d2d65fc06e6631c4dc9478592be8545a21de": "0.12.0-beta",
|
|
36
37
|
"d233f61383f2f950aa06f5b09da5b0e78e784fae": "0.12.1-beta",
|
|
37
38
|
"d62c575f8499a314eb27f12462d20500b6bda2c7": "0.10.3-beta",
|
|
38
|
-
"df0b82f0165f19bde8832bacd1e35544b0a2990d": "0.14.0-beta"
|
|
39
|
+
"df0b82f0165f19bde8832bacd1e35544b0a2990d": "0.14.0-beta",
|
|
40
|
+
"fd1a95bf322cdd1c743a1554f8e470fbf9a5e564": "0.15.1-beta"
|
|
39
41
|
},
|
|
40
42
|
"weightedType": "weightedcomb",
|
|
41
43
|
"wrongLnd": "12 UNIMPLEMENTED: unknown service autopilotrpc.Autopilot"
|
|
@@ -40,6 +40,8 @@ export type GetChannelsResult = {
|
|
|
40
40
|
is_partner_initiated: boolean;
|
|
41
41
|
/** Channel Is Private */
|
|
42
42
|
is_private: boolean;
|
|
43
|
+
/** Funding Output is Trusted */
|
|
44
|
+
is_trusted_funding?: boolean;
|
|
43
45
|
/** Local Balance Tokens */
|
|
44
46
|
local_balance: number;
|
|
45
47
|
/** Local CSV Blocks Delay */
|
|
@@ -56,6 +58,8 @@ export type GetChannelsResult = {
|
|
|
56
58
|
local_min_htlc_mtokens?: string;
|
|
57
59
|
/** Local Reserved Tokens */
|
|
58
60
|
local_reserve: number;
|
|
61
|
+
/** Other Channel Ids */
|
|
62
|
+
other_ids: string[];
|
|
59
63
|
/** Channel Partner Public Key */
|
|
60
64
|
partner_public_key: string;
|
|
61
65
|
/** Past Channel States Count */
|
|
@@ -122,6 +126,8 @@ export type GetChannelsResult = {
|
|
|
122
126
|
*
|
|
123
127
|
* `in_channel`, `in_payment`, `is_forward`, `out_channel`, `out_payment`,
|
|
124
128
|
`payment` are not supported on LND 0.11.1 and below
|
|
129
|
+
*
|
|
130
|
+
* `is_trusted_funding` is not supported on LND 0.15.0 and below
|
|
125
131
|
*/
|
|
126
132
|
export const getChannels: AuthenticatedLightningMethod<
|
|
127
133
|
GetChannelsArgs,
|
|
@@ -66,6 +66,8 @@ export type GetClosedChannelsResult = {
|
|
|
66
66
|
is_partner_initiated?: boolean;
|
|
67
67
|
/** Is Remote Force Close */
|
|
68
68
|
is_remote_force_close: boolean;
|
|
69
|
+
/** Other Channel Ids */
|
|
70
|
+
other_ids: string[];
|
|
69
71
|
/** Partner Public Key Hex */
|
|
70
72
|
partner_public_key: string;
|
|
71
73
|
/** Channel Funding Transaction Id Hex */
|
|
@@ -81,6 +83,8 @@ export type GetClosedChannelsResult = {
|
|
|
81
83
|
* Multiple close type flags are supported.
|
|
82
84
|
*
|
|
83
85
|
* Requires `offchain:read` permission
|
|
86
|
+
*
|
|
87
|
+
* `other_ids is not supported on LND 0.15.0 and below
|
|
84
88
|
*/
|
|
85
89
|
export const getClosedChannels: AuthenticatedLightningMethod<
|
|
86
90
|
GetClosedChannelsArgs,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthenticatedLightningArgs,
|
|
3
|
+
AuthenticatedLightningMethod,
|
|
4
|
+
} from '../../typescript';
|
|
5
|
+
|
|
6
|
+
export type GetEphemeralChannelIdsArgs = AuthenticatedLightningArgs;
|
|
7
|
+
|
|
8
|
+
export type GetEphemeralChannelIdsResult = {
|
|
9
|
+
channels: {
|
|
10
|
+
/** Channel Identifiers */
|
|
11
|
+
other_ids: string[];
|
|
12
|
+
/** Top Level Channel Identifier */
|
|
13
|
+
reference_id: string;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get ephemeral channel ids
|
|
19
|
+
*
|
|
20
|
+
* Requires `offchain:read` permission
|
|
21
|
+
*
|
|
22
|
+
* This method is not supported on LND 0.15.0 and below
|
|
23
|
+
*/
|
|
24
|
+
export const getEphemeralChannelIds: AuthenticatedLightningMethod<
|
|
25
|
+
GetEphemeralChannelIdsArgs,
|
|
26
|
+
GetEphemeralChannelIdsResult
|
|
27
|
+
>;
|
|
@@ -15,6 +15,7 @@ export * from './get_channel_balance';
|
|
|
15
15
|
export * from './get_channels';
|
|
16
16
|
export * from './get_closed_channels';
|
|
17
17
|
export * from './get_connected_watchtowers';
|
|
18
|
+
export * from './get_ephemeral_channel_ids';
|
|
18
19
|
export * from './get_failed_payments';
|
|
19
20
|
export * from './get_fee_rates';
|
|
20
21
|
export * from './get_forwarding_confidence';
|
|
@@ -58,6 +58,8 @@ export type SubscribeToChannelsChannelClosedEvent = {
|
|
|
58
58
|
is_partner_initiated?: boolean;
|
|
59
59
|
/** Is Remote Force Close */
|
|
60
60
|
is_remote_force_close: boolean;
|
|
61
|
+
/** Other Channel Ids */
|
|
62
|
+
other_ids: string[];
|
|
61
63
|
/** Partner Public Key Hex */
|
|
62
64
|
partner_public_key: string;
|
|
63
65
|
/** Channel Funding Transaction Id Hex */
|
|
@@ -89,6 +91,8 @@ export type SubscribeToChannelsChannelOpenedEvent = {
|
|
|
89
91
|
is_partner_initiated: boolean;
|
|
90
92
|
/** Channel Is Private */
|
|
91
93
|
is_private: boolean;
|
|
94
|
+
/** Funding Output is Trusted */
|
|
95
|
+
is_trusted_funding: boolean;
|
|
92
96
|
/** Local Balance Tokens */
|
|
93
97
|
local_balance: number;
|
|
94
98
|
/** Local Initially Pushed Tokens */
|
|
@@ -138,5 +142,7 @@ export type SubscribeToChannelsChannelOpeningEvent = {
|
|
|
138
142
|
* Subscribe to channel updates
|
|
139
143
|
*
|
|
140
144
|
* Requires `offchain:read` permission
|
|
145
|
+
*
|
|
146
|
+
* `is_trusted_funding`, `other_ids` are not supported on LND 0.15.0 and below
|
|
141
147
|
*/
|
|
142
148
|
export const subscribeToChannels: AuthenticatedLightningSubscription;
|
|
@@ -5,6 +5,8 @@ export type SubscribeToOpenRequestsChannelRequestEvent = {
|
|
|
5
5
|
accept: (args: {
|
|
6
6
|
/** Restrict Coop Close To Address */
|
|
7
7
|
cooperative_close_address?: string;
|
|
8
|
+
/** Accept Funding as Trusted */
|
|
9
|
+
is_trusted_funding?: boolean;
|
|
8
10
|
/** Required Confirmations Before Channel Open */
|
|
9
11
|
min_confirmations?: number;
|
|
10
12
|
/** Peer Unilateral Balance Output CSV Delay */
|
|
@@ -28,6 +30,10 @@ export type SubscribeToOpenRequestsChannelRequestEvent = {
|
|
|
28
30
|
csv_delay: number;
|
|
29
31
|
/** Request Id Hex */
|
|
30
32
|
id: string;
|
|
33
|
+
/** Incoming Channel Is Private Bool */
|
|
34
|
+
is_private: boolean;
|
|
35
|
+
/** Request Immediate Trusted Funding */
|
|
36
|
+
is_trusted_funding: boolean;
|
|
31
37
|
/** Channel Local Tokens Balance */
|
|
32
38
|
local_balance: number;
|
|
33
39
|
/** Channel Local Reserve Tokens */
|
|
@@ -61,5 +67,7 @@ channel requests after a short delay.
|
|
|
61
67
|
listeners to `channel_request`
|
|
62
68
|
*
|
|
63
69
|
* LND 0.11.1 and below do not support `accept` or `reject` arguments
|
|
70
|
+
*
|
|
71
|
+
* LND 0.15.0 and below do not support `is_trusted_funding`
|
|
64
72
|
*/
|
|
65
73
|
export const subscribeToOpenRequests: AuthenticatedLightningSubscription;
|
|
@@ -49,6 +49,8 @@ export type CoopCloseChannelArgs = AuthenticatedLightningArgs<
|
|
|
49
49
|
is_force_close?: false;
|
|
50
50
|
/** Request Sending Local Channel Funds To Address String */
|
|
51
51
|
address?: string;
|
|
52
|
+
/** Fail Cooperative Close Above Fee Rate */
|
|
53
|
+
max_tokens_per_vbyte?: number;
|
|
52
54
|
} & ExpectedBothPublicKeyAndSocketForChannelClose &
|
|
53
55
|
UnexpectedTokensPerVbyteForChannelClose
|
|
54
56
|
>;
|
|
@@ -72,7 +74,11 @@ export type CloseChannelResult = {
|
|
|
72
74
|
*
|
|
73
75
|
* If cooperatively closing, pass a public key and socket to connect
|
|
74
76
|
*
|
|
77
|
+
* `max_tokens_per_vbyte` will be ignored when closing a peer initiated channel
|
|
78
|
+
*
|
|
75
79
|
* Requires `info:read`, `offchain:write`, `onchain:write`, `peers:write` permissions
|
|
80
|
+
*
|
|
81
|
+
* `max_tokens_per_vbyte` is not supported in LND 0.15.0 and below
|
|
76
82
|
*/
|
|
77
83
|
export const closeChannel: AuthenticatedLightningMethod<
|
|
78
84
|
CloseChannelArgs,
|
|
@@ -10,39 +10,51 @@ export type GetChainTransactionsArgs = AuthenticatedLightningArgs<{
|
|
|
10
10
|
before?: number;
|
|
11
11
|
}>;
|
|
12
12
|
|
|
13
|
-
export type
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
/** Transaction
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
/** Tokens Including Fee */
|
|
36
|
-
tokens: number;
|
|
37
|
-
/** Raw Transaction Hex */
|
|
38
|
-
transaction?: string;
|
|
13
|
+
export type ChainTransaction = {
|
|
14
|
+
/** Block Hash */
|
|
15
|
+
block_id?: string;
|
|
16
|
+
/** Confirmation Count */
|
|
17
|
+
confirmation_count?: number;
|
|
18
|
+
/** Confirmation Block Height */
|
|
19
|
+
confirmation_height?: number;
|
|
20
|
+
/** Created ISO 8601 Date */
|
|
21
|
+
created_at: string;
|
|
22
|
+
/** Transaction Label */
|
|
23
|
+
description?: string;
|
|
24
|
+
/** Fees Paid Tokens */
|
|
25
|
+
fee?: number;
|
|
26
|
+
/** Transaction Id */
|
|
27
|
+
id: string;
|
|
28
|
+
inputs: {
|
|
29
|
+
/** Spent Outpoint is Local */
|
|
30
|
+
is_local: boolean;
|
|
31
|
+
/** Transaction Id Hex */
|
|
32
|
+
transaction_id: string;
|
|
33
|
+
/** Transaction Output Index */
|
|
34
|
+
transaction_vout: number;
|
|
39
35
|
}[];
|
|
36
|
+
/** Is Confirmed */
|
|
37
|
+
is_confirmed: boolean;
|
|
38
|
+
/** Transaction Outbound */
|
|
39
|
+
is_outgoing: boolean;
|
|
40
|
+
/** Addresses */
|
|
41
|
+
output_addresses: string[];
|
|
42
|
+
/** Tokens Including Fee */
|
|
43
|
+
tokens: number;
|
|
44
|
+
/** Raw Transaction Hex */
|
|
45
|
+
transaction?: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type GetChainTransactionsResult = {
|
|
49
|
+
transactions: ChainTransaction[];
|
|
40
50
|
};
|
|
41
51
|
|
|
42
52
|
/**
|
|
43
53
|
* Get chain transactions.
|
|
44
54
|
*
|
|
45
55
|
* Requires `onchain:read` permission
|
|
56
|
+
*
|
|
57
|
+
* `inputs` are not supported on LND 0.15.0 and below
|
|
46
58
|
*/
|
|
47
59
|
export const getChainTransactions: AuthenticatedLightningMethod<
|
|
48
60
|
GetChainTransactionsArgs,
|
|
@@ -12,6 +12,10 @@ export type GetLockedUtxosResult = {
|
|
|
12
12
|
lock_expires_at: string;
|
|
13
13
|
/** Locking Id Hex String */
|
|
14
14
|
lock_id: string;
|
|
15
|
+
/** Outpoint Output Script Hex */
|
|
16
|
+
output_script?: string;
|
|
17
|
+
/** Token Value of Outpoint */
|
|
18
|
+
tokens?: number;
|
|
15
19
|
/** Transaction Id Hex String */
|
|
16
20
|
transaction_id: string;
|
|
17
21
|
/** Transaction Output Index Number */
|
|
@@ -27,6 +31,8 @@ export type GetLockedUtxosResult = {
|
|
|
27
31
|
* Requires LND built with `walletrpc` build tag
|
|
28
32
|
*
|
|
29
33
|
* This method is not supported on LND 0.12.1 and below
|
|
34
|
+
*
|
|
35
|
+
* `output_script`, `tokens` are not supported on LND 0.15.0 and below
|
|
30
36
|
*/
|
|
31
37
|
export const getLockedUtxos: AuthenticatedLightningMethod<
|
|
32
38
|
GetLockedUtxosArgs,
|
|
@@ -6,6 +6,7 @@ const {isLnd} = require('./../../lnd_requests');
|
|
|
6
6
|
const asMs = sec => Number(sec) * 1e3;
|
|
7
7
|
const bufferAsHex = buffer => buffer.toString('hex');
|
|
8
8
|
const {isArray} = Array;
|
|
9
|
+
const {isBuffer} = Buffer;
|
|
9
10
|
const method = 'listLeases';
|
|
10
11
|
const type = 'wallet';
|
|
11
12
|
const unsuppportedErr = /unknown/;
|
|
@@ -18,6 +19,8 @@ const unsuppportedErr = /unknown/;
|
|
|
18
19
|
|
|
19
20
|
This method is not supported on LND 0.12.1 and below
|
|
20
21
|
|
|
22
|
+
`output_script`, `tokens` are not supported on LND 0.15.0 and below
|
|
23
|
+
|
|
21
24
|
{
|
|
22
25
|
lnd: <Authenticated LND API Object>
|
|
23
26
|
}
|
|
@@ -27,6 +30,8 @@ const unsuppportedErr = /unknown/;
|
|
|
27
30
|
utxos: [{
|
|
28
31
|
lock_expires_at: <Lock Expires At ISO 8601 Date String>
|
|
29
32
|
lock_id: <Locking Id Hex String>
|
|
33
|
+
[output_script]: <Outpoint Output Script Hex String>
|
|
34
|
+
[tokens]: <Token Value of Outpoint Number>
|
|
30
35
|
transaction_id: <Transaction Id Hex String>
|
|
31
36
|
transaction_vout: <Transaction Output Index Number>
|
|
32
37
|
}]
|
|
@@ -64,10 +69,16 @@ module.exports = ({lnd}, cbk) => {
|
|
|
64
69
|
return cbk([503, 'ExpectedExpirationDateForLockedUtxo']);
|
|
65
70
|
}
|
|
66
71
|
|
|
72
|
+
if (!!res.locked_utxos.filter(n => !isBuffer(n.pk_script)).length) {
|
|
73
|
+
return cbk([503, 'ExpectedPkScriptForLockedUtxosInResponse']);
|
|
74
|
+
}
|
|
75
|
+
|
|
67
76
|
try {
|
|
68
77
|
const utxos = res.locked_utxos.map(lock => ({
|
|
69
78
|
lock_expires_at: new Date(asMs(lock.expiration)).toISOString(),
|
|
70
79
|
lock_id: bufferAsHex(lock.id),
|
|
80
|
+
output_script: bufferAsHex(lock.pk_script) || undefined,
|
|
81
|
+
tokens: Number(lock.value) || undefined,
|
|
71
82
|
transaction_id: lock.outpoint.txid_str,
|
|
72
83
|
transaction_vout: lock.outpoint.output_index,
|
|
73
84
|
}));
|
|
@@ -13,6 +13,8 @@ export type OpenChannelsArgs = AuthenticatedLightningArgs<{
|
|
|
13
13
|
give_tokens?: number;
|
|
14
14
|
/** Channel is Private */
|
|
15
15
|
is_private?: boolean;
|
|
16
|
+
/** Peer Should Avoid Waiting For Confirmation */
|
|
17
|
+
is_trusted_funding?: boolean;
|
|
16
18
|
/** Minimum HTLC Millitokens */
|
|
17
19
|
min_htlc_mtokens?: string;
|
|
18
20
|
/** Public Key Hex */
|
|
@@ -45,6 +47,13 @@ minutes to fund the channels.
|
|
|
45
47
|
*
|
|
46
48
|
* If you do not fund the channels, be sure to `cancelPendingChannel`s on each
|
|
47
49
|
channel that was not funded.
|
|
50
|
+
|
|
51
|
+
Use `is_avoiding_broadcast` only when self-publishing the raw transaction
|
|
52
|
+
after the funding step.
|
|
53
|
+
|
|
54
|
+
`is_trusted_funding` is not supported on LND 0.15.0 and below and requires
|
|
55
|
+
`--protocol.option-scid-alias` and `--protocol.zero-conf` set on both sides
|
|
56
|
+
as well as a channel open request listener to accept the trusted funding.
|
|
48
57
|
*/
|
|
49
58
|
export const openChannels: AuthenticatedLightningMethod<
|
|
50
59
|
OpenChannelsArgs,
|
|
@@ -5,6 +5,7 @@ const {isLnd} = require('./../../lnd_requests');
|
|
|
5
5
|
|
|
6
6
|
const initialConfirmationCount = 0;
|
|
7
7
|
const {isArray} = Array;
|
|
8
|
+
const {isInteger} = Number;
|
|
8
9
|
const lowBalanceErr = 'insufficient funds available to construct transaction';
|
|
9
10
|
const method = 'sendCoins';
|
|
10
11
|
const OPEN = 1;
|
|
@@ -53,6 +54,10 @@ module.exports = (args, cbk) => {
|
|
|
53
54
|
return cbk([400, 'ExpectedLndForChainSendRequest']);
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
if (!!args.tokens && !isInteger(args.tokens)) {
|
|
58
|
+
return cbk([400, 'ExpectedWholeNumberAmountToSendFundsOnChain']);
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
if (!args.tokens && !args.is_send_all) {
|
|
57
62
|
return cbk([400, 'MissingTokensToSendOnChain']);
|
|
58
63
|
}
|
|
@@ -1,33 +1,16 @@
|
|
|
1
1
|
import {AuthenticatedLightningSubscription} from '../../typescript';
|
|
2
|
+
import {ChainTransaction} from './get_chain_transactions';
|
|
2
3
|
|
|
3
|
-
export type SubscribeToTransactionsChainTransactionEvent =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
confirmation_count?: number;
|
|
8
|
-
/** Confirmation Block Height */
|
|
9
|
-
confirmation_height?: number;
|
|
10
|
-
/** Created ISO 8601 Date */
|
|
11
|
-
created_at: string;
|
|
12
|
-
/** Fees Paid Tokens */
|
|
13
|
-
fee?: number;
|
|
14
|
-
/** Transaction Id */
|
|
15
|
-
id: string;
|
|
16
|
-
/** Is Confirmed */
|
|
17
|
-
is_confirmed: boolean;
|
|
18
|
-
/** Transaction Outbound */
|
|
19
|
-
is_outgoing: boolean;
|
|
20
|
-
/** Addresses */
|
|
21
|
-
output_addresses: string[];
|
|
22
|
-
/** Tokens Including Fee */
|
|
23
|
-
tokens: number;
|
|
24
|
-
/** Raw Transaction Hex */
|
|
25
|
-
transaction?: string;
|
|
26
|
-
};
|
|
4
|
+
export type SubscribeToTransactionsChainTransactionEvent = Omit<
|
|
5
|
+
ChainTransaction,
|
|
6
|
+
'description'
|
|
7
|
+
>;
|
|
27
8
|
|
|
28
9
|
/**
|
|
29
10
|
* Subscribe to transactions
|
|
30
11
|
*
|
|
31
12
|
* Requires `onchain:read` permission
|
|
13
|
+
*
|
|
14
|
+
* `inputs` are not supported on LND 0.15.0 and below
|
|
32
15
|
*/
|
|
33
16
|
export const subscribeToTransactions: AuthenticatedLightningSubscription;
|
|
@@ -10,6 +10,8 @@ export type SignBytesArgs = AuthenticatedLightningArgs<{
|
|
|
10
10
|
key_index: number;
|
|
11
11
|
/** Bytes To Hash and Sign Hex Encoded String */
|
|
12
12
|
preimage: string;
|
|
13
|
+
/** Signature Type */
|
|
14
|
+
type?: 'ecdsa' | 'schnorr';
|
|
13
15
|
}>;
|
|
14
16
|
|
|
15
17
|
export type SignBytesResult = {
|
|
@@ -23,6 +25,8 @@ export type SignBytesResult = {
|
|
|
23
25
|
* Requires LND built with `signrpc` build tag
|
|
24
26
|
*
|
|
25
27
|
* Requires `signer:generate` permission
|
|
28
|
+
*
|
|
29
|
+
* `schnorr` signature type is not supported on LND 0.15.0 and below
|
|
26
30
|
*/
|
|
27
31
|
export const signBytes: AuthenticatedLightningMethod<
|
|
28
32
|
SignBytesArgs,
|
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.11",
|
|
11
11
|
"@grpc/proto-loader": "0.7.2",
|
|
12
12
|
"@types/express": "4.17.13",
|
|
13
|
-
"@types/node": "18.7.
|
|
13
|
+
"@types/node": "18.7.14",
|
|
14
14
|
"@types/request": "2.48.8",
|
|
15
15
|
"@types/ws": "8.5.3",
|
|
16
16
|
"async": "3.2.4",
|
|
@@ -23,17 +23,17 @@
|
|
|
23
23
|
"cbor": "8.1.0",
|
|
24
24
|
"ecpair": "2.0.1",
|
|
25
25
|
"express": "4.18.1",
|
|
26
|
-
"invoices": "2.
|
|
26
|
+
"invoices": "2.2.0",
|
|
27
27
|
"psbt": "2.7.1",
|
|
28
28
|
"tiny-secp256k1": "2.2.1",
|
|
29
|
-
"type-fest": "2.
|
|
29
|
+
"type-fest": "2.19.0"
|
|
30
30
|
},
|
|
31
31
|
"description": "Lightning Network client library",
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@alexbosworth/node-fetch": "2.6.2",
|
|
34
34
|
"@alexbosworth/tap": "15.0.11",
|
|
35
|
-
"tsd": "0.
|
|
36
|
-
"typescript": "4.
|
|
35
|
+
"tsd": "0.23.0",
|
|
36
|
+
"typescript": "4.8.2",
|
|
37
37
|
"ws": "8.8.1"
|
|
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.
|
|
62
|
+
"version": "5.20.2"
|
|
63
63
|
}
|
|
@@ -13,6 +13,8 @@ const makeLnd = overrides => {
|
|
|
13
13
|
output_index: 0,
|
|
14
14
|
txid_str: Buffer.alloc(32).toString('hex'),
|
|
15
15
|
},
|
|
16
|
+
pk_script: Buffer.alloc(1),
|
|
17
|
+
value: '1',
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
Object.keys(overrides).forEach(k => utxo[k] = overrides[k]);
|
|
@@ -56,12 +58,31 @@ const tests = [
|
|
|
56
58
|
description: 'An outpoint is expected in a locked utxo',
|
|
57
59
|
error: [503, 'UnexpectedErrorParsingLockedUtxosResponse'],
|
|
58
60
|
},
|
|
61
|
+
{
|
|
62
|
+
args: {lnd: makeLnd({pk_script: undefined})},
|
|
63
|
+
description: 'An output script is expected in a locked utxo',
|
|
64
|
+
error: [503, 'ExpectedPkScriptForLockedUtxosInResponse'],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
args: {lnd: makeLnd({pk_script: Buffer.alloc(0), value: '0'})},
|
|
68
|
+
description: 'Get legacy tx and map them to normalized transactions',
|
|
69
|
+
expected: [{
|
|
70
|
+
lock_expires_at: '1970-01-01T00:00:01.000Z',
|
|
71
|
+
lock_id: '0000000000000000000000000000000000000000000000000000000000000000',
|
|
72
|
+
output_script: undefined,
|
|
73
|
+
tokens: undefined,
|
|
74
|
+
transaction_id: Buffer.alloc(32).toString('hex'),
|
|
75
|
+
transaction_vout: 0,
|
|
76
|
+
}],
|
|
77
|
+
},
|
|
59
78
|
{
|
|
60
79
|
args: {lnd: makeLnd({})},
|
|
61
80
|
description: 'Get transactions and map them to normalized transactions',
|
|
62
81
|
expected: [{
|
|
63
82
|
lock_expires_at: '1970-01-01T00:00:01.000Z',
|
|
64
83
|
lock_id: '0000000000000000000000000000000000000000000000000000000000000000',
|
|
84
|
+
output_script: '00',
|
|
85
|
+
tokens: 1,
|
|
65
86
|
transaction_id: Buffer.alloc(32).toString('hex'),
|
|
66
87
|
transaction_vout: 0,
|
|
67
88
|
}],
|
|
@@ -36,6 +36,11 @@ const tests = [
|
|
|
36
36
|
description: 'Expected tokens to send to chain address',
|
|
37
37
|
error: [400, 'MissingTokensToSendOnChain'],
|
|
38
38
|
},
|
|
39
|
+
{
|
|
40
|
+
args: makeArgs({tokens: 0.1}),
|
|
41
|
+
description: 'Expected non-fractional tokens to send to chain address',
|
|
42
|
+
error: [400, 'ExpectedWholeNumberAmountToSendFundsOnChain'],
|
|
43
|
+
},
|
|
39
44
|
{
|
|
40
45
|
args: makeArgs({is_send_all: true, tokens: 1}),
|
|
41
46
|
description: 'Expected either send all or tokens to send to chain address',
|