lightning 5.19.0 → 5.20.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.20.0
4
+
5
+ - `getLockedUtxos`: Add support for returning script, value of locked utxos
6
+
3
7
  ## 5.19.0
4
8
 
5
9
  - `closeChannel`: Add support for `max_tokens_per_vbyte` to set max fee rate
@@ -72,6 +72,12 @@ message ConfRequest {
72
72
  broadcast height of the transaction/output script.
73
73
  */
74
74
  uint32 height_hint = 4;
75
+
76
+ /*
77
+ If true, then the block that mines the specified txid/script will be
78
+ included in eventual the notification event.
79
+ */
80
+ bool include_block = 5;
75
81
  }
76
82
 
77
83
  message ConfDetails {
@@ -87,6 +93,12 @@ message ConfDetails {
87
93
 
88
94
  // The index of the confirmed transaction within the transaction.
89
95
  uint32 tx_index = 4;
96
+
97
+ /*
98
+ The raw bytes of the block that mined the transaction. Only included if
99
+ include_block was set in the request.
100
+ */
101
+ bytes raw_block = 5;
90
102
  }
91
103
 
92
104
  message Reorg {
@@ -336,6 +336,14 @@ message SendToRouteRequest {
336
336
 
337
337
  // Route that should be used to attempt to complete the payment.
338
338
  lnrpc.Route route = 2;
339
+
340
+ /*
341
+ Whether the payment should be marked as failed when a temporary error is
342
+ returned from the given route. Set it to true so the payment won't be
343
+ failed unless a terminal error is occurred, such as payment timeout, no
344
+ routes, incorrect payment details, or insufficient funds.
345
+ */
346
+ bool skip_temp_err = 3;
339
347
  }
340
348
 
341
349
  message SendToRouteResponse {
@@ -844,6 +844,16 @@ message UtxoLease {
844
844
  The absolute expiration of the output lease represented as a unix timestamp.
845
845
  */
846
846
  uint64 expiration = 3;
847
+
848
+ /*
849
+ The public key script of the leased output.
850
+ */
851
+ bytes pk_script = 4;
852
+
853
+ /*
854
+ The value of the leased output in satoshis.
855
+ */
856
+ uint64 value = 5;
847
857
  }
848
858
 
849
859
  message SignPsbtRequest {
@@ -185,6 +185,13 @@ message InitWalletRequest {
185
185
  corresponding private keys and can serve signing RPC requests.
186
186
  */
187
187
  WatchOnly watch_only = 9;
188
+
189
+ /*
190
+ macaroon_root_key is an optional 32 byte macaroon root key that can be
191
+ provided when initializing the wallet rather than letting lnd generate one
192
+ on its own.
193
+ */
194
+ bytes macaroon_root_key = 10;
188
195
  }
189
196
  message InitWalletResponse {
190
197
  /*
@@ -6,6 +6,7 @@ const {isLnd} = require('./../../lnd_requests');
6
6
  const asMs = sec => Number(sec) * 1e3;
7
7
  const bufferAsHex = buffer => buffer.toString('hex');
8
8
  const {isArray} = Array;
9
+ const {isBuffer} = Buffer;
9
10
  const method = 'listLeases';
10
11
  const type = 'wallet';
11
12
  const unsuppportedErr = /unknown/;
@@ -18,6 +19,8 @@ const unsuppportedErr = /unknown/;
18
19
 
19
20
  This method is not supported on LND 0.12.1 and below
20
21
 
22
+ `output_script`, `tokens` are not supported on LND 0.15.0 and below
23
+
21
24
  {
22
25
  lnd: <Authenticated LND API Object>
23
26
  }
@@ -27,6 +30,8 @@ const unsuppportedErr = /unknown/;
27
30
  utxos: [{
28
31
  lock_expires_at: <Lock Expires At ISO 8601 Date String>
29
32
  lock_id: <Locking Id Hex String>
33
+ [output_script]: <Outpoint Output Script Hex String>
34
+ [tokens]: <Token Value of Outpoint Number>
30
35
  transaction_id: <Transaction Id Hex String>
31
36
  transaction_vout: <Transaction Output Index Number>
32
37
  }]
@@ -64,10 +69,16 @@ module.exports = ({lnd}, cbk) => {
64
69
  return cbk([503, 'ExpectedExpirationDateForLockedUtxo']);
65
70
  }
66
71
 
72
+ if (!!res.locked_utxos.filter(n => !isBuffer(n.pk_script)).length) {
73
+ return cbk([503, 'ExpectedPkScriptForLockedUtxosInResponse']);
74
+ }
75
+
67
76
  try {
68
77
  const utxos = res.locked_utxos.map(lock => ({
69
78
  lock_expires_at: new Date(asMs(lock.expiration)).toISOString(),
70
79
  lock_id: bufferAsHex(lock.id),
80
+ output_script: bufferAsHex(lock.pk_script) || undefined,
81
+ tokens: Number(lock.value) || undefined,
71
82
  transaction_id: lock.outpoint.txid_str,
72
83
  transaction_vout: lock.outpoint.output_index,
73
84
  }));
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "@grpc/grpc-js": "1.6.10",
11
11
  "@grpc/proto-loader": "0.7.2",
12
12
  "@types/express": "4.17.13",
13
- "@types/node": "18.7.9",
13
+ "@types/node": "18.7.13",
14
14
  "@types/request": "2.48.8",
15
15
  "@types/ws": "8.5.3",
16
16
  "async": "3.2.4",
@@ -26,7 +26,7 @@
26
26
  "invoices": "2.1.0",
27
27
  "psbt": "2.7.1",
28
28
  "tiny-secp256k1": "2.2.1",
29
- "type-fest": "2.18.1"
29
+ "type-fest": "2.19.0"
30
30
  },
31
31
  "description": "Lightning Network client library",
32
32
  "devDependencies": {
@@ -59,5 +59,5 @@
59
59
  "directory": "test/typescript"
60
60
  },
61
61
  "types": "index.d.ts",
62
- "version": "5.19.0"
62
+ "version": "5.20.0"
63
63
  }
@@ -13,6 +13,8 @@ const makeLnd = overrides => {
13
13
  output_index: 0,
14
14
  txid_str: Buffer.alloc(32).toString('hex'),
15
15
  },
16
+ pk_script: Buffer.alloc(1),
17
+ value: '1',
16
18
  };
17
19
 
18
20
  Object.keys(overrides).forEach(k => utxo[k] = overrides[k]);
@@ -56,12 +58,31 @@ const tests = [
56
58
  description: 'An outpoint is expected in a locked utxo',
57
59
  error: [503, 'UnexpectedErrorParsingLockedUtxosResponse'],
58
60
  },
61
+ {
62
+ args: {lnd: makeLnd({pk_script: undefined})},
63
+ description: 'An output script is expected in a locked utxo',
64
+ error: [503, 'ExpectedPkScriptForLockedUtxosInResponse'],
65
+ },
66
+ {
67
+ args: {lnd: makeLnd({pk_script: Buffer.alloc(0), value: '0'})},
68
+ description: 'Get legacy tx and map them to normalized transactions',
69
+ expected: [{
70
+ lock_expires_at: '1970-01-01T00:00:01.000Z',
71
+ lock_id: '0000000000000000000000000000000000000000000000000000000000000000',
72
+ output_script: undefined,
73
+ tokens: undefined,
74
+ transaction_id: Buffer.alloc(32).toString('hex'),
75
+ transaction_vout: 0,
76
+ }],
77
+ },
59
78
  {
60
79
  args: {lnd: makeLnd({})},
61
80
  description: 'Get transactions and map them to normalized transactions',
62
81
  expected: [{
63
82
  lock_expires_at: '1970-01-01T00:00:01.000Z',
64
83
  lock_id: '0000000000000000000000000000000000000000000000000000000000000000',
84
+ output_script: '00',
85
+ tokens: 1,
65
86
  transaction_id: Buffer.alloc(32).toString('hex'),
66
87
  transaction_vout: 0,
67
88
  }],