lightning 5.0.0 → 5.0.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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Versions
2
2
 
3
+ ## 5.0.1
4
+
5
+ - `createChainAddress`: Fix type hints to reflect optionality of `format`
6
+
3
7
  ## 5.0.0
4
8
 
5
9
  - Removed support for determining the type of channel to support LND 0.14.0.
@@ -5,14 +5,14 @@ import {
5
5
 
6
6
  export type CreateChainAddressArgs = AuthenticatedLightningArgs<{
7
7
  /** Receive Address Type */
8
- format: 'np2wpkh' | 'p2wpkh';
8
+ format?: 'np2wpkh' | 'p2wpkh';
9
9
  /** Get As-Yet Unused Address */
10
10
  is_unused?: boolean;
11
11
  }>;
12
12
 
13
13
  export type CreateChainAddressResult = {
14
14
  /** Chain Address */
15
- address?: string;
15
+ address: string;
16
16
  };
17
17
 
18
18
  /**
@@ -2,9 +2,9 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningMethod,
4
4
  } from '../../typescript';
5
- import {Xor} from '../../typescript/util';
5
+ import {MergeExclusive} from 'type-fest';
6
6
 
7
- type Tokens = Xor<
7
+ type Tokens = MergeExclusive<
8
8
  {
9
9
  /** Millitokens to Send */
10
10
  mtokens?: string;
@@ -2,75 +2,83 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningSubscription,
4
4
  } from '../../typescript';
5
+ import {MergeExclusive} from 'type-fest';
5
6
 
