Struct LxInvoice

pub struct LxInvoice(pub Bolt11Invoice);
Expand description

Wraps [lightning_invoice::Bolt11Invoice] to impl serde Serialize / Deserialize using the LDK’s FromStr / Display impls.

Tuple Fields§

§0: Bolt11Invoice

Implementations§

§

impl LxInvoice

pub fn payment_hash(&self) -> LxPaymentHash

The invoice payment hash. The payer will receive the preimage to this hash upon successful payment, as proof-of-payment.

pub fn payment_secret(&self) -> LxPaymentSecret

The invoice payment secret, used to authenticate the payer to the payee and tie MPP HTLCs together.

pub fn payment_id(&self) -> LxPaymentId

Lexe’s main identifier for this payment, which for BOLT11 invoice payments is just the LxInvoice::payment_hash.

pub fn network(&self) -> Network

pub fn supports_network(&self, network: LxNetwork) -> bool

pub fn description_str(&self) -> Option<&str>

If the invoice contains a non-empty, inline description, then return that as a string. Otherwise return None.

pub fn description_hash(&self) -> Option<&[u8; 32]>

If the invoice uses a description hash, return that. Otherwise return None.

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

Return the invoice’s requested amount, if present. An invoice may leave the final amount up to the payer, in which case this field will be None.

pub fn amount_sats(&self) -> Option<u64>

The invoice amount in satoshis, if included.

pub fn created_at(&self) -> Result<TimestampMs, Error>

Get the invoice creation timestamp. Returns an error if the timestamp is several hundred million years in the future.

pub fn saturating_created_at(&self) -> TimestampMs

Get the invoice creation timestamp unconditionally.

pub fn is_expired(&self) -> bool

Returns true if the invoice has expired.

pub fn is_expired_at(&self, ts: TimestampMs) -> bool

Returns true if the invoice expires before the given timestamp.

pub fn expires_at(&self) -> Result<TimestampMs, Error>

Get the invoice expiration timestamp. Returns an error if the timestamp is several hundred million years in the future.

pub fn saturating_expires_at(&self) -> TimestampMs

Get the invoice expiration timestamp unconditionally.

pub fn payee_node_pk(&self) -> NodePk

Get the invoice payee’s NodePk.

If the pubkey is not included directly in the invoice, we have to ecrecover the pubkey, which is somewhat more expensive (~20-40 us).

pub fn min_final_cltv_expiry_delta_u32(&self) -> Result<u32, Error>

Returns the invoice’s min_final_cltv_expiry_delta time, if present, otherwise [lightning_invoice::DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA].

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

BOLT11 Invoices can attach optional onchain addresses for a payee to use if the lightning payment is not feasible. This fn returns those addresses.

pub fn matches_hrp_prefix(s: &str) -> bool

Returns true if the input string starts with a valid bech32 hrp prefix for a BOLT11 invoice.

Trait Implementations§

§

impl Clone for LxInvoice

§

fn clone(&self) -> LxInvoice

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
§

impl Debug for LxInvoice

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for LxInvoice

§

fn deserialize<__D>( deserializer: __D, ) -> Result<LxInvoice, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl Display for LxInvoice

§

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

Formats the value using the given formatter. Read more
§

impl FromStr for LxInvoice

§

type Err = ParseError

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<LxInvoice, <LxInvoice as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl PartialEq for LxInvoice

§

fn eq(&self, other: &LxInvoice) -> 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.
§

impl Serialize for LxInvoice

§

fn serialize<__S>( &self, serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
§

impl Eq for LxInvoice

§

impl StructuralPartialEq for LxInvoice

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
§

impl<F, T, U> Apply<F, U> for T
where F: FnOnce(T) -> U,

§

fn apply(self, f: F) -> U

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

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

§

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

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

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

§

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

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

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

§

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

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

impl<T> ToStringFallible for T
where T: Display,

§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,