lightning 5.20.0 → 5.21.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 +12 -0
- package/grpc/protos/invoices.proto +5 -2
- package/grpc/protos/peers.proto +1 -1
- 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_fee_estimate.d.ts +2 -0
- package/lnd_methods/onchain/get_chain_fee_estimate.js +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/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 +6 -6
- package/test/lnd_methods/onchain/test_get_chain_fee_estimate.js +16 -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.21.0
|
|
4
|
+
|
|
5
|
+
- `getChainFeeEstimate`: Add support for specifying min `utxo_confirmations`
|
|
6
|
+
|
|
7
|
+
## 5.20.2
|
|
8
|
+
|
|
9
|
+
- `getWalletInfo`: Add support for detecting lnd versions 0.15.0 and 0.15.1
|
|
10
|
+
|
|
11
|
+
## 5.20.1
|
|
12
|
+
|
|
13
|
+
- Update typescript definitions
|
|
14
|
+
|
|
3
15
|
## 5.20.0
|
|
4
16
|
|
|
5
17
|
- `getLockedUtxos`: Add support for returning script, value of locked utxos
|
|
@@ -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
|
|
@@ -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,
|
|
@@ -12,6 +12,8 @@ export type GetChainFeeEstimateArgs = AuthenticatedLightningArgs<{
|
|
|
12
12
|
}[];
|
|
13
13
|
/** Target Confirmations */
|
|
14
14
|
target_confirmations?: number;
|
|
15
|
+
/** Minimum Confirmations for UTXO Selection */
|
|
16
|
+
utxo_confirmations?: number;
|
|
15
17
|
}>;
|
|
16
18
|
|
|
17
19
|
export type GetChainFeeEstimateResult = {
|
|
@@ -8,11 +8,14 @@ const {isArray} = Array;
|
|
|
8
8
|
const method = 'estimateFee';
|
|
9
9
|
const notFound = -1;
|
|
10
10
|
const type = 'default';
|
|
11
|
+
const unconfirmedConfCount = 0;
|
|
11
12
|
|
|
12
13
|
/** Get a chain fee estimate for a prospective chain send
|
|
13
14
|
|
|
14
15
|
Requires `onchain:read` permission
|
|
15
16
|
|
|
17
|
+
Specifying 0 for `utxo_confirmations` is not supported in LND 0.13.0 or below
|
|
18
|
+
|
|
16
19
|
{
|
|
17
20
|
lnd: <Authenticated LND API Object>
|
|
18
21
|
send_to: [{
|
|
@@ -20,6 +23,7 @@ const type = 'default';
|
|
|
20
23
|
tokens: <Tokens Number>
|
|
21
24
|
}]
|
|
22
25
|
[target_confirmations]: <Target Confirmations Number>
|
|
26
|
+
[utxo_confirmations]: <Minimum Confirmations for UTXO Selection Number>
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
@returns via cbk or Promise
|
|
@@ -65,6 +69,8 @@ module.exports = (args, cbk) => {
|
|
|
65
69
|
return args.lnd[type][method]({
|
|
66
70
|
AddrToAmount,
|
|
67
71
|
target_conf: args.target_confirmations || undefined,
|
|
72
|
+
min_confs: args.utxo_confirmations || undefined,
|
|
73
|
+
spend_unconfirmed: args.utxo_confirmations === unconfirmedConfCount,
|
|
68
74
|
},
|
|
69
75
|
(err, res) => {
|
|
70
76
|
if (!!err) {
|
|
@@ -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,
|
|
@@ -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.12",
|
|
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,7 +23,7 @@
|
|
|
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
29
|
"type-fest": "2.19.0"
|
|
@@ -32,8 +32,8 @@
|
|
|
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.21.0"
|
|
63
63
|
}
|
|
@@ -78,6 +78,22 @@ const tests = [
|
|
|
78
78
|
description: 'Fee rate and fee are given in chain response',
|
|
79
79
|
expected: {fee: 1, tokens_per_vbyte: 1},
|
|
80
80
|
},
|
|
81
|
+
{
|
|
82
|
+
args: {
|
|
83
|
+
lnd: {
|
|
84
|
+
default: {
|
|
85
|
+
estimateFee: ({}, cbk) => cbk(null, {
|
|
86
|
+
fee_sat: '1',
|
|
87
|
+
feerate_sat_per_byte: '1',
|
|
88
|
+
}),
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
send_to: [{address: 'address', tokens: 1}],
|
|
92
|
+
utxo_confirmations: 0,
|
|
93
|
+
},
|
|
94
|
+
description: 'Passing 0 UTXO confirmations is supported',
|
|
95
|
+
expected: {fee: 1, tokens_per_vbyte: 1},
|
|
96
|
+
},
|
|
81
97
|
];
|
|
82
98
|
|
|
83
99
|
tests.forEach(({args, description, error, expected}) => {
|
|
@@ -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',
|