pub enum PaymentKind {
Onchain,
Invoice,
Offer,
Spontaneous,
WaivedChannelFee,
WaivedLiquidityFee,
BuyCashApp,
LightningAddress,
HumanBitcoinAddress,
Unknown(Box<str>),
}Expand description
A fine-grained category for a payment. Useful for filtering payment history and analytics (e.g. regular Lightning payments vs. waived channel fees).
Each PaymentKind maps to exactly one parent PaymentRail via
PaymentKind::rail().
Variants§
Onchain
A regular on-chain send or receive. All v1 on-chain payments which had no kind are given this kind.
Invoice
A regular Lightning send or receive. All v1 invoice payments which had no kind are given this kind.
Offer
A regular Lightning offer payment. All v1 offer payments which had no kind are given this kind.
Spontaneous
A regular Lightning spontaneous payment. All v1 spontaneous payments which had no kind are given this kind.
WaivedChannelFee
A channel fee that would have been paid but was waived.
WaivedLiquidityFee
A liquidity fee that would have been paid but was waived.
BuyCashApp
A buy funded via Cash App, where the app mints a BOLT11 invoice to receive the bought funds.
LightningAddress
A payment to or from a Lightning Address.
HumanBitcoinAddress
A payment to or from a BIP353 Human Bitcoin Address.
Unknown(Box<str>)
Unknown kind; used for forward compatibility.
Implementations§
Source§impl PaymentKind
impl PaymentKind
Sourcepub const MAX_UNKNOWN_LEN: usize = 32
pub const MAX_UNKNOWN_LEN: usize = 32
Max byte length of an Unknown kind string.
Limits what a client can inject via an unrecognized kind field.
Sourcepub const KNOWN_VARIANTS: &'static [PaymentKind]
pub const KNOWN_VARIANTS: &'static [PaymentKind]
All non-unknown variants.
pub fn to_str(&self) -> Cow<'static, str>
pub fn rail(&self) -> PaymentRail
Sourcepub fn expect_rail(&self, expected: PaymentRail) -> Result<(), Error>
pub fn expect_rail(&self, expected: PaymentRail) -> Result<(), Error>
Validates this payment kind against an expected parent rail.
Sourcepub fn expect_rail_or_unknown(&self, expected: PaymentRail) -> Result<(), Error>
pub fn expect_rail_or_unknown(&self, expected: PaymentRail) -> Result<(), Error>
Like expect_rail, but also accepts Unknown kinds (from a newer
client). Lets a rail-specific request endpoint reject a recognized kind
on the wrong rail while still accepting forward-compatible kinds.
Trait Implementations§
Source§impl Clone for PaymentKind
impl Clone for PaymentKind
Source§fn clone(&self) -> PaymentKind
fn clone(&self) -> PaymentKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PaymentKind
impl Debug for PaymentKind
Source§impl<'de> Deserialize<'de> for PaymentKind
impl<'de> Deserialize<'de> for PaymentKind
Source§fn deserialize<__D>(
deserializer: __D,
) -> Result<PaymentKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
deserializer: __D,
) -> Result<PaymentKind, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for PaymentKind
impl Display for PaymentKind
impl Eq for PaymentKind
Source§impl FromStr for PaymentKind
impl FromStr for PaymentKind
Source§impl PartialEq for PaymentKind
impl PartialEq for PaymentKind
Source§fn eq(&self, other: &PaymentKind) -> bool
fn eq(&self, other: &PaymentKind) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for PaymentKind
impl Serialize for PaymentKind
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl StructuralPartialEq for PaymentKind
Auto Trait Implementations§
impl Freeze for PaymentKind
impl RefUnwindSafe for PaymentKind
impl Send for PaymentKind
impl Sync for PaymentKind
impl Unpin for PaymentKind
impl UnsafeUnpin for PaymentKind
impl UnwindSafe for PaymentKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.