Struct breez_sdk_liquid::lightning::offers::invoice::Bolt12Invoice

pub struct Bolt12Invoice { /* private fields */ }
Expand description

A Bolt12Invoice is a payment request, typically corresponding to an Offer or a Refund.

An invoice may be sent in response to an InvoiceRequest in the case of an offer or sent directly after scanning a refund. It includes all the information needed to pay a recipient.

Implementations§

§

impl Bolt12Invoice

pub fn description(&self) -> PrintableString<'_>

A complete description of the purpose of the originating offer or refund. Intended to be displayed to the user but with the caveat that it has not been verified in any way.

pub fn payment_paths(&self) -> &[(BlindedPayInfo, BlindedPath)]

Paths to the recipient originating from publicly reachable nodes, including information needed for routing payments across them.

Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this privacy is lost if a public node id is used for Bolt12Invoice::signing_pubkey.

This is not exported to bindings users as slices with non-reference types cannot be ABI matched in another language.

pub fn created_at(&self) -> Duration

Duration since the Unix epoch when the invoice was created.

pub fn relative_expiry(&self) -> Duration

Duration since Bolt12Invoice::created_at when the invoice has expired and therefore should no longer be paid.

pub fn is_expired(&self) -> bool

Whether the invoice has expired.

pub fn payment_hash(&self) -> PaymentHash

SHA256 hash of the payment preimage that will be given in return for paying the invoice.

pub fn amount_msats(&self) -> u64

The minimum amount required for a successful payment of the invoice.

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

Fallback addresses for paying the invoice on-chain, in order of most-preferred to least-preferred.

pub fn features(&self) -> &Features<Bolt12InvoiceContext>

Features pertaining to paying an invoice.

pub fn signing_pubkey(&self) -> PublicKey

The public key corresponding to the key used to sign the invoice.

pub fn signature(&self) -> Signature

Signature of the invoice verified using Bolt12Invoice::signing_pubkey.

pub fn signable_hash(&self) -> [u8; 32]

Hash that was used for signing the invoice.

pub fn verify<T>(&self, key: &ExpandedKey, secp_ctx: &Secp256k1<T>) -> bool
where T: Signing,

Verifies that the invoice was for a request or refund created using the given key.

Trait Implementations§

§

impl Clone for Bolt12Invoice

§

fn clone(&self) -> Bolt12Invoice

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Bolt12Invoice

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl TryFrom<ParsedMessage<(PayerTlvStream, OfferTlvStream, InvoiceRequestTlvStream, InvoiceTlvStream, SignatureTlvStream)>> for Bolt12Invoice

§

type Error = Bolt12ParseError

The type returned in the event of a conversion error.
§

fn try_from( invoice: ParsedMessage<(PayerTlvStream, OfferTlvStream, InvoiceRequestTlvStream, InvoiceTlvStream, SignatureTlvStream)>, ) -> Result<Bolt12Invoice, <Bolt12Invoice as TryFrom<ParsedMessage<(PayerTlvStream, OfferTlvStream, InvoiceRequestTlvStream, InvoiceTlvStream, SignatureTlvStream)>>>::Error>

Performs the conversion.
§

impl TryFrom<Vec<u8>> for Bolt12Invoice

§

type Error = Bolt12ParseError

The type returned in the event of a conversion error.
§

fn try_from( bytes: Vec<u8>, ) -> Result<Bolt12Invoice, <Bolt12Invoice as TryFrom<Vec<u8>>>::Error>

Performs the conversion.
§

impl Writeable for Bolt12Invoice

§

fn write<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Writer,

Writes self out to the given Writer.
§

fn encode(&self) -> Vec<u8>

Writes self out to a Vec<u8>.
§

fn serialized_length(&self) -> usize

Gets the length of this object after it has been serialized. This can be overridden to optimize cases where we prepend an object with its length.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> DartSafe for T

§

impl<T> TaskRetFutTrait for T
where T: Send,