[−][src]Struct lightning_invoice::Invoice
Represents a syntactically and semantically correct lightning BOLT11 invoice.
There are three ways to construct an Invoice
:
- using
InvoiceBuilder
- using
Invoice::from_signed(SignedRawInvoice)
- 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]
signed_invoice: SignedRawInvoice
) -> Result<Self, SemanticError>
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]
&self
) -> FilterMap<Iter<'_, RawTaggedField>, fn(_: &RawTaggedField) -> Option<&TaggedField>>
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>ⓘ
[src]
Returns a list of all fallback addresses
pub fn routes(&self) -> Vec<&Route>ⓘ
[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.
pub fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl PartialEq<Invoice> for Invoice
[src]
impl StructuralEq for Invoice
[src]
impl StructuralPartialEq for Invoice
[src]
Auto Trait Implementations
impl RefUnwindSafe for Invoice
[src]
impl Send for Invoice
[src]
impl Sync for Invoice
[src]
impl Unpin for Invoice
[src]
impl UnwindSafe for Invoice
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,