Struct lightning_signer::invoice::bolt12::Invoice
source · pub struct Invoice { /* private fields */ }Expand description
An Invoice 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 Invoice
impl Invoice
sourcepub fn description(&self) -> PrintableString<'_>
pub fn description(&self) -> PrintableString<'_>
A complete description of the purpose of the originating offer or refund. Intended to be displayed to the user but with the caveat that it has not been verified in any way.
sourcepub fn payment_paths(&self) -> &[(BlindedPath, BlindedPayInfo)]
pub fn payment_paths(&self) -> &[(BlindedPath, BlindedPayInfo)]
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 Invoice::signing_pubkey.
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 Invoice::created_at when the invoice has expired and therefore should no
longer be paid.
sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
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, Global>
pub fn fallbacks(&self) -> Vec<Address, Global>
Fallback addresses for paying the invoice on-chain, in order of most-preferred to least-preferred.
sourcepub fn features(&self) -> &Features<Bolt12InvoiceContext>
pub fn features(&self) -> &Features<Bolt12InvoiceContext>
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 Invoice::signing_pubkey.
sourcepub fn signable_hash(&self) -> [u8; 32]
pub fn signable_hash(&self) -> [u8; 32]
Hash that was used for signing the invoice.
sourcepub fn verify<T>(&self, key: &ExpandedKey, secp_ctx: &Secp256k1<T>) -> boolwhere
T: Signing,
pub fn verify<T>(&self, key: &ExpandedKey, secp_ctx: &Secp256k1<T>) -> boolwhere T: Signing,
Verifies that the invoice was for a request or refund created using the given key.
Trait Implementations§
source§impl TryFrom<ParsedMessage<(PayerTlvStream, OfferTlvStream, InvoiceRequestTlvStream, InvoiceTlvStream, SignatureTlvStream)>> for Invoice
impl TryFrom<ParsedMessage<(PayerTlvStream, OfferTlvStream, InvoiceRequestTlvStream, InvoiceTlvStream, SignatureTlvStream)>> for Invoice
§type Error = ParseError
type Error = ParseError
source§fn try_from(
invoice: ParsedMessage<(PayerTlvStream, OfferTlvStream, InvoiceRequestTlvStream, InvoiceTlvStream, SignatureTlvStream)>
) -> Result<Invoice, <Invoice as TryFrom<ParsedMessage<(PayerTlvStream, OfferTlvStream, InvoiceRequestTlvStream, InvoiceTlvStream, SignatureTlvStream)>>>::Error>
fn try_from( invoice: ParsedMessage<(PayerTlvStream, OfferTlvStream, InvoiceRequestTlvStream, InvoiceTlvStream, SignatureTlvStream)> ) -> Result<Invoice, <Invoice as TryFrom<ParsedMessage<(PayerTlvStream, OfferTlvStream, InvoiceRequestTlvStream, InvoiceTlvStream, SignatureTlvStream)>>>::Error>
source§impl Writeable for Invoice
impl Writeable for Invoice
source§fn write<W>(&self, writer: &mut W) -> Result<(), Error>where
W: Writer,
fn write<W>(&self, writer: &mut W) -> Result<(), Error>where W: Writer,
self out to the given Writer.