@@ -203,20 +203,26 @@ where
203
203
}
204
204
}
205
205
206
- /// Initiate the creation of an invoice that when paid will open a channel
207
- /// with enough inbound liquidity to be able to receive the payment.
206
+ /// Request the channel opening parameters from the LSP.
208
207
///
209
- /// `counterparty_node_id` is the node_id of the LSP you would like to use.
208
+ /// This initiates the JIT-channel flow that, at the end of it, will have the LSP
209
+ /// open a channel with sufficient inbound liquidity to be able to receive the payment.
210
+ ///
211
+ /// The user will receive the LSP's response via an [`OpeningParametersReady`] event.
212
+ ///
213
+ /// `counterparty_node_id` is the `node_id` of the LSP you would like to use.
210
214
///
211
215
/// If `payment_size_msat` is [`Option::Some`] then the invoice will be for a fixed amount
212
216
/// and MPP can be used to pay it.
213
217
///
214
218
/// If `payment_size_msat` is [`Option::None`] then the invoice can be for an arbitrary amount
215
219
/// but MPP can no longer be used to pay it.
216
220
///
217
- /// `token` is an optional String that will be provided to the LSP.
221
+ /// `token` is an optional ` String` that will be provided to the LSP.
218
222
/// It can be used by the LSP as an API key, coupon code, or some other way to identify a user.
219
- pub fn create_invoice (
223
+ ///
224
+ /// [`OpeningParametersReady`]: crate::lsps2::event::LSPS2ClientEvent::OpeningParametersReady
225
+ pub fn request_opening_params (
220
226
& self , counterparty_node_id : PublicKey , payment_size_msat : Option < u64 > ,
221
227
token : Option < String > , user_channel_id : u128 ,
222
228
) {
@@ -239,14 +245,19 @@ where
239
245
) ;
240
246
}
241
247
242
- /// Used by client to confirm which channel parameters to use for the JIT Channel buy request.
248
+ /// Confirms a set of chosen channel opening parameters to use for the JIT channel and
249
+ /// requests the necessary invoice generation parameters from the LSP.
250
+ ///
251
+ /// Should be called in response to receiving a [`OpeningParametersReady`] event.
252
+ ///
253
+ /// The user will receive the LSP's response via an [`InvoiceParametersReady`] event.
254
+ ///
243
255
/// The client agrees to paying an opening fee equal to
244
256
/// `max(min_fee_msat, proportional*(payment_size_msat/1_000_000))`.
245
257
///
246
- /// Should be called in response to receiving a [`LSPS2ClientEvent::GetInfoResponse`] event.
247
- ///
248
- /// [`LSPS2ClientEvent::GetInfoResponse`]: crate::lsps2::event::LSPS2ClientEvent::GetInfoResponse
249
- pub fn opening_fee_params_selected (
258
+ /// [`OpeningParametersReady`]: crate::lsps2::event::LSPS2ClientEvent::OpeningParametersReady
259
+ /// [`InvoiceParametersReady`]: crate::lsps2::event::LSPS2ClientEvent::InvoiceParametersReady
260
+ pub fn select_opening_params (
250
261
& self , counterparty_node_id : PublicKey , jit_channel_id : u128 ,
251
262
opening_fee_params : OpeningFeeParams ,
252
263
) -> Result < ( ) , APIError > {
@@ -334,7 +345,7 @@ where
334
345
}
335
346
336
347
self . pending_events . enqueue ( Event :: LSPS2Client (
337
- LSPS2ClientEvent :: GetInfoResponse {
348
+ LSPS2ClientEvent :: OpeningParametersReady {
338
349
counterparty_node_id : * counterparty_node_id,
339
350
opening_fee_params_menu : result. opening_fee_params_menu ,
340
351
min_payment_size_msat : result. min_payment_size_msat ,
@@ -442,7 +453,7 @@ where
442
453
443
454
if let Ok ( intercept_scid) = result. intercept_scid . to_scid ( ) {
444
455
self . pending_events . enqueue ( Event :: LSPS2Client (
445
- LSPS2ClientEvent :: InvoiceGenerationReady {
456
+ LSPS2ClientEvent :: InvoiceParametersReady {
446
457
counterparty_node_id : * counterparty_node_id,
447
458
intercept_scid,
448
459
cltv_expiry_delta : result. lsp_cltv_expiry_delta ,
0 commit comments