lightning 6.2.7 → 6.3.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
+ ## 6.3.1
4
+
5
+ - `getSettlementStatus`: Add method to lookup received htlc settlement status
6
+
3
7
  ## 6.2.7
4
8
 
5
9
  - `getWalletInfo`: Add support for LND 0.14.5
package/README.md CHANGED
@@ -212,6 +212,8 @@ variables set:
212
212
  Calculate a route through specified nodes.
213
213
  - [getRouteToDestination](https://github.com/alexbosworth/ln-service#getroutetodestination):
214
214
  Calculate a route through the graph to a destination.
215
+ - [getSettlementStatus](https://github.com/alexbosworth/ln-service#getsettlementstatus):
216
+ Lookup the status of a received payment output
215
217
  - [getSweepTransactions](https://github.com/alexbosworth/ln-service#getsweeptransactions): List
216
218
  transactions that are sweeping funds on-chain.
217
219
  - [getTowerServerInfo](https://github.com/alexbosworth/ln-service#gettowerserverinfo): General
@@ -577,6 +577,20 @@ service Lightning {
577
577
  zero conf).
578
578
  */
579
579
  rpc ListAliases (ListAliasesRequest) returns (ListAliasesResponse);
580
+
581
+ rpc LookupHtlc (LookupHtlcRequest) returns (LookupHtlcResponse);
582
+ }
583
+
584
+ message LookupHtlcRequest {
585
+ uint64 chan_id = 1;
586
+
587
+ uint64 htlc_index = 2;
588
+ }
589
+
590
+ message LookupHtlcResponse {
591
+ bool settled = 1;
592
+
593
+ bool offchain = 2;
580
594
  }
581
595
 
582
596
  message SubscribeCustomMessagesRequest {
@@ -2217,6 +2231,13 @@ message OpenChannelRequest {
2217
2231
  to use the default fee rate value specified in the config or 0.
2218
2232
  */
2219
2233
  bool use_fee_rate = 24;
2234
+
2235
+ /*
2236
+ The number of satoshis we require the remote peer to reserve. This value,
2237
+ if specified, must be above the dust limit and below 20% of the channel
2238
+ capacity.
2239
+ */
2240
+ uint64 remote_chan_reserve_sat = 25;
2220
2241
  }
2221
2242
  message OpenStatusUpdate {
2222
2243
  oneof update {
@@ -3047,6 +3068,9 @@ message LightningNode {
3047
3068
  repeated NodeAddress addresses = 4;
3048
3069
  string color = 5;
3049
3070
  map<uint32, Feature> features = 6;
3071
+
3072
+ // Custom node announcement tlv records.
3073
+ map<uint64, bytes> custom_records = 7;
3050
3074
  }
3051
3075
 
3052
3076
  message NodeAddress {
@@ -3062,6 +3086,9 @@ message RoutingPolicy {
3062
3086
  bool disabled = 5;
3063
3087
  uint64 max_htlc_msat = 6;
3064
3088
  uint32 last_update = 7;
3089
+
3090
+ // Custom channel update tlv records.
3091
+ map<uint64, bytes> custom_records = 8;
3065
3092
  }
3066
3093
 
3067
3094
  /*
@@ -3089,6 +3116,9 @@ message ChannelEdge {
3089
3116
 
3090
3117
  RoutingPolicy node1_policy = 7;
3091
3118
  RoutingPolicy node2_policy = 8;
3119
+
3120
+ // Custom channel announcement tlv records.
3121
+ map<uint64, bytes> custom_records = 9;
3092
3122
  }
3093
3123
 
3094
3124
  message ChannelGraphRequest {
@@ -3371,6 +3401,8 @@ message Invoice {
3371
3401
  repeated RouteHint route_hints = 14;
3372
3402
 
3373
3403
  // Whether this invoice should include routing hints for private channels.
3404
+ // Note: When enabled, if value and value_msat are zero, a large number of
3405
+ // hints with these channels can be included, which might not be desirable.
3374
3406
  bool private = 15;
3375
3407
 
3376
3408
  /*
@@ -4042,6 +4074,10 @@ message ForwardingHistoryRequest {
4042
4074
 
4043
4075
  // The max number of events to return in the response to this query.
4044
4076
  uint32 num_max_events = 4;
4077
+
4078
+ // Informs the server if the peer alias should be looked up for each
4079
+ // forwarding event.
4080
+ bool peer_alias_lookup = 5;
4045
4081
  }
4046
4082
  message ForwardingEvent {
4047
4083
  // Timestamp is the time (unix epoch offset) that this circuit was
@@ -4081,6 +4117,12 @@ message ForwardingEvent {
4081
4117
  // circuit was completed.
4082
4118
  uint64 timestamp_ns = 11;
4083
4119
 
4120
+ // The peer alias of the incoming channel.
4121
+ string peer_alias_in = 12;
4122
+
4123
+ // The peer alias of the outgoing channel.
4124
+ string peer_alias_out = 13;
4125
+
4084
4126
  // TODO(roasbeef): add settlement latency?
4085
4127
  // * use FPE on the chan id?
4086
4128
  // * also list failures?
package/index.js CHANGED
@@ -69,6 +69,7 @@ const {getPublicKey} = require('./lnd_methods');
69
69
  const {getRouteConfidence} = require('./lnd_methods');
70
70
  const {getRouteThroughHops} = require('./lnd_methods');
71
71
  const {getRouteToDestination} = require('./lnd_methods');
72
+ const {getSettlementStatus} = require('./lnd_methods');
72
73
  const {getSweepTransactions} = require('./lnd_methods');
73
74
  const {getTowerServerInfo} = require('./lnd_methods');
74
75
  const {getUtxos} = require('./lnd_methods');
@@ -218,6 +219,7 @@ module.exports = {
218
219
  getRouteConfidence,
219
220
  getRouteThroughHops,
220
221
  getRouteToDestination,
222
+ getSettlementStatus,
221
223
  getSweepTransactions,
222
224
  getTowerServerInfo,
223
225
  getUtxos,
@@ -67,6 +67,7 @@ const {getPublicKey} = require('./address');
67
67
  const {getRouteConfidence} = require('./generic');
68
68
  const {getRouteThroughHops} = require('./offchain');
69
69
  const {getRouteToDestination} = require('./info');
70
+ const {getSettlementStatus} = require('./offchain');
70
71
  const {getSweepTransactions} = require('./onchain');
71
72
  const {getTowerServerInfo} = require('./info');
72
73
  const {getUtxos} = require('./onchain');
@@ -212,6 +213,7 @@ module.exports = {
212
213
  getRouteConfidence,
213
214
  getRouteThroughHops,
214
215
  getRouteToDestination,
216
+ getSettlementStatus,
215
217
  getSweepTransactions,
216
218
  getTowerServerInfo,
217
219
  getUtxos,
@@ -276,6 +276,10 @@
276
276
  "method": "QueryRoutes",
277
277
  "type": "default"
278
278
  },
279
+ "getSettlementStatus": {
280
+ "method": "LookupHtlc",
281
+ "type": "default"
282
+ },
279
283
  "getSweepTransactions": {
280
284
  "method": "ListSweeps",
281
285
  "type": "default"
@@ -0,0 +1,30 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript';
5
+
6
+ export type GetSettlementStatusArgs = AuthenticatedLightningArgs<{
7
+ /** Standard Format Channel Id String */
8
+ channel: string;
9
+ /** Payment Id Number */
10
+ payment: number;
11
+ }>;
12
+
13
+ export type GetSettlementStatusResult = {
14
+ /** Payment Went to Chain Bool */
15
+ is_onchain: boolean;
16
+ /** Payment Is Settled Into Non-HTLC Balance Bool */
17
+ is_settled: boolean;
18
+ };
19
+
20
+ /**
21
+ * Get the settlement status of a received HTLC
22
+ *
23
+ * Note: this method is not supported in LND versions 0.15.4 and below
24
+ *
25
+ * Requires `offchain:read` permissions
26
+ */
27
+ export const getSettlementStatus: AuthenticatedLightningMethod<
28
+ GetSettlementStatusArgs,
29
+ GetSettlementStatusResult
30
+ >;
@@ -0,0 +1,91 @@
1
+ const asyncAuto = require('async/auto');
2
+ const {chanNumber} = require('bolt07');
3
+ const {returnResult} = require('asyncjs-util');
4
+
5
+ const {isLnd} = require('./../../lnd_requests');
6
+
7
+ const errorNotFound = 'htlc unknown';
8
+ const errorUnimplemented = 'unknown method LookupHtlc for service lnrpc.Lightning';
9
+ const isBoolean = n => n === false || n === true;
10
+ const method = 'lookupHtlc';
11
+ const type = 'default';
12
+
13
+ /** Get the settlement status of a received HTLC
14
+
15
+ Note: this method is not supported in LND versions 0.15.4 and below
16
+
17
+ Requires `offchain:read` permissions
18
+
19
+ {
20
+ channel: <Standard Format Channel Id String>
21
+ lnd: <Authenticated LND API Object>
22
+ payment: <Payment Id Number>
23
+ }
24
+
25
+ @returns via cbk or Promise
26
+ {
27
+ is_onchain: <Payment Went to Chain Bool>
28
+ is_settled: <Payment Is Settled Into Non-HTLC Balance Bool>
29
+ }
30
+ */
31
+ module.exports = ({channel, lnd, payment}, cbk) => {
32
+ return new Promise((resolve, reject) => {
33
+ return asyncAuto({
34
+ // Check arguments
35
+ validate: cbk => {
36
+ if (!channel) {
37
+ return cbk([400, 'ExpectedChannelIdToGetSettlementStatus']);
38
+ }
39
+
40
+ if (!isLnd({lnd, method, type})) {
41
+ return cbk([400, 'ExpectedLndToGetSettlementStatus']);
42
+ }
43
+
44
+ if (payment === undefined) {
45
+ return cbk([400, 'ExpectedHtlcIndexToGetSettlementStatus']);
46
+ }
47
+
48
+ return cbk();
49
+ },
50
+
51
+ // Get the settlement status of an HTLC
52
+ getStatus: ['validate', ({}, cbk) => {
53
+ return lnd[type][method]({
54
+ chan_id: chanNumber({channel}).number,
55
+ htlc_index: payment.toString(),
56
+ },
57
+ (err, res) => {
58
+ if (!!err && err.details === errorNotFound) {
59
+ return cbk([404, 'PaymentNotFound']);
60
+ }
61
+
62
+ if (!!err && err.details === errorUnimplemented) {
63
+ return cbk([501, 'LookupHtlcMethodUnsupported']);
64
+ }
65
+
66
+ if (!!err) {
67
+ return cbk([503, 'UnexpectedLookupHltcError', {err}]);
68
+ }
69
+
70
+ if (!res) {
71
+ return cbk([503, 'ExpectedHtlcLookupResponse']);
72
+ }
73
+
74
+ if (!isBoolean(res.offchain)) {
75
+ return cbk([503, 'ExpectedOffchainStatusInHtlcLookupResponse']);
76
+ }
77
+
78
+ if (!isBoolean(res.settled)) {
79
+ return cbk([503, 'ExpectedSettledStatusInHtlcLookupResponse']);
80
+ }
81
+
82
+ return cbk(null, {
83
+ is_onchain: !res.offchain,
84
+ is_settled: res.settled,
85
+ });
86
+ });
87
+ }],
88
+ },
89
+ returnResult({reject, resolve, of: 'getStatus'}, cbk));
90
+ });
91
+ };
@@ -27,6 +27,7 @@ export * from './get_payments';
27
27
  export * from './get_pending_channels';
28
28
  export * from './get_pending_payments';
29
29
  export * from './get_route_through_hops';
30
+ export * from './get_settlement_status';
30
31
  export * from './is_destination_payable';
31
32
  export * from './pay_via_payment_details';
32
33
  export * from './pay_via_payment_request';
@@ -27,6 +27,7 @@ const getPayments = require('./get_payments');
27
27
  const getPendingChannels = require('./get_pending_channels');
28
28
  const getPendingPayments = require('./get_pending_payments');
29
29
  const getRouteThroughHops = require('./get_route_through_hops');
30
+ const getSettlementStatus = require('./get_settlement_status');
30
31
  const isDestinationPayable = require('./is_destination_payable');
31
32
  const pay = require('./pay');
32
33
  const payViaPaymentDetails = require('./pay_via_payment_details');
@@ -85,6 +86,7 @@ module.exports = {
85
86
  getPendingChannels,
86
87
  getPendingPayments,
87
88
  getRouteThroughHops,
89
+ getSettlementStatus,
88
90
  isDestinationPayable,
89
91
  pay,
90
92
  payViaPaymentDetails,
@@ -83,7 +83,7 @@ module.exports = ({lnd}) => {
83
83
  const request = rpcForwardAsForwardRequest(data);
84
84
 
85
85
  return emitter.emit(event, {
86
- accept: () => sub.write({
86
+ accept: async () => await sub.write({
87
87
  action: forwardPaymentActions.accept,
88
88
  incoming_circuit_key: data.incoming_circuit_key,
89
89
  }),
@@ -97,11 +97,11 @@ module.exports = ({lnd}) => {
97
97
  mtokens: request.mtokens,
98
98
  onion: request.onion,
99
99
  out_channel: request.out_channel,
100
- reject: () => sub.write({
100
+ reject: async () => await sub.write({
101
101
  action: forwardPaymentActions.reject,
102
102
  incoming_circuit_key: data.incoming_circuit_key,
103
103
  }),
104
- settle: ({secret}) => sub.write({
104
+ settle: async ({secret}) => await sub.write({
105
105
  action: forwardPaymentActions.settle,
106
106
  incoming_circuit_key: data.incoming_circuit_key,
107
107
  preimage: bufferFromHex(secret),
package/package.json CHANGED
@@ -23,18 +23,18 @@
23
23
  "cbor": "8.1.0",
24
24
  "ecpair": "2.1.0",
25
25
  "express": "4.18.2",
26
- "invoices": "2.2.0",
26
+ "invoices": "2.2.2",
27
27
  "psbt": "2.7.1",
28
28
  "tiny-secp256k1": "2.2.1",
29
- "type-fest": "3.1.0"
29
+ "type-fest": "3.2.0"
30
30
  },
31
31
  "description": "Lightning Network client library",
32
32
  "devDependencies": {
33
33
  "@alexbosworth/node-fetch": "2.6.2",
34
34
  "@alexbosworth/tap": "15.0.11",
35
35
  "tsd": "0.24.1",
36
- "typescript": "4.8.4",
37
- "ws": "8.10.0"
36
+ "typescript": "4.9.3",
37
+ "ws": "8.11.0"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=14"
@@ -59,5 +59,5 @@
59
59
  "directory": "test/typescript"
60
60
  },
61
61
  "types": "index.d.ts",
62
- "version": "6.2.7"
62
+ "version": "6.3.1"
63
63
  }
@@ -54,12 +54,54 @@ const tests = [
54
54
  args: {
55
55
  family: 1,
56
56
  index: 1,
57
+ lnd: {wallet: {deriveKey: ({}, cbk) => cbk(null, {
58
+ raw_key_bytes: Buffer.alloc(1),
59
+ })}},
60
+ },
61
+ description: 'Expects result key loc',
62
+ error: [503, 'ExpectedKeyLocatorInPublicKeyResponse'],
63
+ },
64
+ {
65
+ args: {
66
+ family: 1,
67
+ index: 1,
68
+ lnd: {wallet: {deriveKey: ({}, cbk) => cbk(null, {
69
+ key_loc: {},
70
+ raw_key_bytes: Buffer.alloc(1),
71
+ })}},
72
+ },
73
+ description: 'Expects result key loc index',
74
+ error: [503, 'ExpectedKeyIndexInPublicKeyResponse'],
75
+ },
76
+ {
77
+ args: {
78
+ family: 1,
79
+ index: 1,
80
+ lnd: {
81
+ wallet: {
82
+ deriveKey: ({}, cbk) => cbk(null, {
83
+ key_loc: {key_index: 0},
84
+ raw_key_bytes: Buffer.alloc(1),
85
+ }),
86
+ },
87
+ },
88
+ },
89
+ description: 'Got public key result',
90
+ expected: {public_key: '00'},
91
+ },
92
+ {
93
+ args: {
94
+ family: 1,
57
95
  lnd: {
58
96
  wallet: {
59
97
  deriveKey: ({}, cbk) => cbk(null, {
60
98
  key_loc: {key_index: 0},
61
99
  raw_key_bytes: Buffer.alloc(1),
62
100
  }),
101
+ deriveNextKey: ({}, cbk) => cbk(null, {
102
+ key_loc: {key_index: 0},
103
+ raw_key_bytes: Buffer.alloc(1),
104
+ }),
63
105
  },
64
106
  },
65
107
  },
@@ -36,6 +36,11 @@ const tests = [
36
36
  description: 'Connect fails returns error',
37
37
  error: [503, 'FailedToConnectToDaemon'],
38
38
  },
39
+ {
40
+ args: {lnd: makeLnd({err: {details: 'No connection established'}})},
41
+ description: 'Connect fails returns error',
42
+ error: [503, 'FailedToConnectToDaemon'],
43
+ },
39
44
  {
40
45
  args: {lnd: makeLnd({err: 'err'})},
41
46
  description: 'Generic failure returns back the error',
@@ -42,6 +42,10 @@ const tests = [
42
42
  description: 'Server error is returned',
43
43
  error: [503, 'UnexpectedErrDisconnectingWatchtower', {err: 'err'}],
44
44
  },
45
+ {
46
+ args: makeArgs({lnd: makeLnd({details: 'tower not found'})}),
47
+ description: 'Ignore removed already errors',
48
+ },
45
49
  {
46
50
  args: makeArgs({}),
47
51
  description: 'A tower is added',
@@ -0,0 +1,84 @@
1
+ const {test} = require('@alexbosworth/tap');
2
+
3
+ const {getSettlementStatus} = require('./../../../');
4
+
5
+ const makeLnd = ({err, res}) => {
6
+ const result = res === undefined ? {offchain: true, settled: true} : res;
7
+
8
+ return {default: {lookupHtlc: ({}, cbk) => cbk(err, result)}};
9
+ };
10
+
11
+ const makeArgs = overrides => {
12
+ const args = {channel: '0x0x0', lnd: makeLnd({}), payment: 0};
13
+
14
+ Object.keys(overrides).forEach(k => args[k] = overrides[k]);
15
+
16
+ return args;
17
+ };
18
+
19
+ const tests = [
20
+ {
21
+ args: makeArgs({channel: undefined}),
22
+ description: 'A channel id is required',
23
+ error: [400, 'ExpectedChannelIdToGetSettlementStatus'],
24
+ },
25
+ {
26
+ args: makeArgs({lnd: undefined}),
27
+ description: 'LND object is required',
28
+ error: [400, 'ExpectedLndToGetSettlementStatus'],
29
+ },
30
+ {
31
+ args: makeArgs({payment: undefined}),
32
+ description: 'A payment index is required',
33
+ error: [400, 'ExpectedHtlcIndexToGetSettlementStatus'],
34
+ },
35
+ {
36
+ args: makeArgs({lnd: makeLnd({err: {details: 'htlc unknown'}})}),
37
+ description: 'An HTLC not found error is returned',
38
+ error: [404, 'PaymentNotFound'],
39
+ },
40
+ {
41
+ args: makeArgs({lnd: makeLnd({err: {details: 'unknown method LookupHtlc for service lnrpc.Lightning'}})}),
42
+ description: 'A method not supported error is returned',
43
+ error: [501, 'LookupHtlcMethodUnsupported'],
44
+ },
45
+ {
46
+ args: makeArgs({lnd: makeLnd({err: 'err'})}),
47
+ description: 'A generic error is returned',
48
+ error: [503, 'UnexpectedLookupHltcError', {err: 'err'}],
49
+ },
50
+ {
51
+ args: makeArgs({lnd: makeLnd({res: null})}),
52
+ description: 'A response is expected',
53
+ error: [503, 'ExpectedHtlcLookupResponse'],
54
+ },
55
+ {
56
+ args: makeArgs({lnd: makeLnd({res: {}})}),
57
+ description: 'A chain status is expected',
58
+ error: [503, 'ExpectedOffchainStatusInHtlcLookupResponse'],
59
+ },
60
+ {
61
+ args: makeArgs({lnd: makeLnd({res: {offchain: true}})}),
62
+ description: 'A settlement status is expected',
63
+ error: [503, 'ExpectedSettledStatusInHtlcLookupResponse'],
64
+ },
65
+ {
66
+ args: makeArgs({}),
67
+ description: 'Settlement status is returned',
68
+ expected: {is_onchain: false, is_settled: true},
69
+ },
70
+ ];
71
+
72
+ tests.forEach(({args, description, error, expected}) => {
73
+ return test(description, async ({deepEqual, end, rejects, strictSame}) => {
74
+ if (!!error) {
75
+ await rejects(getSettlementStatus(args), error, 'Got expected error');
76
+ } else {
77
+ const res = await getSettlementStatus(args);
78
+
79
+ strictSame(res, expected, 'Got expected result');
80
+ }
81
+
82
+ return end();
83
+ });
84
+ });
@@ -94,6 +94,23 @@ const tests = [
94
94
  description: 'Passing 0 UTXO confirmations is supported',
95
95
  expected: {fee: 1, tokens_per_vbyte: 1},
96
96
  },
97
+ {
98
+ args: {
99
+ lnd: {
100
+ default: {
101
+ estimateFee: ({}, cbk) => cbk(null, {
102
+ fee_sat: '1',
103
+ feerate_sat_per_byte: '1',
104
+ sat_per_vbyte: '2',
105
+ }),
106
+ },
107
+ },
108
+ send_to: [{address: 'address', tokens: 1}],
109
+ utxo_confirmations: 0,
110
+ },
111
+ description: 'Sat per vbyte result is supported',
112
+ expected: {fee: 1, tokens_per_vbyte: 2},
113
+ },
97
114
  ];
98
115
 
99
116
  tests.forEach(({args, description, error, expected}) => {
@@ -17,6 +17,11 @@ const makeArgs = overrides => {
17
17
  };
18
18
 
19
19
  const tests = [
20
+ {
21
+ args: makeArgs({expires_at: '1970'}),
22
+ description: 'Cannot give a past expiry',
23
+ error: [400, 'ExpectedLaterDateToSetLockExpirationDateTo'],
24
+ },
20
25
  {
21
26
  args: makeArgs({lnd: undefined}),
22
27
  description: 'LND is required to lock a utxo',
@@ -84,6 +84,17 @@ const tests = [
84
84
  description: 'Buffers in raw sigs array are expected',
85
85
  expected: {signature: '00'},
86
86
  },
87
+ {
88
+ args: makeArgs({
89
+ override: {
90
+ inputs: [{
91
+ output_script: '51200000000000000000000000000000000000000000000000000000000000000000',
92
+ }],
93
+ },
94
+ }),
95
+ description: 'A taproot tx is signed',
96
+ expected: {signature: '00'},
97
+ },
87
98
  ];
88
99
 
89
100
  tests.forEach(({args, description, error, expected}) => {
@@ -18,6 +18,26 @@ const tests = [
18
18
  description: 'Seed is required',
19
19
  error: [400, 'ExpectedSeedMnemonicForWalletCreation'],
20
20
  },
21
+ {
22
+ args: {
23
+ lnd: {unlocker: {initWallet: ({}, cbk) => cbk()}},
24
+ passphrase: 'passphrase',
25
+ password: 'pass',
26
+ seed: 'seed',
27
+ },
28
+ description: 'A wallet creation is expected',
29
+ error: [503, 'ExpectedResponseForInitWallet'],
30
+ },
31
+ {
32
+ args: {
33
+ lnd: {unlocker: {initWallet: ({}, cbk) => cbk(null, {})}},
34
+ passphrase: 'passphrase',
35
+ password: 'pass',
36
+ seed: 'seed',
37
+ },
38
+ description: 'An admin macaroon is expected',
39
+ error: [503, 'ExpectedAdminMacaroonToCrateWallet'],
40
+ },
21
41
  {
22
42
  args: {
23
43
  lnd: {unlocker: {initWallet: ({}, cbk) => cbk('err')}},
@@ -86,6 +86,18 @@ const tests = [
86
86
  args: {lnd: makeLnd({state: 'RPC_ACTIVE'})},
87
87
  description: 'Active wallet state emitted',
88
88
  },
89
+ {
90
+ args: {lnd: makeLnd({state: 'SERVER_ACTIVE'})},
91
+ description: 'Active server state emitted',
92
+ },
93
+ {
94
+ args: {lnd: makeLnd({state: 'WAITING_TO_START'})},
95
+ description: 'Server waiting to start',
96
+ },
97
+ {
98
+ args: {lnd: makeLnd({state: 'undefined_state'})},
99
+ description: 'Server emitted an unknown event',
100
+ },
89
101
  {
90
102
  args: {lnd: makeLnd({state: 'UNLOCKED'})},
91
103
  description: 'Starting state emitted',
@@ -0,0 +1,26 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {AuthenticatedLnd} from '../../lnd_grpc';
3
+ import {
4
+ getSettlementStatus,
5
+ GetSettlementStatusResult,
6
+ } from '../../lnd_methods';
7
+
8
+ const lnd = {} as AuthenticatedLnd;
9
+ const channel = 'channel id';
10
+ const payment = 0;
11
+
12
+ expectError(getSettlementStatus());
13
+ expectError(getSettlementStatus({}));
14
+ expectError(getSettlementStatus({lnd}));
15
+ expectError(getSettlementStatus({lnd, channel}));
16
+ expectError(getSettlementStatus({lnd, payment}));
17
+
18
+ expectType<GetSettlementStatusResult>(
19
+ await getSettlementStatus({lnd, channel, payment})
20
+ );
21
+
22
+ expectType<void>(
23
+ getSettlementStatus({lnd, channel, payment}, (error, result) => {
24
+ expectType<GetSettlementStatusResult>(result);
25
+ })
26
+ );