6
- type SubscribeToPayWithDestination = {
7
+ export type SubscribeToPayWithDestinationArgs = {
7
8
  /** Destination Public Key String> */
8
9
  destination: string;
9
10
  /** Payment Request Hash Hex String> */
10
11
  id: string;
11
12
  /** Final CLTV Delta Number> */
12
13
  cltv_delta?: number;
13
- request?: never;
14
14
  };
15
15
 
16
- type SubscribeToPayWithRequest = {
16
+ export type SubscribeToPayWithRequestArgs = {
17
17
  /** BOLT 11 Payment Request String> */
18
18
  request: string;
19
- cltv_delta?: never;
19
+ };
20
+
21
+ export type SubscribeToPayWithDestinationOrRequestArgs = MergeExclusive<
22
+ SubscribeToPayWithDestinationArgs,
23
+ SubscribeToPayWithRequestArgs
24
+ >;
25
+
26
+ export type SubscribeToPayOptionsArgs = {
27
+ features?: {
28
+ /** Feature Bit Number> */
29
+ bit: number;
30
+ }[];
31
+ /** Pay Through Specific Final Hop Public Key Hex String> */
32
+ incoming_peer?: string;
33
+ /** Maximum Fee Tokens To Pay Number> */
34
+ max_fee?: number;
35
+ /** Maximum Fee Millitokens to Pay String> */
36
+ max_fee_mtokens?: string;
37
+ /** Maximum Millitokens For A Multi-Path Path */
38
+ max_path_mtokens?: string;
39
+ /** Maximum Simultaneous Paths Number> */
40
+ max_paths?: number;
41
+ /** Maximum Height of Payment Timeout Number> */
42
+ max_timeout_height?: number;
43
+ messages?: {
44
+ /** Message Type Number String> */
45
+ type: string;
46
+ /** Message Raw Value Hex Encoded String> */
47
+ value: string;
48
+ }[];
49
+ /** Millitokens to Pay String> */
50
+ mtokens?: string;
51
+ /** Pay Out of Outgoing Channel Id String> */
52
+ outgoing_channel?: string;
53
+ /** Pay Out of Outgoing Channel Ids String> */
54
+ outgoing_channels?: string[];
55
+ /** Time to Spend Finding a Route Milliseconds Number> */
56
+ pathfinding_timeout?: number;
57
+ /** Payment Identifier Hex String> */
58
+ payment?: string;
59
+ routes?: {
60
+ /** Base Routing Fee In Millitokens String> */
61
+ base_fee_mtokens?: string;
62
+ /** Standard Format Channel Id String> */
63
+ channel?: string;
64
+ /** CLTV Blocks Delta Number> */
65
+ cltv_delta?: number;
66
+ /** Fee Rate In Millitokens Per Million Number> */
67
+ fee_rate?: number;
68
+ /** Forward Edge Public Key Hex String> */
69
+ public_key: string;
70
+ }[][];
71
+ /** Tokens to Pay Number> */
72
+ tokens?: number;
20
73
  };
21
74
 
22
75
  export type SubscribeToPayArgs = AuthenticatedLightningArgs<
23
- (SubscribeToPayWithDestination | SubscribeToPayWithRequest) & {
24
- features?: {
25
- /** Feature Bit Number> */
26
- bit: number;
27
- }[];
28
- /** Pay Through Specific Final Hop Public Key Hex String> */
29
- incoming_peer?: string;
30
- /** Maximum Fee Tokens To Pay Number> */
31
- max_fee?: number;
32
- /** Maximum Fee Millitokens to Pay String> */
33
- max_fee_mtokens?: string;
34
- /** Maximum Millitokens For A Multi-Path Path */
35
- max_path_mtokens?: string;
36
- /** Maximum Simultaneous Paths Number> */
37
- max_paths?: number;
38
- /** Maximum Height of Payment Timeout Number> */
39
- max_timeout_height?: number;
40
- messages?: {
41
- /** Message Type Number String> */
42
- type: string;
43
- /** Message Raw Value Hex Encoded String> */
44
- value: string;
45
- }[];
46
- /** Millitokens to Pay String> */
47
- mtokens?: string;
48
- /** Pay Out of Outgoing Channel Id String> */
49
- outgoing_channel?: string;
50
- /** Pay Out of Outgoing Channel Ids String> */
51
- outgoing_channels?: string[];
52
- /** Time to Spend Finding a Route Milliseconds Number> */
53
- pathfinding_timeout?: number;
54
- /** Payment Identifier Hex String> */
55
- payment?: string;
56
- routes?: {
57
- /** Base Routing Fee In Millitokens String> */
58
- base_fee_mtokens?: string;
59
- /** Standard Format Channel Id String> */
60
- channel?: string;
61
- /** CLTV Blocks Delta Number> */
62
- cltv_delta?: number;
63
- /** Fee Rate In Millitokens Per Million Number> */
64
- fee_rate?: number;
65
- /** Forward Edge Public Key Hex String> */
66
- public_key: string;
67
- }[][];
68
- /** Tokens to Probe Number> */
69
- tokens?: number;
70
- }
76
+ SubscribeToPayWithDestinationOrRequestArgs & SubscribeToPayOptionsArgs
71
77
  >;
72
78
 
73
79
  export type SubscribeToPayConfirmedEvent = {
80
+ /** Payment Confirmed At ISO 8601 Date String */
81
+ confirmed_at: string;
74
82
  /** Total Fee Tokens Paid Rounded Down Number> */
75
83
  fee: number;
76
84
  /** Total Fee Millitokens Paid String> */
@@ -174,7 +182,103 @@ export type SubscribeToPayFailedEvent = {
174
182
  };
175
183
  };
176
184
 
177
- export type SubscribeToPayPayingEvent = {[key: string]: never};
185
+ export type SubscribeToPayPayingEvent = {
186
+ /** Payment Created At ISO 8601 Date String> */
187
+ created_at: string;
188
+ /** Payment Destination Hex String> */
189
+ destination: string;
190
+ /** Payment Hash Hex String> */
191
+ id: string;
192
+ /** Total Millitokens Pending String> */
193
+ mtokens: string;
194
+ paths: {
195
+ /** Total Fee Tokens Pending Number> */
196
+ fee: number;
197
+ /** Total Fee Millitokens Pending String> */
198
+ fee_mtokens: string;
199
+ hops: {
200
+ /** Standard Format Channel Id String> */
201
+ channel: string;
202
+ /** Channel Capacity Tokens Number> */
203
+ channel_capacity: number;
204
+ /** Fee Tokens Rounded Down Number> */
205
+ fee: number;
206
+ /** Fee Millitokens String> */
207
+ fee_mtokens: string;
208
+ /** Forward Tokens Number> */
209
+ forward: number;
210
+ /** Forward Millitokens String> */
211
+ forward_mtokens: string;
212
+ /** Public Key Hex String> */
213
+ public_key: string;
214
+ /** Timeout Block Height Number> */
215
+ timeout: number;
216
+ }[];
217
+ /** Total Millitokens Pending String> */
218
+ mtokens: string;
219
+ /** Total Fee Tokens Pending Rounded Up Number> */
220
+ safe_fee: number;
221
+ /** Total Tokens Pending, Rounded Up Number> */
222
+ safe_tokens: number;
223
+ /** Expiration Block Height Number> */
224
+ timeout: number;
225
+ }[];
226
+ /** BOLT 11 Encoded Payment Request String> */
227
+ request?: string;
228
+ /** Total Tokens Pending, Rounded Up Number> */
229
+ safe_tokens: number;
230
+ /** Expiration Block Height Number> */
231
+ timeout?: number;
232
+ /** Total Tokens Pending Rounded Down Number> */
233
+ tokens: number;
234
+ };
235
+
236
+ export type SubscribeToRoutingFailureEvent = {
237
+ /** Standard Format Channel Id String> */
238
+ channel?: string;
239
+ /** Failure Index Number> */
240
+ index: number;
241
+ /** Millitokens String> */
242
+ mtokens?: string;
243
+ /** Public Key Hex String> */
244
+ public_key?: string;
245
+ /** Failure Reason String> */
246
+ reason: string;
247
+ route: {
248
+ /** Total Route Fee Tokens To Pay Number> */
249
+ fee: number;
250
+ /** Total Route Fee Millitokens To Pay String> */
251
+ fee_mtokens: string;
252
+ hops: {
253
+ /** Standard Format Channel Id String> */
254
+ channel: string;
255
+ /** Channel Capacity Tokens Number> */
256
+ channel_capacity: number;
257
+ /** Fee Number> */
258
+ fee: number;
259
+ /** Fee Millitokens String> */
260
+ fee_mtokens: string;
261
+ /** Forward Tokens Number> */
262
+ forward: number;
263
+ /** Forward Millitokens String> */
264
+ forward_mtokens: string;
265
+ /** Public Key Hex String> */
266
+ public_key: string;
267
+ /** Timeout Block Height Number> */
268
+ timeout: number;
269
+ }[];
270
+ /** Total Route Millitokens String> */
271
+ mtokens: string;
272
+ /** Payment Identifier Hex String> */
273
+ payment?: string;
274
+ /** Expiration Block Height Number> */
275
+ timeout: number;
276
+ /** Total Route Tokens Number> */
277
+ tokens: number;
278
+ /** Total Millitokens String> */
279
+ total_mtokens?: string;
280
+ };
281
+ };
178
282
 
179
283
  /**
180
284
  * Initiate and subscribe to the outcome of a payment
@@ -1,146 +1,34 @@
1
+ import {SetOptional} from 'type-fest';
1
2
  import {
2
3
  AuthenticatedLightningArgs,
3
4
  AuthenticatedLightningSubscription,
4
5
  } from '../../typescript';
6
+ import {
7
+ SubscribeToPayConfirmedEvent,
8
+ SubscribeToPayFailedEvent,
9
+ SubscribeToPayOptionsArgs,
10
+ SubscribeToPayPayingEvent,
11
+ SubscribeToPayWithDestinationArgs,
12
+ SubscribeToRoutingFailureEvent,
13
+ } from './subscribe_to_pay';
14
+
15
+ export type SubscribeToPayViaDetailsArgs = AuthenticatedLightningArgs<
16
+ SetOptional<SubscribeToPayWithDestinationArgs, 'id'> &
17
+ SubscribeToPayOptionsArgs
18
+ >;
5
19
 
6
- export type SubscribeToPayViaDetailsArgs = AuthenticatedLightningArgs<{
7
- /** Final CLTV Delta */
8
- cltv_delta?: number;
9
- /** Destination Public Key */
10
- destination: string;
11
- features?: {
12
- /** Feature Bit */
13
- bit: number;
14
- }[];
15
- /** Payment Request Hash Hex */
16
- id?: string;
17
- /** Pay Through Specific Final Hop Public Key Hex */
18
- incoming_peer?: string;
19
- /** Maximum Fee Tokens To Pay */
20
- max_fee?: number;
21
- /** Maximum Fee Millitokens to Pay */
22
- max_fee_mtokens?: string;
23
- /** Maximum Millitokens For A Multi-Path Path */
24
- max_path_mtokens?: string;
25
- /** Maximum Simultaneous Paths */
26
- max_paths?: number;
27
- /** Maximum Height of Payment Timeout */
28
- max_timeout_height?: number;
29
- messages?: {
30
- /** Message Type number */
31
- type: string;
32
- /** Message Raw Value Hex Encoded */
33
- value: string;
34
- }[];
35
- /** Millitokens to Pay */
36
- mtokens?: string;
37
- /** Pay Out of Outgoing Channel Id */
38
- outgoing_channel?: string;
39
- /** Pay Out of Outgoing Channel Ids */
40
- outgoing_channels?: string[];
41
- /** Time to Spend Finding a Route Milliseconds */
42
- pathfinding_timeout?: number;
43
- /** Payment Identifier Hex String */
44
- payment?: string;
45
- routes?: [
46
- {
47
- /** Base Routing Fee In Millitokens */
48
- base_fee_mtokens?: string;
49
- /** Standard Format Channel Id */
50
- channel?: string;
51
- /** CLTV Blocks Delta */
52
- cltv_delta?: number;
53
- /** Fee Rate In Millitokens Per Million */
54
- fee_rate?: number;
55
- /** Forward Edge Public Key Hex */
56
- public_key: string;
57
- }[]
58
- ];
59
- /** Tokens to Pay */
60
- tokens?: number;
61
- }>;
20
+ export type SubscribeToPayViaDetailsConfirmedEvent =
21
+ SubscribeToPayConfirmedEvent;
62
22
 
63
- export type SubscribeToPayViaDetailsConfirmedEvent = {
64
- /** Confirmed at ISO-8601 Date */
65
- confirmed_at: string;
66
- /** Fee Tokens Paid */
67
- fee: number;
68
- /** Total Fee Millitokens Paid */
69
- fee_mtokens: string;
70
- hops: {
71
- /** Standard Format Channel Id */
72
- channel: string;
73
- /** Channel Capacity Tokens */
74
- channel_capacity: number;
75
- /** Fee Millitokens */
76
- fee_mtokens: string;
77
- /** Forward Millitokens */
78
- forward_mtokens: string;
79
- /** Public Key Hex */
80
- public_key: string;
81
- /** Timeout Block Height */
82
- timeout: number;
83
- }[];
84
- /** Payment Hash Hex */
85
- id?: string;
86
- /** Total Millitokens To Pay */
87
- mtokens: string;
88
- /** Payment Forwarding Fee Rounded Up Tokens */
89
- safe_fee: number;
90
- /** Payment Tokens Rounded Up */
91
- safe_tokens: number;
92
- /** Payment Preimage Hex */
93
- secret: string;
94
- /** Total Tokens Paid Rounded Down */
95
- tokens: number;
96
- };
23
+ export type SubscribeToPayViaDetailsFailedEvent = SubscribeToPayFailedEvent;
97
24
 
98
- export type SubscribeToPayViaDetailsFailedEvent = {
99
- /** Failed Due To Lack of Balance */
100
- is_insufficient_balance: boolean;
101
- /** Failed Due to Invalid Payment */
102
- is_invalid_payment: boolean;
103
- /** Failed Due to Pathfinding Timeout */
104
- is_pathfinding_timeout: boolean;
105
- /** Failed Due to Route Not Found */
106
- is_route_not_found: boolean;
107
- route?: {
108
- /** Route Total Fee Tokens Rounded Down */
109
- fee: number;
110
- /** Route Total Fee Millitokens */
111
- fee_mtokens: string;
112
- hops: {
113
- /** Standard Format Channel Id */
114
- channel: string;
115
- /** Channel Capacity Tokens */
116
- channel_capacity: number;
117
- /** Hop Forwarding Fee Rounded Down Tokens */
118
- fee: number;
119
- /** Hop Forwarding Fee Millitokens */
120
- fee_mtokens: string;
121
- /** Hop Forwarding Tokens Rounded Down */
122
- forward: number;
123
- /** Hop Forwarding Millitokens */
124
- forward_mtokens: string;
125
- /** Hop Sending To Public Key Hex */
126
- public_key: string;
127
- /** Hop CTLV Expiration Height */
128
- timeout: number;
129
- }[];
130
- /** Payment Sending Millitokens */
131
- mtokens: string;
132
- /** Payment Forwarding Fee Rounded Up Tokens */
133
- safe_fee: number;
134
- /** Payment Sending Tokens Rounded Up */
135
- safe_tokens: number;
136
- /** Payment CLTV Expiration Height */
137
- timeout: number;
138
- /** Payment Sending Tokens Rounded Down */
139
- tokens: number;
140
- };
141
- };
25
+ export type SubscribeToPayViaDetailsPayingEvent = Omit<
26
+ SubscribeToPayPayingEvent,
27
+ 'request'
28
+ >;
142
29
 
143
- export type SubscribeToPayViaDetailsPayingEvent = {[key: string]: never};
30
+ export type SubscribeToPayViaDetailsRoutingFailure =
31
+ SubscribeToRoutingFailureEvent;
144
32
 
145
33
  /**
146
34
  * Subscribe to the flight of a payment
@@ -2,123 +2,31 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningSubscription,
4
4
  } from '../../typescript';
5
+ import {
6
+ SubscribeToPayConfirmedEvent,
7
+ SubscribeToPayFailedEvent,
8
+ SubscribeToPayOptionsArgs,
9
+ SubscribeToPayPayingEvent,
10
+ SubscribeToPayWithRequestArgs,
11
+ SubscribeToRoutingFailureEvent,
12
+ } from './subscribe_to_pay';
13
+
14
+ export type SubscribeToPayViaRequestArgs = AuthenticatedLightningArgs<
15
+ SubscribeToPayWithRequestArgs &
16
+ Omit<SubscribeToPayOptionsArgs, 'omit' | 'routes'>
17
+ >;
5
18
 
6
- export type SubscribeToPayViaRequestArgs = AuthenticatedLightningArgs<{
7
- /** Pay Through Specific Final Hop Public Key Hex */
8
- incoming_peer?: string;
9
- /** Maximum Fee Tokens To Pay */
10
- max_fee?: number;
11
- /** Maximum Fee Millitokens to Pay */
12
- max_fee_mtokens?: string;
13
- /** Maximum Millitokens For A Multi-Path Path */
14
- max_path_mtokens?: string;
15
- /** Maximum Simultaneous Paths */
16
- max_paths?: number;
17
- /** Maximum Height of Payment Timeout */
18
- max_timeout_height?: number;
19
- messages?: {
20
- /** Message Type number */
21
- type: string;
22
- /** Message Raw Value Hex Encoded */
23
- value: string;
24
- }[];
25
- /** Millitokens to Pay */
26
- mtokens?: string;
27
- /** Pay Out of Outgoing Channel Id */
28
- outgoing_channel?: string;
29
- /** Pay Out of Outgoing Channel Ids */
30
- outgoing_channels?: string[];
31
- /** Time to Spend Finding a Route Milliseconds */
32
- pathfinding_timeout?: number;
33
- /** BOLT 11 Payment Request */
34
- request: string;
35
- /** Tokens To Pay */
36
- tokens?: number;
37
- }>;
19
+ export type SubscribeToPayViaRequestConfirmedEvent = Omit<
20
+ SubscribeToPayConfirmedEvent,
21
+ 'paths'
22
+ >;
38
23
 
