Struct LSPS2ClientHandler

Source
pub struct LSPS2ClientHandler<ES: Deref>
where ES::Target: EntropySource,
{ /* private fields */ }
Expand description

The main object allowing to send and receive LSPS2 messages.

Note that currently only the ‘client-trusts-LSP’ trust model is supported, i.e., we don’t provide any additional API guidance to allow withholding the preimage until the channel is opened. Please refer to the LSPS2 specification for more information.

Implementations§

Source§

impl<ES: Deref> LSPS2ClientHandler<ES>
where ES::Target: EntropySource,

Source

pub fn request_opening_params( &self, counterparty_node_id: PublicKey, token: Option<String>, ) -> RequestId

Request the channel opening parameters from the LSP.

This initiates the JIT-channel flow that, at the end of it, will have the LSP open a channel with sufficient inbound liquidity to be able to receive the payment.

The user will receive the LSP’s response via an OpeningParametersReady event.

counterparty_node_id is the node_id of the LSP you would like to use.

token is an optional String that will be provided to the LSP. It can be used by the LSP as an API key, coupon code, or some other way to identify a user.

Returns the used RequestId, which will be returned via OpeningParametersReady.

Source

pub fn select_opening_params( &self, counterparty_node_id: PublicKey, payment_size_msat: Option<u64>, opening_fee_params: OpeningFeeParams, ) -> Result<RequestId, APIError>

Confirms a set of chosen channel opening parameters to use for the JIT channel and requests the necessary invoice generation parameters from the LSP.

Should be called in response to receiving a OpeningParametersReady event.

The user will receive the LSP’s response via an InvoiceParametersReady event.

If payment_size_msat is Option::Some then the invoice will be for a fixed amount and MPP can be used to pay it.

If payment_size_msat is Option::None then the invoice can be for an arbitrary amount but MPP can no longer be used to pay it.

The client agrees to paying an opening fee equal to max(min_fee_msat, proportional*(payment_size_msat/1_000_000)).

Auto Trait Implementations§

§

impl<ES> !Freeze for LSPS2ClientHandler<ES>

§

impl<ES> RefUnwindSafe for LSPS2ClientHandler<ES>
where ES: RefUnwindSafe,

§

impl<ES> Send for LSPS2ClientHandler<ES>
where ES: Send,

§

impl<ES> Sync for LSPS2ClientHandler<ES>
where ES: Sync,

§

impl<ES> Unpin for LSPS2ClientHandler<ES>
where ES: Unpin,

§

impl<ES> UnwindSafe for LSPS2ClientHandler<ES>
where ES: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.