lightning 10.10.4 → 10.11.1
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 +5 -0
- package/lnd_methods/info/get_channel.d.ts +2 -18
- package/lnd_methods/info/get_channel.js +5 -0
- package/lnd_methods/info/get_network_graph.d.ts +12 -26
- package/lnd_methods/info/get_network_graph.js +5 -0
- package/lnd_methods/info/get_node.d.ts +9 -25
- package/lnd_methods/info/get_node.js +5 -0
- package/lnd_methods/offchain/update_routing_fees.js +5 -0
- package/lnd_methods/onchain/get_pending_sweeps.d.ts +47 -0
- package/lnd_methods/onchain/index.d.ts +2 -0
- package/lnd_methods/onchain/request_batched_fee_increase.d.ts +26 -0
- package/lnd_responses/channel_policy_as_policy.js +8 -0
- package/package.json +3 -3
- package/test/lnd_methods/info/test_get_channel.js +4 -0
- package/test/lnd_methods/info/test_get_network_graph.js +4 -0
- package/test/lnd_methods/info/test_get_node.js +4 -0
- package/test/lnd_responses/test_channel_edge_as_channel.js +4 -0
- package/test/lnd_responses/test_channel_policy_as_policy.js +39 -8
- package/test/lnd_responses/test_node_info_as_node.js +4 -0
- package/test/lnd_responses/test_rpc_peer_as_peer.js +0 -1
- package/typescript/shared.d.ts +41 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AuthenticatedLightningArgs,
|
|
3
3
|
AuthenticatedLightningMethod,
|
|
4
|
+
ChannelPolicy,
|
|
4
5
|
} from '../../typescript';
|
|
5
6
|
|
|
6
7
|
export type GetChannelArgs = AuthenticatedLightningArgs<{
|
|
@@ -13,24 +14,7 @@ export type GetChannelResult = {
|
|
|
13
14
|
capacity: number;
|
|
14
15
|
/** Standard Format Channel Id */
|
|
15
16
|
id: string;
|
|
16
|
-
policies:
|
|
17
|
-
/** Base Fee Millitokens */
|
|
18
|
-
base_fee_mtokens?: string;
|
|
19
|
-
/** Locktime Delta */
|
|
20
|
-
cltv_delta?: number;
|
|
21
|
-
/** Fees Charged Per Million Millitokens */
|
|
22
|
-
fee_rate?: number;
|
|
23
|
-
/** Channel Is Disabled */
|
|
24
|
-
is_disabled?: boolean;
|
|
25
|
-
/** Maximum HTLC Millitokens Value */
|
|
26
|
-
max_htlc_mtokens?: string;
|
|
27
|
-
/** Minimum HTLC Millitokens Value */
|
|
28
|
-
min_htlc_mtokens?: string;
|
|
29
|
-
/** Node Public Key */
|
|
30
|
-
public_key: string;
|
|
31
|
-
/** Policy Last Updated At ISO 8601 Date */
|
|
32
|
-
updated_at?: string;
|
|
33
|
-
}[];
|
|
17
|
+
policies: ChannelPolicy[];
|
|
34
18
|
/** Transaction Id Hex */
|
|
35
19
|
transaction_id: string;
|
|
36
20
|
/** Transaction Output Index */
|
|
@@ -12,6 +12,9 @@ const edgeNotFoundErrorMessage = 'edge not found';
|
|
|
12
12
|
|
|
13
13
|
Requires `info:read` permission
|
|
14
14
|
|
|
15
|
+
`inbound_base_discount_mtokens` is not supported on LND 0.17.5 and below
|
|
16
|
+
`inbound_rate_discount` is not supported on LND 0.17.5 and below
|
|
17
|
+
|
|
15
18
|
{
|
|
16
19
|
id: <Standard Format Channel Id String>
|
|
17
20
|
lnd: <Authenticated LND API Object>
|
|
@@ -25,6 +28,8 @@ const edgeNotFoundErrorMessage = 'edge not found';
|
|
|
25
28
|
[base_fee_mtokens]: <Base Fee Millitokens String>
|
|
26
29
|
[cltv_delta]: <Locktime Delta Number>
|
|
27
30
|
[fee_rate]: <Fees Charged in Millitokens Per Million Number>
|
|
31
|
+
[inbound_base_discount_mtokens]: <Source Based Base Fee Reduction String>
|
|
32
|
+
[inbound_rate_discount]: <Source Based Per Million Rate Reduction Number>
|
|
28
33
|
[is_disabled]: <Channel Is Disabled Bool>
|
|
29
34
|
[max_htlc_mtokens]: <Maximum HTLC Millitokens Value String>
|
|
30
35
|
[min_htlc_mtokens]: <Minimum HTLC Millitokens Value String>
|
|
@@ -1,43 +1,29 @@
|
|
|
1
|
-
import {AuthenticatedLnd} from '../../lnd_grpc';
|
|
2
|
-
import {
|
|
1
|
+
import type {AuthenticatedLnd} from '../../lnd_grpc';
|
|
2
|
+
import type {
|
|
3
|
+
AuthenticatedLightningMethod,
|
|
4
|
+
ChannelPolicy,
|
|
5
|
+
} from '../../typescript';
|
|
3
6
|
|
|
4
7
|
export type GetNetworkGraphResult = {
|
|
5
|
-
channels: {
|
|
8
|
+
channels: Array<{
|
|
6
9
|
/** Channel Capacity Tokens */
|
|
7
10
|
capacity: number;
|
|
8
11
|
/** Standard Format Channel Id */
|
|
9
12
|
id: string;
|
|
10
|
-
policies:
|
|
11
|
-
/** Base Fee Millitokens */
|
|
12
|
-
base_fee_mtokens?: string;
|
|
13
|
-
/** CLTV Height Delta */
|
|
14
|
-
cltv_delta?: number;
|
|
15
|
-
/** Fee Rate In Millitokens Per Million */
|
|
16
|
-
fee_rate?: number;
|
|
17
|
-
/** Edge is Disabled */
|
|
18
|
-
is_disabled?: boolean;
|
|
19
|
-
/** Maximum HTLC Millitokens */
|
|
20
|
-
max_htlc_mtokens?: string;
|
|
21
|
-
/** Minimum HTLC Millitokens */
|
|
22
|
-
min_htlc_mtokens?: string;
|
|
23
|
-
/** Public Key */
|
|
24
|
-
public_key: string;
|
|
25
|
-
/** Last Update Epoch ISO 8601 Date */
|
|
26
|
-
updated_at?: string;
|
|
27
|
-
}[];
|
|
13
|
+
policies: ChannelPolicy[];
|
|
28
14
|
/** Funding Transaction Id */
|
|
29
15
|
transaction_id: string;
|
|
30
16
|
/** Funding Transaction Output Index */
|
|
31
17
|
transaction_vout: number;
|
|
32
18
|
/** Last Update Epoch ISO 8601 Date */
|
|
33
19
|
updated_at?: string;
|
|
34
|
-
}
|
|
35
|
-
nodes: {
|
|
20
|
+
}>;
|
|
21
|
+
nodes: Array<{
|
|
36
22
|
/** Name */
|
|
37
23
|
alias: string;
|
|
38
24
|
/** Hex Encoded Color */
|
|
39
25
|
color: string;
|
|
40
|
-
features: {
|
|
26
|
+
features: Array<{
|
|
41
27
|
/** BOLT 09 Feature Bit */
|
|
42
28
|
bit: number;
|
|
43
29
|
/** Feature is Known */
|
|
@@ -46,14 +32,14 @@ export type GetNetworkGraphResult = {
|
|
|
46
32
|
is_required: boolean;
|
|
47
33
|
/** Feature Type */
|
|
48
34
|
type: string;
|
|
49
|
-
}
|
|
35
|
+
}>;
|
|
50
36
|
/** Node Public Key */
|
|
51
37
|
public_key: string;
|
|
52
38
|
/** Network Addresses and Ports */
|
|
53
39
|
sockets: string[];
|
|
54
40
|
/** Last Updated ISO 8601 Date */
|
|
55
41
|
updated_at: string;
|
|
56
|
-
}
|
|
42
|
+
}>;
|
|
57
43
|
};
|
|
58
44
|
|
|
59
45
|
/**
|
|
@@ -16,6 +16,9 @@ const type = 'default';
|
|
|
16
16
|
|
|
17
17
|
Requires `info:read` permission
|
|
18
18
|
|
|
19
|
+
`inbound_base_discount_mtokens` is not supported on LND 0.17.5 and below
|
|
20
|
+
`inbound_rate_discount` is not supported on LND 0.17.5 and below
|
|
21
|
+
|
|
19
22
|
{
|
|
20
23
|
lnd: <Authenticated LND API Object>
|
|
21
24
|
}
|
|
@@ -29,6 +32,8 @@ const type = 'default';
|
|
|
29
32
|
[base_fee_mtokens]: <Bae Fee Millitokens String>
|
|
30
33
|
[cltv_delta]: <CLTV Height Delta Number>
|
|
31
34
|
[fee_rate]: <Fee Rate In Millitokens Per Million Number>
|
|
35
|
+
[inbound_base_discount_mtokens]: <Source Base Fee Reduction String>
|
|
36
|
+
[inbound_rate_discount]: <Source Per Million Rate Reduction Number>
|
|
32
37
|
[is_disabled]: <Edge is Disabled Bool>
|
|
33
38
|
[max_htlc_mtokens]: <Maximum HTLC Millitokens String>
|
|
34
39
|
[min_htlc_mtokens]: <Minimum HTLC Millitokens String>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
AuthenticatedLightningArgs,
|
|
3
3
|
AuthenticatedLightningMethod,
|
|
4
|
+
ChannelPolicy,
|
|
4
5
|
} from '../../typescript';
|
|
5
6
|
|
|
6
7
|
export type GetNodeArgs = AuthenticatedLightningArgs<{
|
|
@@ -17,39 +18,22 @@ export type GetNodeResult = {
|
|
|
17
18
|
capacity: number;
|
|
18
19
|
/** Known Node Channels */
|
|
19
20
|
channel_count: number;
|
|
20
|
-
channels?: {
|
|
21
|
+
channels?: Array<{
|
|
21
22
|
/** Maximum Tokens */
|
|
22
23
|
capacity: number;
|
|
23
24
|
/** Standard Format Channel Id */
|
|
24
25
|
id: string;
|
|
25
|
-
policies:
|
|
26
|
-
/** Base Fee Millitokens */
|
|
27
|
-
base_fee_mtokens?: string;
|
|
28
|
-
/** Locktime Delta */
|
|
29
|
-
cltv_delta?: number;
|
|
30
|
-
/** Fees Charged Per Million Millitokens */
|
|
31
|
-
fee_rate?: number;
|
|
32
|
-
/** Channel Is Disabled */
|
|
33
|
-
is_disabled?: boolean;
|
|
34
|
-
/** Maximum HTLC Millitokens Value */
|
|
35
|
-
max_htlc_mtokens?: string;
|
|
36
|
-
/** Minimum HTLC Millitokens Value */
|
|
37
|
-
min_htlc_mtokens?: string;
|
|
38
|
-
/** Node Public Key */
|
|
39
|
-
public_key: string;
|
|
40
|
-
/** Policy Last Updated At ISO 8601 Date */
|
|
41
|
-
updated_at?: string;
|
|
42
|
-
}[];
|
|
26
|
+
policies: ChannelPolicy[];
|
|
43
27
|
/** Transaction Id Hex */
|
|
44
28
|
transaction_id: string;
|
|
45
29
|
/** Transaction Output Index */
|
|
46
30
|
transaction_vout: number;
|
|
47
31
|
/** Channel Last Updated At ISO 8601 Date */
|
|
48
32
|
updated_at?: string;
|
|
49
|
-
}
|
|
33
|
+
}>;
|
|
50
34
|
/** RGB Hex Color */
|
|
51
35
|
color: string;
|
|
52
|
-
features: {
|
|
36
|
+
features: Array<{
|
|
53
37
|
/** BOLT 09 Feature Bit */
|
|
54
38
|
bit: number;
|
|
55
39
|
/** Feature is Known */
|
|
@@ -58,13 +42,13 @@ export type GetNodeResult = {
|
|
|
58
42
|
is_required: boolean;
|
|
59
43
|
/** Feature Type */
|
|
60
44
|
type: string;
|
|
61
|
-
}
|
|
62
|
-
sockets: {
|
|
45
|
+
}>;
|
|
46
|
+
sockets: Array<{
|
|
63
47
|
/** Host and Port */
|
|
64
48
|
socket: string;
|
|
65
49
|
/** Socket Type */
|
|
66
50
|
type: string;
|
|
67
|
-
}
|
|
51
|
+
}>;
|
|
68
52
|
/** Last Known Update ISO 8601 Date */
|
|
69
53
|
updated_at?: string;
|
|
70
54
|
};
|
|
@@ -22,6 +22,9 @@ const type = 'default';
|
|
|
22
22
|
|
|
23
23
|
Requires `info:read` permission
|
|
24
24
|
|
|
25
|
+
`inbound_base_discount_mtokens` is not supported on LND 0.17.5 and below
|
|
26
|
+
`inbound_rate_discount` is not supported on LND 0.17.5 and below
|
|
27
|
+
|
|
25
28
|
{
|
|
26
29
|
[is_omitting_channels]: <Omit Channels from Node Bool>
|
|
27
30
|
lnd: <Authenticated LND API Object>
|
|
@@ -40,6 +43,8 @@ const type = 'default';
|
|
|
40
43
|
[base_fee_mtokens]: <Base Fee Millitokens String>
|
|
41
44
|
[cltv_delta]: <Locktime Delta Number>
|
|
42
45
|
[fee_rate]: <Fees Charged in Millitokens Per Million Number>
|
|
46
|
+
[inbound_base_discount_mtokens]: <Source Base Fee Reduction String>
|
|
47
|
+
[inbound_rate_discount]: <Source Per Million Rate Reduction Number>
|
|
43
48
|
[is_disabled]: <Channel Is Disabled Bool>
|
|
44
49
|
[max_htlc_mtokens]: <Maximum HTLC Millitokens Value String>
|
|
45
50
|
[min_htlc_mtokens]: <Minimum HTLC Millitokens Value String>
|
|
@@ -11,6 +11,7 @@ const feeRatio = 1e6;
|
|
|
11
11
|
const {floor} = Math;
|
|
12
12
|
const {isArray} = Array;
|
|
13
13
|
const method = 'updateChannelPolicy';
|
|
14
|
+
const surcharge = discount => discount === undefined ? undefined : -discount;
|
|
14
15
|
const tokensAsMtokens = tokens => (BigInt(tokens) * BigInt(1e3)).toString();
|
|
15
16
|
const type = 'default';
|
|
16
17
|
|
|
@@ -29,6 +30,8 @@ const type = 'default';
|
|
|
29
30
|
[base_fee_tokens]: <Base Fee Tokens Charged Number>
|
|
30
31
|
[cltv_delta]: <HTLC CLTV Delta Number>
|
|
31
32
|
[fee_rate]: <Fee Rate In Millitokens Per Million Number>
|
|
33
|
+
[inbound_base_discount_mtokens]: <Inbound Fee Millitokens Reduction String>
|
|
34
|
+
[inbound_rate_discount]: <Source Millitokens Per Million Discount Number>
|
|
32
35
|
lnd: <Authenticated LND API Object>
|
|
33
36
|
[max_htlc_mtokens]: <Maximum HTLC Millitokens to Forward String>
|
|
34
37
|
[min_htlc_mtokens]: <Minimum HTLC Millitokens to Forward String>
|
|
@@ -105,6 +108,8 @@ module.exports = (args, cbk) => {
|
|
|
105
108
|
chan_point: !isGlobal ? chan : undefined,
|
|
106
109
|
fee_rate: rate / feeRatio,
|
|
107
110
|
global: isGlobal || undefined,
|
|
111
|
+
inbound_base_fee_msat: surcharge(args.inbound_base_discount_mtokens),
|
|
112
|
+
inbound_fee_rate_ppm: surcharge(args.inbound_rate_discount),
|
|
108
113
|
max_htlc_msat: args.max_htlc_mtokens || undefined,
|
|
109
114
|
min_htlc_msat: args.min_htlc_mtokens || undefined,
|
|
110
115
|
min_htlc_msat_specified: !!args.min_htlc_mtokens,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthenticatedLightningArgs,
|
|
3
|
+
AuthenticatedLightningMethod,
|
|
4
|
+
} from '../../typescript';
|
|
5
|
+
|
|
6
|
+
export type GetPendingSweepsArgs = AuthenticatedLightningArgs;
|
|
7
|
+
|
|
8
|
+
export interface Sweep {
|
|
9
|
+
/** Total Sweep Broadcast Attempts Count Number */
|
|
10
|
+
broadcasts_count: number;
|
|
11
|
+
/** Current Chain Fee Rate Tokens Per VByte Number */
|
|
12
|
+
current_fee_rate?: number;
|
|
13
|
+
/** Requested Chain Fee Rate Tokens per VByte Number */
|
|
14
|
+
initial_fee_rate?: number;
|
|
15
|
+
/** Requested Waiting For Batching Bool */
|
|
16
|
+
is_batching: boolean;
|
|
17
|
+
/** Maximum Total Fee Tokens Allowed Number */
|
|
18
|
+
max_fee?: number;
|
|
19
|
+
/** Targeted Maximum Confirmation Height Number */
|
|
20
|
+
max_height?: number;
|
|
21
|
+
/** Sweep Outpoint Tokens Value Number */
|
|
22
|
+
tokens: number;
|
|
23
|
+
/** Sweeping Outpoint Transaction Id Hex String */
|
|
24
|
+
transaction_id: string;
|
|
25
|
+
/** Sweeping Outpoint Transaction Output Index Number */
|
|
26
|
+
transaction_vout: number;
|
|
27
|
+
/** Outpoint Constraint Script Type String */
|
|
28
|
+
type: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface GetPendingSweepsResult {
|
|
32
|
+
sweeps: Sweep[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Get pending self-transfer spends
|
|
37
|
+
*
|
|
38
|
+
* Requires `onchain:read` permission
|
|
39
|
+
*
|
|
40
|
+
* Requires LND built with `walletrpc` build tag
|
|
41
|
+
*
|
|
42
|
+
* This method is not supported in LND 0.17.5 or below
|
|
43
|
+
*/
|
|
44
|
+
export const getPendingSweeps: AuthenticatedLightningMethod<
|
|
45
|
+
GetPendingSweepsArgs,
|
|
46
|
+
GetPendingSweepsResult
|
|
47
|
+
>;
|
|
@@ -15,6 +15,7 @@ export * from './get_chain_transactions';
|
|
|
15
15
|
export * from './get_locked_utxos';
|
|
16
16
|
export * from './get_master_public_keys';
|
|
17
17
|
export * from './get_pending_chain_balance';
|
|
18
|
+
export * from './get_pending_sweeps';
|
|
18
19
|
export * from './get_sweep_transactions';
|
|
19
20
|
export * from './get_utxos';
|
|
20
21
|
export * from './lock_utxo';
|
|
@@ -23,6 +24,7 @@ export * from './open_channels';
|
|
|
23
24
|
export * from './partially_sign_psbt';
|
|
24
25
|
export * from './prepare_for_channel_proposal';
|
|
25
26
|
export * from './propose_channel';
|
|
27
|
+
export * from './request_batched_fee_increase';
|
|
26
28
|
export * from './request_chain_fee_increase';
|
|
27
29
|
export * from './send_to_chain_address';
|
|
28
30
|
export * from './send_to_chain_addresses';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AuthenticatedLightningArgs,
|
|
3
|
+
AuthenticatedLightningMethod,
|
|
4
|
+
} from '../../typescript';
|
|
5
|
+
|
|
6
|
+
export type RequestBatchedFeeIncreaseArgs = AuthenticatedLightningArgs<{
|
|
7
|
+
/** Maximum Tokens to Pay Into Chain Fees Number */
|
|
8
|
+
max_fee?: number;
|
|
9
|
+
/** Maximum Height To Reach a Confirmation Number */
|
|
10
|
+
max_height?: number;
|
|
11
|
+
/** Unconfirmed UTXO Transaction Id Hex String */
|
|
12
|
+
transaction_id: string;
|
|
13
|
+
/** Unconfirmed UTXO Transaction Index Number */
|
|
14
|
+
transaction_vout: number;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Request batched CPFP fee bumping of an unconfirmed outpoint on a deadline
|
|
19
|
+
*
|
|
20
|
+
* Requires `onchain:write` permission
|
|
21
|
+
*
|
|
22
|
+
* Requires LND built with `walletrpc` build tag
|
|
23
|
+
*
|
|
24
|
+
* This method is unsupported on LND 0.17.5 and below
|
|
25
|
+
*/
|
|
26
|
+
export const requestBatchedFeeIncrease: AuthenticatedLightningMethod<RequestBatchedFeeIncreaseArgs>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const asDate = epochTime => new Date(epochTime * 1e3).toISOString();
|
|
2
|
+
const discount = fee => (!fee ? 0 : -fee).toString();
|
|
3
|
+
const inverse = rate => !rate ? 0 : -rate;
|
|
2
4
|
|
|
3
5
|
/** Convert raw channel policy to standard channel policy
|
|
4
6
|
|
|
@@ -7,6 +9,8 @@ const asDate = epochTime => new Date(epochTime * 1e3).toISOString();
|
|
|
7
9
|
disabled: <Forwarding is Disabled Bool>
|
|
8
10
|
fee_base_msat: <Base Fee Tokens String>
|
|
9
11
|
fee_rate_milli_msat: <Fee Rate Number String>
|
|
12
|
+
inbound_fee_base_msat: <Inbound Fee Base Number>
|
|
13
|
+
inbound_fee_rate_milli_msat: <Inbound Fee Rate Number>
|
|
10
14
|
last_update: <Last Update Epoch Time Seconds Number>
|
|
11
15
|
max_htlc_msat: <Maximum HTLC Millitokens String>
|
|
12
16
|
min_htlc: <Minimum HTLC Millitokens String>
|
|
@@ -23,6 +27,8 @@ const asDate = epochTime => new Date(epochTime * 1e3).toISOString();
|
|
|
23
27
|
base_fee_mtokens: <Base Fee Millitokens String>
|
|
24
28
|
cltv_delta: <Forward CLTV Delta Number>
|
|
25
29
|
fee_rate: <Fee Rate in Parts Per Millitoken Number>
|
|
30
|
+
inbound_base_discount_mtokens: <Source Specific Base Fee Reduction String>
|
|
31
|
+
inbound_rate_discount: <Source Specific Per Million Rate Reduction Number>
|
|
26
32
|
is_disabled: <Forwarding Is Disabled Bool>
|
|
27
33
|
max_htlc_mtokens: <Maximum Forward Millitokens String>
|
|
28
34
|
min_htlc_mtokens: <Minimum Forward Millitokens String>
|
|
@@ -72,6 +78,8 @@ module.exports = args => {
|
|
|
72
78
|
base_fee_mtokens: args.policy.fee_base_msat,
|
|
73
79
|
cltv_delta: args.policy.time_lock_delta,
|
|
74
80
|
fee_rate: Number(args.policy.fee_rate_milli_msat),
|
|
81
|
+
inbound_base_discount_mtokens: discount(args.policy.inbound_fee_base_msat),
|
|
82
|
+
inbound_rate_discount: inverse(args.policy.inbound_fee_rate_milli_msat),
|
|
75
83
|
is_disabled: args.policy.disabled,
|
|
76
84
|
max_htlc_mtokens: args.policy.max_htlc_msat,
|
|
77
85
|
min_htlc_mtokens: args.policy.min_htlc,
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@grpc/grpc-js": "1.10.7",
|
|
11
11
|
"@grpc/proto-loader": "0.7.13",
|
|
12
|
-
"@types/node": "20.12.
|
|
12
|
+
"@types/node": "20.12.11",
|
|
13
13
|
"@types/request": "2.48.12",
|
|
14
14
|
"@types/ws": "8.5.10",
|
|
15
15
|
"async": "3.2.5",
|
|
@@ -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.18.
|
|
25
|
+
"type-fest": "4.18.2"
|
|
26
26
|
},
|
|
27
27
|
"description": "Lightning Network client library",
|
|
28
28
|
"devDependencies": {
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"directory": "test/typescript"
|
|
54
54
|
},
|
|
55
55
|
"types": "index.d.ts",
|
|
56
|
-
"version": "10.
|
|
56
|
+
"version": "10.11.1"
|
|
57
57
|
}
|
|
@@ -128,6 +128,8 @@ const tests = [
|
|
|
128
128
|
base_fee_mtokens: '1',
|
|
129
129
|
cltv_delta: 1,
|
|
130
130
|
fee_rate: 1,
|
|
131
|
+
inbound_base_discount_mtokens: '0',
|
|
132
|
+
inbound_rate_discount: 0,
|
|
131
133
|
is_disabled: true,
|
|
132
134
|
max_htlc_mtokens: '1',
|
|
133
135
|
min_htlc_mtokens: '1',
|
|
@@ -138,6 +140,8 @@ const tests = [
|
|
|
138
140
|
base_fee_mtokens: '2',
|
|
139
141
|
cltv_delta: 2,
|
|
140
142
|
fee_rate: 2,
|
|
143
|
+
inbound_base_discount_mtokens: '0',
|
|
144
|
+
inbound_rate_discount: 0,
|
|
141
145
|
is_disabled: false,
|
|
142
146
|
max_htlc_mtokens: '2',
|
|
143
147
|
min_htlc_mtokens: '2',
|
|
@@ -117,6 +117,8 @@ const tests = [
|
|
|
117
117
|
base_fee_mtokens: '1000',
|
|
118
118
|
cltv_delta: 1,
|
|
119
119
|
fee_rate: 1,
|
|
120
|
+
inbound_base_discount_mtokens: '0',
|
|
121
|
+
inbound_rate_discount: 0,
|
|
120
122
|
is_disabled: false,
|
|
121
123
|
max_htlc_mtokens: '1000',
|
|
122
124
|
min_htlc_mtokens: '1000',
|
|
@@ -127,6 +129,8 @@ const tests = [
|
|
|
127
129
|
base_fee_mtokens: '2',
|
|
128
130
|
cltv_delta: 2,
|
|
129
131
|
fee_rate: 2,
|
|
132
|
+
inbound_base_discount_mtokens: '0',
|
|
133
|
+
inbound_rate_discount: 0,
|
|
130
134
|
is_disabled: true,
|
|
131
135
|
max_htlc_mtokens: '2',
|
|
132
136
|
min_htlc_mtokens: '2',
|
|
@@ -98,6 +98,8 @@ const makeExpected = ({}) => {
|
|
|
98
98
|
base_fee_mtokens: '1',
|
|
99
99
|
cltv_delta: 1,
|
|
100
100
|
fee_rate: 1,
|
|
101
|
+
inbound_base_discount_mtokens: '0',
|
|
102
|
+
inbound_rate_discount: 0,
|
|
101
103
|
is_disabled: true,
|
|
102
104
|
max_htlc_mtokens: '1',
|
|
103
105
|
min_htlc_mtokens: '1',
|
|
@@ -108,6 +110,8 @@ const makeExpected = ({}) => {
|
|
|
108
110
|
base_fee_mtokens: '2',
|
|
109
111
|
cltv_delta: 2,
|
|
110
112
|
fee_rate: 2,
|
|
113
|
+
inbound_base_discount_mtokens: '0',
|
|
114
|
+
inbound_rate_discount: 0,
|
|
111
115
|
is_disabled: false,
|
|
112
116
|
max_htlc_mtokens: '2',
|
|
113
117
|
min_htlc_mtokens: '2',
|
|
@@ -60,6 +60,8 @@ const tests = [
|
|
|
60
60
|
base_fee_mtokens: '1',
|
|
61
61
|
cltv_delta: 1,
|
|
62
62
|
fee_rate: 1,
|
|
63
|
+
inbound_base_discount_mtokens: '0',
|
|
64
|
+
inbound_rate_discount: 0,
|
|
63
65
|
is_disabled: true,
|
|
64
66
|
max_htlc_mtokens: '1',
|
|
65
67
|
min_htlc_mtokens: '1',
|
|
@@ -70,6 +72,8 @@ const tests = [
|
|
|
70
72
|
base_fee_mtokens: '2',
|
|
71
73
|
cltv_delta: 2,
|
|
72
74
|
fee_rate: 2,
|
|
75
|
+
inbound_base_discount_mtokens: '0',
|
|
76
|
+
inbound_rate_discount: 0,
|
|
73
77
|
is_disabled: false,
|
|
74
78
|
max_htlc_mtokens: '2',
|
|
75
79
|
min_htlc_mtokens: '2',
|
|
@@ -4,6 +4,25 @@ const {throws} = require('node:assert').strict;
|
|
|
4
4
|
|
|
5
5
|
const chanPolicyAsPolicy = require('./../../lnd_responses/channel_policy_as_policy');
|
|
6
6
|
|
|
7
|
+
const makeExpected = overrides => {
|
|
8
|
+
const expected = {
|
|
9
|
+
base_fee_mtokens: '1',
|
|
10
|
+
cltv_delta: 1,
|
|
11
|
+
fee_rate: 1,
|
|
12
|
+
inbound_base_discount_mtokens: '0',
|
|
13
|
+
inbound_rate_discount: 0,
|
|
14
|
+
is_disabled: false,
|
|
15
|
+
max_htlc_mtokens: '1',
|
|
16
|
+
min_htlc_mtokens: '1',
|
|
17
|
+
public_key: '00',
|
|
18
|
+
updated_at: new Date(1000).toISOString(),
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
Object.keys(overrides || {}).forEach(key => expected[key] = overrides[key]);
|
|
22
|
+
|
|
23
|
+
return expected;
|
|
24
|
+
};
|
|
25
|
+
|
|
7
26
|
const tests = [
|
|
8
27
|
{
|
|
9
28
|
args: {},
|
|
@@ -94,16 +113,28 @@ const tests = [
|
|
|
94
113
|
},
|
|
95
114
|
},
|
|
96
115
|
description: 'Policy mapped',
|
|
97
|
-
expected: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
is_disabled: false,
|
|
102
|
-
max_htlc_mtokens: '1',
|
|
103
|
-
min_htlc_mtokens: '1',
|
|
116
|
+
expected: makeExpected({}),
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
args: {
|
|
104
120
|
public_key: '00',
|
|
105
|
-
|
|
121
|
+
policy: {
|
|
122
|
+
disabled: false,
|
|
123
|
+
fee_base_msat: '1',
|
|
124
|
+
fee_rate_milli_msat: '1',
|
|
125
|
+
inbound_fee_base_msat: -1,
|
|
126
|
+
inbound_fee_rate_milli_msat: -1,
|
|
127
|
+
last_update: 1,
|
|
128
|
+
max_htlc_msat: '1',
|
|
129
|
+
min_htlc: '1',
|
|
130
|
+
time_lock_delta: 1,
|
|
131
|
+
},
|
|
106
132
|
},
|
|
133
|
+
description: 'Policy mapped',
|
|
134
|
+
expected: makeExpected({
|
|
135
|
+
inbound_base_discount_mtokens: '1',
|
|
136
|
+
inbound_rate_discount: 1,
|
|
137
|
+
}),
|
|
107
138
|
},
|
|
108
139
|
];
|
|
109
140
|
|
|
@@ -75,6 +75,8 @@ const makeExpected = overrides => {
|
|
|
75
75
|
base_fee_mtokens: '1',
|
|
76
76
|
cltv_delta: 1,
|
|
77
77
|
fee_rate: 1,
|
|
78
|
+
inbound_base_discount_mtokens: '0',
|
|
79
|
+
inbound_rate_discount: 0,
|
|
78
80
|
is_disabled: true,
|
|
79
81
|
max_htlc_mtokens: '1',
|
|
80
82
|
min_htlc_mtokens: '1',
|
|
@@ -85,6 +87,8 @@ const makeExpected = overrides => {
|
|
|
85
87
|
base_fee_mtokens: '2',
|
|
86
88
|
cltv_delta: 2,
|
|
87
89
|
fee_rate: 2,
|
|
90
|
+
inbound_base_discount_mtokens: '0',
|
|
91
|
+
inbound_rate_discount: 0,
|
|
88
92
|
is_disabled: false,
|
|
89
93
|
max_htlc_mtokens: '2',
|
|
90
94
|
min_htlc_mtokens: '2',
|
package/typescript/shared.d.ts
CHANGED
|
@@ -19,13 +19,13 @@ export type LightningError<TError = {err: Error}> = TError extends undefined
|
|
|
19
19
|
|
|
20
20
|
export type LightningCallback<TResult = void, TErrorDetails = any> = (
|
|
21
21
|
error: LightningError<TErrorDetails> | undefined | null,
|
|
22
|
-
result: TResult extends void ? undefined : TResult
|
|
22
|
+
result: TResult extends void ? undefined : TResult,
|
|
23
23
|
) => void;
|
|
24
24
|
|
|
25
25
|
export type LightningMethod<
|
|
26
26
|
TArgs = EmptyObject,
|
|
27
27
|
TResult = void,
|
|
28
|
-
TErrorDetails = any
|
|
28
|
+
TErrorDetails = any,
|
|
29
29
|
> = {
|
|
30
30
|
(args: TArgs): Promise<TResult>;
|
|
31
31
|
(args: TArgs, callback: LightningCallback<TResult, TErrorDetails>): void;
|
|
@@ -34,21 +34,21 @@ export type LightningMethod<
|
|
|
34
34
|
export type AuthenticatedLightningMethod<
|
|
35
35
|
TArgs extends {lnd: AuthenticatedLnd} = {lnd: AuthenticatedLnd},
|
|
36
36
|
TResult = void,
|
|
37
|
-
TErrorDetails = any
|
|
37
|
+
TErrorDetails = any,
|
|
38
38
|
> = LightningMethod<TArgs, TResult, TErrorDetails>;
|
|
39
39
|
|
|
40
40
|
export type UnauthenticatedLightningMethod<
|
|
41
41
|
TArgs extends {lnd: UnauthenticatedLnd} = {lnd: UnauthenticatedLnd},
|
|
42
42
|
TResult = void,
|
|
43
|
-
TErrorDetails = any
|
|
43
|
+
TErrorDetails = any,
|
|
44
44
|
> = LightningMethod<TArgs, TResult, TErrorDetails>;
|
|
45
45
|
|
|
46
46
|
export type AuthenticatedLightningSubscription<
|
|
47
|
-
TArgs extends {lnd: AuthenticatedLnd} = {lnd: AuthenticatedLnd}
|
|
47
|
+
TArgs extends {lnd: AuthenticatedLnd} = {lnd: AuthenticatedLnd},
|
|
48
48
|
> = (args: TArgs) => events.EventEmitter;
|
|
49
49
|
|
|
50
50
|
export type UnauthenticatedLightningSubscription<
|
|
51
|
-
TArgs extends {lnd: UnauthenticatedLnd} = {lnd: UnauthenticatedLnd}
|
|
51
|
+
TArgs extends {lnd: UnauthenticatedLnd} = {lnd: UnauthenticatedLnd},
|
|
52
52
|
> = (args: TArgs) => events.EventEmitter;
|
|
53
53
|
|
|
54
54
|
type CommonStatus = 'IN_FLIGHT' | 'SUCCEEDED' | 'FAILED';
|
|
@@ -113,10 +113,41 @@ export type RouteNode = {
|
|
|
113
113
|
fee_rate?: number;
|
|
114
114
|
/** Forward Edge Public Key Hex */
|
|
115
115
|
public_key: string;
|
|
116
|
-
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type Route = RouteNode[];
|
|
117
119
|
|
|
118
|
-
export type
|
|
120
|
+
export type Routes = Route[];
|
|
119
121
|
|
|
120
|
-
export type
|
|
122
|
+
export type UtxoSelection = 'largest' | 'random';
|
|
121
123
|
|
|
122
|
-
export
|
|
124
|
+
export interface ChannelPolicy {
|
|
125
|
+
/** Base Fee Millitokens */
|
|
126
|
+
base_fee_mtokens?: string;
|
|
127
|
+
/** Locktime Delta */
|
|
128
|
+
cltv_delta?: number;
|
|
129
|
+
/** Fees Charged Per Million Millitokens */
|
|
130
|
+
fee_rate?: number;
|
|
131
|
+
/**
|
|
132
|
+
* Source Based Base Fee Reduction String
|
|
133
|
+
*
|
|
134
|
+
* Not supported on LND 0.17.5 and below
|
|
135
|
+
*/
|
|
136
|
+
inbound_base_discount_mtokens?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Source Based Per Million Rate Reduction Number
|
|
139
|
+
*
|
|
140
|
+
* Not supported on LND 0.17.5 and below
|
|
141
|
+
*/
|
|
142
|
+
inbound_rate_discount?: number;
|
|
143
|
+
/** Channel Is Disabled */
|
|
144
|
+
is_disabled?: boolean;
|
|
145
|
+
/** Maximum HTLC Millitokens Value */
|
|
146
|
+
max_htlc_mtokens?: string;
|
|
147
|
+
/** Minimum HTLC Millitokens Value */
|
|
148
|
+
min_htlc_mtokens?: string;
|
|
149
|
+
/** Node Public Key */
|
|
150
|
+
public_key: string;
|
|
151
|
+
/** Policy Last Updated At ISO 8601 Date */
|
|
152
|
+
updated_at?: string;
|
|
153
|
+
}
|