lightning 5.13.1 → 5.15.1

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 (39) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +2 -2
  3. package/grpc/protos/chainnotifier.proto +5 -3
  4. package/grpc/protos/lightning.proto +15 -1
  5. package/grpc/protos/router.proto +6 -0
  6. package/grpc/protos/signer.proto +308 -0
  7. package/index.js +6 -0
  8. package/lnd_methods/index.js +6 -0
  9. package/lnd_methods/info/get_route_to_destination.js +10 -0
  10. package/lnd_methods/macaroon/methods.json +13 -0
  11. package/lnd_methods/offchain/get_failed_payments.js +3 -1
  12. package/lnd_methods/offchain/get_payments.js +3 -1
  13. package/lnd_methods/offchain/get_pending_payments.js +2 -0
  14. package/lnd_methods/offchain/is_destination_payable.js +4 -0
  15. package/lnd_methods/offchain/pay.js +4 -0
  16. package/lnd_methods/offchain/pay_via_payment_details.js +4 -0
  17. package/lnd_methods/offchain/pay_via_payment_request.js +4 -0
  18. package/lnd_methods/offchain/probe_for_route.js +4 -0
  19. package/lnd_methods/offchain/subscribe_to_pay.js +10 -0
  20. package/lnd_methods/offchain/subscribe_to_pay_via_details.js +4 -0
  21. package/lnd_methods/offchain/subscribe_to_pay_via_request.js +4 -0
  22. package/lnd_methods/offchain/subscribe_to_probe_for_route.js +4 -0
  23. package/lnd_methods/signer/begin_group_signing_session.js +144 -0
  24. package/lnd_methods/signer/end_group_signing_session.js +102 -0
  25. package/lnd_methods/signer/index.js +6 -0
  26. package/lnd_methods/signer/update_group_signing_session.js +110 -0
  27. package/lnd_responses/index.js +2 -0
  28. package/lnd_responses/rpc_attempt_htlc_as_attempt.js +39 -5
  29. package/lnd_responses/rpc_group_session_as_session.js +51 -0
  30. package/lnd_responses/rpc_payment_as_payment.js +6 -0
  31. package/package.json +6 -6
  32. package/test/lnd_methods/offchain/test_get_payments.js +2 -0
  33. package/test/lnd_methods/signer/test_begin_group_signing_session.js +134 -0
  34. package/test/lnd_methods/signer/test_diffie_hellman_compute_secret.js +3 -1
  35. package/test/lnd_methods/signer/test_end_group_signing_session.js +93 -0
  36. package/test/lnd_methods/signer/test_update_group_signing_session.js +108 -0
  37. package/test/lnd_responses/test_rpc_attempt_htlc_as_attempt.js +19 -3
  38. package/test/lnd_responses/test_rpc_group_session_as_session.js +79 -0
  39. package/test/lnd_responses/test_rpc_payment_as_payment.js +5 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Versions
2
2
 
3
+ ## 5.15.1
4
+
5
+ - `getFailedPayments`, `getPayments`, `getPendingPayments`: Remove
6
+ `confirmed_at` date when a payment is not confirmed, add `created_at` and
7
+ `failed_at` dates for attempt start and attempt failed dates.
8
+
9
+ ## 5.15.0
10
+
11
+ - `beginGroupSigningSession`: Add method to start a MuSig2 signing session
12
+ - `endGroupSigningSession`: Add method to complete a MuSig2 signing session
13
+ - `updateGroupSigningSession`: Add method to add nonces to a MuSig2 session
14
+
15
+ ## 5.14.0
16
+
17
+ - `getRouteToDestination`, `isDestinationPayable`, `pay`,
18
+ `payViaPaymentDetails`, `payViaPaymentRequest`, `probeForRoute`,
19
+ `subscribeToPayViaDetails`, `subscribeToPayViaRequest`,
20
+ `subscribeToProbeForRoute` - add support for pathfinding `confidence`
21
+
3
22
  ## 5.13.1
4
23
 
5
24
  - `signTransaction`: Fix multi-input signing for upcoming Taproot API changes
package/README.md CHANGED
@@ -24,8 +24,8 @@ Methods for working with the Lightning Network
24
24
  https://github.com/stackernews/stacker.news
