pub struct Payment { /* private fields */ }Expand description
A parsed payment category from a payment instruction string.
This can be a Bitcoin address, Liquid address, Lightning invoice, Lightning offer, LNURL, BIP353, BIP21 URI, or Liquid BIP21 URI.
Implementations§
Source§impl Payment
impl Payment
Sourcepub fn new(s: &str) -> Result<Arc<Self>, LwkError>
pub fn new(s: &str) -> Result<Arc<Self>, LwkError>
Parse a payment instruction string into a PaymentCategory
Sourcepub fn kind(&self) -> PaymentKind
pub fn kind(&self) -> PaymentKind
Returns the kind of payment category
Sourcepub fn bitcoin_address(&self) -> Option<Arc<BitcoinAddress>>
pub fn bitcoin_address(&self) -> Option<Arc<BitcoinAddress>>
Returns the Bitcoin address if this is a BitcoinAddress category, None otherwise
Returns the address portion of the original input string
Sourcepub fn liquid_address(&self) -> Option<Arc<Address>>
pub fn liquid_address(&self) -> Option<Arc<Address>>
Returns the Liquid address if this is a LiquidAddress category, None otherwise
Sourcepub fn lightning_invoice(&self) -> Option<Arc<Bolt11Invoice>>
Available on crate feature lightning only.
pub fn lightning_invoice(&self) -> Option<Arc<Bolt11Invoice>>
lightning only.Returns the Lightning invoice if this is a LightningInvoice category, None otherwise
Sourcepub fn lightning_offer(&self) -> Option<String>
pub fn lightning_offer(&self) -> Option<String>
Returns the Lightning offer as a string if this is a LightningOffer category, None otherwise
Sourcepub fn lnurl(&self) -> Option<String>
pub fn lnurl(&self) -> Option<String>
Returns the LNURL as a string if this is an LnUrl category, None otherwise
Sourcepub fn bip353(&self) -> Option<String>
pub fn bip353(&self) -> Option<String>
Returns the BIP353 address (without the ₿ prefix) if this is a Bip353 category, None otherwise
Sourcepub fn bip21(&self) -> Option<Arc<Bip21>>
pub fn bip21(&self) -> Option<Arc<Bip21>>
Returns the BIP21 URI if this is a Bip21 category, None otherwise
Sourcepub fn bip321(&self) -> Option<Arc<Bip321>>
pub fn bip321(&self) -> Option<Arc<Bip321>>
Returns the BIP321 URI if this is a Bip321 category, None otherwise
Sourcepub fn liquid_bip21(&self) -> Option<LiquidBip21>
pub fn liquid_bip21(&self) -> Option<LiquidBip21>
Returns the Liquid BIP21 details if this is a LiquidBip21 category, None otherwise
Sourcepub fn lightning_payment(&self) -> Option<Arc<LightningPayment>>
Available on crate feature lightning only.
pub fn lightning_payment(&self) -> Option<Arc<LightningPayment>>
lightning only.Returns a `LightningPayment`` if this category is payable via Lightning
Returns Some for LightningInvoice, LightningOffer, and LnUrl categories.
The returned LightningPayment can be used with BoltzSession::prepare_pay().
Trait Implementations§
Source§impl<UT> LowerError<UT> for Payment
impl<UT> LowerError<UT> for Payment
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for Payment
impl<UT> LowerReturn<UT> for Payment
Source§type ReturnType = <Arc<Payment> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<Payment> as LowerReturn<UniFfiTag>>::ReturnType
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
Source§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Auto Trait Implementations§
impl Freeze for Payment
impl RefUnwindSafe for Payment
impl Send for Payment
impl Sync for Payment
impl Unpin for Payment
impl UnwindSafe for Payment
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, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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.