39
- export type SubscribeToPayViaRequestConfirmedEvent = {
40
- /** Confirmed at ISO-8601 Date */
41
- confirmed_at: string;
42
- /** Fee Tokens */
43
- fee: number;
44
- /** Total Fee Millitokens To Pay */
45
- fee_mtokens: string;
46
- hops: {
47
- /** Standard Format Channel Id */
48
- channel: string;
49
- /** Channel Capacity Tokens */
50
- channel_capacity: number;
51
- /** Fee Millitokens */
52
- fee_mtokens: string;
53
- /** Forward Millitokens */
54
- forward_mtokens: string;
55
- /** Public Key Hex */
56
- public_key: string;
57
- /** Timeout Block Height */
58
- timeout: number;
59
- }[];
60
- /** Payment Hash Hex */
61
- id: string;
62
- /** Total Millitokens Paid */
63
- mtokens: string;
64
- /** Payment Forwarding Fee Rounded Up Tokens */
65
- safe_fee: number;
66
- /** Payment Tokens Rounded Up */
67
- safe_tokens: number;
68
- /** Payment Preimage Hex */
69
- secret: string;
70
- /** Expiration Block Height */
71
- timeout: number;
72
- /** Total Tokens Paid */
73
- tokens: number;
74
- };
24
+ export type SubscribeToPayViaRequestFailedEvent = SubscribeToPayFailedEvent;
75
25
 
