breez_sdk_liquid::lightning_invoice::utils

Function create_invoice_from_channelmanager

pub fn create_invoice_from_channelmanager<M, T, ES, NS, SP, F, R, L>(
    channelmanager: &ChannelManager<M, T, ES, NS, SP, F, R, L>,
    node_signer: NS,
    logger: L,
    network: Currency,
    amt_msat: Option<u64>,
    description: String,
    invoice_expiry_delta_secs: u32,
    min_final_cltv_expiry_delta: Option<u16>,
) -> Result<Bolt11Invoice, SignOrCreationError>
where M: Deref, T: Deref, ES: Deref, NS: Deref, SP: Deref, F: Deref, R: Deref, L: Deref, <M as Deref>::Target: Watch<<<SP as Deref>::Target as SignerProvider>::Signer>, <T as Deref>::Target: BroadcasterInterface, <ES as Deref>::Target: EntropySource, <NS as Deref>::Target: NodeSigner, <SP as Deref>::Target: SignerProvider, <F as Deref>::Target: FeeEstimator, <R as Deref>::Target: Router, <L as Deref>::Target: Logger,
Expand description

Utility to construct an invoice. Generally, unless you want to do something like a custom cltv_expiry, this is what you should be using to create an invoice. The reason being, this method stores the invoice’s payment secret and preimage in ChannelManager, so (a) the user doesn’t have to store preimage/payment secret information and (b) ChannelManager can verify that the payment secret is valid when the invoice is paid.

invoice_expiry_delta_secs describes the number of seconds that the invoice is valid for in excess of the current time.

You can specify a custom min_final_cltv_expiry_delta, or let LDK default it to MIN_FINAL_CLTV_EXPIRY_DELTA. The provided expiry must be at least MIN_FINAL_CLTV_EXPIRY_DELTA. Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block confirmations during routing.