Struct StaticInvoice

Source
pub struct StaticInvoice { /* private fields */ }
Expand description

A StaticInvoice is a reusable payment request corresponding to an Offer.

A static invoice may be sent in response to an InvoiceRequest and includes all the information needed to pay the recipient. However, unlike Bolt12Invoices, static invoices do not provide proof-of-payment. Therefore, Bolt12Invoices should be preferred when the recipient is online to provide one.

Implementations§

Source§

impl StaticInvoice

Source

pub fn payment_paths(&self) -> &[BlindedPaymentPath]

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 StaticInvoice::signing_pubkey.

Source

pub fn created_at(&self) -> Duration

Duration since the Unix epoch when the invoice was created.

Source

pub fn relative_expiry(&self) -> Duration

Duration since StaticInvoice::created_at when the invoice has expired and therefore should no longer be paid.

Source

pub fn is_expired(&self) -> bool

Whether the invoice has expired.

Source

pub fn is_expired_no_std(&self, duration_since_epoch: Duration) -> bool

Whether the invoice has expired given the current time as duration since the Unix epoch.

Source

pub fn fallbacks(&self) -> Vec<Address>

Fallback addresses for paying the invoice on-chain, in order of most-preferred to least-preferred.

Source

pub fn invoice_features(&self) -> &Bolt12InvoiceFeatures

Features pertaining to paying an invoice.

Source

pub fn signing_pubkey(&self) -> PublicKey

The public key corresponding to the key used to sign the invoice.

This will be:

Source

pub fn chain(&self) -> ChainHash

The chain that must be used when paying the invoice. StaticInvoices currently can only be created from offers that support a single chain.

Source

pub fn metadata(&self) -> Option<&Vec<u8>>

Opaque bytes set by the originating Offer::metadata.

Source

pub fn amount(&self) -> Option<Amount>

The minimum amount required for a successful payment of a single item.

From Offer::amount.

Source

pub fn offer_features(&self) -> &OfferFeatures

Features pertaining to the originating Offer, from Offer::offer_features.

Source

pub fn description(&self) -> Option<PrintableString<'_>>

A complete description of the purpose of the originating offer, from Offer::description.

Source

pub fn absolute_expiry(&self) -> Option<Duration>

Duration since the Unix epoch when an invoice should no longer be requested, from Offer::absolute_expiry.

Source

pub fn issuer(&self) -> Option<PrintableString<'_>>

The issuer of the offer, from Offer::issuer.

Source

pub fn offer_message_paths(&self) -> &[BlindedMessagePath]

Paths to the node that may supply the invoice on the recipient’s behalf, originating from publicly reachable nodes. Taken from Offer::paths.

Source

pub fn message_paths(&self) -> &[BlindedMessagePath]

Paths to the recipient for indicating that a held HTLC is available to claim when they next come online.

Source

pub fn supported_quantity(&self) -> Quantity

The quantity of items supported, from Offer::supported_quantity.

Source

pub fn issuer_signing_pubkey(&self) -> Option<PublicKey>

The public key used by the recipient to sign invoices, from Offer::issuer_signing_pubkey.

Source

pub fn signature(&self) -> Signature

Signature of the invoice verified using StaticInvoice::signing_pubkey.

Source

pub fn is_offer_expired(&self) -> bool

Whether the Offer that this invoice is based on is expired.

Source

pub fn is_offer_expired_no_std(&self, duration_since_epoch: Duration) -> bool

Whether the Offer that this invoice is based on is expired, given the current time as duration since the Unix epoch.

Source

pub fn offer_id(&self) -> OfferId

Returns the OfferId corresponding to the originating Offer.

Trait Implementations§

Source§

impl Clone for StaticInvoice

Source§

fn clone(&self) -> StaticInvoice

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StaticInvoice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for StaticInvoice

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl LengthReadable for StaticInvoice

Source§

impl PartialEq for StaticInvoice

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<Vec<u8>> for StaticInvoice

Source§

type Error = Bolt12ParseError

The type returned in the event of a conversion error.
Source§

fn try_from(bytes: Vec<u8>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Writeable for StaticInvoice

Source§

fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error>

Writes self out to the given Writer.
Source§

fn encode(&self) -> Vec<u8>

Writes self out to a Vec<u8>.
Source§

fn serialized_length(&self) -> usize

Gets the length of this object after it has been serialized. This can be overridden to optimize cases where we prepend an object with its length.
Source§

impl Eq for StaticInvoice

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V