Struct lightning::offers::invoice_request::InvoiceRequest
source · pub struct InvoiceRequest { /* private fields */ }
Expand description
Implementations§
source§impl InvoiceRequest
impl InvoiceRequest
sourcepub fn metadata(&self) -> &[u8] ⓘ
pub fn metadata(&self) -> &[u8] ⓘ
An unpredictable series of bytes, typically containing information about the derivation of
payer_id
.
sourcepub fn chain(&self) -> ChainHash
pub fn chain(&self) -> ChainHash
A chain from Offer::chains
that the offer is valid for.
sourcepub fn amount_msats(&self) -> Option<u64>
pub fn amount_msats(&self) -> Option<u64>
The amount to pay in msats (i.e., the minimum lightning-payable unit for chain
), which
must be greater than or equal to Offer::amount
, converted if necessary.
sourcepub fn features(&self) -> &InvoiceRequestFeatures
pub fn features(&self) -> &InvoiceRequestFeatures
Features pertaining to requesting an invoice.
sourcepub fn quantity(&self) -> Option<u64>
pub fn quantity(&self) -> Option<u64>
The quantity of the offer’s item conforming to Offer::is_valid_quantity
.
sourcepub fn payer_id(&self) -> PublicKey
pub fn payer_id(&self) -> PublicKey
A possibly transient pubkey used to sign the invoice request.
sourcepub fn payer_note(&self) -> Option<PrintableString<'_>>
pub fn payer_note(&self) -> Option<PrintableString<'_>>
A payer-provided note which will be seen by the recipient and reflected back in the invoice response.
sourcepub fn respond_with(
&self,
payment_paths: Vec<(BlindedPath, BlindedPayInfo)>,
payment_hash: PaymentHash
) -> Result<InvoiceBuilder<'_>, SemanticError>
Available on crate feature std
only.
pub fn respond_with( &self, payment_paths: Vec<(BlindedPath, BlindedPayInfo)>, payment_hash: PaymentHash ) -> Result<InvoiceBuilder<'_>, SemanticError>
std
only.Creates an Invoice
for the request with the given required fields and using the
Duration
since std::time::SystemTime::UNIX_EPOCH
as the creation time.
See InvoiceRequest::respond_with_no_std
for further details where the aforementioned
creation time is used for the created_at
parameter.
sourcepub fn respond_with_no_std(
&self,
payment_paths: Vec<(BlindedPath, BlindedPayInfo)>,
payment_hash: PaymentHash,
created_at: Duration
) -> Result<InvoiceBuilder<'_>, SemanticError>
pub fn respond_with_no_std( &self, payment_paths: Vec<(BlindedPath, BlindedPayInfo)>, payment_hash: PaymentHash, created_at: Duration ) -> Result<InvoiceBuilder<'_>, SemanticError>
Creates an Invoice
for the request with the given required fields.
Unless InvoiceBuilder::relative_expiry
is set, the invoice will expire two hours after
created_at
, which is used to set Invoice::created_at
. Useful for no-std
builds where
std::time::SystemTime
is not available.
The caller is expected to remember the preimage of payment_hash
in order to claim a payment
for the invoice.
The payment_paths
parameter is useful for maintaining the payment recipient’s privacy. It
must contain one or more elements ordered from most-preferred to least-preferred, if there’s
a preference. Note, however, that any privacy is lost if a public node id was used for
Offer::signing_pubkey
.
Errors if the request contains unknown required features.
Trait Implementations§
source§impl Clone for InvoiceRequest
impl Clone for InvoiceRequest
source§fn clone(&self) -> InvoiceRequest
fn clone(&self) -> InvoiceRequest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for InvoiceRequest
impl Debug for InvoiceRequest
source§impl PartialEq<InvoiceRequest> for InvoiceRequest
impl PartialEq<InvoiceRequest> for InvoiceRequest
source§fn eq(&self, other: &InvoiceRequest) -> bool
fn eq(&self, other: &InvoiceRequest) -> bool
self
and other
values to be equal, and is used
by ==
.