Struct lightning::offers::invoice_request::InvoiceRequest
source · pub struct InvoiceRequest { /* private fields */ }
Expand description
An InvoiceRequest
is a request for a Bolt12Invoice
formulated from an Offer
.
An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request specifies these such that its recipient can send an invoice for payment.
Implementations§
source§impl InvoiceRequest
impl InvoiceRequest
sourcepub fn chains(&self) -> Vec<ChainHash>
Available on non-c_bindings
only.
pub fn chains(&self) -> Vec<ChainHash>
c_bindings
only.The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) for the selected chain.
sourcepub fn metadata(&self) -> Option<&Vec<u8>>
Available on non-c_bindings
only.
pub fn metadata(&self) -> Option<&Vec<u8>>
c_bindings
only.Opaque bytes set by the originator. Useful for authentication and validating fields since it
is reflected in invoice_request
messages along with all the other fields from the offer
.
sourcepub fn amount(&self) -> Option<&Amount>
Available on non-c_bindings
only.
pub fn amount(&self) -> Option<&Amount>
c_bindings
only.The minimum amount required for a successful payment of a single item.
sourcepub fn description(&self) -> Option<PrintableString<'_>>
Available on non-c_bindings
only.
pub fn description(&self) -> Option<PrintableString<'_>>
c_bindings
only.A complete description of the purpose of the payment. Intended to be displayed to the user but with the caveat that it has not been verified in any way.
sourcepub fn offer_features(&self) -> &OfferFeatures
Available on non-c_bindings
only.
pub fn offer_features(&self) -> &OfferFeatures
c_bindings
only.Features pertaining to the offer.
sourcepub fn absolute_expiry(&self) -> Option<Duration>
Available on non-c_bindings
only.
pub fn absolute_expiry(&self) -> Option<Duration>
c_bindings
only.Duration since the Unix epoch when an invoice should no longer be requested.
If None
, the offer does not expire.
sourcepub fn issuer(&self) -> Option<PrintableString<'_>>
Available on non-c_bindings
only.
pub fn issuer(&self) -> Option<PrintableString<'_>>
c_bindings
only.The issuer of the offer, possibly beginning with user@domain
or domain
. Intended to be
displayed to the user but with the caveat that it has not been verified in any way.
sourcepub fn paths(&self) -> &[BlindedPath]
Available on non-c_bindings
only.
pub fn paths(&self) -> &[BlindedPath]
c_bindings
only.Paths to the recipient originating from publicly reachable nodes. Blinded paths provide recipient privacy by obfuscating its node id.
sourcepub fn supported_quantity(&self) -> Quantity
Available on non-c_bindings
only.
pub fn supported_quantity(&self) -> Quantity
c_bindings
only.The quantity of items supported.
sourcepub fn signing_pubkey(&self) -> Option<PublicKey>
Available on non-c_bindings
only.
pub fn signing_pubkey(&self) -> Option<PublicKey>
c_bindings
only.The public key used by the recipient to sign invoices.
sourcepub fn payer_metadata(&self) -> &[u8] ⓘ
Available on non-c_bindings
only.
pub fn payer_metadata(&self) -> &[u8] ⓘ
c_bindings
only.An unpredictable series of bytes, typically containing information about the derivation of
payer_id
.
sourcepub fn chain(&self) -> ChainHash
Available on non-c_bindings
only.
pub fn chain(&self) -> ChainHash
c_bindings
only.A chain from Offer::chains
that the offer is valid for.
sourcepub fn amount_msats(&self) -> Option<u64>
Available on non-c_bindings
only.
pub fn amount_msats(&self) -> Option<u64>
c_bindings
only.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 invoice_request_features(&self) -> &InvoiceRequestFeatures
Available on non-c_bindings
only.
pub fn invoice_request_features(&self) -> &InvoiceRequestFeatures
c_bindings
only.Features pertaining to requesting an invoice.
sourcepub fn quantity(&self) -> Option<u64>
Available on non-c_bindings
only.
pub fn quantity(&self) -> Option<u64>
c_bindings
only.The quantity of the offer’s item conforming to Offer::is_valid_quantity
.
sourcepub fn payer_id(&self) -> PublicKey
Available on non-c_bindings
only.
pub fn payer_id(&self) -> PublicKey
c_bindings
only.A possibly transient pubkey used to sign the invoice request.
sourcepub fn payer_note(&self) -> Option<PrintableString<'_>>
Available on non-c_bindings
only.
pub fn payer_note(&self) -> Option<PrintableString<'_>>
c_bindings
only.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<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash
) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
Available on non-c_bindings
and crate feature std
only.
pub fn respond_with( &self, payment_paths: Vec<(BlindedPayInfo, BlindedPath)>, payment_hash: PaymentHash ) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
c_bindings
and crate feature std
only.Creates an InvoiceBuilder
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<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
created_at: Duration
) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
Available on non-c_bindings
only.
pub fn respond_with_no_std( &self, payment_paths: Vec<(BlindedPayInfo, BlindedPath)>, payment_hash: PaymentHash, created_at: Duration ) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
c_bindings
only.Creates an InvoiceBuilder
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 Bolt12Invoice::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.
§Note
If the originating Offer
was created using OfferBuilder::deriving_signing_pubkey
,
then use InvoiceRequest::verify
and VerifiedInvoiceRequest
methods instead.
sourcepub fn verify<T: Signing>(
self,
key: &ExpandedKey,
secp_ctx: &Secp256k1<T>
) -> Result<VerifiedInvoiceRequest, ()>
Available on non-c_bindings
only.
pub fn verify<T: Signing>( self, key: &ExpandedKey, secp_ctx: &Secp256k1<T> ) -> Result<VerifiedInvoiceRequest, ()>
c_bindings
only.Verifies that the request was for an offer created using the given key. Returns the verified
request which contains the derived keys needed to sign a Bolt12Invoice
for the request
if they could be extracted from the metadata.
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 more