Enum PaymentKind
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§
§impl PaymentKind
impl PaymentKind
pub const MAX_UNKNOWN_LEN: usize = 32usize
pub const MAX_UNKNOWN_LEN: usize = 32usize
Max byte length of an Unknown kind string.
Limits what a client can inject via an unrecognized kind field.
pub 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
pub 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.
pub 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§
§impl Clone for PaymentKind
impl Clone for PaymentKind
§fn clone(&self) -> PaymentKind
fn clone(&self) -> PaymentKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for PaymentKind
impl Debug for PaymentKind
§impl<'de> Deserialize<'de> for PaymentKind
impl<'de> Deserialize<'de> for PaymentKind
§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>,
§impl Display for PaymentKind
impl Display for PaymentKind
§impl FromStr for PaymentKind
impl FromStr for PaymentKind
§impl PartialEq for PaymentKind
impl PartialEq for PaymentKind
§impl Serialize for PaymentKind
impl Serialize for PaymentKind
§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 Eq for PaymentKind
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 UnwindSafe for PaymentKind
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
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.