Trait Bolt12InvoiceExt

Source
pub trait Bolt12InvoiceExt: Borrow<Bolt12Invoice> {
    // Provided methods
    fn payment_hash(&self) -> PaymentHash { ... }
    fn get_final_amount(
        &self,
        user_amount: Option<Amount>,
    ) -> Result<Amount, CheckAmountError> { ... }
    fn check_signature(&self) -> Result<(), CheckSignatureError> { ... }
    fn bytes(&self) -> Vec<u8>  { ... }
    fn from_bytes(bytes: &[u8]) -> Result<Bolt12Invoice, Bolt12ParseError> { ... }
    fn validate_issuance(
        &self,
        offer: &Offer,
    ) -> Result<(), CheckSignatureError> { ... }
    fn from_str(s: &str) -> Result<Bolt12Invoice, Bolt12ParseError> { ... }
}
Expand description

Extension trait for the Bolt12Invoice type

Provided Methods§

Source

fn payment_hash(&self) -> PaymentHash

Source

fn get_final_amount( &self, user_amount: Option<Amount>, ) -> Result<Amount, CheckAmountError>

Get the amount to be paid. It checks both user and invoice equality if both are provided, else it tries to return one of them, or returns an error if neither are provided.

Source

fn check_signature(&self) -> Result<(), CheckSignatureError>

Source

fn bytes(&self) -> Vec<u8>

Source

fn from_bytes(bytes: &[u8]) -> Result<Bolt12Invoice, Bolt12ParseError>

Source

fn validate_issuance(&self, offer: &Offer) -> Result<(), CheckSignatureError>

Source

fn from_str(s: &str) -> Result<Bolt12Invoice, Bolt12ParseError>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§