76
- export type SubscribeToPayViaRequestFailedEvent = {
77
- /** Failed Due To Lack of Balance */
78
- is_insufficient_balance: boolean;
79
- /** Failed Due to Invalid Payment */
80
- is_invalid_payment: boolean;
81
- /** Failed Due to Pathfinding Timeout */
82
- is_pathfinding_timeout: boolean;
83
- /** Failed Due to Route Not Found */
84
- is_route_not_found: boolean;
85
- route?: {
86
- /** Route Total Fee Tokens Rounded Down */
87
- fee: number;
88
- /** Route Total Fee Millitokens */
89
- fee_mtokens: string;
90
- hops: {
91
- /** Standard Format Channel Id */
92
- channel: string;
93
- /** Channel Capacity Tokens */
94
- channel_capacity: number;
95
- /** Hop Forwarding Fee Rounded Down Tokens */
96
- fee: number;
97
- /** Hop Forwarding Fee Millitokens */
98
- fee_mtokens: string;
99
- /** Hop Forwarding Tokens Rounded Down */
100
- forward: number;
101
- /** Hop Forwarding Millitokens */
102
- forward_mtokens: string;
103
- /** Hop Sending To Public Key Hex */
104
- public_key: string;
105
- /** Hop CTLV Expiration Height */
106
- timeout: number;
107
- }[];
108
- /** Payment Sending Millitokens */
109
- mtokens: string;
110
- /** Payment Forwarding Fee Rounded Up Tokens */
111
- safe_fee: number;
112
- /** Payment Sending Tokens Rounded Up */
113
- safe_tokens: number;
114
- /** Payment CLTV Expiration Height */
115
- timeout: number;
116
- /** Payment Sending Tokens Rounded Down */
117
- tokens: number;
118
- };
119
- };
26
+ export type SubscribeToPayViaRequestPayingEvent = SubscribeToPayPayingEvent;
120
27
 
