Struct lightning::offers::invoice::Bolt12Invoice
source · pub struct Bolt12Invoice { /* private fields */ }
Expand description
A Bolt12Invoice
is a payment request, typically corresponding to an Offer
or a Refund
.
An invoice may be sent in response to an InvoiceRequest
in the case of an offer or sent
directly after scanning a refund. It includes all the information needed to pay a recipient.
Implementations§
source§impl Bolt12Invoice
impl Bolt12Invoice
sourcepub fn offer_chains(&self) -> Option<Vec<ChainHash>>
pub fn offer_chains(&self) -> Option<Vec<ChainHash>>
The chains that may be used when paying a requested invoice.
From Offer::chains
; None
if the invoice was created in response to a Refund
.
sourcepub fn chain(&self) -> ChainHash
pub fn chain(&self) -> ChainHash
The chain that must be used when paying the invoice; selected from offer_chains
if the
invoice originated from an offer.
From InvoiceRequest::chain
or Refund::chain
.
sourcepub fn metadata(&self) -> Option<&Vec<u8>>
pub fn metadata(&self) -> Option<&Vec<u8>>
Opaque bytes set by the originating Offer
.
From Offer::metadata
; None
if the invoice was created in response to a Refund
or
if the Offer
did not set it.
sourcepub fn amount(&self) -> Option<&Amount>
pub fn amount(&self) -> Option<&Amount>
The minimum amount required for a successful payment of a single item.
From Offer::amount
; None
if the invoice was created in response to a Refund
or if
the Offer
did not set it.
sourcepub fn offer_features(&self) -> Option<&OfferFeatures>
pub fn offer_features(&self) -> Option<&OfferFeatures>
Features pertaining to the originating Offer
.
From Offer::offer_features
; None
if the invoice was created in response to a
Refund
.
sourcepub fn description(&self) -> Option<PrintableString<'_>>
pub fn description(&self) -> Option<PrintableString<'_>>
A complete description of the purpose of the originating offer or refund.
From Offer::description
or Refund::description
.
sourcepub fn absolute_expiry(&self) -> Option<Duration>
pub fn absolute_expiry(&self) -> Option<Duration>
Duration since the Unix epoch when an invoice should no longer be requested.
sourcepub fn issuer(&self) -> Option<PrintableString<'_>>
pub fn issuer(&self) -> Option<PrintableString<'_>>
The issuer of the offer or refund.
From Offer::issuer
or Refund::issuer
.
sourcepub fn message_paths(&self) -> &[BlindedPath]
pub fn message_paths(&self) -> &[BlindedPath]
Paths to the recipient originating from publicly reachable nodes.
From Offer::paths
or Refund::paths
.
sourcepub fn supported_quantity(&self) -> Option<Quantity>
pub fn supported_quantity(&self) -> Option<Quantity>
The quantity of items supported.
From Offer::supported_quantity
; None
if the invoice was created in response to a
Refund
.
sourcepub fn payer_metadata(&self) -> &[u8] ⓘ
pub fn payer_metadata(&self) -> &[u8] ⓘ
An unpredictable series of bytes from the payer.
From InvoiceRequest::payer_metadata
or Refund::payer_metadata
.
sourcepub fn invoice_request_features(&self) -> &InvoiceRequestFeatures
pub fn invoice_request_features(&self) -> &InvoiceRequestFeatures
Features pertaining to requesting an invoice.
From InvoiceRequest::invoice_request_features
or Refund::features
.
sourcepub fn quantity(&self) -> Option<u64>
pub fn quantity(&self) -> Option<u64>
The quantity of items requested or refunded for.
From InvoiceRequest::quantity
or Refund::quantity
.
sourcepub fn payer_id(&self) -> PublicKey
pub fn payer_id(&self) -> PublicKey
A possibly transient pubkey used to sign the invoice request or to send an invoice for a
refund in case there are no message_paths
.
sourcepub fn payer_note(&self) -> Option<PrintableString<'_>>
pub fn payer_note(&self) -> Option<PrintableString<'_>>
A payer-provided note reflected back in the invoice.
sourcepub fn payment_paths(&self) -> &[(BlindedPayInfo, BlindedPath)]
pub fn payment_paths(&self) -> &[(BlindedPayInfo, BlindedPath)]
Paths to the recipient originating from publicly reachable nodes, including information needed for routing payments across them.
Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this
privacy is lost if a public node id is used for Bolt12Invoice::signing_pubkey
.
This is not exported to bindings users as slices with non-reference types cannot be ABI matched in another language.
sourcepub fn created_at(&self) -> Duration
pub fn created_at(&self) -> Duration
Duration since the Unix epoch when the invoice was created.
sourcepub fn relative_expiry(&self) -> Duration
pub fn relative_expiry(&self) -> Duration
Duration since Bolt12Invoice::created_at
when the invoice has expired and therefore
should no longer be paid.
sourcepub fn is_expired(&self) -> bool
Available on crate feature std
only.
pub fn is_expired(&self) -> bool
std
only.Whether the invoice has expired.
sourcepub fn payment_hash(&self) -> PaymentHash
pub fn payment_hash(&self) -> PaymentHash
SHA256 hash of the payment preimage that will be given in return for paying the invoice.
sourcepub fn amount_msats(&self) -> u64
pub fn amount_msats(&self) -> u64
The minimum amount required for a successful payment of the invoice.
sourcepub fn fallbacks(&self) -> Vec<Address>
pub fn fallbacks(&self) -> Vec<Address>
Fallback addresses for paying the invoice on-chain, in order of most-preferred to least-preferred.
sourcepub fn invoice_features(&self) -> &Bolt12InvoiceFeatures
pub fn invoice_features(&self) -> &Bolt12InvoiceFeatures
Features pertaining to paying an invoice.
sourcepub fn signing_pubkey(&self) -> PublicKey
pub fn signing_pubkey(&self) -> PublicKey
The public key corresponding to the key used to sign the invoice.
sourcepub fn signature(&self) -> Signature
pub fn signature(&self) -> Signature
Signature of the invoice verified using Bolt12Invoice::signing_pubkey
.
sourcepub fn signable_hash(&self) -> [u8; 32]
pub fn signable_hash(&self) -> [u8; 32]
Hash that was used for signing the invoice.
Trait Implementations§
source§impl Clone for Bolt12Invoice
impl Clone for Bolt12Invoice
source§fn clone(&self) -> Bolt12Invoice
fn clone(&self) -> Bolt12Invoice
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more