lightning 10.18.0 → 10.20.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 +13 -0
- package/grpc/protos/lightning.proto +53 -3
- package/lnd_methods/info/get_wallet_info.d.ts +4 -0
- package/lnd_methods/invoices/create_invoice.d.ts +2 -0
- package/lnd_methods/invoices/create_invoice.js +2 -0
- package/lnd_methods/offchain/finished_payment.d.ts +4 -0
- package/lnd_methods/offchain/finished_payment.js +7 -0
- package/lnd_methods/offchain/pay_via_payment_request.js +1 -0
- package/lnd_methods/offchain/subscribe_to_past_payment.d.ts +2 -0
- package/lnd_methods/offchain/subscribe_to_past_payment.js +1 -0
- package/lnd_methods/offchain/subscribe_to_pay.d.ts +3 -1
- package/lnd_methods/offchain/subscribe_to_pay.js +1 -0
- package/lnd_methods/offchain/subscribe_to_pay_via_details.js +1 -0
- package/lnd_methods/offchain/subscribe_to_pay_via_request.js +3 -0
- package/lnd_methods/offchain/subscribe_to_payments.d.ts +138 -3
- package/lnd_methods/offchain/subscribe_to_payments.js +1 -0
- package/lnd_methods/onchain/get_minimum_relay_fee.d.ts +25 -0
- package/lnd_methods/onchain/index.d.ts +1 -0
- package/lnd_methods/onchain/send_to_chain_address.js +4 -0
- package/lnd_responses/confirmed_from_payment.d.ts +2 -0
- package/lnd_responses/confirmed_from_payment.js +2 -0
- package/lnd_responses/constants.json +1 -0
- package/lnd_responses/failure_from_payment.js +7 -5
- package/lnd_responses/pending_from_payment.js +2 -0
- package/package.json +6 -6
- package/test/lnd_methods/offchain/test_finished_payment.js +2 -0
- package/test/lnd_methods/offchain/test_get_payment.js +1 -0
- package/test/lnd_methods/offchain/test_subscribe_to_past_payments.js +1 -0
- package/test/lnd_methods/offchain/test_subscribe_to_payments.js +1 -0
- package/test/lnd_responses/test_confirmed_from_payment.js +1 -0
- package/test/lnd_responses/test_failure_from_payment.js +9 -0
- package/test/lnd_responses/test_pending_from_payment.js +1 -0
- package/test/typescript/finished_payment.test-d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 10.20.0
|
|
4
|
+
|
|
5
|
+
- `payViaPaymentRequest`, `subscribeToPayViaRequest`: Add `index` to response
|
|
6
|
+
for payment offset number in payments set
|
|
7
|
+
|
|
8
|
+
## 10.19.0
|
|
9
|
+
|
|
10
|
+
- `createInvoice`: add `is_encrypting_routes` to enable blinded paths feature
|
|
11
|
+
|
|
12
|
+
- `pay`, `subscribeToPastPayment`, `subscribeToPayViaDetails`,
|
|
13
|
+
`subscribeToPayViaRequest`, `subscribeToPayments`: Add `is_canceled` for
|
|
14
|
+
when the payment loop was explicitly canceled.
|
|
15
|
+
|
|
3
16
|
## 10.18.0
|
|
4
17
|
|
|
5
18
|
- `getMinimumRelayFee`: Add method to get the chain backend minimum relay fee
|
|
@@ -1190,9 +1190,8 @@ message SendCoinsRequest {
|
|
|
1190
1190
|
int64 sat_per_byte = 5 [deprecated = true];
|
|
1191
1191
|
|
|
1192
1192
|
/*
|
|
1193
|
-
If set,
|
|
1194
|
-
|
|
1195
|
-
address.
|
|
1193
|
+
If set, the amount field should be unset. It indicates lnd will send all
|
|
1194
|
+
wallet coins or all selected coins to the specified address.
|
|
1196
1195
|
*/
|
|
1197
1196
|
bool send_all = 6;
|
|
1198
1197
|
|
|
@@ -1208,6 +1207,9 @@ message SendCoinsRequest {
|
|
|
1208
1207
|
|
|
1209
1208
|
// The strategy to use for selecting coins.
|
|
1210
1209
|
CoinSelectionStrategy coin_selection_strategy = 10;
|
|
1210
|
+
|
|
1211
|
+
// A list of selected outpoints as inputs for the transaction.
|
|
1212
|
+
repeated OutPoint outpoints = 11;
|
|
1211
1213
|
}
|
|
1212
1214
|
message SendCoinsResponse {
|
|
1213
1215
|
// The transaction ID of the transaction
|
|
@@ -3836,6 +3838,48 @@ message Invoice {
|
|
|
3836
3838
|
Note: Output only, don't specify for creating an invoice.
|
|
3837
3839
|
*/
|
|
3838
3840
|
map<string, AMPInvoiceState> amp_invoice_state = 28;
|
|
3841
|
+
|
|
3842
|
+
/*
|
|
3843
|
+
Signals that the invoice should include blinded paths to hide the true
|
|
3844
|
+
identity of the recipient.
|
|
3845
|
+
*/
|
|
3846
|
+
bool is_blinded = 29;
|
|
3847
|
+
|
|
3848
|
+
/*
|
|
3849
|
+
Config values to use when creating blinded paths for this invoice. These
|
|
3850
|
+
can be used to override the defaults config values provided in by the
|
|
3851
|
+
global config. This field is only used if is_blinded is true.
|
|
3852
|
+
*/
|
|
3853
|
+
BlindedPathConfig blinded_path_config = 30;
|
|
3854
|
+
}
|
|
3855
|
+
|
|
3856
|
+
message BlindedPathConfig {
|
|
3857
|
+
/*
|
|
3858
|
+
The minimum number of real hops to include in a blinded path. This doesn't
|
|
3859
|
+
include our node, so if the minimum is 1, then the path will contain at
|
|
3860
|
+
minimum our node along with an introduction node hop. If it is zero then
|
|
3861
|
+
the shortest path will use our node as an introduction node.
|
|
3862
|
+
*/
|
|
3863
|
+
optional uint32 min_num_real_hops = 1;
|
|
3864
|
+
|
|
3865
|
+
/*
|
|
3866
|
+
The number of hops to include in a blinded path. This doesn't include our
|
|
3867
|
+
node, so if it is 1, then the path will contain our node along with an
|
|
3868
|
+
introduction node or dummy node hop. If paths shorter than NumHops is
|
|
3869
|
+
found, then they will be padded using dummy hops.
|
|
3870
|
+
*/
|
|
3871
|
+
optional uint32 num_hops = 2;
|
|
3872
|
+
|
|
3873
|
+
/*
|
|
3874
|
+
The maximum number of blinded paths to select and add to an invoice.
|
|
3875
|
+
*/
|
|
3876
|
+
optional uint32 max_num_paths = 3;
|
|
3877
|
+
|
|
3878
|
+
/*
|
|
3879
|
+
A list of node IDs of nodes that should not be used in any of our generated
|
|
3880
|
+
blinded paths.
|
|
3881
|
+
*/
|
|
3882
|
+
repeated bytes node_omission_list = 4;
|
|
3839
3883
|
}
|
|
3840
3884
|
|
|
3841
3885
|
enum InvoiceHTLCState {
|
|
@@ -4044,6 +4088,11 @@ enum PaymentFailureReason {
|
|
|
4044
4088
|
Insufficient local balance.
|
|
4045
4089
|
*/
|
|
4046
4090
|
FAILURE_REASON_INSUFFICIENT_BALANCE = 5;
|
|
4091
|
+
|
|
4092
|
+
/*
|
|
4093
|
+
The payment was canceled.
|
|
4094
|
+
*/
|
|
4095
|
+
FAILURE_REASON_CANCELED = 6;
|
|
4047
4096
|
}
|
|
4048
4097
|
|
|
4049
4098
|
message Payment {
|
|
@@ -4289,6 +4338,7 @@ message PayReq {
|
|
|
4289
4338
|
bytes payment_addr = 11;
|
|
4290
4339
|
int64 num_msat = 12;
|
|
4291
4340
|
map<uint32, Feature> features = 13;
|
|
4341
|
+
repeated BlindedPaymentPath blinded_paths = 14;
|
|
4292
4342
|
}
|
|
4293
4343
|
|
|
4294
4344
|
enum FeatureBit {
|
|
@@ -26,6 +26,8 @@ export type GetWalletInfoResult = {
|
|
|
26
26
|
}[];
|
|
27
27
|
/** Is Synced To Chain */
|
|
28
28
|
is_synced_to_chain: boolean;
|
|
29
|
+
/** Is Synced To Network Graph */
|
|
30
|
+
is_synced_to_graph?: boolean;
|
|
29
31
|
/** Latest Known Block At Date */
|
|
30
32
|
latest_block_at: string;
|
|
31
33
|
/** Peer Count */
|
|
@@ -34,6 +36,8 @@ export type GetWalletInfoResult = {
|
|
|
34
36
|
pending_channels_count: number;
|
|
35
37
|
/** Public Key */
|
|
36
38
|
public_key: string;
|
|
39
|
+
/** The URIs of the Node */
|
|
40
|
+
uris?: string[];
|
|
37
41
|
/** Version String */
|
|
38
42
|
version: string;
|
|
39
43
|
};
|
|
@@ -13,6 +13,8 @@ export type CreateInvoiceArgs = AuthenticatedLightningArgs<{
|
|
|
13
13
|
description_hash?: string;
|
|
14
14
|
/** Expires At ISO 8601 Date */
|
|
15
15
|
expires_at?: string;
|
|
16
|
+
/** Use Blinded Paths For Inbound Routes */
|
|
17
|
+
is_encrypting_routes?: boolean;
|
|
16
18
|
/** Is Fallback Address Included */
|
|
17
19
|
is_fallback_included?: boolean;
|
|
18
20
|
/** Is Fallback Address Nested */
|
|
@@ -31,6 +31,7 @@ const type = 'default';
|
|
|
31
31
|
[description]: <Invoice Description String>
|
|
32
32
|
[description_hash]: <Hashed Description of Payment Hex String>
|
|
33
33
|
[expires_at]: <Expires At ISO 8601 Date String>
|
|
34
|
+
[is_encrypting_routes]: <Use Blinded Paths For Inbound Routes Bool>
|
|
34
35
|
[is_fallback_included]: <Is Fallback Address Included Bool>
|
|
35
36
|
[is_fallback_nested]: <Is Fallback Address Nested Bool>
|
|
36
37
|
[is_including_private_channels]: <Invoice Includes Private Channels Bool>
|
|
@@ -161,6 +162,7 @@ module.exports = (args, cbk) => {
|
|
|
161
162
|
description_hash: hexAsBuffer(args.description_hash),
|
|
162
163
|
expiry: !expiryMs ? defaultExpirySec : round(expiryMs / msPerSec),
|
|
163
164
|
fallback_addr: fallbackAddress,
|
|
165
|
+
is_blinded: !!args.is_encrypting_routes,
|
|
164
166
|
memo: args.description,
|
|
165
167
|
private: !!args.is_including_private_channels,
|
|
166
168
|
r_preimage: preimage || undefined,
|
|
@@ -27,6 +27,8 @@ export type FinishedPaymentArgs = AuthenticatedLightningArgs<{
|
|
|
27
27
|
}[];
|
|
28
28
|
/** Payment Hash Hex String */
|
|
29
29
|
id: string;
|
|
30
|
+
/** Payment Index String */
|
|
31
|
+
index: string;
|
|
30
32
|
/** Total Millitokens Paid String */
|
|
31
33
|
mtokens: string;
|
|
32
34
|
paths: {
|
|
@@ -129,6 +131,8 @@ export type FinishedPaymentResult = {
|
|
|
129
131
|
}[];
|
|
130
132
|
/** Payment Hash Hex String */
|
|
131
133
|
id?: string;
|
|
134
|
+
/** Payment Index String */
|
|
135
|
+
index: string;
|
|
132
136
|
/** Total Millitokens Paid String */
|
|
133
137
|
mtokens: string;
|
|
134
138
|
paths: {
|
|
@@ -39,6 +39,7 @@ const {returnResult} = require('asyncjs-util');
|
|
|
39
39
|
tokens: <Total Tokens Paid Rounded Down Number>
|
|
40
40
|
}
|
|
41
41
|
[failed]: {
|
|
42
|
+
is_canceled: <Payment Canceled Bool>
|
|
42
43
|
is_insufficient_balance: <Failed Due To Lack of Balance Bool>
|
|
43
44
|
is_invalid_payment: <Failed Due to Invalid Payment Bool>
|
|
44
45
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
|
@@ -79,6 +80,7 @@ const {returnResult} = require('asyncjs-util');
|
|
|
79
80
|
timeout: <Timeout Block Height Number>
|
|
80
81
|
}]
|
|
81
82
|
[id]: <Payment Hash Hex String>
|
|
83
|
+
index: <Payment Index Offset Number String>
|
|
82
84
|
mtokens: <Total Millitokens Paid String>
|
|
83
85
|
paths: [{
|
|
84
86
|
fee_mtokens: <Total Fee Millitokens Paid String>
|
|
@@ -114,6 +116,10 @@ module.exports = ({confirmed, failed}, cbk) => {
|
|
|
114
116
|
return cbk();
|
|
115
117
|
}
|
|
116
118
|
|
|
119
|
+
if (!!failed.is_canceled) {
|
|
120
|
+
return cbk([503, 'PaymentExecutionCanceled']);
|
|
121
|
+
}
|
|
122
|
+
|
|
117
123
|
if (!!failed.is_insufficient_balance) {
|
|
118
124
|
return cbk([503, 'InsufficientBalanceToAttemptPayment']);
|
|
119
125
|
}
|
|
@@ -141,6 +147,7 @@ module.exports = ({confirmed, failed}, cbk) => {
|
|
|
141
147
|
fee_mtokens: confirmed.fee_mtokens,
|
|
142
148
|
hops: confirmed.hops,
|
|
143
149
|
id: confirmed.id,
|
|
150
|
+
index: confirmed.index,
|
|
144
151
|
mtokens: confirmed.mtokens,
|
|
145
152
|
paths: confirmed.paths,
|
|
146
153
|
secret: confirmed.secret,
|
|
@@ -52,6 +52,7 @@ const type = 'router';
|
|
|
52
52
|
timeout: <First Route Timeout Block Height Number>
|
|
53
53
|
}]
|
|
54
54
|
id: <Payment Hash Hex String>
|
|
55
|
+
index: <Payment Index Offset Number String>
|
|
55
56
|
mtokens: <Total Millitokens Paid String>
|
|
56
57
|
paths: [{
|
|
57
58
|
fee_mtokens: <Total Fee Millitokens Paid String>
|
|
@@ -58,6 +58,8 @@ export type SubscribeToPastPaymentConfirmedEvent = {
|
|
|
58
58
|
export type SubscribeToPastPaymentFailedEvent = {
|
|
59
59
|
/** Payment Hash Hex */
|
|
60
60
|
id: string;
|
|
61
|
+
/** Payment Canceled */
|
|
62
|
+
is_canceled: boolean;
|
|
61
63
|
/** Failed Due To Lack of Balance */
|
|
62
64
|
is_insufficient_balance: boolean;
|
|
63
65
|
/** Failed Due to Payment Rejected At Destination */
|
|
@@ -78,6 +78,7 @@ const unknownServiceErr = 'unknown service verrpc.Versioner';
|
|
|
78
78
|
@event 'failed'
|
|
79
79
|
{
|
|
80
80
|
id: <Payment Hash Hex String>
|
|
81
|
+
is_canceled: <Payment Canceled Bool>
|
|
81
82
|
is_insufficient_balance: <Failed Due To Lack of Balance Bool>
|
|
82
83
|
is_invalid_payment: <Failed Due to Payment Rejected At Destination Bool>
|
|
83
84
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
|
@@ -140,7 +140,9 @@ export type SubscribeToPayConfirmedEvent = {
|
|
|
140
140
|
export type SubscribeToPayFailedEvent = {
|
|
141
141
|
/** Payment Hash Hex */
|
|
142
142
|
id: string;
|
|
143
|
-
/**
|
|
143
|
+
/** Payment Canceled */
|
|
144
|
+
is_canceled: boolean;
|
|
145
|
+
/** Failed Due To Lack of Balance */
|
|
144
146
|
is_insufficient_balance: boolean;
|
|
145
147
|
/** Failed Due to Invalid Payment Bool> */
|
|
146
148
|
is_invalid_payment: boolean;
|
|
@@ -128,6 +128,7 @@ const unsupportedFeatures = [30, 31];
|
|
|
128
128
|
@event 'failed'
|
|
129
129
|
{
|
|
130
130
|
id: <Payment Hash Hex String>
|
|
131
|
+
is_canceled: <Payment Canceled Bool>
|
|
131
132
|
is_insufficient_balance: <Failed Due To Lack of Balance Bool>
|
|
132
133
|
is_invalid_payment: <Failed Due to Invalid Payment Bool>
|
|
133
134
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
|
@@ -98,6 +98,7 @@ const type = 'router';
|
|
|
98
98
|
@event 'failed'
|
|
99
99
|
{
|
|
100
100
|
id: <Payment Hash Hex String>
|
|
101
|
+
is_canceled: <Payment Canceled Bool>
|
|
101
102
|
is_insufficient_balance: <Failed Due To Lack of Balance Bool>
|
|
102
103
|
is_invalid_payment: <Failed Due to Invalid Payment Bool>
|
|
103
104
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
|
@@ -54,6 +54,7 @@ const type = 'router';
|
|
|
54
54
|
timeout: <First Route Timeout Block Height Number>
|
|
55
55
|
}]
|
|
56
56
|
id: <Payment Hash Hex String>
|
|
57
|
+
index: <Payment Index Offset Number String>
|
|
57
58
|
mtokens: <Total Millitokens Paid String>
|
|
58
59
|
paths: [{
|
|
59
60
|
fee_mtokens: <Total Fee Millitokens Paid String>
|
|
@@ -78,6 +79,7 @@ const type = 'router';
|
|
|
78
79
|
@event 'failed'
|
|
79
80
|
{
|
|
80
81
|
id: <Payment Hash Hex String>
|
|
82
|
+
is_canceled: <Payment Canceled Bool>
|
|
81
83
|
is_insufficient_balance: <Failed Due To Lack of Balance Bool>
|
|
82
84
|
is_invalid_payment: <Failed Due to Invalid Payment Bool>
|
|
83
85
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
|
@@ -108,6 +110,7 @@ const type = 'router';
|
|
|
108
110
|
created_at: <Payment Created At ISO 8601 Date String>
|
|
109
111
|
destination: <Payment Destination Hex String>
|
|
110
112
|
id: <Payment Hash Hex String>
|
|
113
|
+
index: <Payment Index Offset Number String>
|
|
111
114
|
mtokens: <Total Millitokens Pending String>
|
|
112
115
|
paths: [{
|
|
113
116
|
fee: <Total Fee Tokens Pending Number>
|
|
@@ -7,10 +7,145 @@ import type {SubscribeToPastPaymentsPaymentEvent} from './subscribe_to_past_paym
|
|
|
7
7
|
|
|
8
8
|
export type SubscribeToPaymentsArgs = AuthenticatedLightningArgs;
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/** A confirmed payment event
|
|
11
|
+
* @event 'confirmed'
|
|
12
|
+
*/
|
|
13
|
+
export interface SubscribeToPaymentsConfirmedEvent {
|
|
14
|
+
/** Payment Confirmed At ISO 8601 Date String */
|
|
15
|
+
confirmed_at: string;
|
|
16
|
+
/** Payment Created At ISO 8601 Date String */
|
|
17
|
+
created_at: string;
|
|
18
|
+
/** Payment Destination Hex String */
|
|
19
|
+
destination: string;
|
|
20
|
+
/** Total Fee Tokens Paid Rounded Down Number */
|
|
21
|
+
fee: number;
|
|
22
|
+
/** Total Fee Millitokens Paid String */
|
|
23
|
+
fee_mtokens: string;
|
|
24
|
+
/** Payment Hash Hex String */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Total Millitokens Paid String */
|
|
27
|
+
mtokens: string;
|
|
28
|
+
/** Payment paths */
|
|
29
|
+
paths?: Array<{
|
|
30
|
+
/** Total Fee Tokens Paid Number */
|
|
31
|
+
fee: number;
|
|
32
|
+
/** Total Fee Millitokens Paid String */
|
|
33
|
+
fee_mtokens: string;
|
|
34
|
+
/** Hops in the path */
|
|
35
|
+
hops: Array<{
|
|
36
|
+
/** Standard Format Channel Id String */
|
|
37
|
+
channel: string;
|
|
38
|
+
/** Channel Capacity Tokens Number */
|
|
39
|
+
channel_capacity: number;
|
|
40
|
+
/** Fee Tokens Rounded Down Number */
|
|
41
|
+
fee: number;
|
|
42
|
+
/** Fee Millitokens String */
|
|
43
|
+
fee_mtokens: string;
|
|
44
|
+
/** Forward Tokens Number */
|
|
45
|
+
forward: number;
|
|
46
|
+
/** Forward Millitokens String */
|
|
47
|
+
forward_mtokens: string;
|
|
48
|
+
/** Public Key Hex String */
|
|
49
|
+
public_key: string;
|
|
50
|
+
/** Timeout Block Height Number */
|
|
51
|
+
timeout: number;
|
|
52
|
+
}>;
|
|
53
|
+
/** Total Millitokens Paid String */
|
|
54
|
+
mtokens: string;
|
|
55
|
+
/** Total Fee Tokens Paid Rounded Up Number */
|
|
56
|
+
safe_fee: number;
|
|
57
|
+
/** Total Tokens Paid, Rounded Up Number */
|
|
58
|
+
safe_tokens: number;
|
|
59
|
+
/** Expiration Block Height Number */
|
|
60
|
+
timeout: number;
|
|
61
|
+
}>;
|
|
62
|
+
/** BOLT 11 Encoded Payment Request String */
|
|
63
|
+
request?: string;
|
|
64
|
+
/** Total Fee Tokens Paid Rounded Up Number */
|
|
65
|
+
safe_fee: number;
|
|
66
|
+
/** Total Tokens Paid, Rounded Up Number */
|
|
67
|
+
safe_tokens: number;
|
|
68
|
+
/** Payment Preimage Hex String */
|
|
69
|
+
secret: string;
|
|
70
|
+
/** Expiration Block Height Number */
|
|
71
|
+
timeout: number;
|
|
72
|
+
/** Total Tokens Paid Rounded Down Number */
|
|
73
|
+
tokens: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** A failed payment event
|
|
77
|
+
* @event 'failed'
|
|
78
|
+
*/
|
|
79
|
+
export interface SubscribeToPaymentsFailedEvent {
|
|
80
|
+
/** Payment Hash Hex String */
|
|
81
|
+
id: string;
|
|
82
|
+
/** Payment Canceled Bool */
|
|
83
|
+
is_canceled: boolean;
|
|
84
|
+
/** Failed Due To Lack of Balance Bool */
|
|
85
|
+
is_insufficient_balance: boolean;
|
|
86
|
+
/** Failed Due to Payment Rejected At Destination Bool */
|
|
87
|
+
is_invalid_payment: boolean;
|
|
88
|
+
/** Failed Due to Pathfinding Timeout Bool */
|
|
89
|
+
is_pathfinding_timeout: boolean;
|
|
90
|
+
/** Failed Due to Absence of Path Through Graph Bool */
|
|
91
|
+
is_route_not_found: boolean;
|
|
92
|
+
}
|
|
11
93
|
|
|
12
|
-
|
|
13
|
-
|
|
94
|
+
/** A paying (in-progress) payment event
|
|
95
|
+
* @event 'paying'
|
|
96
|
+
*/
|
|
97
|
+
export interface SubscribeToPaymentsPayingEvent {
|
|
98
|
+
/** Payment Created At ISO 8601 Date String */
|
|
99
|
+
created_at: string;
|
|
100
|
+
/** Payment Destination Hex String */
|
|
101
|
+
destination: string;
|
|
102
|
+
/** Payment Hash Hex String */
|
|
103
|
+
id: string;
|
|
104
|
+
/** Total Millitokens Pending String */
|
|
105
|
+
mtokens: string;
|
|
106
|
+
/** Payment paths */
|
|
107
|
+
paths?: Array<{
|
|
108
|
+
/** Total Fee Tokens Pending Number */
|
|
109
|
+
fee: number;
|
|
110
|
+
/** Total Fee Millitokens Pending String */
|
|
111
|
+
fee_mtokens: string;
|
|
112
|
+
/** Hops in the path */
|
|
113
|
+
hops: Array<{
|
|
114
|
+
/** Standard Format Channel Id String */
|
|
115
|
+
channel: string;
|
|
116
|
+
/** Channel Capacity Tokens Number */
|
|
117
|
+
channel_capacity: number;
|
|
118
|
+
/** Fee Tokens Rounded Down Number */
|
|
119
|
+
fee: number;
|
|
120
|
+
/** Fee Millitokens String */
|
|
121
|
+
fee_mtokens: string;
|
|
122
|
+
/** Forward Tokens Number */
|
|
123
|
+
forward: number;
|
|
124
|
+
/** Forward Millitokens String */
|
|
125
|
+
forward_mtokens: string;
|
|
126
|
+
/** Public Key Hex String */
|
|
127
|
+
public_key: string;
|
|
128
|
+
/** Timeout Block Height Number */
|
|
129
|
+
timeout: number;
|
|
130
|
+
}>;
|
|
131
|
+
/** Total Millitokens Pending String */
|
|
132
|
+
mtokens: string;
|
|
133
|
+
/** Total Fee Tokens Pending Rounded Up Number */
|
|
134
|
+
safe_fee: number;
|
|
135
|
+
/** Total Tokens Pending, Rounded Up Number */
|
|
136
|
+
safe_tokens: number;
|
|
137
|
+
/** Expiration Block Height Number */
|
|
138
|
+
timeout: number;
|
|
139
|
+
}>;
|
|
140
|
+
/** BOLT 11 Encoded Payment Request String */
|
|
141
|
+
request?: string;
|
|
142
|
+
/** Total Tokens Pending, Rounded Up Number */
|
|
143
|
+
safe_tokens: number;
|
|
144
|
+
/** Expiration Block Height Number */
|
|
145
|
+
timeout?: number;
|
|
146
|
+
/** Total Tokens Pending Rounded Down Number */
|
|
147
|
+
tokens: number;
|
|
148
|
+
}
|
|
14
149
|
|
|
15
150
|
/**
|
|
16
151
|
* Subscribe to outgoing payments
|
|
@@ -64,6 +64,7 @@ const type = 'router';
|
|
|
64
64
|
@event 'failed'
|
|
65
65
|
{
|
|
66
66
|
id: <Payment Hash Hex String>
|
|
67
|
+
is_canceled: <Payment Canceled Bool>
|
|
67
68
|
is_insufficient_balance: <Failed Due To Lack of Balance Bool>
|
|
68
69
|
is_invalid_payment: <Failed Due to Payment Rejected At Destination Bool>
|
|
69
70
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AuthenticatedLightningArgs,
|
|
3
|
+
AuthenticatedLightningMethod,
|
|
4
|
+
} from '../../typescript';
|
|
5
|
+
|
|
6
|
+
export type GetMinimumRelayFeeArgs = AuthenticatedLightningArgs;
|
|
7
|
+
|
|
8
|
+
export interface GetMinimumRelayFeeResult {
|
|
9
|
+
/** Minimum Relayable Tokens Per Virtual Byte Number */
|
|
10
|
+
tokens_per_vbyte: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get the current minimum relay fee for the chain backend
|
|
15
|
+
*
|
|
16
|
+
* Requires LND built with `walletrpc` tag
|
|
17
|
+
*
|
|
18
|
+
* Requires `onchain:read` permission
|
|
19
|
+
*
|
|
20
|
+
* This method is not supported on LND 0.18.2 and below
|
|
21
|
+
*/
|
|
22
|
+
export const getMinimumRelayFee: AuthenticatedLightningMethod<
|
|
23
|
+
GetMinimumRelayFeeArgs,
|
|
24
|
+
GetMinimumRelayFeeResult
|
|
25
|
+
>;
|
|
@@ -15,6 +15,7 @@ export * from './get_chain_transaction';
|
|
|
15
15
|
export * from './get_chain_transactions';
|
|
16
16
|
export * from './get_locked_utxos';
|
|
17
17
|
export * from './get_master_public_keys';
|
|
18
|
+
export * from './get_minimum_relay_fee';
|
|
18
19
|
export * from './get_pending_chain_balance';
|
|
19
20
|
export * from './get_pending_sweeps';
|
|
20
21
|
export * from './get_sweep_transactions';
|
|
@@ -29,6 +29,10 @@ const unconfirmedConfCount = 0;
|
|
|
29
29
|
address: <Destination Chain Address String>
|
|
30
30
|
[description]: <Transaction Label String>
|
|
31
31
|
[fee_tokens_per_vbyte]: <Chain Fee Tokens Per Virtual Byte Number>
|
|
32
|
+
[inputs]: [{
|
|
33
|
+
transaction_id: <Unspent Transaction Id Hex String>
|
|
34
|
+
transaction_vout: <Unspent Transaction Output Index Number>
|
|
35
|
+
}]
|
|
32
36
|
[is_send_all]: <Send All Funds Bool>
|
|
33
37
|
lnd: <Authenticated LND API Object>
|
|
34
38
|
[log]: <Log Function>
|
|
@@ -81,6 +81,7 @@ const nsAsDate = ns => new Date(Number(BigInt(ns) / BigInt(1e6)));
|
|
|
81
81
|
timeout: <First Path Timeout Block Height Number>
|
|
82
82
|
}]
|
|
83
83
|
id: <Payment Hash Hex String>
|
|
84
|
+
index: <Payment Index Offset Number String>
|
|
84
85
|
mtokens: <Total Millitokens Paid String>
|
|
85
86
|
paths: [{
|
|
86
87
|
fee: <Total Fee Tokens Paid Number>
|
|
@@ -159,6 +160,7 @@ module.exports = payment => {
|
|
|
159
160
|
fee_mtokens: payment.fee_msat,
|
|
160
161
|
hops: success.route.hops,
|
|
161
162
|
id: payment.payment_hash,
|
|
163
|
+
index: payment.payment_index,
|
|
162
164
|
mtokens: mtokens.toString(),
|
|
163
165
|
paths: successes.map(n => n.route),
|
|
164
166
|
request: payment.payment_request || undefined,
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"defaultChannelType": "UNKNOWN_COMMITMENT_TYPE",
|
|
31
31
|
"failureReason": {
|
|
32
|
+
"canceled": "FAILURE_REASON_CANCELED",
|
|
32
33
|
"invalid_payment": "FAILURE_REASON_INCORRECT_PAYMENT_DETAILS",
|
|
33
34
|
"insufficient_balance": "FAILURE_REASON_INSUFFICIENT_BALANCE",
|
|
34
35
|
"pathfinding_timeout_failed": "FAILURE_REASON_TIMEOUT",
|
|
@@ -14,11 +14,12 @@ const is256Hex = n => !!n && /^[0-9A-F]{64}$/i.test(n);
|
|
|
14
14
|
|
|
15
15
|
@returns
|
|
16
16
|
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
id: <Payment Hash Hex String>
|
|
18
|
+
is_canceled: <Payment Was Canceled Bool>
|
|
19
|
+
is_insufficient_balance: <Payment Failed Due to Insufficient Balance Bool>
|
|
20
|
+
is_invalid_payment: <Payment Failed Due to Invalid Details Rejection Bool>
|
|
21
|
+
is_pathfinding_timeout: <Failure Due To Pathfinding Timeout Failure Bool>
|
|
22
|
+
is_route_not_found: <Failure Due to No Route To Destination Found Bool>
|
|
22
23
|
}
|
|
23
24
|
*/
|
|
24
25
|
module.exports = payment => {
|
|
@@ -30,6 +31,7 @@ module.exports = payment => {
|
|
|
30
31
|
|
|
31
32
|
return {
|
|
32
33
|
id: payment.payment_hash,
|
|
34
|
+
is_canceled: state === failureReason.canceled,
|
|
33
35
|
is_insufficient_balance: state === failureReason.insufficient_balance,
|
|
34
36
|
is_invalid_payment: state === failureReason.invalid_payment,
|
|
35
37
|
is_pathfinding_timeout: state === failureReason.pathfinding_timeout_failed,
|
|
@@ -67,6 +67,7 @@ const nsAsDate = ns => new Date(Number(BigInt(ns) / BigInt(1e6)));
|
|
|
67
67
|
created_at: <Payment Created At ISO 8601 Date String>
|
|
68
68
|
destination: <Payment Destination Public Key Hex String>
|
|
69
69
|
id: <Payment Hash Hex String>
|
|
70
|
+
index: <Payment Index Offset Number String>
|
|
70
71
|
mtokens: <Total Millitokens Pending String>
|
|
71
72
|
paths: [{
|
|
72
73
|
fee: <Total Fee Tokens Pending Number>
|
|
@@ -134,6 +135,7 @@ module.exports = payment => {
|
|
|
134
135
|
destination,
|
|
135
136
|
created_at: nsAsDate(payment.creation_time_ns).toISOString(),
|
|
136
137
|
id: payment.payment_hash,
|
|
138
|
+
index: payment.payment_index,
|
|
137
139
|
mtokens: mtokens.toString(),
|
|
138
140
|
paths: pending.map(n => n.route),
|
|
139
141
|
request: payment.payment_request || undefined,
|
package/package.json
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@grpc/grpc-js": "1.11.1",
|
|
11
11
|
"@grpc/proto-loader": "0.7.13",
|
|
12
|
-
"@types/node": "22.
|
|
12
|
+
"@types/node": "22.5.4",
|
|
13
13
|
"@types/request": "2.48.12",
|
|
14
14
|
"@types/ws": "8.5.12",
|
|
15
|
-
"async": "3.2.
|
|
15
|
+
"async": "3.2.6",
|
|
16
16
|
"asyncjs-util": "1.2.12",
|
|
17
17
|
"bitcoinjs-lib": "6.1.6",
|
|
18
18
|
"bn.js": "5.2.1",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"invoices": "3.0.0",
|
|
23
23
|
"psbt": "3.0.0",
|
|
24
24
|
"tiny-secp256k1": "2.2.3",
|
|
25
|
-
"type-fest": "4.
|
|
25
|
+
"type-fest": "4.26.0"
|
|
26
26
|
},
|
|
27
27
|
"description": "Lightning Network client library",
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"tsd": "0.31.
|
|
29
|
+
"tsd": "0.31.2",
|
|
30
30
|
"typescript": "5.5.4"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"url": "https://github.com/alexbosworth/lightning.git"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
|
-
"test": "npx nyc@
|
|
48
|
+
"test": "npx nyc@17.0.0 node --experimental-test-coverage --test && npm run test:types",
|
|
49
49
|
"test:types": "tsd",
|
|
50
50
|
"unit-tests": "node --test && npm run test:types"
|
|
51
51
|
},
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"directory": "test/typescript"
|
|
54
54
|
},
|
|
55
55
|
"types": "index.d.ts",
|
|
56
|
-
"version": "10.
|
|
56
|
+
"version": "10.20.0"
|
|
57
57
|
}
|
|
@@ -20,6 +20,7 @@ const makeArgs = overrides => {
|
|
|
20
20
|
timeout: 1,
|
|
21
21
|
}],
|
|
22
22
|
id: Buffer.alloc(32).toString('hex'),
|
|
23
|
+
index: '1',
|
|
23
24
|
mtokens: '1000',
|
|
24
25
|
paths: [{
|
|
25
26
|
fee_mtokens: '1000',
|
|
@@ -107,6 +108,7 @@ const tests = [
|
|
|
107
108
|
timeout: 1,
|
|
108
109
|
}],
|
|
109
110
|
id: '0000000000000000000000000000000000000000000000000000000000000000',
|
|
111
|
+
index: '1',
|
|
110
112
|
mtokens: '1000',
|
|
111
113
|
paths: [{
|
|
112
114
|
fee_mtokens: '1000',
|
|
@@ -9,6 +9,7 @@ const id = Buffer.alloc(32).toString('hex')
|
|
|
9
9
|
const makeExpected = overrides => {
|
|
10
10
|
const expected = {
|
|
11
11
|
id,
|
|
12
|
+
is_canceled: false,
|
|
12
13
|
is_insufficient_balance: false,
|
|
13
14
|
is_invalid_payment: false,
|
|
14
15
|
is_pathfinding_timeout: false,
|
|
@@ -53,6 +54,14 @@ const tests = [
|
|
|
53
54
|
description: 'Timeout is mapped',
|
|
54
55
|
expected: makeExpected({is_pathfinding_timeout: true}),
|
|
55
56
|
},
|
|
57
|
+
{
|
|
58
|
+
args: {
|
|
59
|
+
failure_reason: 'FAILURE_REASON_CANCELED',
|
|
60
|
+
payment_hash: id,
|
|
61
|
+
},
|
|
62
|
+
description: 'Cancel is mapped',
|
|
63
|
+
expected: makeExpected({is_canceled: true}),
|
|
64
|
+
},
|
|
56
65
|
{
|
|
57
66
|
args: {payment_hash: undefined},
|
|
58
67
|
description: 'A payment hash is expected',
|