121
- export type SubscribeToPayViaRequestPayingEvent = {[key: string]: never};
28
+ export type SubscribeToPayViaRequestRoutingFailureEvent =
29
+ SubscribeToRoutingFailureEvent;
122
30
 
123
31
  /**
124
32
  * Initiate and subscribe to the outcome of a payment request
@@ -172,15 +172,15 @@ export type SubscribeToPayViaRoutesRoutingFailureEvent = {
172
172
  }[];
173
173
  /** Total Millitokens To Pay */
174
174
  mtokens: string;
175
+ /** Payment Forwarding Fee Rounded Up Tokens Number */
176
+ safe_fee: number;
177
+ /** Payment Tokens Rounded Up Number */
178
+ safe_tokens: number;
175
179
  /** Expiration Block Height */
176
180
  timeout: number;
177
181
  /** Total Tokens To Pay */
178
182
  tokens: number;
179
183
  };
180
- /** Payment Forwarding Fee Rounded Up Tokens */
181
- safe_fee: number;
182
- /** Payment Tokens Rounded Up */
183
- safe_tokens: number;
184
184
  /** Failure Related CLTV Timeout Height */
185
185
  timeout_height?: number;
186
186
  update?: {
@@ -198,8 +198,6 @@ export type SubscribeToPayViaRoutesRoutingFailureEvent = {
198
198
  };
199
199
 
200
200
  export type SubscribeToPayViaRoutesSuccessEvent = {
201
- /** Payment Sent At ISO 8601 Date */
202
- confirmed_at: string;
203
201
  /** Fee Paid Tokens */
204
202
  fee: number;
205
203
  /** Fee Paid Millitokens */
@@ -249,6 +247,10 @@ export type SubscribeToPayViaRoutesSuccessEvent = {
249
247
  }[];
250
248
  /** Total Millitokens To Pay */
251
249
  mtokens: string;
250
+ /** Payment Forwarding Fee Rounded Up Tokens Number */
251
+ safe_fee: number;
252
+ /** Payment Tokens Rounded Up Number */
253
+ safe_tokens: number;
252
254
  /** Expiration Block Height */
253
255
  timeout: number;
254
256
  /** Total Tokens To Pay */
@@ -2,13 +2,13 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningMethod,
4
4
  } from '../../typescript';
5
- import {Xor} from '../../typescript/util';
5
+ import {MergeExclusive} from 'type-fest';
6
6
 
7
7
  export type UpdateConnectedWatchtowerArgs = AuthenticatedLightningArgs<
8
8
  {
9
9
  /** Watchtower Public Key Hex String */
10
10
  public_key: string;
11
- } & Xor<
11
+ } & MergeExclusive<
12
12
  {
13
13
  /** Add Socket String */
14
14
  add_socket: string;
@@ -2,9 +2,9 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningMethod,
4
4
  } from '../../typescript';
