Enum PaymentKind
pub enum PaymentKind {
Onchain,
Invoice,
Offer,
Spontaneous,
WaivedChannelFee,
WaivedLiquidityFee,
Unknown(Box<str>),
}Expand description
A granular application-level ‘type’ of a payment.
In Lexe’s DB, payment information is encrypted, but this type is exposed. This is because without this type, the DB cannot identify which payments are relevant to a application level queries like
- “Show me my last N liquidity fee payments from this index”
- “Show me my history of channel opens and closes”
- “Show me the last N times I paid a channel fee.”
These payment kinds are also useful for accounting and analytics, allowing users to breakdown their payments history using fine-grained categories.
When implementing new kind of payment flows, err on the side of adding a new
PaymentKind for it, instead of incorporating it into an existing kind.
We can always add another OR in a WHERE clause, but cannot easily separate
out data once it has already been unified.
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.
Unknown(Box<str>)
Unknown kind; used for forward compatibility.
Implementations§
§impl PaymentKind
impl PaymentKind
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.
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
§type Err = Infallible
type Err = Infallible
§fn from_str(s: &str) -> Result<PaymentKind, <PaymentKind as FromStr>::Err>
fn from_str(s: &str) -> Result<PaymentKind, <PaymentKind as FromStr>::Err>
s to return a value of this type. Read more§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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.