Struct BasicPaymentV2

pub struct BasicPaymentV2 {
Show 24 fields pub id: LxPaymentId, pub related_ids: HashSet<LxPaymentId>, pub kind: PaymentKind, pub direction: PaymentDirection, pub offer_id: Option<LxOfferId>, pub txid: Option<LxTxid>, pub amount: Option<Amount>, pub fee: Amount, pub status: PaymentStatus, pub status_str: String, pub address: Option<Arc<Address<NetworkUnchecked>>>, pub invoice: Option<Arc<LxInvoice>>, pub offer: Option<Arc<LxOffer>>, pub tx: Option<Arc<Transaction>>, pub note: Option<String>, pub payer_name: Option<String>, pub payer_note: Option<String>, pub priority: Option<ConfirmationPriority>, pub quantity: Option<NonZero<u64>>, pub replacement_txid: Option<LxTxid>, pub expires_at: Option<TimestampMs>, pub finalized_at: Option<TimestampMs>, pub created_at: TimestampMs, pub updated_at: TimestampMs,
}
Expand description

A basic payment type which contains all of the user-facing payment details for any kind of payment. These details are exposed in the Lexe app.

It is essentially the Payment type flattened out such that each field is the result of the corresponding Payment getter.

Fields§

§id: LxPaymentId

Payment identifier; globally unique from the user’s perspective.

§related_ids: HashSet<LxPaymentId>

The ids of payments related to this payment.

§kind: PaymentKind

Payment kind: Application-level purpose of this payment.

§direction: PaymentDirection

The payment direction: Inbound, Outbound, or Info.

§offer_id: Option<LxOfferId>

(Offer payments only) The id of the BOLT12 offer used in this payment.

§txid: Option<LxTxid>

(Onchain payments only) The original txid.

§amount: Option<Amount>

The amount of this payment.

  • If this is a completed inbound invoice payment, this is the amount we received.
  • If this is a pending or failed inbound inbound invoice payment, this is the amount encoded in our invoice, which may be null.
  • For all other payment types, an amount is always included.
§fee: Amount

The fees for this payment.

Use this whenever you need a singular value to display.

  • For outbound Lightning payments, these are the routing fees. If the payment is not completed, this value is an estimation only. Iff the payment completes, this value reflects actual fees paid.
  • For inbound Lightning payments, this is the skimmed fee, which may also cover the on-chain fees incurred by a JIT channel open.
  • For on-chain sends, this is the on-chain fee paid in the spending tx.
§status: PaymentStatus

General payment status: pending, completed, or failed.

§status_str: String

The payment status as a human-readable string. These strings are customized per payment type, e.g. “invoice generated”, “timed out”

§address: Option<Arc<Address<NetworkUnchecked>>>

(Onchain send only) The address that we’re sending to.

§invoice: Option<Arc<LxInvoice>>

(Invoice payments only) The BOLT11 invoice used in this payment.

§offer: Option<Arc<LxOffer>>

(Outbound offer payments only) The BOLT12 offer used in this payment. Until we store offers out-of-line, this is not yet available for inbound offer payments.

§tx: Option<Arc<Transaction>>

The on-chain transaction, if there is one. Always Some for on-chain sends and receives.

§note: Option<String>

An optional personal note which a user can attach to any payment. A note can always be added or modified when a payment already exists, but this may not always be possible at creation time. These differences are documented below:

  • Onchain send: The user has the option to set this at creation time.

  • Onchain receive: The user can only add a note after the onchain receive has been detected.

  • Inbound invoice payments: Since a user-provided description is already required when creating an invoice, at invoice creation time this field is not exposed to the user and is simply initialized to None. Useful primarily if a user wants to update their note later.

  • Inbound offer reusable payments and Inbound spontaneous payment: There is no way for users to add the note at receive time, so this field can only be added or updated later.

  • Outbound invoice payments: Since the receiver sets the invoice description, which might just be a useless 🍆 emoji, the user has the option to add this note at the time of invoice payment.

  • Outbound spontaneous payment: Since there is no invoice description field, the user has the option to set this at payment creation time.

§payer_name: Option<String>

(Offer payments only) The payer’s self-reported human-readable name.

§payer_note: Option<String>

(Offer payments only) A payer-provided note for this payment. LDK truncates this to 512 bytes.

§priority: Option<ConfirmationPriority>

(Onchain send only) The confirmation priority used for this payment.

§quantity: Option<NonZero<u64>>

(Inbound offer reusable only) The number of items the payer bought.

§replacement_txid: Option<LxTxid>

(Onchain payments only) The txid of the replacement tx, if one exists.

§expires_at: Option<TimestampMs>

The invoice or offer expiry time. None otherwise, or if the timestamp overflows.

§finalized_at: Option<TimestampMs>

When this payment was finalized (completed or failed).

§created_at: TimestampMs

When this payment was created.

§updated_at: TimestampMs

When this payment was last updated.

Implementations§

§

impl BasicPaymentV2

pub fn from_v1(v1: BasicPaymentV1, updated_at: TimestampMs) -> BasicPaymentV2

pub fn payment_id(&self) -> LxPaymentId

pub fn is_pending(&self) -> bool

pub fn is_finalized(&self) -> bool

pub fn is_pending_not_junk(&self) -> bool

pub fn is_finalized_not_junk(&self) -> bool

pub fn is_junk(&self) -> bool

“Junk” payments are unimportant, usually not-user-initiated payments that we don’t display by default, unless a user explicitly opts-in to a a “show everything” filter for debugging.

For example, the current receive UI generates a “junk” BOLT11 invoice on every page open, but we don’t want this invoice to show up in the payments list unless it actually gets paid.

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

Returns the user’s note or invoice description, prefering note over description.

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

Returns the invoice or offer description if present.

pub fn created_at(&self) -> TimestampMs

pub fn updated_at(&self) -> TimestampMs

pub fn created_index(&self) -> PaymentCreatedIndex

pub fn updated_index(&self) -> PaymentUpdatedIndex

Trait Implementations§

§

impl Clone for BasicPaymentV2

§

fn clone(&self) -> BasicPaymentV2

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 BasicPaymentV2

§

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

Formats the value using the given formatter. Read more
§

impl<'de> Deserialize<'de> for BasicPaymentV2

§

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

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

impl From<BasicPaymentV2> for SdkPayment

§

fn from(p: BasicPaymentV2) -> SdkPayment

Converts to this type from the input type.
§

impl PartialEq for BasicPaymentV2

§

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

§

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 BasicPaymentV2

§

impl StructuralPartialEq for BasicPaymentV2

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, 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>,