lightning 5.20.2 → 5.21.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,9 @@
1
1
  # Versions
2
2
 
3
+ ## 5.21.0
4
+
5
+ - `getChainFeeEstimate`: Add support for specifying min `utxo_confirmations`
6
+
3
7
  ## 5.20.2
4
8
 
5
9
  - `getWalletInfo`: Add support for detecting lnd versions 0.15.0 and 0.15.1
@@ -12,6 +12,8 @@ export type GetChainFeeEstimateArgs = AuthenticatedLightningArgs<{
12
12
  }[];
13
13
  /** Target Confirmations */
14
14
  target_confirmations?: number;
15
+ /** Minimum Confirmations for UTXO Selection */
16
+ utxo_confirmations?: number;
15
17
  }>;
16
18
 
17
19
  export type GetChainFeeEstimateResult = {
@@ -8,11 +8,14 @@ const {isArray} = Array;
8
8
  const method = 'estimateFee';
9
9
  const notFound = -1;
10
10
  const type = 'default';
11
+ const unconfirmedConfCount = 0;
11
12
 
12
13
  /** Get a chain fee estimate for a prospective chain send
13
14
 
14
15
  Requires `onchain:read` permission
15
16
 
17
+ Specifying 0 for `utxo_confirmations` is not supported in LND 0.13.0 or below
18
+
16
19
  {
17
20
  lnd: <Authenticated LND API Object>
18
21
  send_to: [{
@@ -20,6 +23,7 @@ const type = 'default';
20
23
  tokens: <Tokens Number>
21
24
  }]
22
25
  [target_confirmations]: <Target Confirmations Number>
26
+ [utxo_confirmations]: <Minimum Confirmations for UTXO Selection Number>
23
27
  }
24
28
 
25
29
  @returns via cbk or Promise
@@ -65,6 +69,8 @@ module.exports = (args, cbk) => {
65
69
  return args.lnd[type][method]({
66
70
  AddrToAmount,
67
71
  target_conf: args.target_confirmations || undefined,
72
+ min_confs: args.utxo_confirmations || undefined,
73
+ spend_unconfirmed: args.utxo_confirmations === unconfirmedConfCount,
68
74
  },
69
75
  (err, res) => {
70
76
  if (!!err) {
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/alexbosworth/lightning/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@grpc/grpc-js": "1.6.11",
10
+ "@grpc/grpc-js": "1.6.12",
11
11
  "@grpc/proto-loader": "0.7.2",
12
12
  "@types/express": "4.17.13",
13
13
  "@types/node": "18.7.14",
@@ -59,5 +59,5 @@
59
59
  "directory": "test/typescript"
60
60
  },
61
61
  "types": "index.d.ts",
62
- "version": "5.20.2"
62
+ "version": "5.21.0"
63
63
  }
@@ -78,6 +78,22 @@ const tests = [
78
78
  description: 'Fee rate and fee are given in chain response',
79
79
  expected: {fee: 1, tokens_per_vbyte: 1},
80
80
  },
81
+ {
82
+ args: {
83
+ lnd: {
84
+ default: {
85
+ estimateFee: ({}, cbk) => cbk(null, {
86
+ fee_sat: '1',
87
+ feerate_sat_per_byte: '1',
88
+ }),
89
+ },
90
+ },
91
+ send_to: [{address: 'address', tokens: 1}],
92
+ utxo_confirmations: 0,
93
+ },
94
+ description: 'Passing 0 UTXO confirmations is supported',
95
+ expected: {fee: 1, tokens_per_vbyte: 1},
96
+ },
81
97
  ];
82
98
 
83
99
  tests.forEach(({args, description, error, expected}) => {