Struct lightning_invoice::Invoice [−][src]
pub struct Invoice { /* fields omitted */ }
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]
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.
(C-not exported) As there is not yet a manual mapping for a FilterMap
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
(C-not exported) because we don’t yet export InvoiceDescription
pub fn payee_pub_key(&self) -> Option<&PublicKey>
[src]
Get the payee’s public key if one was included in the invoice
pub fn payment_secret(&self) -> Option<&PaymentSecret>
[src]
Get the payment secret if one was included in the invoice
pub fn features(&self) -> Option<&InvoiceFeatures>
[src]
Get the invoice features if they were 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, otherwise [DEFAULT_EXPIRY_TIME
].
pub fn min_final_cltv_expiry(&self) -> u64
[src]
Returns the invoice’s min_final_cltv_expiry
time, if present, otherwise
[DEFAULT_MIN_FINAL_CLTV_EXPIRY
].
pub fn fallbacks(&self) -> Vec<&Fallback>ⓘ
[src]
Returns a list of all fallback addresses
(C-not exported) as we don’t support Vec<&NonOpaqueType>
pub fn routes(&self) -> Vec<&RouteHint>ⓘ
[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 FromStr for Invoice
[src]
impl FromStr for Invoice
[src]use lightning_invoice::Invoice; let invoice = "lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\ l2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\ 3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\ ky03ylcqca784w"; assert!(invoice.parse::<Invoice>().is_ok());
impl StructuralEq for Invoice
[src]
impl StructuralEq for Invoice
[src]impl StructuralPartialEq for Invoice
[src]
impl StructuralPartialEq for Invoice
[src]Auto Trait Implementations
impl RefUnwindSafe for Invoice
impl RefUnwindSafe for Invoice
impl UnwindSafe for Invoice
impl UnwindSafe for Invoice