lightning 5.16.6 → 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.
Files changed (44) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +2 -0
  3. package/bolt00/mtokens_amount.js +5 -0
  4. package/grpc/protos/lightning.proto +152 -17
  5. package/grpc/protos/signer.proto +31 -5
  6. package/index.js +3 -1
  7. package/lnd_methods/index.js +2 -0
  8. package/lnd_methods/info/get_network_graph.d.ts +1 -1
  9. package/lnd_methods/macaroon/methods.json +4 -0
  10. package/lnd_methods/offchain/get_channels.js +4 -0
  11. package/lnd_methods/offchain/get_closed_channels.js +16 -1
  12. package/lnd_methods/offchain/get_ephemeral_channel_ids.js +86 -0
  13. package/lnd_methods/offchain/index.js +2 -0
  14. package/lnd_methods/offchain/subscribe_to_channels.js +4 -0
  15. package/lnd_methods/offchain/subscribe_to_open_requests.js +6 -0
  16. package/lnd_methods/onchain/close_channel.js +9 -2
  17. package/lnd_methods/onchain/get_chain_transactions.js +8 -1
  18. package/lnd_methods/onchain/open_channels.js +9 -0
  19. package/lnd_methods/onchain/subscribe_to_transactions.js +7 -0
  20. package/lnd_methods/onchain/unlock_utxo.js +0 -4
  21. package/lnd_methods/signer/sign_bytes.js +17 -0
  22. package/lnd_methods/signer/verify_bytes_signature.js +6 -0
  23. package/lnd_responses/channel_accept_as_open_request.js +3 -0
  24. package/lnd_responses/rpc_channel_as_channel.js +17 -1
  25. package/lnd_responses/rpc_closed_channel_as_closed.js +17 -1
  26. package/lnd_responses/rpc_invoice_as_invoice.js +3 -6
  27. package/lnd_responses/rpc_tx_as_transaction.js +49 -0
  28. package/package.json +5 -5
  29. package/test/bolt00/test_mtokens_amount.js +10 -0
  30. package/test/lnd_methods/offchain/test_get_channels.js +3 -0
  31. package/test/lnd_methods/offchain/test_get_closed_channels.js +23 -0
  32. package/test/lnd_methods/offchain/test_get_ephemeral_channel_ids.js +68 -0
  33. package/test/lnd_methods/offchain/test_subscribe_to_channels.js +5 -0
  34. package/test/lnd_methods/offchain/test_subscribe_to_open_requests.js +1 -0
  35. package/test/lnd_methods/onchain/test_get_chain_transactions.js +2 -0
  36. package/test/lnd_methods/onchain/test_get_sweep_transactions.js +1 -0
  37. package/test/lnd_methods/onchain/test_subscribe_to_transactions.js +2 -0
  38. package/test/lnd_methods/onchain/test_unlock_utxo.js +0 -7
  39. package/test/lnd_methods/signer/test_sign_bytes.js +20 -2
  40. package/test/lnd_responses/test_channel_accept_as_open_request.js +1 -0
  41. package/test/lnd_responses/test_rpc_channel_as_channel.js +13 -0
  42. package/test/lnd_responses/test_rpc_closed_channel_as_closed.js +15 -0
  43. package/test/lnd_responses/test_rpc_invoice_as_invoice.js +2 -8
  44. package/test/lnd_responses/test_rpc_tx_as_transaction.js +50 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
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
+
9
+ ## 5.18.0
10
+
11
+ - `signBytes`: Add `type` and support for specifying `schnorr` type signing
12
+ - `verifyBytesSignature`: Add support for verifying Schnorr signatures
13
+
14
+ ## 5.17.0
15
+
16
+ - `getChannels`: Add support for `is_trusted_funding` and `other_ids`
17
+ - `getClosedChannels`: Add support for `other_ids`
18
+ - `getEphemeralChannelIds`: Add method to get other channel ids
19
+ - `openChannels`: Add support for `is_trusted_funding` for instant opening
20
+ - `subscribeToChannels`: Add support for `is_trusted_funding`, `other_ids`
21
+ - `subscribeToOpenRequests`: Add support for `is_trusted_funding`
22
+
3
23
  ## 5.16.6
4
24
 
5
25
  - `subscribeToInvoices`: Cancel subscription when there are no event listeners