5
- import {Xor} from '../../typescript/util';
5
+ import {MergeExclusive} from 'type-fest';
6
6
 
7
- type BaseFeeTokens = Xor<
7
+ type BaseFeeTokens = MergeExclusive<
8
8
  {
9
9
  /** Base Fee Millitokens Charged */
10
10
  base_fee_mtokens?: string;
@@ -2,9 +2,9 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningMethod,
4
4
  } from '../../typescript';
5
- import {Xor} from '../../typescript/util';
5
+ import {MergeExclusive} from 'type-fest';
6
6
 
7
- type ExpectedIdOfChannelToClose = Xor<
7
+ type ExpectedIdOfChannelToClose = MergeExclusive<
8
8
  {
9
9
  /** Standard Format Channel Id String */
10
10
  id: string;
@@ -17,7 +17,7 @@ type ExpectedIdOfChannelToClose = Xor<
17
17
  }
18
18
  >;
19
19
 
20
- type UnexpectedTokensPerVbyteForChannelClose = Xor<
20
+ type UnexpectedTokensPerVbyteForChannelClose = MergeExclusive<
21
21
  {
22
22
  /** Confirmation Target Number */
23
23
  target_confirmations?: number;
@@ -28,7 +28,7 @@ type UnexpectedTokensPerVbyteForChannelClose = Xor<
28
28
  }
29
29
  >;
30
30
 
