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)
Transform the Invoice
into it's unchecked version
Check that the invoice is signed correctly and that key recovery works
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());
Returns the Invoice
's timestamp (should equal it's creation time)
Returns an iterator over all tagged fields of this Invoice.
Returns the hash to which we will receive the preimage on completion of the payment
Return the description or a hash of it for longer ones
Get the payee's public key if one was included in the invoice
Recover the payee's public key (only to be used if none was included in the invoice)
Returns the invoice's expiry time if present
Returns the invoice's min_cltv_expiry
time if present
Returns a list of all fallback addresses
Returns a list of all routes included in the invoice
Returns the currency for which the invoice was issued
Returns the amount if specified in the invoice as pico .
Performs copy-assignment from source
. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
use lightning_invoice::Invoice;
let invoice = "lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\
l2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\
3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\
ky03ylcqca784w";
assert!(invoice.parse::<Invoice>().is_ok());
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
Converts the given value to a String
. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static