package/README.md CHANGED
@@ -156,6 +156,8 @@ variables set:
156
156
  channels on the node.
157
157
  - [getConnectedWatchtowers](https://github.com/alexbosworth/ln-service#getconnectedwatchtowers):
158
158
  List watchtowers that were added
159
+ - [getEphemeralChannelIds](https://github.com/alexbosworth/ln-service#getephemeralchannelids):
160
+ List other channel ids for channels
159
161
  - [getFailedPayments](https://github.com/alexbosworth/ln-service#getfailedpayments): List out
160
162
  past payments that failed.
161
163
  - [getFeeRates](https://github.com/alexbosworth/ln-service#getfeerates): List routing fee rates
@@ -1,3 +1,4 @@
1
+ const isNumber = n => !isNaN(n);
1
2
  const tokensAsMtokens = tokens => (BigInt(tokens) * BigInt(1e3)).toString();
2
3
 
3
4
  /** Derive millitokens from tokens and mtokens
@@ -20,6 +21,10 @@ module.exports = ({mtokens, tokens}) => {
20
21
  return {};
21
22
  }
22
23
 
24
+ if (!mtokens && !isNumber(tokens)) {
25
+ throw new Error('ExpectedEitherTokensNumberOrMtokensStringForAmountValue');
26
+ }
27
+
23
28
  // Exit early when there is only tokens set
24
29
  if (!mtokens) {
25
30
  return {mtokens: tokensAsMtokens(tokens)};
@@ -570,6 +570,13 @@ service Lightning {
570
570
  */
571
571
  rpc SubscribeCustomMessages (SubscribeCustomMessagesRequest)
572
572
  returns (stream CustomMessage);
573
+
574
+ /* lncli: `listaliases`
575
+ ListAliases returns the set of all aliases that have ever existed with
576
+ their confirmed SCID (if it exists) and/or the base SCID (in the case of
577
+ zero conf).
578
+ */
579
+ rpc ListAliases (ListAliasesRequest) returns (ListAliasesResponse);
573
580
  }
574
581
 
575
582
  message SubscribeCustomMessagesRequest {
@@ -686,7 +693,11 @@ message Transaction {
686
693
 
687
694
  // A label that was optionally set on transaction broadcast.
688
695
  string label = 10;
696
+
697
+ // PreviousOutpoints/Inputs of this transaction.
698
+ repeated PreviousOutPoint previous_outpoints = 12;
689
699
  }
700
+
690
701
  message GetTransactionsRequest {
691
702
  /*
692
703
  The height from which to list transactions, inclusive. If this value is
@@ -915,6 +926,14 @@ message ChannelAcceptRequest {
915
926
 
916
927
  // The commitment type the initiator wishes to use for the proposed channel.
917
928
  CommitmentType commitment_type = 14;
929
+
930
+ // Whether the initiator wants to open a zero-conf channel via the channel
931
+ // type.
932
+ bool wants_zero_conf = 15;
933
+
934
+ // Whether the initiator wants to use the scid-alias channel type. This is
935
+ // separate from the feature bit.
936
+ bool wants_scid_alias = 16;
918
937
  }
919
938
 
920
939
  message ChannelAcceptResponse {
@@ -975,6 +994,13 @@ message ChannelAcceptResponse {
975
994
  The number of confirmations we require before we consider the channel open.
976
995
  */
977
996
  uint32 min_accept_depth = 10;
997
+
998
+ /*
999
+ Whether the responder wants this to be a zero-conf channel. This will fail
1000
+ if either side does not have the scid-alias feature bit set. The minimum
1001
+ depth field must be zero if this is true.
1002
+ */
1003
+ bool zero_conf = 11;
978
1004
  }
979
1005
 
980
1006
  message ChannelPoint {
@@ -1007,12 +1033,21 @@ message OutPoint {
1007
1033
  uint32 output_index = 3;
1008
1034
  }
1009
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
+
1010
1045
  message LightningAddress {
1011
- // The identity pubkey of the Lightning node
1046
+ // The identity pubkey of the Lightning node.
1012
1047
  string pubkey = 1;
1013
1048
 
1014
1049
  // The network location of the lightning node, e.g. `69.69.69.69:1337` or
1015
- // `localhost:10011`
1050
+ // `localhost:10011`.
1016
1051
  string host = 2;
1017
1052
  }
1018
1053
 
@@ -1201,11 +1236,15 @@ message VerifyMessageResponse {
1201
1236
  }
1202
1237
 
1203
1238
  message ConnectPeerRequest {
1204
- // Lightning address of the peer, in the format `<pubkey>@host`
1239
+ /*
1240
+ Lightning address of the peer to connect to.
1241
+ */
1205
1242
  LightningAddress addr = 1;
1206
1243
 
1207
- /* If set, the daemon will attempt to persistently connect to the target
1208
- * 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
+ */
1209
1248
  bool perm = 2;
1210
1249
 
1211
1250
  /*
@@ -1458,6 +1497,18 @@ message Channel {
1458
1497
 
1459
1498
  // List constraints for the remote node.
1460
1499
  ChannelConstraints remote_constraints = 30;
1500
+
1501
+ /*
1502
+ This lists out the set of alias short channel ids that exist for a channel.
1503
+ This may be empty.
1504
+ */
1505
+ repeated uint64 alias_scids = 31;
1506
+
1507
+ // Whether or not this is a zero-conf channel.
1508
+ bool zero_conf = 32;
1509
+
1510
+ // This is the confirmed / on-chain zero-conf SCID.
1511
+ uint64 zero_conf_confirmed_scid = 33;
1461
1512
  }
1462
1513
 
1463
1514
  message ListChannelsRequest {
@@ -1477,6 +1528,22 @@ message ListChannelsResponse {
1477
1528
  repeated Channel channels = 11;
1478
1529
  }
1479
1530
 
1531
+ message AliasMap {
1532
+ /*
1533
+ For non-zero-conf channels, this is the confirmed SCID. Otherwise, this is
1534
+ the first assigned "base" alias.
1535
+ */
1536
+ uint64 base_scid = 1;
1537
+
1538
+ // The set of all aliases stored for the base SCID.
1539
+ repeated uint64 aliases = 2;
1540
+ }
1541
+ message ListAliasesRequest {
1542
+ }
1543
+ message ListAliasesResponse {
1544
+ repeated AliasMap alias_maps = 1;
1545
+ }
1546
+
1480
1547
  enum Initiator {
1481
1548
  INITIATOR_UNKNOWN = 0;
1482
1549
  INITIATOR_LOCAL = 1;
@@ -1541,6 +1608,15 @@ message ChannelCloseSummary {
1541
1608
  Initiator close_initiator = 12;
1542
1609
 
1543
1610
  repeated Resolution resolutions = 13;
1611
+
1612
+ /*
1613
+ This lists out the set of alias short channel ids that existed for the
1614
+ closed channel. This may be empty.
1615
+ */
1616
+ repeated uint64 alias_scids = 14;
1617
+
1618
+ // The confirmed SCID for a zero-conf channel.
1619
+ uint64 zero_conf_confirmed_scid = 15 [jstype = JS_STRING];
1544
1620
  }
1545
1621
 
1546
1622
  enum ResolutionType {
@@ -1886,6 +1962,11 @@ message CloseChannelRequest {
1886
1962
  // A manual fee rate set in sat/vbyte that should be used when crafting the
1887
1963
  // closure transaction.
1888
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;
1889
1970
  }
1890
1971
 
1891
1972
  message CloseStatusUpdate {
@@ -2097,6 +2178,17 @@ message OpenChannelRequest {
2097
2178
  the remote peer supports explicit channel negotiation.
2098
2179
  */
2099
2180
  CommitmentType commitment_type = 18;
2181
+
2182
+ /*
2183
+ If this is true, then a zero-conf channel open will be attempted.
2184
+ */
2185
+ bool zero_conf = 19;
2186
+
2187
+ /*
2188
+ If this is true, then an option-scid-alias channel-type open will be
2189
+ attempted.
2190
+ */
2191
+ bool scid_alias = 20;
2100
2192
  }
2101
2193
  message OpenStatusUpdate {
2102
2194
  oneof update {
@@ -2550,6 +2642,9 @@ message WalletBalanceResponse {
2550
2642
  // other usage.
2551
2643
  int64 locked_balance = 5;
2552
2644
 
2645
+ // The amount of reserve required.
2646
+ int64 reserved_balance_anchor_chan = 6;
2647
+
2553
2648
  // A mapping of each wallet account's name to its balance.
2554
2649
  map<string, WalletAccountBalance> account_balance = 4;
2555
2650
  }
@@ -3171,6 +3266,7 @@ message Invoice {
3171
3266
  /*
3172
3267
  The hash of the preimage. When using REST, this field must be encoded as
3173
3268
  base64.
3269
+ Note: Output only, don't specify for creating an invoice.
3174
3270
  */
3175
3271
  bytes r_hash = 4;
3176
3272
 
@@ -3188,19 +3284,30 @@ message Invoice {
3188
3284
  */
3189
3285
  int64 value_msat = 23;
3190
3286
 
3191
- // 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
+ */
3192
3292
  bool settled = 6 [deprecated = true];
3193
3293
 
3194
- // When this invoice was created
3294
+ /*
3295
+ When this invoice was created.
3296
+ Note: Output only, don't specify for creating an invoice.
3297
+ */
3195
3298
  int64 creation_date = 7;
3196
3299
 
3197
- // When this invoice was settled
3300
+ /*
3301
+ When this invoice was settled.
3302
+ Note: Output only, don't specify for creating an invoice.
3303
+ */
3198
3304
  int64 settle_date = 8;
3199
3305
 
3200
3306
  /*
3201
3307
  A bare-bones invoice for a payment within the Lightning Network. With the
3202
3308
  details of the invoice, the sender has all the data necessary to send a
3203
3309
  payment to the recipient.
3310
+ Note: Output only, don't specify for creating an invoice.
3204
3311
  */
3205
3312
  string payment_request = 9;
3206
3313
 
@@ -3235,6 +3342,7 @@ message Invoice {
3235
3342
  this index making it monotonically increasing. Callers to the
3236
3343
  SubscribeInvoices call can use this to instantly get notified of all added
3237
3344
  invoices with an add_index greater than this one.
3345
+ Note: Output only, don't specify for creating an invoice.
3238
3346
  */
3239
3347
  uint64 add_index = 16;
3240
3348
 
@@ -3243,6 +3351,7 @@ message Invoice {
3243
3351
  increment this index making it monotonically increasing. Callers to the
3244
3352
  SubscribeInvoices call can use this to instantly get notified of all
3245
3353
  settled invoices with an settle_index greater than this one.
3354
+ Note: Output only, don't specify for creating an invoice.
3246
3355
  */
3247
3356
  uint64 settle_index = 17;
3248
3357
 
@@ -3256,6 +3365,7 @@ message Invoice {
3256
3365
  was ultimately accepted. Additionally, it's possible that the sender paid
3257
3366
  MORE that was specified in the original invoice. So we'll record that here
3258
3367
  as well.
3368
+ Note: Output only, don't specify for creating an invoice.
3259
3369
  */
3260
3370
  int64 amt_paid_sat = 19;
3261
3371
 
@@ -3266,6 +3376,7 @@ message Invoice {
3266
3376
  amount was ultimately accepted. Additionally, it's possible that the sender
3267
3377
  paid MORE that was specified in the original invoice. So we'll record that
3268
3378
  here as well.
3379
+ Note: Output only, don't specify for creating an invoice.
3269
3380
  */
3270
3381
  int64 amt_paid_msat = 20;
3271
3382
 
@@ -3278,18 +3389,26 @@ message Invoice {
3278
3389
 
3279
3390
  /*
3280
3391
  The state the invoice is in.
3392
+ Note: Output only, don't specify for creating an invoice.
3281
3393
  */
3282
3394
  InvoiceState state = 21;
3283
3395
 
3284
- // 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
+ */
3285
3400
  repeated InvoiceHTLC htlcs = 22;
3286
3401
 
3287
- // 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
+ */
3288
3406
  map<uint32, Feature> features = 24;
3289
3407
 
3290
3408
  /*
3291
3409
  Indicates if this invoice was a spontaneous payment that arrived via keysend
3292
3410
  [EXPERIMENTAL].
3411
+ Note: Output only, don't specify for creating an invoice.
3293
3412
  */
3294
3413
  bool is_keysend = 25;
3295
3414
 
@@ -3297,6 +3416,7 @@ message Invoice {
3297
3416
  The payment address of this invoice. This value will be used in MPP
3298
3417
  payments, and also for newer invoices that always require the MPP payload
3299
3418
  for added end-to-end security.
3419
+ Note: Output only, don't specify for creating an invoice.
3300
3420
  */
3301
3421
  bytes payment_addr = 26;
3302
3422
 
@@ -3312,6 +3432,7 @@ message Invoice {
3312
3432
  given set ID. This field is always populated for AMP invoices, and can be
3313
3433
  used along side LookupInvoice to obtain the HTLC information related to a
3314
3434
  given sub-invoice.
3435
+ Note: Output only, don't specify for creating an invoice.
3315
3436
  */
3316
3437
  map<string, AMPInvoiceState> amp_invoice_state = 28;
3317
3438
  }
@@ -4319,6 +4440,14 @@ message RPCMiddlewareRequest {
4319
4440
  the same type, or replaced by an error message.
4320
4441
  */
4321
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;
4322
4451
  }
4323
4452
 
4324
4453
  /*
@@ -4356,7 +4485,8 @@ message RPCMessage {
4356
4485
 
4357
4486
  /*
4358
4487
  The full canonical gRPC name of the message type (in the format
4359
- <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".
4360
4490
  */
4361
4491
  string type_name = 3;
4362
4492
 
@@ -4365,6 +4495,13 @@ message RPCMessage {
4365
4495
  format.
4366
4496
  */
4367
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;
4368
4505
  }
4369
4506
 
4370
4507
  message RPCMiddlewareResponse {
@@ -4441,18 +4578,16 @@ message InterceptFeedback {
4441
4578
  string error = 1;
4442
4579
 
4443
4580
  /*
4444
- A boolean indicating that the gRPC response should be replaced/overwritten.
4445
- As its name suggests, this can only be used as a feedback to an intercepted
4446
- response RPC message and is ignored for feedback on any other message. This
4447
- boolean is needed because in protobuf an empty message is serialized as a
4448
- 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
4449
4584
  an empty replacement message and the "don't replace anything" case.
4450
4585
  */
4451
4586
  bool replace_response = 2;
4452
4587
 
4453
4588
  /*
4454
4589
  If the replace_response field is set to true, this field must contain the
4455
- binary serialized gRPC response message in the protobuf format.
4590
+ binary serialized gRPC message in the protobuf format.
4456
4591
  */
4457
4592
  bytes replacement_serialized = 3;
4458
4593
  }
@@ -320,7 +320,10 @@ message InputScriptResp {
320
320
  }
321
321
 
322
322
  message SignMessageReq {
323
- // The message to be signed.
323
+ /*
324
+ The message to be signed. When using REST, this field must be encoded as
325
+ base64.
326
+ */
324
327
  bytes msg = 1;
325
328
 
326
329
  // The key locator that identifies which key to use for signing.
@@ -331,9 +334,21 @@ message SignMessageReq {
331
334
 
332
335
  /*
333
336
  Use the compact (pubkey recoverable) format instead of the raw lnwire
334
- format.
337
+ format. This option cannot be used with Schnorr signatures.
335
338
  */
336
339
  bool compact_sig = 4;
340
+
341
+ /*
342
+ Use Schnorr signature. This option cannot be used with compact format.
343
+ */
344
+ bool schnorr_sig = 5;
345
+
346
+ /*
347
+ The optional Taproot tweak bytes to apply to the private key before creating
348
+ a Schnorr signature. The private key is tweaked as described in BIP-341:
349
+ privKey + h_tapTweak(internalKey || tapTweak)
350
+ */
351
+ bytes schnorr_sig_tap_tweak = 6;
337
352
  }
338
353
  message SignMessageResp {
339
354
  /*
@@ -343,17 +358,28 @@ message SignMessageResp {
343
358
  }
344
359
 
345
360
  message VerifyMessageReq {
346
- // The message over which the signature is to be verified.
361
+ // The message over which the signature is to be verified. When using
362
+ // REST, this field must be encoded as base64.
347
363
  bytes msg = 1;
348
364
 
349
365
  /*
350
366
  The fixed-size LN wire encoded signature to be verified over the given
351
- message.
367
+ message. When using REST, this field must be encoded as base64.
352
368
  */
353
369
  bytes signature = 2;
354
370
 
355
- // The public key the signature has to be valid for.
371
+ /*
372
+ The public key the signature has to be valid for. When using REST, this
373
+ field must be encoded as base64. If the is_schnorr_sig option is true, then
374
+ the public key is expected to be in the 32-byte x-only serialization
375
+ according to BIP-340.
376
+ */
356
377
  bytes pubkey = 3;
378
+
379
+ /*
380
+ Specifies if the signature is a Schnorr signature.
381
+ */
382
+ bool is_schnorr_sig = 4;
357
383
  }
358
384
  message VerifyMessageResp {
359
385
  // Whether the signature was valid over the given message.
package/index.js CHANGED
@@ -41,6 +41,7 @@ const {getChannelBalance} = require('./lnd_methods');
41
41
  const {getChannels} = require('./lnd_methods');
42
42
  const {getClosedChannels} = require('./lnd_methods');
43
43
  const {getConnectedWatchtowers} = require('./lnd_methods');
44
+ const {getEphemeralChannelIds} = require('./lnd_methods');
44
45
  const {getFailedPayments} = require('./lnd_methods');
45
46
  const {getFeeRates} = require('./lnd_methods');
46
47
  const {getForwardingConfidence} = require('./lnd_methods');
@@ -183,11 +184,12 @@ module.exports = {
183
184
  getChainFeeEstimate,
184
185
  getChainFeeRate,
185
186
  getChainTransactions,
186
- getChannelBalance,
187
187
  getChannel,
188
+ getChannelBalance,
188
189
  getChannels,
189
190
  getClosedChannels,
190
191
  getConnectedWatchtowers,
192
+ getEphemeralChannelIds,
191
193
  getFailedPayments,
192
194
  getFeeRates,
193
195
  getForwardingConfidence,
@@ -39,6 +39,7 @@ const {getChannelBalance} = require('./offchain');
39
39
  const {getChannels} = require('./offchain');
40
40
  const {getClosedChannels} = require('./offchain');
41
41
  const {getConnectedWatchtowers} = require('./offchain');
42
+ const {getEphemeralChannelIds} = require('./offchain');
42
43
  const {getFailedPayments} = require('./offchain');
43
44
  const {getFeeRates} = require('./offchain');
44
45
  const {getForwardingConfidence} = require('./offchain');
@@ -182,6 +183,7 @@ module.exports = {
182
183
  getChannels,
183
184
  getClosedChannels,
184
185
  getConnectedWatchtowers,
186
+ getEphemeralChannelIds,
185
187
  getFailedPayments,
186
188
  getFeeRates,
187
189
  getForwardingConfidence,
@@ -8,7 +8,7 @@ export type GetNetworkGraphResult = {
8
8
  /** Standard Format Channel Id */
9
9
  id: string;
10
10
  policies: {
11
- /** Bae Fee Millitokens */
11
+ /** Base Fee Millitokens */
12
12
  base_fee_mtokens?: string;
13
13
  /** CLTV Height Delta */
14
14
  cltv_delta?: number;
@@ -157,6 +157,10 @@
157
157
  "methods": ["ListTowers", "Policy", "Stats"],
158
158
  "type": "tower_client"
159
159
  },
160
+ "getEphemeralChannelIds": {
161
+ "method": "ListAliases",
162
+ "type": "default"
163
+ },
160
164
  "getFailedPayments": {
161
165
  "method": "ListPayments",
162
166
  "type": "default"
@@ -15,6 +15,8 @@ const type = 'default';
15
15
  `in_channel`, `in_payment`, `is_forward`, `out_channel`, `out_payment`,
16
16
  `payment` are not supported on LND 0.11.1 and below
17
17
 
18
+ `is_trusted_funding` is not supported on LND 0.15.0 and below
19
+
18
20
  {
19
21
  [is_active]: <Limit Results To Only Active Channels Bool> // false
20
22
  [is_offline]: <Limit Results To Only Offline Channels Bool> // false
@@ -38,6 +40,7 @@ const type = 'default';
38
40
  is_opening: <Channel Is Opening Bool>
39
41
  is_partner_initiated: <Channel Partner Opened Channel Bool>
40
42
  is_private: <Channel Is Private Bool>
43
+ [is_trusted_funding]: <Funding Output is Trusted Bool>
41
44
  local_balance: <Local Balance Tokens Number>
42
45
  [local_csv]: <Local CSV Blocks Delay Number>
43
46
  [local_dust]: <Local Non-Enforceable Amount Tokens Number>
@@ -46,6 +49,7 @@ const type = 'default';
46
49
  [local_max_pending_mtokens]: <Local Maximum Pending Millitokens String>
47
50
  [local_min_htlc_mtokens]: <Local Minimum HTLC Millitokens String>
48
51
  local_reserve: <Local Reserved Tokens Number>
52
+ other_ids: [<Other Channel Id String>]
49
53
  partner_public_key: <Channel Partner Public Key String>
50
54
  past_states: <Total Count of Past Channel States Number>
51
55
  pending_payments: [{
@@ -17,6 +17,8 @@ const outpointSeparator = ':';
17
17
 
18
18
  Requires `offchain:read` permission
19
19
 
20
+ `other_ids is not supported on LND 0.15.0 and below
21
+
20
22
  {
21
23
  [is_breach_close]: <Only Return Breach Close Channels Bool>
22
24
  [is_cooperative_close]: <Only Return Cooperative Close Channels Bool>
@@ -54,6 +56,7 @@ const outpointSeparator = ':';
54
56
  [is_partner_closed]: <Channel Was Closed By Channel Peer Bool>
55
57
  [is_partner_initiated]: <Channel Was Initiated By Channel Peer Bool>
56
58
  is_remote_force_close: <Is Remote Force Close Bool>
59
+ other_ids: [<Other Channel Id String>]
57
60
  partner_public_key: <Partner Public Key Hex String>
58
61
  transaction_id: <Channel Funding Transaction Id Hex String>
59
62
  transaction_vout: <Channel Funding Output Index Number>
@@ -101,6 +104,10 @@ module.exports = (args, cbk) => {
101
104
  // Map channels
102
105
  mapChannels: ['getClosedChannels', ({getClosedChannels}, cbk) => {
103
106
  return asyncMapSeries(getClosedChannels, (chan, cbk) => {
107
+ if (!isArray(chan.alias_scids)) {
108
+ return cbk([503, 'ExpectedArrayOfAliasShortChannelIds']);
109
+ }
110
+
104
111
  if (!chan.capacity) {
105
112
  return cbk([503, 'ExpectedCloseChannelCapacity']);
106
113
  }
@@ -133,6 +140,10 @@ module.exports = (args, cbk) => {
133
140
  return cbk([503, 'ExpectedFinalTimeLockedBalanceForClosedChan']);
134
141
  }
135
142
 
143
+ const otherIds = chan.alias_scids
144
+ .filter(n => n !== chan.zero_conf_confirmed_scid)
145
+ .map(number => chanFormat({number}));
146
+
136
147
  const closer = chan.close_initiator;
137
148
  const finalTimeLock = Number(chan.time_locked_balance);
138
149
  const hasCloseTx = chan.closing_tx_hash !== emptyTxId;
@@ -141,11 +152,14 @@ module.exports = (args, cbk) => {
141
152
  let isPartnerClosed;
142
153
  let isPartnerInitiated;
143
154
  const [txId, vout] = chan.channel_point.split(outpointSeparator);
155
+ const zeroConfId = chan.zero_conf_confirmed_scid;
144
156
 
145
- const chanId = !hasId ? null : chanFormat({number: chan.chan_id});
146
157
  const closeTxId = !hasCloseTx ? undefined : chan.closing_tx_hash;
147
158
  const isLocalCooperativeClose = closer === 'INITIATOR_LOCAL';
148
159
  const isRemoteCooperativeClose = closer === 'INITIATOR_REMOTE';
160
+ const number = !!Number(zeroConfId) ? zeroConfId : chan.chan_id;
161
+
162
+ const chanId = !hasId ? null : chanFormat({number});
149
163
 
150
164
  // Try and determine if the channel was opened by our peer
151
165
  if (chan.open_initiator === 'INITIATOR_LOCAL') {
@@ -197,6 +211,7 @@ module.exports = (args, cbk) => {
197
211
  is_partner_closed: isPartnerClosed,
198
212
  is_partner_initiated: isPartnerInitiated,
199
213
  is_remote_force_close: chan.close_type === 'REMOTE_FORCE_CLOSE',
214
+ other_ids: otherIds.map(n => n.channel),
200
215
  partner_public_key: chan.remote_pubkey,
201
216
  transaction_id: txId,
202
217
  transaction_vout: Number(vout),