31
- type ExpectedBothPublicKeyAndSocketForChannelClose = Xor<
31
+ type ExpectedBothPublicKeyAndSocketForChannelClose = MergeExclusive<
32
32
  {
33
33
  /** Peer Public Key String */
34
34
  public_key: string;
@@ -53,7 +53,10 @@ export type CoopCloseChannelArgs = AuthenticatedLightningArgs<
53
53
  UnexpectedTokensPerVbyteForChannelClose
54
54
  >;
55
55
 
56
- export type CloseChannelArgs = Xor<ForceCloseChannelArgs, CoopCloseChannelArgs>;
56
+ export type CloseChannelArgs = MergeExclusive<
57
+ ForceCloseChannelArgs,
58
+ CoopCloseChannelArgs
59
+ >;
57
60
 
58
61
  export type CloseChannelResult = {
59
62
  /** Closing Transaction Id Hex */
@@ -2,7 +2,7 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningMethod,
4
4
  } from '../../typescript';
5
- import {Xor} from '../../typescript/util';
5
+ import {MergeExclusive} from 'type-fest';
6
6
 
7
7
  export type FundPsbtArgs = AuthenticatedLightningArgs<
8
8
  {
@@ -20,7 +20,7 @@ export type FundPsbtArgs = AuthenticatedLightningArgs<
20
20
 
21
21
  /** Confirmations To Wait */
22
22
  target_confirmations?: number;
23
- } & Xor<
23
+ } & MergeExclusive<
24
24
  {
25
25
  /** Existing PSBT Hex */
26
26
  psbt: string;
@@ -2,7 +2,7 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningMethod,
4
4
  } from '../../typescript';
5
- import {Xor} from '../../typescript/util';
5
+ import {MergeExclusive} from 'type-fest';
6
6
 
7
7
  export type RequestChainFeeIncreaseArgs = AuthenticatedLightningArgs<
