Enum PaymentMethod

Source
pub enum PaymentMethod {
    LightningBolt11(Bolt11Invoice),
    LightningBolt12(Offer),
    OnChain {
        amount: Option<Amount>,
        address: Address,
    },
}
Expand description

A method which can be used to make a payment

Variants§

§

LightningBolt11(Bolt11Invoice)

A payment using lightning as descibred by the given BOLT 11 invoice.

§

LightningBolt12(Offer)

A payment using lightning as descibred by the given BOLT 12 offer.

§

OnChain

A payment directly on-chain to the specified address.

Fields

§amount: Option<Amount>

The amount which this payment method requires payment for.

  • For instructions extracted from BIP 321 bitcoin: URIs this is the amount parameter.
  • For the fallback address from a lightning BOLT 11 invoice this is the invoice’s amount, rounded up to the nearest whole satoshi.
§address: Address

The address to which payment can be made.

Implementations§

Source§

impl PaymentMethod

Source

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

The amount this payment method requires payment for.

If None for non-BOLT 12 payments, any amount can be paid.

For Lightning BOLT 12 offers, the requested amount may be denominated in an alternative currency, requiring currency conversion and negotiatin while paying. In such a case, None will be returned. See Offer::amount and LDK’s offer payment logic for more info.

Trait Implementations§

Source§

impl Debug for PaymentMethod

Source§

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

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

impl PartialEq for PaymentMethod

Source§

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

Source§

impl StructuralPartialEq for PaymentMethod

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