lightning 5.3.4 → 5.5.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # Versions
2
2
 
3
+ ## 5.5.0
4
+
5
+ - `partiallySignPsbt`: Add method to partially sign a PSBT
6
+
7
+ ## 5.4.2
8
+
9
+ - `deletePendingChannel`: Add method to delete a stuck pending channel
10
+ - `getInvoices`: Fill in type definition for `is_unconfirmed`
11
+
3
12
  ## 5.3.4
4
13
 
5
14
  - `getPayments`: Correct paging issue that prevented paging through all results
package/README.md CHANGED
@@ -206,8 +206,10 @@ To access unauthenticated methods like the wallet unlocker, use
206
206
  chosen to be spent.
207
207
  - [openChannel](https://github.com/alexbosworth/ln-service#openchannel): Create a new channel
208
208
  to another node.
209
- - [openChannels](https://github.com/alexbosworth/ln-service#openchannels): Open multiple
210
- channels in a single on-chain transaction batch.
209
+ - [openChannels](https://github.com/alexbosworth/ln-service#openchannels): Open
210
+ multiple channels in a single on-chain transaction batch.
211
+ - [partiallySignPsbt](https://github.com/alexbosworth/ln-service#partiallysignpsbt):
212
+ Add a partial signature to a PSBT
211
213
  - [pay](https://github.com/alexbosworth/ln-service#pay): Make an off-chain payment.
212
214
  - [payViaPaymentDetails](https://github.com/alexbosworth/ln-service#payviapaymentdetails): Pay
213
215
  off-chain using details about a destination invoice.
@@ -1210,13 +1210,13 @@ enum CommitmentType {
1210
1210
  /*
1211
1211
  Returned when the commitment type isn't known or unavailable.
1212
1212
  */
1213
- UNKNOWN_COMMITMENT_TYPE = 999;
1213
+ UNKNOWN_COMMITMENT_TYPE = 0;
1214
1214
 
1215
1215
  /*
1216
1216
  A channel using the legacy commitment format having tweaked to_remote
1217
1217
  keys.
1218
1218
  */
1219
- LEGACY = 0;
1219
+ LEGACY = 1;
1220
1220
 
1221
1221
  /*
1222
1222
  A channel that uses the modern commitment format where the key in the
@@ -1224,14 +1224,14 @@ enum CommitmentType {
1224
1224
  up and recovery easier as when the channel is closed, the funds go
1225
1225
  directly to that key.
1226
1226
  */
1227
- STATIC_REMOTE_KEY = 1;
1227
+ STATIC_REMOTE_KEY = 2;
1228
1228
 
1229
1229
  /*
1230
1230
  A channel that uses a commitment format that has anchor outputs on the
1231
1231
  commitments, allowing fee bumping after a force close transaction has
1232
1232
  been broadcast.
1233
1233
  */
1234
- ANCHORS = 2;
1234
+ ANCHORS = 3;
1235
1235
 
1236
1236
  /*
1237
1237
  A channel that uses a commitment type that builds upon the anchors
@@ -2312,6 +2312,12 @@ message PendingChannelsResponse {
2312
2312
 
2313
2313
  // Total number of forwarding packages created in this channel.
2314
2314
  int64 num_forwarding_packages = 10;
2315
+
2316
+ // A set of flags showing the current state of the channel.
2317
+ string chan_status_flags = 11;
2318
+
2319
+ // Whether this channel is advertised to the network or not.
2320
+ bool private = 12;
2315
2321
  }
2316
2322
 
2317
2323
  message PendingOpenChannel {
@@ -2353,6 +2359,9 @@ message PendingChannelsResponse {
2353
2359
  this point.
2354
2360
  */
2355
2361
  Commitments commitments = 3;
2362
+
2363
+ // The transaction id of the closing transaction
2364
+ string closing_txid = 4;
2356
2365
  }
2357
2366
 
2358
2367
  message Commitments {
@@ -3742,6 +3751,9 @@ message PolicyUpdateRequest {
3742
3751
  // goes up to 6 decimal places, so 1e-6.
3743
3752
  double fee_rate = 4;
3744
3753
 
3754
+ // The effective fee rate in micro-satoshis (parts per million).
3755
+ uint32 fee_rate_ppm = 9;
3756
+
3745
3757
  // The required timelock delta for HTLCs forwarded over the channel.
3746
3758
  uint32 time_lock_delta = 5;
3747
3759
 
@@ -360,6 +360,11 @@ message QueryMissionControlResponse {
360
360
  message XImportMissionControlRequest {
361
361
  // Node pair-level mission control state to be imported.
362
362
  repeated PairHistory pairs = 1;
363
+
364
+ // Whether to force override MC pair history. Note that even with force
365
+ // override the failure pair is imported before the success pair and both
366
+ // still clamp existing failure/success amounts.
367
+ bool force = 2;
363
368
  }
364
369
 
365
370
  message XImportMissionControlResponse {
@@ -200,6 +200,21 @@ service WalletKit {
200
200
  */
201
201
  rpc FundPsbt (FundPsbtRequest) returns (FundPsbtResponse);
202
202
 
203
+ /*
204
+ SignPsbt expects a partial transaction with all inputs and outputs fully
205
+ declared and tries to sign all unsigned inputs that have all required fields
206
+ (UTXO information, BIP32 derivation information, witness or sig scripts)
207
+ set.
208
+ If no error is returned, the PSBT is ready to be given to the next signer or
209
+ to be finalized if lnd was the last signer.
210
+
211
+ NOTE: This RPC only signs inputs (and only those it can sign), it does not
212
+ perform any other tasks (such as coin selection, UTXO locking or
213
+ input/output/fee value validation, PSBT finalization). Any input that is
214
+ incomplete will be skipped.
215
+ */
216
+ rpc SignPsbt (SignPsbtRequest) returns (SignPsbtResponse);
217
+
203
218
  /*
204
219
  FinalizePsbt expects a partial transaction with all inputs and outputs fully
205
220
  declared and tries to sign all inputs that belong to the wallet. Lnd must be
@@ -820,6 +835,19 @@ message UtxoLease {
820
835
  uint64 expiration = 3;
821
836
  }
822
837
 
838
+ message SignPsbtRequest {
839
+ /*
840
+ The PSBT that should be signed. The PSBT must contain all required inputs,
841
+ outputs, UTXO data and custom fields required to identify the signing key.
842
+ */
843
+ bytes funded_psbt = 1;
844
+ }
845
+
846
+ message SignPsbtResponse {
847
+ // The signed transaction in PSBT format.
848
+ bytes signed_psbt = 1;
849
+ }
850
+
823
851
  message FinalizePsbtRequest {
824
852
  /*
825
853
  A PSBT that should be signed and finalized. The PSBT must contain all
package/index.js CHANGED
@@ -76,6 +76,7 @@ const {lndGateway} = require('./lnd_gateway');
76
76
  const {lockUtxo} = require('./lnd_methods');
77
77
  const {openChannel} = require('./lnd_methods');
78
78
  const {openChannels} = require('./lnd_methods');
79
+ const {partiallySignPsbt} = require('./lnd_methods');
79
80
  const {pay} = require('./lnd_methods');
80
81
  const {payViaPaymentDetails} = require('./lnd_methods');
81
82
  const {payViaPaymentRequest} = require('./lnd_methods');
@@ -213,6 +214,7 @@ module.exports = {
213
214
  lockUtxo,
214
215
  openChannel,
215
216
  openChannels,
217
+ partiallySignPsbt,
216
218
  pay,
217
219
  payViaPaymentDetails,
218
220
  payViaPaymentRequest,
@@ -72,6 +72,7 @@ const {isDestinationPayable} = require('./offchain');
72
72
  const {lockUtxo} = require('./onchain');
73
73
  const {openChannel} = require('./onchain');
74
74
  const {openChannels} = require('./onchain');
75
+ const {partiallySignPsbt} = require('./onchain');
75
76
  const {pay} = require('./offchain');
76
77
  const {payViaPaymentDetails} = require('./offchain');
77
78
  const {payViaPaymentRequest} = require('./offchain');
@@ -205,6 +206,7 @@ module.exports = {
205
206
  lockUtxo,
206
207
  openChannel,
207
208
  openChannels,
209
+ partiallySignPsbt,
208
210
  pay,
209
211
  payViaPaymentDetails,
210
212
  payViaPaymentRequest,
@@ -4,7 +4,12 @@ import {
4
4
  PaginationArgs,
5
5
  } from '../../typescript';
6
6
 
7
- export type GetInvoicesArgs = AuthenticatedLightningArgs<PaginationArgs>;
7
+ export type GetInvoicesArgs = AuthenticatedLightningArgs<
8
+ PaginationArgs & {
9
+ /** Omit Canceled and Settled Invoices Bool */
10
+ is_unconfirmed?: boolean;
11
+ }
12
+ >;
8
13
 
9
14
  export type GetInvoicesResult = {
10
15
  invoices: {
@@ -293,6 +293,10 @@
293
293
  "method": "OpenChannel",
294
294
  "type": "default"
295
295
  },
296
+ "partiallySignPsbt": {
297
+ "method": "SignPsbt",
298
+ "type": "wallet"
299
+ },
296
300
  "payViaPaymentDetails": {
297
301
  "depends_on": ["subscribeToPayViaDetails"]
298
302
  },
@@ -0,0 +1,21 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript';
5
+
6
+ export type DeletePendingChannelArgs = AuthenticatedLightningArgs<{
7
+ /** Hex Encoded Conflicting Transaction String */
8
+ confirmed_transaction: string;
9
+ /** Hex Encoded Pending Transaction String */
10
+ pending_transaction: string;
11
+ /** Pending Channel Output Index Number */
12
+ pending_transaction_vout: number;
13
+ }>;
14
+
15
+ /**
16
+ * Delete a pending channel
17
+ *
18
+ * Pass the confirmed conflicting transaction that spends the same input to make sure that no funds are being deleted.
19
+ * This method is not supported on LND 0.13.3 and below
20
+ */
21
+ export const deletePendingChannel: AuthenticatedLightningMethod<DeletePendingChannelArgs>;
@@ -4,6 +4,7 @@ const {Transaction} = require('bitcoinjs-lib');
4
4
 
5
5
  const {fromHex} = Transaction;
6
6
  const method = 'abandonChannel';
7
+ const methodUnsupported = 'AbandonChannel RPC call only available in dev builds';
7
8
  const txIdAsHash = id => Buffer.from(id, 'hex').reverse();
8
9
  const type = 'default';
9
10
 
@@ -96,6 +97,10 @@ module.exports = (args, cbk) => {
96
97
  i_know_what_i_am_doing: true,
97
98
  },
98
99
  err => {
100
+ if (!!err && err.details === methodUnsupported) {
101
+ return cbk([501, 'DeletePendingChannelMethodNotSupported']);
102
+ }
103
+
99
104
  if (!!err) {
100
105
  return cbk([503, 'UnexpectedErrorDeletingPendingChannel', {err}]);
101
106
  }
@@ -5,6 +5,7 @@ export * from './delete_failed_payments';
5
5
  export * from './delete_forwarding_reputations';
6
6
  export * from './delete_payment';
7
7
  export * from './delete_payments';
8
+ export * from './delete_pending_channel';
8
9
  export * from './disable_channel';
9
10
  export * from './disconnect_watchtower';
10
11
  export * from './enable_channel';
@@ -14,6 +14,7 @@ export * from './get_utxos';
14
14
  export * from './lock_utxo';
15
15
  export * from './open_channel';
16
16
  export * from './open_channels';
17
+ export * from './partially_sign_psbt';
17
18
  export * from './prepare_for_channel_proposal';
18
19
  export * from './propose_channel';
19
20
  export * from './request_chain_fee_increase';
@@ -14,6 +14,7 @@ const getUtxos = require('./get_utxos');
14
14
  const lockUtxo = require('./lock_utxo');
15
15
  const openChannel = require('./open_channel');
16
16
  const openChannels = require('./open_channels');
17
+ const partiallySignPsbt = require('./partially_sign_psbt');
17
18
  const prepareForChannelProposal = require('./prepare_for_channel_proposal');
18
19
  const proposeChannel = require('./propose_channel');
19
20
  const requestChainFeeIncrease = require('./request_chain_fee_increase');
@@ -46,6 +47,7 @@ module.exports = {
46
47
  lockUtxo,
47
48
  openChannel,
48
49
  openChannels,
50
+ partiallySignPsbt,
49
51
  prepareForChannelProposal,
50
52
  proposeChannel,
51
53
  requestChainFeeIncrease,
@@ -0,0 +1,28 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript';
5
+
6
+ export type PartiallySignPsbtArgs = AuthenticatedLightningArgs<{
7
+ /** Funded PSBT Hex String */
8
+ psbt: string;
9
+ }>;
10
+
11
+ export type PartiallySignPsbtResult = {
12
+ /** Partially Signed PSBT Hex String */
13
+ psbt: string;
14
+ };
15
+
16
+ /**
17
+ * Sign a PSBT to produce a partially signed PSBT
18
+ *
19
+ * Requires `onchain:write` permission
20
+ *
21
+ * Requires LND built with `walletrpc` tag
22
+ *
23
+ * This method is not supported in LND 0.14.1 and below
24
+ */
25
+ export const partiallySignPsbt: AuthenticatedLightningMethod<
26
+ PartiallySignPsbtArgs,
27
+ PartiallySignPsbtResult
28
+ >;
@@ -0,0 +1,79 @@
1
+ const asyncAuto = require('async/auto');
2
+ const {returnResult} = require('asyncjs-util');
3
+
4
+ const {isLnd} = require('./../../lnd_requests');
5
+
6
+ const bufferAsHex = buffer => buffer.toString('hex');
7
+ const hexAsBuf = hex => Buffer.from(hex, 'hex');
8
+ const {isBuffer} = Buffer;
9
+ const method = 'signPsbt';
10
+ const notSupported = /unknown.*walletrpc.WalletKit/;
11
+ const type = 'wallet';
12
+
13
+ /** Sign a PSBT to produce a partially signed PSBT
14
+
15
+ Requires `onchain:write` permission
16
+
17
+ Requires LND built with `walletrpc` tag
18
+
19
+ This method is not supported in LND 0.14.1 and below
20
+
21
+ {
22
+ lnd: <Authenticated LND API Object>
23
+ psbt: <Funded PSBT Hex String>
24
+ }
25
+
26
+ @returns via cbk or Promise
27
+ {
28
+ psbt: <Partially Signed PSBT Hex String>
29
+ }
30
+ */
31
+ module.exports = ({lnd, psbt}, cbk) => {
32
+ return new Promise((resolve, reject) => {
33
+ return asyncAuto({
34
+ // Check arguments
35
+ validate: cbk => {
36
+ if (!isLnd({lnd, method, type})) {
37
+ return cbk([400, 'ExpectedAuthenticatedLndToPartiallySignPsbt']);
38
+ }
39
+
40
+ if (!psbt) {
41
+ return cbk([400, 'ExpectedPsbtToPartiallySign']);
42
+ }
43
+
44
+ return cbk();
45
+ },
46
+
47
+ // Partially sign the funded PSBT
48
+ sign: ['validate', ({}, cbk) => {
49
+ return lnd[type][method]({funded_psbt: hexAsBuf(psbt)}, (err, res) => {
50
+ if (!!err && notSupported.test(err.details)) {
51
+ return cbk([501, 'PartiallySignPsbtMethodNotSupported']);
52
+ }
53
+
54
+ if (!!err) {
55
+ return cbk([503, 'UnexpectedErrorPartiallySigningPsbt', {err}]);
56
+ }
57
+
58
+ if (!res) {
59
+ return cbk([503, 'ExpectedResponseWhenPartiallySigningPsbt']);
60
+ }
61
+
62
+ if (!isBuffer(res.signed_psbt)) {
63
+ return cbk([503, 'ExpectedSignPsbtInSignPsbtResult']);
64
+ }
65
+
66
+ const signed = bufferAsHex(res.signed_psbt);
67
+
68
+ // Detect a failure to add a partial signature
69
+ if (signed === psbt) {
70
+ return cbk([503, 'FailedToModifyInputPsbt']);
71
+ }
72
+
73
+ return cbk(null, {psbt: signed});
74
+ });
75
+ }],
76
+ },
77
+ returnResult({reject, resolve, of: 'sign'}, cbk));
78
+ });
79
+ };
@@ -22,7 +22,7 @@ export type GetPeersResult = {
22
22
  /** Is Syncing Graph Data */
23
23
  is_sync_peer?: boolean;
24
24
  /** Peer Last Reconnected At ISO 8601 Date */
25
- last_reconnected?: string;
25
+ last_reconnection?: string;
26
26
  /** Ping Latency Milliseconds */
27
27
  ping_time: number;
28
28
  /** Node Identity Public Key */
@@ -31,7 +31,7 @@ const type = 'default';
31
31
  }]
32
32
  is_inbound: <Is Inbound Peer Bool>
33
33
  [is_sync_peer]: <Is Syncing Graph Data Bool>
34
- [last_reconnected]: <Peer Last Reconnected At ISO 8601 Date String>
34
+ [last_reconnection]: <Peer Last Reconnected At ISO 8601 Date String>
35
35
  ping_time: <Ping Latency Milliseconds Number>
36
36
  public_key: <Node Identity Public Key String>
37
37
  [reconnection_rate]: <Count of Reconnections Over Time Number>
@@ -12,9 +12,17 @@ export type CreateWalletArgs = UnauthenticatedLightningArgs<{
12
12
  seed: string;
13
13
  }>;
14
14
 
15
+ export type CreateWalletResult = {
16
+ /** Base64 Encoded Admin Macaroon String */
17
+ macaroon: string;
18
+ };
19
+
15
20
  /**
16
21
  * Create a wallet
17
22
  *
18
23
  * Requires unlocked lnd and unauthenticated LND
19
24
  */
20
- export const createWallet: UnauthenticatedLightningMethod<CreateWalletArgs>;
25
+ export const createWallet: UnauthenticatedLightningMethod<
26
+ CreateWalletArgs,
27
+ CreateWalletResult
28
+ >;
@@ -49,7 +49,7 @@ const microPerMilli = 1e3;
49
49
  }]
50
50
  is_inbound: <Is Inbound Peer Bool>
51
51
  [is_sync_peer]: <Is Syncing Graph Data Bool>
52
- [last_reconnected]: <Peer Last Reconnected At ISO 8601 Date String>
52
+ [last_reconnection]: <Peer Last Reconnected At ISO 8601 Date String>
53
53
  ping_time: <Milliseconds Number>
54
54
  public_key: <Public Key String>
55
55
  [reconnection_rate]: <Count of Reconnections Over Time Number>
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "@grpc/grpc-js": "1.5.3",
11
11
  "@grpc/proto-loader": "0.6.9",
12
12
  "@types/express": "4.17.13",
13
- "@types/node": "17.0.10",
13
+ "@types/node": "17.0.13",
14
14
  "@types/request": "2.48.8",
15
15
  "@types/ws": "8.2.2",
16
16
  "async": "3.2.3",
@@ -23,8 +23,8 @@
23
23
  "cbor": "8.1.0",
24
24
  "express": "4.17.2",
25
25
  "invoices": "2.0.3",
26
- "psbt": "1.1.10",
27
- "type-fest": "2.10.0"
26
+ "psbt": "1.1.11",
27
+ "type-fest": "2.11.0"
28
28
  },
29
29
  "description": "Lightning Network client library",
30
30
  "devDependencies": {
@@ -57,5 +57,5 @@
57
57
  "directory": "test/typescript"
58
58
  },
59
59
  "types": "index.d.ts",
60
- "version": "5.3.4"
60
+ "version": "5.5.0"
61
61
  }
@@ -67,6 +67,13 @@ const tests = [
67
67
  description: 'A conflicting tx is required',
68
68
  error: [400, 'FailedToFindConflictingInputInConfirmedTx'],
69
69
  },
70
+ {
71
+ args: makeArgs({lnd: {default: {abandonChannel: ({}, cbk) => cbk({
72
+ details: 'AbandonChannel RPC call only available in dev builds',
73
+ })}}}),
74
+ description: 'Method unsupported error is returned',
75
+ error: [501, 'DeletePendingChannelMethodNotSupported'],
76
+ },
70
77
  {
71
78
  args: makeArgs({lnd: {default: {abandonChannel: ({}, cbk) => cbk('er')}}}),
72
79
  description: 'A server error is passed back',
@@ -0,0 +1,100 @@
1
+ const {test} = require('@alexbosworth/tap');
2
+
3
+ const {partiallySignPsbt} = require('./../../../lnd_methods');
4
+
5
+ const unsupported = {details: 'unknown method for service walletrpc.WalletKit'};
6
+
7
+ const makeLnd = overrides => {
8
+ const res = {signed_psbt: Buffer.alloc(2)};
9
+
10
+ Object.keys(overrides).forEach(k => res[k] = overrides[k]);
11
+
12
+ return {wallet: {signPsbt: (args, cbk) => cbk(null, res)}};
13
+ };
14
+
15
+ const makeArgs = overrides => {
16
+ const args = {lnd: makeLnd({}), psbt: '00'};
17
+
18
+ Object.keys(overrides).forEach(key => args[key] = overrides[key]);
19
+
20
+ return args;
21
+ };
22
+
23
+ const makeExpected = overrides => {
24
+ const expected = {psbt: '0000'};
25
+
26
+ Object.keys(overrides).forEach(k => expected[k] = overrides[k]);
27
+
28
+ return expected;
29
+ };
30
+
31
+ const tests = [
32
+ {
33
+ args: makeArgs({lnd: undefined}),
34
+ description: 'An LND object is required',
35
+ error: [400, 'ExpectedAuthenticatedLndToPartiallySignPsbt'],
36
+ },
37
+ {
38
+ args: makeArgs({psbt: undefined}),
39
+ description: 'A PSBT is required',
40
+ error: [400, 'ExpectedPsbtToPartiallySign'],
41
+ },
42
+ {
43
+ args: makeArgs({
44
+ lnd: {
45
+ wallet: {
46
+ signPsbt: ({}, cbk) => cbk({
47
+ details: 'unknown method for service walletrpc.WalletKit',
48
+ }),
49
+ },
50
+ },
51
+ }),
52
+ description: 'Unsupported error is passed back',
53
+ error: [501, 'SignPsbtMethodNotSupported'],
54
+ },
55
+ {
56
+ args: makeArgs({lnd: {wallet: {signPsbt: ({}, cbk) => cbk('err')}}}),
57
+ description: 'Errors signing are passed back',
58
+ error: [503, 'UnexpectedErrorPartiallySigningPsbt', {err: 'err'}],
59
+ },
60
+ {
61
+ args: makeArgs({lnd: {wallet: {signPsbt: ({}, cbk) => cbk()}}}),
62
+ description: 'A result is expected',
63
+ error: [503, 'ExpectedResponseWhenPartiallySigningPsbt'],
64
+ },
65
+ {
66
+ args: makeArgs({lnd: makeLnd({signed_psbt: undefined})}),
67
+ description: 'A partially signed psbt is expected',
68
+ error: [503, 'ExpectedSignPsbtInSignPsbtResult'],
69
+ },
70
+ {
71
+ args: makeArgs({
72
+ lnd: {
73
+ wallet: {
74
+ signPsbt: ({}, cbk) => cbk(null, {signed_psbt: Buffer.alloc(1)}),
75
+ },
76
+ },
77
+ }),
78
+ description: 'A signature is expected',
79
+ error: [503, 'FailedToModifyInputPsbt'],
80
+ },
81
+ {
82
+ args: makeArgs({}),
83
+ description: 'PSBT partial signing is executed',
84
+ expected: makeExpected({}),
85
+ },
86
+ ];
87
+
88
+ tests.forEach(({args, description, error, expected}) => {
89
+ return test(description, async ({end, rejects, strictSame}) => {
90
+ if (!!error) {
91
+ await rejects(partiallySignPsbt(args), error, 'Got error');
92
+ } else {
93
+ const got = await partiallySignPsbt(args);
94
+
95
+ strictSame(got, expected, 'Got expected result');
96
+ }
97
+
98
+ return end();
99
+ });
100
+ });
@@ -1,10 +1,6 @@
1
1
  {
2
2
  "overrides": [
3
- ["lightning", 1212],
4
- ["lightning", 1218],
5
- ["lightning", 1226],
6
- ["lightning", 1233],
7
- ["lightning", 3459],
3
+ ["lightning", 3468],
8
4
  ["router", 100],
9
5
  ["walletkit", 3],
10
6
  ["walletunlocker", 2]
@@ -1,6 +1,6 @@
1
1
  import {expectError, expectType} from 'tsd';
2
2
  import {UnauthenticatedLnd} from '../../lnd_grpc';
3
- import {createWallet} from '../../lnd_methods';
3
+ import {createWallet, CreateWalletResult} from '../../lnd_methods';
4
4
 
5
5
  const lnd = {} as UnauthenticatedLnd;
6
6
 
@@ -20,8 +20,14 @@ expectError(createWallet({lnd, seed}));
20
20
  expectError(createWallet({lnd, passphrase, password}));
21
21
  expectError(createWallet({lnd, passphrase, seed}));
22
22
 
23
- expectType<void>(await createWallet({lnd, password, seed}));
24
- expectType<void>(await createWallet({lnd, passphrase, password, seed}));
23
+ expectType<CreateWalletResult>(await createWallet({lnd, password, seed}));
24
+ expectType<CreateWalletResult>(
25
+ await createWallet({lnd, passphrase, password, seed})
26
+ );
25
27
 
26
- expectType<void>(createWallet({lnd, password, seed}, () => {}));
27
- expectType<void>(createWallet({lnd, passphrase, password, seed}, () => {}));
28
+ createWallet({lnd, password, seed}, (err, res) => {
29
+ expectType<CreateWalletResult>(res);
30
+ });
31
+ createWallet({lnd, passphrase, password, seed}, (err, res) => {
32
+ expectType<CreateWalletResult>(res);
33
+ });
@@ -0,0 +1,43 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {AuthenticatedLnd} from '../../lnd_grpc';
3
+ import {deletePendingChannel} from '../../lnd_methods';
4
+
5
+ const lnd = {} as AuthenticatedLnd;
6
+ const confirmed_transaction = 'tx0';
7
+ const pending_transaction = 'tx1';
8
+ const pending_transaction_vout = 1;
9
+
10
+ expectError(deletePendingChannel());
11
+ expectError(deletePendingChannel({}));
12
+ expectError(deletePendingChannel({lnd}));
13
+ expectError(deletePendingChannel({confirmed_transaction}));
14
+ expectError(deletePendingChannel({pending_transaction}));
15
+ expectError(deletePendingChannel({pending_transaction_vout}));
16
+ expectError(deletePendingChannel({lnd, confirmed_transaction}));
17
+ expectError(deletePendingChannel({lnd, pending_transaction}));
18
+ expectError(deletePendingChannel({lnd, pending_transaction_vout}));
19
+ expectError(
20
+ deletePendingChannel({lnd, confirmed_transaction, pending_transaction})
21
+ );
22
+ expectError(
23
+ deletePendingChannel({lnd, confirmed_transaction, pending_transaction_vout})
24
+ );
25
+ expectError(
26
+ deletePendingChannel({lnd, pending_transaction, pending_transaction_vout})
27
+ );
28
+
29
+ expectType<void>(
30
+ await deletePendingChannel({
31
+ lnd,
32
+ confirmed_transaction,
33
+ pending_transaction,
34
+ pending_transaction_vout,
35
+ })
36
+ );
37
+
38
+ expectType<void>(
39
+ deletePendingChannel(
40
+ {lnd, confirmed_transaction, pending_transaction, pending_transaction_vout},
41
+ () => {}
42
+ )
43
+ );
@@ -5,14 +5,18 @@ import {getInvoices, GetInvoicesResult} from '../../lnd_methods';
5
5
  const lnd = {} as AuthenticatedLnd;
6
6
  const limit = 100;
7
7
  const token = 'token';
8
+ const is_unconfirmed = true;
8
9
 
9
10
  expectError(getInvoices());
10
11
  expectError(getInvoices({}));
11
12
  expectError(getInvoices({lnd, limit, token}));
13
+ expectError(getInvoices({lnd, limit, token, is_unconfirmed}));
12
14
 
13
15
  expectType<GetInvoicesResult>(await getInvoices({lnd}));
14
16
  expectType<GetInvoicesResult>(await getInvoices({lnd, limit}));
17
+ expectType<GetInvoicesResult>(await getInvoices({lnd, limit, is_unconfirmed}));
15
18
  expectType<GetInvoicesResult>(await getInvoices({lnd, token}));
19
+ expectType<GetInvoicesResult>(await getInvoices({lnd, token, is_unconfirmed}));
16
20
 
17
21
  expectType<void>(
18
22
  getInvoices({lnd}, (error, result) => {
@@ -24,8 +28,18 @@ expectType<void>(
24
28
  expectType<GetInvoicesResult>(result);
25
29
  })
26
30
  );
31
+ expectType<void>(
32
+ getInvoices({lnd, limit, is_unconfirmed}, (error, result) => {
33
+ expectType<GetInvoicesResult>(result);
34
+ })
35
+ );
27
36
  expectType<void>(
28
37
  getInvoices({lnd, token}, (error, result) => {
29
38
  expectType<GetInvoicesResult>(result);
30
39
  })
31
40
  );
41
+ expectType<void>(
42
+ getInvoices({lnd, token, is_unconfirmed}, (error, result) => {
43
+ expectType<GetInvoicesResult>(result);
44
+ })
45
+ );
@@ -0,0 +1,18 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {AuthenticatedLnd} from '../../lnd_grpc';
3
+ import {partiallySignPsbt, PartiallySignPsbtResult} from '../../lnd_methods';
4
+
5
+ const lnd = {} as AuthenticatedLnd;
6
+ const psbt = 'psbt';
7
+
8
+ expectError(partiallySignPsbt());
9
+ expectError(partiallySignPsbt({}));
10
+ expectError(partiallySignPsbt({lnd}));
11
+
12
+ expectType<PartiallySignPsbtResult>(await partiallySignPsbt({lnd, psbt}));
13
+
14
+ expectType<void>(
15
+ partiallySignPsbt({lnd, psbt}, (error, result) => {
16
+ expectType<PartiallySignPsbtResult>(result);
17
+ })
18
+ );