8
8
  {
@@ -10,7 +10,7 @@ export type RequestChainFeeIncreaseArgs = AuthenticatedLightningArgs<
10
10
  transaction_id: string;
11
11
  /** Unconfirmed UTXO Transaction Index Number */
12
12
  transaction_vout: number;
13
- } & Xor<
13
+ } & MergeExclusive<
14
14
  {
15
15
  /** Chain Fee Tokens Per Virtual Byte Number */
16
16
  fee_tokens_per_vbyte: number;
@@ -1,11 +1,11 @@
1
- import {Xor} from '../../typescript/util';
1
+ import {MergeExclusive} from 'type-fest';
2
2
 
3
- export type ScriptFromChainAddressArgs = Xor<
3
+ export type ScriptFromChainAddressArgs = MergeExclusive<
4
4
  {
5
5
  /** Address String */
6
6
  bech32_address: string;
7
7
  },
8
- Xor<
8
+ MergeExclusive<
9
9
  {
10
10
  /** Address String */
11
11
  p2pkh_address: string;
@@ -4,9 +4,9 @@ import {
4
4
  AuthenticatedLightningMethod,
5
5
  LightningError,
6
6
  } from '../../typescript';
7
- import {Xor} from '../../typescript/util';
7
+ import {MergeExclusive} from 'type-fest';
8
8
 
9
- type ExpectedNoTokensSpecifiedWhenSendingAllFunds = Xor<
9
+ type ExpectedNoTokensSpecifiedWhenSendingAllFunds = MergeExclusive<
10
10
  {
11
11
  /** Tokens To Send */
12
12
  tokens: number;
@@ -16,7 +16,7 @@ type ExpectedNoTokensSpecifiedWhenSendingAllFunds = Xor<
16
16
  is_send_all: true;
17
17
  }
18
18
  >;
19
- type ExpectedLogFunctionForChainSendSocketAnnounce = Xor<
19
+ type ExpectedLogFunctionForChainSendSocketAnnounce = MergeExclusive<
20
20
  {
21
21
  /** Web Socket Servers */
22
22
  wss: ws.Server[];
@@ -4,9 +4,9 @@ import {
4
4
  AuthenticatedLightningMethod,
5
5
  LightningError,
6
6
  } from '../../typescript';
7
- import {Xor} from '../../typescript/util';
7
+ import {MergeExclusive} from 'type-fest';
8
8
 
9
- type ExpectedLogForChainSendWebSocketAnnouncement = Xor<
9
+ type ExpectedLogForChainSendWebSocketAnnouncement = MergeExclusive<
10
10
  {
11
11
  /** Web Socket Servers */
12
12
  wss: ws.Server[];
@@ -2,7 +2,7 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningMethod,
4
4
  } from '../../typescript';
5
- import {Xor} from '../../typescript/util';
5
+ import {MergeExclusive} from 'type-fest';
6
6
 
7
7
  export type SendToChainOutputScriptsArgs = AuthenticatedLightningArgs<{
8
8
  /** Transaction Label String */
@@ -2,7 +2,7 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningMethod,
4
4
  } from '../../typescript';
5
- import {Xor} from '../../typescript/util';
5
+ import {MergeExclusive} from 'type-fest';
6
6
 
7
7
  export type CandidateNode = {
8
8
  /** Node Public Key Hex */
@@ -22,7 +22,10 @@ type ExpectedNodesOrEnabledSettingToAdjustAutopilot =
22
22
  };
23
23
 
24
24
  export type SetAutopilotArgs = AuthenticatedLightningArgs<
25
- Xor<ExpectedNodesOrEnabledSettingToAdjustAutopilot, {is_enabled: false}>
25
+ MergeExclusive<
26
+ ExpectedNodesOrEnabledSettingToAdjustAutopilot,
27
+ {is_enabled: false}
28
+ >
26
29
  >;
27
30
 
28
31
  /**
@@ -2,10 +2,10 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningSubscription,
4
4
  } from '../../typescript';
5
- import {Xor} from '../../typescript/util';
5
+ import {MergeExclusive} from 'type-fest';
6
6
  import {ScriptFromChainAddressArgs} from './script_from_chain_address';
7
7
 
8
- type ExpectedChainAddressToSubscribeForConfirmationEvents = Xor<
8
+ type ExpectedChainAddressToSubscribeForConfirmationEvents = MergeExclusive<
9
9
  {
10
10
  /** Output Script Hex */
11
11
  output_script: string;
@@ -2,10 +2,10 @@ import {
2
2
  AuthenticatedLightningArgs,
3
3
  AuthenticatedLightningSubscription,
4
4
  } from '../../typescript';
5
- import {Xor} from '../../typescript/util';
5
+ import {MergeExclusive} from 'type-fest';
6
6
  import {ScriptFromChainAddressArgs} from './script_from_chain_address';
7
7
 
8
- type ExpectOutputScriptOrAddress = Xor<
8
+ type ExpectOutputScriptOrAddress = MergeExclusive<
9
9
  {
10
10
  /** Output Script AKA ScriptPub Hex */
11
11
  output_script: string;
package/package.json CHANGED
@@ -23,7 +23,8 @@
23
23
  "cbor": "8.1.0",
24
24
  "express": "4.17.1",
25
25
  "invoices": "2.0.2",
26
- "psbt": "1.1.10"
26
+ "psbt": "1.1.10",
27
+ "type-fest": "2.6.0"
27
28
  },
28
29
  "description": "Lightning Network client library",
29
30
  "devDependencies": {
@@ -56,5 +57,5 @@
56
57
  "directory": "test/typescript"
57
58
  },
58
59
  "types": "index.d.ts",
59
- "version": "5.0.0"
60
+ "version": "5.0.1"
60
61
  }
@@ -8,9 +8,9 @@ const p2wpkh = 'p2wpkh';
8
8
 
9
9
  expectError(createChainAddress());
10
10
  expectError(createChainAddress({}));
11
- expectError(createChainAddress({}));
12
11
  expectError(createChainAddress({lnd, format: 'invalidFormat'}));
13
12
 
13
+ expectType<CreateChainAddressResult>(await createChainAddress({lnd}));
14
14
  expectType<CreateChainAddressResult>(
15
15
  await createChainAddress({lnd, format: np2wpkh})
16
16
  );
@@ -18,6 +18,11 @@ expectType<CreateChainAddressResult>(
18
18
  await createChainAddress({lnd, format: p2wpkh})
19
19
  );
20
20
 
21
+ expectType<void>(
22
+ createChainAddress({lnd}, (error, result) => {
23
+ expectType<CreateChainAddressResult>(result);
24
+ })
25
+ );
21
26
  expectType<void>(
22
27
  createChainAddress({lnd, format: np2wpkh}, (error, result) => {
23
28
  expectType<CreateChainAddressResult>(result);
@@ -1,6 +1,6 @@
1
1
  import * as events from 'events';
2
+ import {MergeExclusive} from 'type-fest';
2
3
  import {AuthenticatedLnd, UnauthenticatedLnd} from '../lnd_grpc';
3
- import {Xor} from './util';
4
4
 
5
5
  export type EmptyObject = {[key: string]: never};
6
6
 
@@ -84,7 +84,7 @@ export type PaymentState =
84
84
  | 'FAILED_TIMEOUT';
85
85
  export type PaymentStatus = CommonStatus | 'UNKNOWN';
86
86
 
87
- export type PaginationArgs = Xor<
87
+ export type PaginationArgs = MergeExclusive<
88
88
  {
89
89
  /** Page Result Limit */
90
90
  limit?: number;
@@ -1,7 +0,0 @@
1
- type Without<T, U> = {
2
- [KeyType in Exclude<keyof T, keyof U>]?: never;
3
- };
4
-
5
- export type Xor<T, U> = T | U extends object
6
- ? (Without<T, U> & U) | (Without<U, T> & T)
7
- : T | U;