[][src]Struct lightning_invoice::Invoice

pub struct Invoice { /* fields omitted */ }

Represents a syntactically and semantically correct lightning BOLT11 invoice.

There are three ways to construct an Invoice:

  1. using InvoiceBuilder
  2. using Invoice::from_signed(SignedRawInvoice)
  3. using str::parse::<Invoice>(&str)

Implementations

impl Invoice[src]

pub fn into_signed_raw(self) -> SignedRawInvoice[src]

Transform the Invoice into it's unchecked version

pub fn check_signature(&self) -> Result<(), SemanticError>[src]

Check that the invoice is signed correctly and that key recovery works

pub fn from_signed(
    signed_invoice: SignedRawInvoice
) -> Result<Self, SemanticError>
[src]

Constructs an Invoice from a SignedInvoice by checking all its invariants.

use lightning_invoice::*;

let invoice = "lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\
	l2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\
	3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\
	ky03ylcqca784w";

let signed = invoice.parse::<SignedRawInvoice>().unwrap();

assert!(Invoice::from_signed(signed).is_ok());

pub fn timestamp(&self) -> &SystemTime[src]

Returns the Invoice's timestamp (should equal it's creation time)

pub fn tagged_fields(
    &self
) -> FilterMap<Iter<'_, RawTaggedField>, fn(_: &RawTaggedField) -> Option<&TaggedField>>
[src]

Returns an iterator over all tagged fields of this Invoice.

pub fn payment_hash(&self) -> &Hash[src]

Returns the hash to which we will receive the preimage on completion of the payment

pub fn description(&self) -> InvoiceDescription<'_>[src]

Return the description or a hash of it for longer ones

pub fn payee_pub_key(&self) -> Option<&PublicKey>[src]

Get the payee's public key if one was included in the invoice

pub fn recover_payee_pub_key(&self) -> PublicKey[src]

Recover the payee's public key (only to be used if none was included in the invoice)

pub fn expiry_time(&self) -> Duration[src]

Returns the invoice's expiry time if present

pub fn min_final_cltv_expiry(&self) -> Option<&u64>[src]

Returns the invoice's min_cltv_expiry time if present

pub fn fallbacks(&self) -> Vec<&Fallback>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

Returns a list of all fallback addresses

pub fn routes(&self) -> Vec<&Route>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

Returns a list of all routes included in the invoice

pub fn currency(&self) -> Currency[src]

Returns the currency for which the invoice was issued

pub fn amount_pico_btc(&self) -> Option<u64>[src]

Returns the amount if specified in the invoice as pico .

Trait Implementations

impl Clone for Invoice[src]

impl Debug for Invoice[src]

impl Display for Invoice[src]

impl Eq for Invoice[src]

impl FromStr for Invoice[src]

use lightning_invoice::Invoice;

let invoice = "lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\
	l2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\
	3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\
	ky03ylcqca784w";

assert!(invoice.parse::<Invoice>().is_ok());

type Err = ParseOrSemanticError

The associated error which can be returned from parsing.

impl PartialEq<Invoice> for Invoice[src]

impl StructuralEq for Invoice[src]

impl StructuralPartialEq for Invoice[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.