lightning 5.18.0 → 5.19.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,11 @@
1
1
  # Versions
2
2
 
3
+ ## 5.19.0
4
+
5
+ - `closeChannel`: Add support for `max_tokens_per_vbyte` to set max fee rate
6
+ - `getChainTransactions`: Add `inputs` support for previous outpoints
7
+ - `subscribeToTransactions`: Add `inputs` support for previous outpoints
8
+
3
9
  ## 5.18.0
4
10
 
5
11
  - `signBytes`: Add `type` and support for specifying `schnorr` type signing
@@ -693,7 +693,11 @@ message Transaction {
693
693
 
694
694
  // A label that was optionally set on transaction broadcast.
695
695
  string label = 10;
696
+
697
+ // PreviousOutpoints/Inputs of this transaction.
698
+ repeated PreviousOutPoint previous_outpoints = 12;
696
699
  }
700
+
697
701
  message GetTransactionsRequest {
698
702
  /*
699
703
  The height from which to list transactions, inclusive. If this value is
@@ -1029,12 +1033,21 @@ message OutPoint {
1029
1033
  uint32 output_index = 3;
1030
1034
  }
1031
1035
 
1036
+ message PreviousOutPoint {
1037
+ // The outpoint in format txid:n.
1038
+ string outpoint = 1;
1039
+
1040
+ // Denotes if the outpoint is controlled by the internal wallet.
1041
+ // The flag will only detect p2wkh, np2wkh and p2tr inputs as its own.
1042
+ bool is_our_output = 2;
1043
+ }
1044
+
1032
1045
  message LightningAddress {
1033
- // The identity pubkey of the Lightning node
1046
+ // The identity pubkey of the Lightning node.
1034
1047
  string pubkey = 1;
1035
1048
 
1036
1049
  // The network location of the lightning node, e.g. `69.69.69.69:1337` or
1037
- // `localhost:10011`
1050
+ // `localhost:10011`.
1038
1051
  string host = 2;
1039
1052
  }
1040
1053
 
@@ -1223,11 +1236,15 @@ message VerifyMessageResponse {
1223
1236
  }
1224
1237
 
1225
1238
  message ConnectPeerRequest {
1226
- // Lightning address of the peer, in the format `<pubkey>@host`
1239
+ /*
1240
+ Lightning address of the peer to connect to.
1241
+ */
1227
1242
  LightningAddress addr = 1;
1228
1243
 
1229
- /* If set, the daemon will attempt to persistently connect to the target
1230
- * peer. Otherwise, the call will be synchronous. */
1244
+ /*
1245
+ If set, the daemon will attempt to persistently connect to the target
1246
+ peer. Otherwise, the call will be synchronous.
1247
+ */
1231
1248
  bool perm = 2;
1232
1249
 
1233
1250
  /*
@@ -1945,6 +1962,11 @@ message CloseChannelRequest {
1945
1962
  // A manual fee rate set in sat/vbyte that should be used when crafting the
1946
1963
  // closure transaction.
1947
1964
  uint64 sat_per_vbyte = 6;
1965
+
1966
+ // The maximum fee rate the closer is willing to pay.
1967
+ //
1968
+ // NOTE: This field is only respected if we're the initiator of the channel.
1969
+ uint64 max_fee_per_vbyte = 7;
1948
1970
  }
1949
1971
 
1950
1972
  message CloseStatusUpdate {
@@ -2620,6 +2642,9 @@ message WalletBalanceResponse {
2620
2642
  // other usage.
2621
2643
  int64 locked_balance = 5;
2622
2644
 
2645
+ // The amount of reserve required.
2646
+ int64 reserved_balance_anchor_chan = 6;
2647
+
2623
2648
  // A mapping of each wallet account's name to its balance.
2624
2649
  map<string, WalletAccountBalance> account_balance = 4;
2625
2650
  }
@@ -3241,6 +3266,7 @@ message Invoice {
3241
3266
  /*
3242
3267
  The hash of the preimage. When using REST, this field must be encoded as
3243
3268
  base64.
3269
+ Note: Output only, don't specify for creating an invoice.
3244
3270
  */
3245
3271
  bytes r_hash = 4;
3246
3272
 
@@ -3258,19 +3284,30 @@ message Invoice {
3258
3284
  */
3259
3285
  int64 value_msat = 23;
3260
3286
 
3261
- // Whether this invoice has been fulfilled
3287
+ /*
3288
+ Whether this invoice has been fulfilled
3289
+
3290
+ The field is deprecated. Use the state field instead (compare to SETTLED).
3291
+ */
3262
3292
  bool settled = 6 [deprecated = true];
3263
3293
 
3264
- // When this invoice was created
3294
+ /*
3295
+ When this invoice was created.
3296
+ Note: Output only, don't specify for creating an invoice.
3297
+ */
3265
3298
  int64 creation_date = 7;
3266
3299
 
3267
- // When this invoice was settled
3300
+ /*
3301
+ When this invoice was settled.
3302
+ Note: Output only, don't specify for creating an invoice.
3303
+ */
3268
3304
  int64 settle_date = 8;
3269
3305
 
3270
3306
  /*
3271
3307
  A bare-bones invoice for a payment within the Lightning Network. With the
3272
3308
  details of the invoice, the sender has all the data necessary to send a
3273
3309
  payment to the recipient.
3310
+ Note: Output only, don't specify for creating an invoice.
3274
3311
  */
3275
3312
  string payment_request = 9;
3276
3313
 
@@ -3305,6 +3342,7 @@ message Invoice {
3305
3342
  this index making it monotonically increasing. Callers to the
3306
3343
  SubscribeInvoices call can use this to instantly get notified of all added
3307
3344
  invoices with an add_index greater than this one.
3345
+ Note: Output only, don't specify for creating an invoice.
3308
3346
  */
3309
3347
  uint64 add_index = 16;
3310
3348
 
@@ -3313,6 +3351,7 @@ message Invoice {
3313
3351
  increment this index making it monotonically increasing. Callers to the
3314
3352
  SubscribeInvoices call can use this to instantly get notified of all
3315
3353
  settled invoices with an settle_index greater than this one.
3354
+ Note: Output only, don't specify for creating an invoice.
3316
3355
  */
3317
3356
  uint64 settle_index = 17;
3318
3357
 
@@ -3326,6 +3365,7 @@ message Invoice {
3326
3365
  was ultimately accepted. Additionally, it's possible that the sender paid
3327
3366
  MORE that was specified in the original invoice. So we'll record that here
3328
3367
  as well.
3368
+ Note: Output only, don't specify for creating an invoice.
3329
3369
  */
3330
3370
  int64 amt_paid_sat = 19;
3331
3371
 
@@ -3336,6 +3376,7 @@ message Invoice {
3336
3376
  amount was ultimately accepted. Additionally, it's possible that the sender
3337
3377
  paid MORE that was specified in the original invoice. So we'll record that
3338
3378
  here as well.
3379
+ Note: Output only, don't specify for creating an invoice.
3339
3380
  */
3340
3381
  int64 amt_paid_msat = 20;
3341
3382
 
@@ -3348,18 +3389,26 @@ message Invoice {
3348
3389
 
3349
3390
  /*
3350
3391
  The state the invoice is in.
3392
+ Note: Output only, don't specify for creating an invoice.
3351
3393
  */
3352
3394
  InvoiceState state = 21;
3353
3395
 
3354
- // List of HTLCs paying to this invoice [EXPERIMENTAL].
3396
+ /*
3397
+ List of HTLCs paying to this invoice [EXPERIMENTAL].
3398
+ Note: Output only, don't specify for creating an invoice.
3399
+ */
3355
3400
  repeated InvoiceHTLC htlcs = 22;
3356
3401
 
3357
- // List of features advertised on the invoice.
3402
+ /*
3403
+ List of features advertised on the invoice.
3404
+ Note: Output only, don't specify for creating an invoice.
3405
+ */
3358
3406
  map<uint32, Feature> features = 24;
3359
3407
 
3360
3408
  /*
3361
3409
  Indicates if this invoice was a spontaneous payment that arrived via keysend
3362
3410
  [EXPERIMENTAL].
3411
+ Note: Output only, don't specify for creating an invoice.
3363
3412
  */
3364
3413
  bool is_keysend = 25;
3365
3414
 
@@ -3367,6 +3416,7 @@ message Invoice {
3367
3416
  The payment address of this invoice. This value will be used in MPP
3368
3417
  payments, and also for newer invoices that always require the MPP payload
3369
3418
  for added end-to-end security.
3419
+ Note: Output only, don't specify for creating an invoice.
3370
3420
  */
3371
3421
  bytes payment_addr = 26;
3372
3422
 
@@ -3382,6 +3432,7 @@ message Invoice {
3382
3432
  given set ID. This field is always populated for AMP invoices, and can be
3383
3433
  used along side LookupInvoice to obtain the HTLC information related to a
3384
3434
  given sub-invoice.
3435
+ Note: Output only, don't specify for creating an invoice.
3385
3436
  */
3386
3437
  map<string, AMPInvoiceState> amp_invoice_state = 28;
3387
3438
  }
@@ -4389,6 +4440,14 @@ message RPCMiddlewareRequest {
4389
4440
  the same type, or replaced by an error message.
4390
4441
  */
4391
4442
  RPCMessage response = 6;
4443
+
4444
+ /*
4445
+ This is used to indicate to the client that the server has successfully
4446
+ registered the interceptor. This is only used in the very first message
4447
+ that the server sends to the client after the client sends the server
4448
+ the middleware registration message.
4449
+ */
4450
+ bool reg_complete = 8;
4392
4451
  }
4393
4452
 
4394
4453
  /*
@@ -4426,7 +4485,8 @@ message RPCMessage {
4426
4485
 
4427
4486
  /*
4428
4487
  The full canonical gRPC name of the message type (in the format
4429
- <rpcpackage>.TypeName, for example lnrpc.GetInfoRequest).
4488
+ <rpcpackage>.TypeName, for example lnrpc.GetInfoRequest). In case of an
4489
+ error being returned from lnd, this simply contains the string "error".
4430
4490
  */
4431
4491
  string type_name = 3;
4432
4492
 
@@ -4435,6 +4495,13 @@ message RPCMessage {
4435
4495
  format.
4436
4496
  */
4437
4497
  bytes serialized = 4;
4498
+
4499
+ /*
4500
+ Indicates that the response from lnd was an error, not a gRPC response. If
4501
+ this is set to true then the type_name contains the string "error" and
4502
+ serialized contains the error string.
4503
+ */
4504
+ bool is_error = 5;
4438
4505
  }
4439
4506
 
4440
4507
  message RPCMiddlewareResponse {
@@ -4511,18 +4578,16 @@ message InterceptFeedback {
4511
4578
  string error = 1;
4512
4579
 
4513
4580
  /*
4514
- A boolean indicating that the gRPC response should be replaced/overwritten.
4515
- As its name suggests, this can only be used as a feedback to an intercepted
4516
- response RPC message and is ignored for feedback on any other message. This
4517
- boolean is needed because in protobuf an empty message is serialized as a
4518
- 0-length or nil byte slice and we wouldn't be able to distinguish between
4581
+ A boolean indicating that the gRPC message should be replaced/overwritten.
4582
+ This boolean is needed because in protobuf an empty message is serialized as
4583
+ a 0-length or nil byte slice and we wouldn't be able to distinguish between
4519
4584
  an empty replacement message and the "don't replace anything" case.
4520
4585
  */
4521
4586
  bool replace_response = 2;
4522
4587
 
4523
4588
  /*
4524
4589
  If the replace_response field is set to true, this field must contain the
4525
- binary serialized gRPC response message in the protobuf format.
4590
+ binary serialized gRPC message in the protobuf format.
4526
4591
  */
4527
4592
  bytes replacement_serialized = 3;
4528
4593
  }
@@ -15,17 +15,23 @@ const type = 'default';
15
15
 
16
16
  If cooperatively closing, pass a public key and socket to connect
17
17
 
18
- Requires info:read, offchain:write, onchain:write, peers:write permissions
18
+ `max_tokens_per_vbyte` will be ignored when closing a peer initiated channel
19
+
20
+ Requires `info:read`, `offchain:write`, `onchain:write`, `peers:write`
21
+ permissions
22
+
23
+ `max_tokens_per_vbyte` is not supported in LND 0.15.0 and below
19
24
 
20
25
  {
21
26
  [address]: <Request Sending Local Channel Funds To Address String>
22
27
  [id]: <Standard Format Channel Id String>
23
28
  [is_force_close]: <Is Force Close Bool>
24
29
  lnd: <Authenticated LND API Object>
30
+ [max_tokens_per_vbyte]: <Fail Cooperative Close Above Fee Rate Number>
25
31
  [public_key]: <Peer Public Key String>
26
32
  [socket]: <Peer Socket String>
27
33
  [target_confirmations]: <Confirmation Target Number>
28
- [tokens_per_vbyte]: <Tokens Per Virtual Byte Number>
34
+ [tokens_per_vbyte]: <Target Tokens Per Virtual Byte Number>
29
35
  [transaction_id]: <Transaction Id Hex String>
30
36
  [transaction_vout]: <Transaction Output Index Number>
31
37
  }
@@ -115,6 +121,7 @@ module.exports = (args, cbk) => {
115
121
  },
116
122
  delivery_address: args.address || undefined,
117
123
  force: !!args.is_force_close,
124
+ max_fee_per_vbyte: args.max_tokens_per_vbyte || undefined,
118
125
  sat_per_byte: !!tokensPerVByte ? tokensPerVByte : undefined,
119
126
  target_conf: args.target_confirmations || undefined,
120
127
  });
@@ -13,10 +13,12 @@ const type = 'default';
13
13
 
14
14
  Requires `onchain:read` permission
15
15
 
16
+ `inputs` are not supported on LND 0.15.0 and below
17
+
16
18
  {
17
19
  [after]: <Confirmed After Current Best Chain Block Height Number>
18
20
  [before]: <Confirmed Before Current Best Chain Block Height Number>
19
- lnd: <Authenticated LND Object>
21
+ lnd: <Authenticated LND API Object>
20
22
  }
21
23
 
22
24
  @returns via cbk or Promise
@@ -29,6 +31,11 @@ const type = 'default';
29
31
  [description]: <Transaction Label String>
30
32
  [fee]: <Fees Paid Tokens Number>
31
33
  id: <Transaction Id String>
34
+ inputs: [{
35
+ is_local: <Spent Outpoint is Local Bool>
36
+ transaction_id: <Transaction Id Hex String>
37
+ transaction_vout: <Transaction Output Index Number>
38
+ }]
32
39
  is_confirmed: <Is Confirmed Bool>
33
40
  is_outgoing: <Transaction Outbound Bool>
34
41
  output_addresses: [<Address String>]
@@ -12,6 +12,8 @@ const type = 'default';
12
12
 
13
13
  Requires `onchain:read` permission
14
14
 
15
+ `inputs` are not supported on LND 0.15.0 and below
16
+
15
17
  {
16
18
  lnd: <Authenticated LND API Object>
17
19
  }
@@ -30,6 +32,11 @@ const type = 'default';
30
32
  created_at: <Created ISO 8601 Date String>
31
33
  [fee]: <Fees Paid Tokens Number>
32
34
  id: <Transaction Id String>
35
+ inputs: [{
36
+ is_local: <Spent Outpoint is Local Bool>
37
+ transaction_id: <Transaction Id Hex String>
38
+ transaction_vout: <Transaction Output Index Number>
39
+ }]
33
40
  is_confirmed: <Is Confirmed Bool>
34
41
  is_outgoing: <Transaction Outbound Bool>
35
42
  output_addresses: [<Address String>]
@@ -59,10 +59,6 @@ module.exports = (args, cbk) => {
59
59
  },
60
60
  },
61
61
  err => {
62
- if (!!err && unsuppportedErr.test(err.details)) {
63
- return cbk([501, 'BackingLndDoesNotSupportUnlockingUtxos']);
64
- }
65
-
66
62
  if (!!err) {
67
63
  return cbk([503, 'UnexpectedErrorUnlockingUtxo', {err}]);
68
64
  }
@@ -167,10 +167,6 @@ module.exports = args => {
167
167
  throw new Error('ExpectedPreimageInLookupInvoiceResponse');
168
168
  }
169
169
 
170
- if (args.settled !== false && args.settled !== true) {
171
- throw new Error('ExpectedSettledStateInLookupInvoiceResponse');
172
- }
173
-
174
170
  if (args.value === undefined) {
175
171
  throw new Error('ExpectedTokensValueInLookupInvoiceResponse');
176
172
  }
@@ -180,6 +176,7 @@ module.exports = args => {
180
176
  const descHash = args.description_hash;
181
177
  const expiresInMs = Number(args.expiry) * msPerSec;
182
178
  const isAmpPush = !args.payment_request && !!args.is_amp;
179
+ const isConfirmed = args.state === 'SETTLED';
183
180
  const mtok = (BigInt(args.value) * mtokensPerToken).toString();
184
181
  const payment = args.payment_addr.toString('hex');
185
182
  const settleDate = args.settle_date;
@@ -190,7 +187,7 @@ module.exports = args => {
190
187
  return {
191
188
  chain_address: args.fallback_addr || undefined,
192
189
  cltv_delta: Number(args.cltv_expiry),
193
- confirmed_at: !args.settled ? undefined : dateFrom(settleDate),
190
+ confirmed_at: isConfirmed ? dateFrom(settleDate) : undefined,
194
191
  confirmed_index: confirmedIndex || undefined,
195
192
  created_at: new Date(createdAtMs).toISOString(),
196
193
  description: args.memo,
@@ -205,7 +202,7 @@ module.exports = args => {
205
202
  id: args.r_hash.toString('hex'),
206
203
  index: Number(args.add_index),
207
204
  is_canceled: args.state === 'CANCELED' || undefined,
208
- is_confirmed: args.settled,
205
+ is_confirmed: isConfirmed,
209
206
  is_held: args.state === 'ACCEPTED' || undefined,
210
207
  is_private: args.private,
211
208
  is_push: isAmpPush || args.is_keysend || undefined,
@@ -1,8 +1,12 @@
1
1
  const {abs} = Math;
2
2
  const {isArray} = Array;
3
+ const isBool = n => n === false || n === true;
3
4
  const isHash = n => !!n && /^[0-9A-F]{64}$/i.test(n);
5
+ const isNumber = n => !!n && !isNaN(n);
4
6
  const msPerSec = 1e3;
5
7
  const notFound = -1;
8
+ const nullHash = '0000000000000000000000000000000000000000000000000000000000000000';
9
+ const outpointAsComponents = n => n.split(':');
6
10
 
7
11
  /** Transaction from RPC transaction message
8
12
 
@@ -13,6 +17,10 @@ const notFound = -1;
13
17
  dest_addresses: [<Output Address String>]
14
18
  label: <Label String>
15
19
  num_confirmations: <Confirmation Count Number>
20
+ previous_outpoints: [{
21
+ is_our_output: <Is Local Output Bool>
22
+ outpoint: <Outpoint String>
23
+ }]
16
24
  raw_tx_hex: <Raw Transaction Serialized Hex String>
17
25
  time_stamp: <Transaction Created At Epoch Time String>
18
26
  total_fees: <Total Fees Paid Related To This Transaction String>
@@ -31,6 +39,11 @@ const notFound = -1;
31
39
  [description]: <Transaction Label String>
32
40
  [fee]: <Fees Paid Tokens Number>
33
41
  id: <Transaction Id String>
42
+ inputs: [{
43
+ is_local: <Spent Outpoint is Local Bool>
44
+ transaction_id: <Transaction Id Hex String>
45
+ transaction_vout: <Transaction Output Index Number>
46
+ }]
34
47
  is_confirmed: <Is Confirmed Bool>
35
48
  is_outgoing: <Transaction Outbound Bool>
36
49
  output_addresses: [<Address String>]
@@ -67,6 +80,10 @@ module.exports = tx => {
67
80
  throw new Error('ExpectedChainTransactionConfirmationsCount');
68
81
  }
69
82
 
83
+ if (!isArray(tx.previous_outpoints)) {
84
+ throw new Error('ExpectedArrayOfPreviousOutpointsInRpcTransaction');
85
+ }
86
+
70
87
  if (!tx.time_stamp) {
71
88
  throw new Error('ExpectedChainTransactionTimestamp');
72
89
  }
@@ -79,6 +96,37 @@ module.exports = tx => {
79
96
  throw new Error('ExpectedChainTransactionId');
80
97
  }
81
98
 
99
+ const inputs = tx.previous_outpoints.map(spend => {
100
+ if (!spend.outpoint) {
101
+ throw new Error('ExpectedPreviousOutpointInRpcTransaction');
102
+ }
103
+
104
+ const [id, vout] = outpointAsComponents(spend.outpoint);
105
+
106
+ if (!isHash(id)) {
107
+ throw new Error('ExpectedOutpointSpendingTransactionIdInRpcTx');
108
+ }
109
+
110
+ // Exit early when spend is empty
111
+ if (id === nullHash) {
112
+ return null;
113
+ }
114
+
115
+ if (!isNumber(vout)) {
116
+ throw new Error('ExpectedOutpointSpendingTransactionVoutInRpcTx');
117
+ }
118
+
119
+ if (!isBool(spend.is_our_output)) {
120
+ throw new Error('ExpectedOutpointOwnershipBooleanInRpcTransaction');
121
+ }
122
+
123
+ return {
124
+ is_local: spend.is_our_output,
125
+ transaction_id: id,
126
+ transaction_vout: Number(vout),
127
+ };
128
+ });
129
+
82
130
  return {
83
131
  block_id: tx.block_hash || undefined,
84
132
  confirmation_count: tx.num_confirmations || undefined,
@@ -87,6 +135,7 @@ module.exports = tx => {
87
135
  description: tx.label || undefined,
88
136
  fee: Number(tx.total_fees) || undefined,
89
137
  id: tx.tx_hash,
138
+ inputs: inputs.filter(n => !!n),
90
139
  is_confirmed: !!tx.num_confirmations,
91
140
  is_outgoing: Number(tx.amount) < Number(),
92
141
  output_addresses: tx.dest_addresses,
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.8",
13
+ "@types/node": "18.7.9",
14
14
  "@types/request": "2.48.8",
15
15
  "@types/ws": "8.5.3",
16
16
  "async": "3.2.4",
@@ -59,5 +59,5 @@
59
59
  "directory": "test/typescript"
60
60
  },
61
61
  "types": "index.d.ts",
62
- "version": "5.18.0"
62
+ "version": "5.19.0"
63
63
  }
@@ -11,6 +11,7 @@ const makeExpected = overrides => {
11
11
  description: undefined,
12
12
  fee: 1,
13
13
  id: Buffer.alloc(32).toString('hex'),
14
+ inputs: [],
14
15
  is_confirmed: true,
15
16
  is_outgoing: false,
16
17
  output_addresses: ['address'],
@@ -33,6 +34,7 @@ const makeLnd = overrides => {
33
34
  block_height: 1,
34
35
  dest_addresses: ['address'],
35
36
  num_confirmations: 1,
37
+ previous_outpoints: [],
36
38
  time_stamp: '1',
37
39
  total_fees: '1',
38
40
  tx_hash: Buffer.alloc(32).toString('hex'),
@@ -13,6 +13,7 @@ const makeDefault = overrides => {
13
13
  block_height: 1,
14
14
  dest_addresses: ['address'],
15
15
  num_confirmations: 1,
16
+ previous_outpoints: [],
16
17
  raw_tx_hex: (new Transaction()).toHex(),
17
18
  time_stamp: '1',
18
19
  total_fees: '1',
@@ -11,6 +11,7 @@ const makeLnd = overrides => {
11
11
  block_height: 1,
12
12
  dest_addresses: ['address'],
13
13
  num_confirmations: 1,
14
+ previous_outpoints: [],
14
15
  raw_tx_hex: '00',
15
16
  time_stamp: '1',
16
17
  total_fees: '1',
@@ -95,6 +96,7 @@ const tests = [
95
96
  description: undefined,
96
97
  fee: 1,
97
98
  id: '0000000000000000000000000000000000000000000000000000000000000000',
99
+ inputs: [],
98
100
  is_confirmed: true,
99
101
  is_outgoing: false,
100
102
  output_addresses: ['address'],
@@ -38,13 +38,6 @@ const tests = [
38
38
  description: 'A transaction id is required to unlock a utxo',
39
39
  error: [400, 'ExpectedTransactionOutputIndexToUnlockUtxo'],
40
40
  },
41
- {
42
- args: makeArgs({
43
- lnd: {wallet: {releaseOutput: ({}, cbk) => cbk({details: 'unknown'})}},
44
- }),
45
- description: 'LND unknown service errors are returned',
46
- error: [501, 'BackingLndDoesNotSupportUnlockingUtxos'],
47
- },
48
41
  {
49
42
  args: makeArgs({lnd: {wallet: {releaseOutput: ({}, cbk) => cbk('err')}}}),
50
43
  description: 'LND errors are returned',
@@ -49,7 +49,6 @@ const makeInput = overrides => {
49
49
  }],
50
50
  settle_date: '1',
51
51
  settle_index: '1',
52
- settled: false,
53
52
  state: 'STATE',
54
53
  value: '1',
55
54
  value_msat: '1000',
@@ -179,11 +178,6 @@ const tests = [
179
178
  description: 'Preimage is expected',
180
179
  error: 'ExpectedPreimageInLookupInvoiceResponse',
181
180
  },
182
- {
183
- args: makeInput({settled: undefined}),
184
- description: 'Settled is expected',
185
- error: 'ExpectedSettledStateInLookupInvoiceResponse',
186
- },
187
181
  {
188
182
  args: makeInput({value: undefined}),
189
183
  description: 'Value is expected',
@@ -199,7 +193,7 @@ const tests = [
199
193
  is_amp: true,
200
194
  is_keysend: false,
201
195
  payment_request: undefined,
202
- settled: true,
196
+ state: 'SETTLED',
203
197
  }),
204
198
  description: 'AMP invoice mapped to invoice',
205
199
  expected: makeExpected({
@@ -211,7 +205,7 @@ const tests = [
211
205
  {
212
206
  args: makeInput({
213
207
  payment_request: undefined,
214
- settled: true,
208
+ state: 'SETTLED',
215
209
  value_msat: '0',
216
210
  }),
217
211
  description: 'Unsettled zero RPC invoice mapped to invoice',
@@ -9,6 +9,16 @@ const makeTx = override => {
9
9
  block_height: 1,
10
10
  dest_addresses: ['address'],
11
11
  num_confirmations: 1,
12
+ previous_outpoints: [
13
+ {
14
+ is_our_output: true,
15
+ outpoint: `${Buffer.alloc(32).toString('hex')}:1`,
16
+ },
17
+ {
18
+ is_our_output: true,
19
+ outpoint: `${Buffer.alloc(32, 1).toString('hex')}:1`,
20
+ },
21
+ ],
12
22
  raw_tx_hex: '00',
13
23
  time_stamp: '1',
14
24
  total_fees: '1',
@@ -56,6 +66,39 @@ const tests = [
56
66
  description: 'Confirmation count is expected',
57
67
  error: 'ExpectedChainTransactionConfirmationsCount',
58
68
  },
69
+ {
70
+ args: makeTx({previous_outpoints: undefined}),
71
+ description: 'Previous outpoints are expected',
72
+ error: 'ExpectedArrayOfPreviousOutpointsInRpcTransaction',
73
+ },
74
+ {
75
+ args: makeTx({previous_outpoints: [{}]}),
76
+ description: 'An outpoint spend is expected',
77
+ error: 'ExpectedPreviousOutpointInRpcTransaction',
78
+ },
79
+ {
80
+ args: makeTx({previous_outpoints: [{outpoint: '00'}]}),
81
+ description: 'An outpoint with a tx id is expected',
82
+ error: 'ExpectedOutpointSpendingTransactionIdInRpcTx',
83
+ },
84
+ {
85
+ args: makeTx({
86
+ previous_outpoints: [{
87
+ outpoint: `${Buffer.alloc(32, 1).toString('hex')}`,
88
+ }],
89
+ }),
90
+ description: 'An outpoint with a tx vout is expected',
91
+ error: 'ExpectedOutpointSpendingTransactionVoutInRpcTx',
92
+ },
93
+ {
94
+ args: makeTx({
95
+ previous_outpoints: [{
96
+ outpoint: `${Buffer.alloc(32, 1).toString('hex')}:1`,
97
+ }],
98
+ }),
99
+ description: 'Local status for spend is expected',
100
+ error: 'ExpectedOutpointOwnershipBooleanInRpcTransaction',
101
+ },
59
102
  {
60
103
  args: makeTx({time_stamp: undefined}),
61
104
  description: 'A time stamp is expected',
@@ -82,6 +125,11 @@ const tests = [
82
125
  description: undefined,
83
126
  fee: 1,
84
127
  id: Buffer.alloc(32).toString('hex'),
128
+ inputs: [{
129
+ is_local: true,
130
+ transaction_id: '0101010101010101010101010101010101010101010101010101010101010101',
131
+ transaction_vout: 1,
132
+ }],
85
133
  is_confirmed: true,
86
134
  is_outgoing: false,
87
135
  output_addresses: ['address'],
@@ -95,6 +143,7 @@ const tests = [
95
143
  block_hash: '',
96
144
  block_height: 0,
97
145
  num_confirmations: 0,
146
+ previous_outpoints: [],
98
147
  raw_tx_hex: '',
99
148
  total_fees: '0',
100
149
  }),
@@ -107,6 +156,7 @@ const tests = [
107
156
  description: undefined,
108
157
  fee: undefined,
109
158
  id: Buffer.alloc(32).toString('hex'),
159
+ inputs: [],
110
160
  is_confirmed: false,
111
161
  is_outgoing: true,
112
162
  output_addresses: ['address'],