lightning 10.18.0 → 10.19.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 +8 -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.js +2 -0
- package/lnd_methods/offchain/finished_payment.js +5 -0
- package/lnd_methods/offchain/subscribe_to_past_payment.js +1 -0
- 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 +1 -0
- 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/constants.json +1 -0
- package/lnd_responses/failure_from_payment.js +7 -5
- package/package.json +5 -5
- package/test/lnd_responses/test_failure_from_payment.js +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 10.19.0
|
|
4
|
+
|
|
5
|
+
- `createInvoice`: add `is_encrypting_routes` to enable blinded paths feature
|
|
6
|
+
|
|
7
|
+
- `pay`, `subscribeToPastPayment`, `subscribeToPayViaDetails`,
|
|
8
|
+
`subscribeToPayViaRequest`, `subscribeToPayments`: Add `is_canceled` for
|
|
9
|
+
when the payment loop was explicitly canceled.
|
|
10
|
+
|
|
3
11
|
## 10.18.0
|
|
4
12
|
|
|
5
13
|
- `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
|
};
|
|
@@ -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,
|
|
@@ -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>
|
|
@@ -114,6 +115,10 @@ module.exports = ({confirmed, failed}, cbk) => {
|
|
|
114
115
|
return cbk();
|
|
115
116
|
}
|
|
116
117
|
|
|
118
|
+
if (!!failed.is_canceled) {
|
|
119
|
+
return cbk([503, 'PaymentExecutionCanceled']);
|
|
120
|
+
}
|
|
121
|
+
|
|
117
122
|
if (!!failed.is_insufficient_balance) {
|
|
118
123
|
return cbk([503, 'InsufficientBalanceToAttemptPayment']);
|
|
119
124
|
}
|
|
@@ -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>
|
|
@@ -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>
|
|
@@ -78,6 +78,7 @@ const type = 'router';
|
|
|
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 Invalid Payment Bool>
|
|
83
84
|
is_pathfinding_timeout: <Failed Due to Pathfinding Timeout Bool>
|
|
@@ -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>
|
|
@@ -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,
|
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.0",
|
|
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,7 +22,7 @@
|
|
|
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.25.0"
|
|
26
26
|
},
|
|
27
27
|
"description": "Lightning Network client library",
|
|
28
28
|
"devDependencies": {
|
|
@@ -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.19.0"
|
|
57
57
|
}
|
|
@@ -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',
|