Expand description
This crate provides data structures to represent lightning BOLT11 invoices and functions to create, encode and decode these. If you just want to use the standard en-/decoding functionality this should get you started:
- For parsing use
str::parse::<Bolt11Invoice>(&self)
(seeBolt11Invoice::from_str
) - For constructing invoices use the
InvoiceBuilder
- For serializing invoices use the
Display
/ToString
traits
Re-exports§
pub use lightning_types::payment::PaymentSecret;
pub use lightning_types::routing::RouteHint;
pub use lightning_types::routing::RouteHintHop;
pub use lightning_types::routing::RoutingFees;
Modules§
- constants
- Tag constants as specified in BOLT11
Structs§
- Bolt11
Invoice - Represents a syntactically and semantically correct lightning BOLT11 invoice.
- Bolt11
Invoice Signature - Recoverable signature
- Description
- Description string
- Expiry
Time - Positive duration that defines when (relatively to the timestamp) in the future the invoice expires
- Invoice
Builder - Builder for
Bolt11Invoice
s. It’s the most convenient and advised way to use this library. It ensures that only a semantically and syntactically correct invoice can be built using it. - MinFinal
Cltv Expiry Delta min_final_cltv_expiry_delta
to use for the last HTLC in the route- Payee
PubKey - Payee public key
- Positive
Timestamp - A timestamp that refers to a date after 1 January 1970.
- Private
Route - Private routing information
- RawBolt11
Invoice - Represents an syntactically correct
Bolt11Invoice
for a payment on the lightning network, but without the signature information. Decoding and encoding should not lead to information loss but may lead to different hashes. - RawData
Part - Data of the
RawBolt11Invoice
that is encoded in the data part - RawHrp
- Data of the
RawBolt11Invoice
that is encoded in the human readable part. - Sha256
- SHA-256 hash
- Signed
RawBolt11 Invoice - Represents a signed
RawBolt11Invoice
with cached hash. The signature is not checked and may be invalid.
Enums§
- Bolt11
Invoice Description - Represents the description of an invoice which has to be either a directly included string or a hash of a description provided out of band.
- Bolt11
Invoice Description Ref - Represents the description of an invoice which has to be either a directly included string or a hash of a description provided out of band.
- Bolt11
Parse Error - Errors that indicate what is wrong with the invoice. They have some granularity for debug reasons, but should generally result in an “invalid BOLT11 invoice” message for the user.
- Bolt11
Semantic Error - Errors that may occur when converting a
RawBolt11Invoice
to aBolt11Invoice
. They relate to the requirements sections in BOLT #11 - Creation
Error - Errors that may occur when constructing a new
RawBolt11Invoice
orBolt11Invoice
- Currency
- Enum representing the crypto currencies (or networks) supported by this library
- Fallback
- Fallback address in case no LN payment is possible
- Parse
OrSemantic Error - Indicates that something went wrong while parsing or validating the invoice. Parsing errors should be mostly seen as opaque and are only there for debugging reasons. Semantic errors like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
- RawTagged
Field - Tagged field which may have an unknown tag
- SiPrefix
- SI prefixes for the human readable part
- Sign
OrCreation Error - When signing using a fallible method either an user-supplied
SignError
or aCreationError
may occur. - Tagged
Field - Tagged field with known tag
Constants§
- DEFAULT_
EXPIRY_ TIME - Default expiry time as defined by BOLT 11.
- DEFAULT_
MIN_ FINAL_ CLTV_ EXPIRY_ DELTA - Default minimum final CLTV expiry as defined by BOLT 11.
- MAX_
TIMESTAMP - The maximum timestamp as
Duration::as_secs
since the Unix epoch allowed by [BOLT 11
].