25
25
  - [Suredbits API](https://suredbits.com/) -
26
26
  https://github.com/Suredbits/sb-api-lnd
27
- - [Synonym demo server](https://synonym.to) -
28
- https://github.com/synonymdev/slash-pay-demo-server
27
+ - [Synonym Blocktank server](https://synonym.to) -
28
+ https://github.com/synonymdev/blocktank-server/
29
29
  - [Tarnhelm](https://www.tarnhelm.app/) - https://github.com/bkiac/tarnhelm
30
30
  - [tbtcswaps](https://tbtcswaps.com/) -
31
31
  https://github.com/keep-community/tbtcswaps
@@ -12,9 +12,11 @@ service ChainNotifier {
12
12
  registers an intent for a client to be notified once a confirmation request
13
13
  has reached its required number of confirmations on-chain.
14
14
 
15
- A client can specify whether the confirmation request should be for a
16
- particular transaction by its hash or for an output script by specifying a
17
- zero hash.
15
+ A confirmation request must have a valid output script. It is also possible
16
+ to give a transaction ID. If the transaction ID is not set, a notification
17
+ is sent once the output script confirms. If the transaction ID is also set,
18
+ a notification is sent once the output script confirms in the given
19
+ transaction.
18
20
  */
19
21
  rpc RegisterConfirmationsNtfn (ConfRequest) returns (stream ConfEvent);
20
22
 
@@ -1809,6 +1809,11 @@ message GetInfoResponse {
1809
1809
  announcements and invoices.
1810
1810
  */
1811
1811
  map<uint32, Feature> features = 19;
1812
+
1813
+ /*
1814
+ Indicates whether the HTLC interceptor API is in always-on mode.
1815
+ */
1816
+ bool require_htlc_interceptor = 21;
1812
1817
  }
1813
1818
 
1814
1819
  message GetRecoveryInfoRequest {
@@ -2692,6 +2697,12 @@ message QueryRoutesRequest {
2692
2697
  fallback.
2693
2698
  */
2694
2699
  repeated lnrpc.FeatureBit dest_features = 17;
2700
+
2701
+ /*
2702
+ The time preference for this payment. Set to -1 to optimize for fees
2703
+ only, to 1 to optimize for reliability only or a value inbetween for a mix.
2704
+ */
2705
+ double time_pref = 18;
2695
2706
  }
2696
2707
 
2697
2708
  message NodePair {
@@ -2760,7 +2771,7 @@ message Hop {
2760
2771
  TLV format. Note that if any custom tlv_records below are specified, then
2761
2772
  this field MUST be set to true for them to be encoded properly.
2762
2773
  */
2763
- bool tlv_payload = 9;
2774
+ bool tlv_payload = 9 [deprecated = true];
2764
2775
 
2765
2776
  /*
2766
2777
  An optional TLV record that signals the use of an MPP payment. If present,
@@ -2786,6 +2797,9 @@ message Hop {
2786
2797
  to drop off at each hop within the onion.
2787
2798
  */
2788
2799
  map<uint64, bytes> custom_records = 11;
2800
+
2801
+ // The payment metadata to send along with the payment to the payee.
2802
+ bytes metadata = 13;
2789
2803
  }
2790
2804
 
2791
2805
  message MPPRecord {
@@ -284,6 +284,12 @@ message SendPaymentRequest {
284
284
  If set, an AMP-payment will be attempted.
285
285
  */
286
286
  bool amp = 22;
287
+
288
+ /*
289
+ The time preference for this payment. Set to -1 to optimize for fees
290
+ only, to 1 to optimize for reliability only or a value inbetween for a mix.
291
+ */
292
+ double time_pref = 23;
287
293
  }
288
294
 
289
295
  message TrackPaymentRequest {
@@ -62,6 +62,86 @@ service Signer {
62
62
  hashed with sha256, resulting in the final key length of 256bit.
63
63
  */
64
64
  rpc DeriveSharedKey (SharedKeyRequest) returns (SharedKeyResponse);
65
+
66
+ /*
67
+ MuSig2CombineKeys (experimental!) is a stateless helper RPC that can be used
68
+ to calculate the combined MuSig2 public key from a list of all participating
69
+ signers' public keys. This RPC is completely stateless and deterministic and
70
+ does not create any signing session. It can be used to determine the Taproot
71
+ public key that should be put in an on-chain output once all public keys are
72
+ known. A signing session is only needed later when that output should be
73
+ _spent_ again.
74
+
75
+ NOTE: The MuSig2 BIP is not final yet and therefore this API must be
76
+ considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
77
+ releases. Backward compatibility is not guaranteed!
78
+ */
79
+ rpc MuSig2CombineKeys (MuSig2CombineKeysRequest)
80
+ returns (MuSig2CombineKeysResponse);
81
+
82
+ /*
83
+ MuSig2CreateSession (experimental!) creates a new MuSig2 signing session
84
+ using the local key identified by the key locator. The complete list of all
85
+ public keys of all signing parties must be provided, including the public
86
+ key of the local signing key. If nonces of other parties are already known,
87
+ they can be submitted as well to reduce the number of RPC calls necessary
88
+ later on.
89
+
90
+ NOTE: The MuSig2 BIP is not final yet and therefore this API must be
91
+ considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
92
+ releases. Backward compatibility is not guaranteed!
93
+ */
94
+ rpc MuSig2CreateSession (MuSig2SessionRequest)
95
+ returns (MuSig2SessionResponse);
96
+
97
+ /*
98
+ MuSig2RegisterNonces (experimental!) registers one or more public nonces of
99
+ other signing participants for a session identified by its ID. This RPC can
100
+ be called multiple times until all nonces are registered.
101
+
102
+ NOTE: The MuSig2 BIP is not final yet and therefore this API must be
103
+ considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
104
+ releases. Backward compatibility is not guaranteed!
105
+ */
106
+ rpc MuSig2RegisterNonces (MuSig2RegisterNoncesRequest)
107
+ returns (MuSig2RegisterNoncesResponse);
108
+
109
+ /*
110
+ MuSig2Sign (experimental!) creates a partial signature using the local
111
+ signing key that was specified when the session was created. This can only
112
+ be called when all public nonces of all participants are known and have been
113
+ registered with the session. If this node isn't responsible for combining
114
+ all the partial signatures, then the cleanup flag should be set, indicating
115
+ that the session can be removed from memory once the signature was produced.
116
+
117
+ NOTE: The MuSig2 BIP is not final yet and therefore this API must be
118
+ considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
119
+ releases. Backward compatibility is not guaranteed!
120
+ */
121
+ rpc MuSig2Sign (MuSig2SignRequest) returns (MuSig2SignResponse);
122
+
123
+ /*
124
+ MuSig2CombineSig (experimental!) combines the given partial signature(s)
125
+ with the local one, if it already exists. Once a partial signature of all
126
+ participants is registered, the final signature will be combined and
127
+ returned.
128
+
129
+ NOTE: The MuSig2 BIP is not final yet and therefore this API must be
130
+ considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
131
+ releases. Backward compatibility is not guaranteed!
132
+ */
133
+ rpc MuSig2CombineSig (MuSig2CombineSigRequest)
134
+ returns (MuSig2CombineSigResponse);
135
+
136
+ /*
137
+ MuSig2Cleanup (experimental!) allows a caller to clean up a session early in
138
+ cases where it's obvious that the signing session won't succeed and the
139
+ resources can be released.
140
+ NOTE: The MuSig2 BIP is not final yet and therefore this API must be
141
+ considered to be HIGHLY EXPERIMENTAL and subject to change in upcoming
142
+ releases. Backward compatibility is not guaranteed!
143
+ */
144
+ rpc MuSig2Cleanup (MuSig2CleanupRequest) returns (MuSig2CleanupResponse);
65
145
  }
66
146
 
67
147
  message KeyLocator {
@@ -264,4 +344,232 @@ message SharedKeyRequest {
264
344
  message SharedKeyResponse {
265
345
  // The shared public key, hashed with sha256.
266
346
  bytes shared_key = 1;
347
+ }
348
+
349
+ message TweakDesc {
350
+ /*
351
+ Tweak is the 32-byte value that will modify the public key.
352
+ */
353
+ bytes tweak = 1;
354
+
355
+ /*
356
+ Specifies if the target key should be converted to an x-only public key
357
+ before tweaking. If true, then the public key will be mapped to an x-only
358
+ key before the tweaking operation is applied.
359
+ */
360
+ bool is_x_only = 2;
361
+ }
362
+
363
+ message TaprootTweakDesc {
364
+ /*
365
+ The root hash of the tapscript tree if a script path is committed to. If
366
+ the MuSig2 key put on chain doesn't also commit to a script path (BIP-0086
367
+ key spend only), then this needs to be empty and the key_spend_only field
368
+ below must be set to true. This is required because gRPC cannot
369
+ differentiate between a zero-size byte slice and a nil byte slice (both
370
+ would be serialized the same way). So the extra boolean is required.
371
+ */
372
+ bytes script_root = 1;
373
+
374
+ /*
375
+ Indicates that the above script_root is expected to be empty because this
376
+ is a BIP-0086 key spend only commitment where only the internal key is
377
+ committed to instead of also including a script root hash.
378
+ */
379
+ bool key_spend_only = 2;
380
+ }
381
+
382
+ message MuSig2CombineKeysRequest {
383
+ /*
384
+ A list of all public keys (serialized in 32-byte x-only format!)
385
+ participating in the signing session. The list will always be sorted
386
+ lexicographically internally. This must include the local key which is
387
+ described by the above key_loc.
388
+ */
389
+ repeated bytes all_signer_pubkeys = 1;
390
+
391
+ /*
392
+ A series of optional generic tweaks to be applied to the the aggregated
393
+ public key.
394
+ */
395
+ repeated TweakDesc tweaks = 2;
396
+
397
+ /*
398
+ An optional taproot specific tweak that must be specified if the MuSig2
399
+ combined key will be used as the main taproot key of a taproot output
400
+ on-chain.
401
+ */
402
+ TaprootTweakDesc taproot_tweak = 3;
403
+ }
404
+
405
+ message MuSig2CombineKeysResponse {
406
+ /*
407
+ The combined public key (in the 32-byte x-only format) with all tweaks
408
+ applied to it. If a taproot tweak is specified, this corresponds to the
409
+ taproot key that can be put into the on-chain output.
410
+ */
411
+ bytes combined_key = 1;
412
+
413
+ /*
414
+ The raw combined public key (in the 32-byte x-only format) before any tweaks
415
+ are applied to it. If a taproot tweak is specified, this corresponds to the
416
+ internal key that needs to be put into the witness if the script spend path
417
+ is used.
418
+ */
419
+ bytes taproot_internal_key = 2;
420
+ }
421
+
422
+ message MuSig2SessionRequest {
423
+ /*
424
+ The key locator that identifies which key to use for signing.
425
+ */
426
+ KeyLocator key_loc = 1;
427
+
428
+ /*
429
+ A list of all public keys (serialized in 32-byte x-only format!)
430
+ participating in the signing session. The list will always be sorted
431
+ lexicographically internally. This must include the local key which is
432
+ described by the above key_loc.
433
+ */
434
+ repeated bytes all_signer_pubkeys = 2;
435
+
436
+ /*
437
+ An optional list of all public nonces of other signing participants that
438
+ might already be known.
439
+ */
440
+ repeated bytes other_signer_public_nonces = 3;
441
+
442
+ /*
443
+ A series of optional generic tweaks to be applied to the the aggregated
444
+ public key.
445
+ */
446
+ repeated TweakDesc tweaks = 4;
447
+
448
+ /*
449
+ An optional taproot specific tweak that must be specified if the MuSig2
450
+ combined key will be used as the main taproot key of a taproot output
451
+ on-chain.
452
+ */
453
+ TaprootTweakDesc taproot_tweak = 5;
454
+ }
455
+
456
+ message MuSig2SessionResponse {
457
+ /*
458
+ The unique ID that represents this signing session. A session can be used
459
+ for producing a signature a single time. If the signing fails for any
460
+ reason, a new session with the same participants needs to be created.
461
+ */
462
+ bytes session_id = 1;
463
+
464
+ /*
465
+ The combined public key (in the 32-byte x-only format) with all tweaks
466
+ applied to it. If a taproot tweak is specified, this corresponds to the
467
+ taproot key that can be put into the on-chain output.
468
+ */
469
+ bytes combined_key = 2;
470
+
471
+ /*
472
+ The raw combined public key (in the 32-byte x-only format) before any tweaks
473
+ are applied to it. If a taproot tweak is specified, this corresponds to the
474
+ internal key that needs to be put into the witness if the script spend path
475
+ is used.
476
+ */
477
+ bytes taproot_internal_key = 3;
478
+
479
+ /*
480
+ The two public nonces the local signer uses, combined into a single value
481
+ of 66 bytes. Can be split into the two 33-byte points to get the individual
482
+ nonces.
483
+ */
484
+ bytes local_public_nonces = 4;
485
+
486
+ /*
487
+ Indicates whether all nonces required to start the signing process are known
488
+ now.
489
+ */
490
+ bool have_all_nonces = 5;
491
+ }
492
+
493
+ message MuSig2RegisterNoncesRequest {
494
+ /*
495
+ The unique ID of the signing session those nonces should be registered with.
496
+ */
497
+ bytes session_id = 1;
498
+
499
+ /*
500
+ A list of all public nonces of other signing participants that should be
501
+ registered.
502
+ */
503
+ repeated bytes other_signer_public_nonces = 3;
504
+ }
505
+
506
+ message MuSig2RegisterNoncesResponse {
507
+ /*
508
+ Indicates whether all nonces required to start the signing process are known
509
+ now.
510
+ */
511
+ bool have_all_nonces = 1;
512
+ }
513
+
514
+ message MuSig2SignRequest {
515
+ /*
516
+ The unique ID of the signing session to use for signing.
517
+ */
518
+ bytes session_id = 1;
519
+
520
+ /*
521
+ The 32-byte SHA256 digest of the message to sign.
522
+ */
523
+ bytes message_digest = 2;
524
+
525
+ /*
526
+ Cleanup indicates that after signing, the session state can be cleaned up,
527
+ since another participant is going to be responsible for combining the
528
+ partial signatures.
529
+ */
530
+ bool cleanup = 3;
531
+ }
532
+
533
+ message MuSig2SignResponse {
534
+ /*
535
+ The partial signature created by the local signer.
536
+ */
537
+ bytes local_partial_signature = 1;
538
+ }
539
+
540
+ message MuSig2CombineSigRequest {
541
+ /*
542
+ The unique ID of the signing session to combine the signatures for.
543
+ */
544
+ bytes session_id = 1;
545
+
546
+ /*
547
+ The list of all other participants' partial signatures to add to the current
548
+ session.
549
+ */
550
+ repeated bytes other_partial_signatures = 2;
551
+ }
552
+
553
+ message MuSig2CombineSigResponse {
554
+ /*
555
+ Indicates whether all partial signatures required to create a final, full
556
+ signature are known yet. If this is true, then the final_signature field is
557
+ set, otherwise it is empty.
558
+ */
559
+ bool have_all_signatures = 1;
560
+
561
+ /*
562
+ The final, full signature that is valid for the combined public key.
563
+ */
564
+ bytes final_signature = 2;
565
+ }
566
+
567
+ message MuSig2CleanupRequest {
568
+ /*
569
+ The unique ID of the signing session that should be removed/cleaned up.
570
+ */
571
+ bytes session_id = 1;
572
+ }
573
+
574
+ message MuSig2CleanupResponse {
267
575
  }
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const {addExternalSocket} = require('./lnd_methods');
2
2
  const {addPeer} = require('./lnd_methods');
3
3
  const {authenticatedLndGrpc} = require('./lnd_grpc');
4
+ const {beginGroupSigningSession} = require('./lnd_methods');
4
5
  const {broadcastChainTransaction} = require('./lnd_methods');
5
6
  const {cancelHodlInvoice} = require('./lnd_methods');
6
7
  const {cancelPendingChannel} = require('./lnd_methods');
@@ -24,6 +25,7 @@ const {disableChannel} = require('./lnd_methods');
24
25
  const {disconnectWatchtower} = require('./lnd_methods');
25
26
  const {emitGrpcEvents} = require('./lnd_gateway');
26
27
  const {enableChannel} = require('./lnd_methods');
28
+ const {endGroupSigningSession} = require('./lnd_methods');
27
29
  const {fundPendingChannels} = require('./lnd_methods');
28
30
  const {fundPsbt} = require('./lnd_methods');
29
31
  const {getAccessIds} = require('./lnd_methods');
@@ -133,6 +135,7 @@ const {updateAlias} = require('./lnd_methods');
133
135
  const {updateChainTransaction} = require('./lnd_methods');
134
136
  const {updateColor} = require('./lnd_methods');
135
137
  const {updateConnectedWatchtower} = require('./lnd_methods');
138
+ const {updateGroupSigningSession} = require('./lnd_methods');
136
139
  const {updatePathfindingSettings} = require('./lnd_methods');
137
140
  const {updateRoutingFees} = require('./lnd_methods');
138
141
  const {verifyAccess} = require('./lnd_methods');
@@ -145,6 +148,7 @@ module.exports = {
145
148
  addExternalSocket,
146
149
  addPeer,
147
150
  authenticatedLndGrpc,
151
+ beginGroupSigningSession,
148
152
  broadcastChainTransaction,
149
153
  cancelHodlInvoice,
150
154
  cancelPendingChannel,
@@ -166,6 +170,7 @@ module.exports = {
166
170
  disableChannel,
167
171
  disconnectWatchtower,
168
172
  enableChannel,
173
+ endGroupSigningSession,
169
174
  diffieHellmanComputeSecret,
170
175
  emitGrpcEvents,
171
176
  fundPendingChannels,
@@ -277,6 +282,7 @@ module.exports = {
277
282
  updateColor,
278
283
  updateChainTransaction,
279
284
  updateConnectedWatchtower,
285
+ updateGroupSigningSession,
280
286
  updatePathfindingSettings,
281
287
  updateRoutingFees,
282
288
  verifyAccess,
@@ -1,5 +1,6 @@
1
1
  const {addExternalSocket} = require('./peers');
2
2
  const {addPeer} = require('./peers');
3
+ const {beginGroupSigningSession} = require('./signer');
3
4
  const {broadcastChainTransaction} = require('./onchain');
4
5
  const {cancelHodlInvoice} = require('./invoices');
5
6
  const {cancelPendingChannel} = require('./onchain');
@@ -22,6 +23,7 @@ const {diffieHellmanComputeSecret} = require('./signer');
22
23
  const {disableChannel} = require('./offchain');
23
24
  const {disconnectWatchtower} = require('./offchain');
24
25
  const {enableChannel} = require('./offchain');
26
+ const {endGroupSigningSession} = require('./signer');
25
27
  const {fundPendingChannels} = require('./onchain');
26
28
  const {fundPsbt} = require('./onchain');
27
29
  const {getAccessIds} = require('./macaroon');
@@ -129,6 +131,7 @@ const {updateAlias} = require('./peers');
129
131
  const {updateChainTransaction} = require('./onchain');
130
132
  const {updateColor} = require('./peers');
131
133
  const {updateConnectedWatchtower} = require('./offchain');
134
+ const {updateGroupSigningSession} = require('./signer');
132
135
  const {updatePathfindingSettings} = require('./offchain');
133
136
  const {updateRoutingFees} = require('./offchain');
134
137
  const {verifyAccess} = require('./macaroon');
@@ -140,6 +143,7 @@ const {verifyMessage} = require('./message');
140
143
  module.exports = {
141
144
  addExternalSocket,
142
145
  addPeer,
146
+ beginGroupSigningSession,
143
147
  broadcastChainTransaction,
144
148
  cancelHodlInvoice,
145
149
  cancelPendingChannel,
@@ -162,6 +166,7 @@ module.exports = {
162
166
  disableChannel,
163
167
  disconnectWatchtower,
164
168
  enableChannel,
169
+ endGroupSigningSession,
165
170
  fundPendingChannels,
166
171
  fundPsbt,
167
172
  getAccessIds,
@@ -269,6 +274,7 @@ module.exports = {
269
274
  updateChainTransaction,
270
275
  updateColor,
271
276
  updateConnectedWatchtower,
277
+ updateGroupSigningSession,
272
278
  updatePathfindingSettings,
273
279
  updateRoutingFees,
274
280
  verifyAccess,
@@ -17,6 +17,7 @@ const {pathNotFoundErrors} = require('./constants');
17
17
  const {routeHintFromRoute} = require('./../../lnd_requests');
18
18
  const {routesFromQueryRoutes} = require('./../../lnd_responses');
19
19
 
20
+ const asTimePreference = n => n === undefined ? n : ((n * 2) - 1e6) / 1e6;
20
21
  const bufFromHex = hex => !hex ? null : Buffer.from(hex, 'hex');
21
22
  const {concat} = Buffer;
22
23
  const defaultRetryInterval = retryCount => 50 * Math.pow(2, retryCount);
@@ -24,6 +25,7 @@ const defaultMaxFee = Number.MAX_SAFE_INTEGER;
24
25
  const errorFilter = err => Array.isArray(err) && err.slice().shift() === 429;
25
26
  const internalServerError = /internal.server.error/i;
26
27
  const {isArray} = Array;
28
+ const isConfidence = n => !isNaN(n) && n >= 0 && n <= 1e6;
27
29
  const isHex = n => !(n.length % 2) && /^[0-9A-F]*$/i.test(n);
28
30
  const mtokensByteLength = 8;
29
31
  const networkBusyError = /device.or.resource.busy/;
@@ -41,8 +43,11 @@ const trimByte = 0;
41
43
 
42
44
  Requires `info:read` permission
43
45
 
46
+ Preferred `confidence` is not supported on LND 0.14.3 and below
47
+
44
48
  {
45
49
  [cltv_delta]: <Final CLTV Delta Number>
50
+ [confidence]: <Preferred Route Confidence Number Out of One Million Number>
46
51
  destination: <Final Send Destination Hex Encoded Public Key String>
47
52
  [features]: [{
48
53
  bit: <Feature Bit Number>
@@ -112,6 +117,10 @@ module.exports = (args, cbk) => {
112
117
  return asyncAuto({
113
118
  // Check arguments
114
119
  validate: cbk => {
120
+ if (args.confidence !== undefined && !isConfidence(args.confidence)) {
121
+ return cbk([400, 'ExpectedConfidenceInPartsPerMillionForQuery']);
122
+ }
123
+
115
124
  if (!args.destination || !isHex(args.destination)) {
116
125
  return cbk([400, 'ExpectedDestinationKeyToGetRouteToDestination']);
117
126
  }
@@ -261,6 +270,7 @@ module.exports = (args, cbk) => {
261
270
  pub_key: args.destination,
262
271
  route_hints: routeHints || undefined,
263
272
  source_pub_key: args.start || undefined,
273
+ time_pref: asTimePreference(args.confidence),
264
274
  use_mission_control: !args.is_ignoring_past_failures,
265
275
  },
266
276
  (err, response) => {
@@ -7,6 +7,11 @@
7
7
  "method": "ConnectPeer",
8
8
  "type": "default"
9
9
  },
10
+ "beginGroupSigningSession": {
11
+ "depends_on": ["getPublicKey"],
12
+ "method": "MuSig2CreateSession",
13
+ "type": "signer"
14
+ },
10
15
  "broadcastChainTransaction": {
11
16
  "method": "PublishTransaction",
12
17
  "type": "wallet"
@@ -87,6 +92,10 @@
87
92
  "method": "UpdateChanStatus",
88
93
  "type": "router"
89
94
  },
95
+ "endGroupSigningSession": {
96
+ "methods": ["MuSig2Cleanup", "MuSig2CombineSig"],
97
+ "type": "signer"
98
+ },
90
99
  "fundPendingChannels": {
91
100
  "method": "FundingStateStep",
92
101
  "type": "default"
@@ -514,6 +523,10 @@
514
523
  "methods": ["AddTower", "RemoveTower"],
515
524
  "type": "tower_client"
516
525
  },
526
+ "updateGroupSigningSession": {
527
+ "methods": ["MuSig2RegisterNonces", "MuSig2Sign"],
528
+ "type": "signer"
529
+ },
517
530
  "updatePathfindingSettings": {
518
531
  "method": "SetMissionControlConfig",
519
532
  "type": "router"
@@ -56,7 +56,9 @@ const type = 'default';
56
56
  message: <Error Message String>
57
57
  }
58
58
  [index]: <Payment Add Index Number>
59
- [confirmed_at]: <Payment Confirmed At ISO 8601 Date String>
59
+ [confirmed_at]: <Payment Attempt Succeeded At ISO 8601 Date String>
60
+ created_at: <Attempt Was Started At ISO 8601 Date String>
61
+ [failed_at]: <Payment Attempt Failed At ISO 8601 Date String>
60
62
  is_confirmed: <Payment Attempt Succeeded Bool>
61
63
  is_failed: <Payment Attempt Failed Bool>
62
64
  is_pending: <Payment Attempt is Waiting For Resolution Bool>
@@ -55,7 +55,9 @@ const type = 'default';
55
55
  message: <Error Message String>
56
56
  }
57
57
  [index]: <Payment Add Index Number>
58
- [confirmed_at]: <Payment Confirmed At ISO 8601 Date String>
58
+ [confirmed_at]: <Payment Attempt Succeeded At ISO 8601 Date String>
59
+ created_at: <Attempt Was Started At ISO 8601 Date String>
60
+ [failed_at]: <Payment Attempt Failed At ISO 8601 Date String>
59
61
  is_confirmed: <Payment Attempt Succeeded Bool>
60
62
  is_failed: <Payment Attempt Failed Bool>
61
63
  is_pending: <Payment Attempt is Waiting For Resolution Bool>
@@ -57,6 +57,8 @@ const type = 'default';
57
57
  }
58
58
  [index]: <Payment Add Index Number>
59
59
  [confirmed_at]: <Payment Confirmed At ISO 8601 Date String>
60
+ created_at: <Attempt Was Started At ISO 8601 Date String>
61
+ [failed_at]: <Payment Attempt Failed At ISO 8601 Date String>
60
62
  is_confirmed: <Payment Attempt Succeeded Bool>
61
63
  is_failed: <Payment Attempt Failed Bool>
62
64
  is_pending: <Payment Attempt is Waiting For Resolution Bool>
@@ -9,8 +9,11 @@ const defaultTokens = 1;
9
9
 
10
10
  Requires `offchain:write` permission
11
11
 
12
+ Preferred `confidence` is not supported on LND 0.14.3 and below
13
+
12
14
  {
13
15
  [cltv_delta]: <Final CLTV Delta Number>
16
+ [confidence]: <Preferred Route Confidence Number Out of One Million Number>
14
17
  destination: <Pay to Node with Public Key Hex String>
15
18
  [incoming_peer]: <Pay Through Specific Final Hop Public Key Hex String>
16
19
  lnd: <Authenticated LND API Object>
@@ -57,6 +60,7 @@ module.exports = (args, cbk) => {
57
60
 
58
61
  const sub = subscribeToPayViaDetails({
59
62
  cltv_delta: args.cltv_delta,
63
+ confidence: args.confidence,
60
64
  destination: args.destination,
61
65
  lnd: args.lnd,
62
66
  max_fee: args.max_fee,
@@ -17,7 +17,10 @@ const payViaRoutes = require('./pay_via_routes');
17
17
 
18
18
  `max_path_mtokens` is not supported in LND 0.12.0 or below
19
19
 
20
+ Preferred `confidence` is not supported on LND 0.14.3 and below
21
+
20
22
  {
23
+ [confidence]: <Preferred Route Confidence Number Out of One Million Number>
21
24
  [incoming_peer]: <Pay Through Specific Final Hop Public Key Hex String>
22
25
  lnd: <Authenticated LND API Object>
23
26
  [max_fee]: <Maximum Additional Fee Tokens To Pay Number>
@@ -124,6 +127,7 @@ module.exports = (args, cbk) => {
124
127
  }
125
128
 
126
129
  return payViaPaymentRequest({
130
+ confidence: args.confidence,
127
131
  incoming_peer: args.incoming_peer,
128
132
  lnd: args.lnd,
129
133
  max_fee: args.max_fee,