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

A semantically valid Bolt12Invoice that hasn’t been signed.

§Serialization

This is serialized as a TLV stream, which includes TLV records from the originating message. As such, it may include unknown, odd TLV records.

Implementations§

§

impl UnsignedBolt12Invoice

pub fn tagged_hash(&self) -> &TaggedHash

Returns the TaggedHash of the invoice to sign.

pub fn sign<F, E>(self, sign: F) -> Result<Bolt12Invoice, SignError<E>>

Signs the TaggedHash of the invoice using the given function.

Note: The hash computation may have included unknown, odd TLV records.

This is not exported to bindings users as functions aren’t currently mapped.

§

impl UnsignedBolt12Invoice

pub fn offer_chains(&self) -> Option<Vec<ChainHash>>

The chains that may be used when paying a requested invoice.

From Offer::chains; None if the invoice was created in response to a Refund.

pub fn chain(&self) -> ChainHash

The chain that must be used when paying the invoice; selected from offer_chains if the invoice originated from an offer.

From InvoiceRequest::chain or Refund::chain.

pub fn metadata(&self) -> Option<&Vec<u8>>

Opaque bytes set by the originating Offer.

From Offer::metadata; None if the invoice was created in response to a Refund or if the Offer did not set it.

pub fn amount(&self) -> Option<&Amount>

The minimum amount required for a successful payment of a single item.

From Offer::amount; None if the invoice was created in response to a Refund or if the Offer did not set it.

pub fn offer_features(&self) -> Option<&Features<OfferContext>>

Features pertaining to the originating Offer.

From Offer::offer_features; None if the invoice was created in response to a Refund.

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

A complete description of the purpose of the originating offer or refund.

From Offer::description or Refund::description.

pub fn absolute_expiry(&self) -> Option<Duration>

Duration since the Unix epoch when an invoice should no longer be requested.

From Offer::absolute_expiry or Refund::absolute_expiry.

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

The issuer of the offer or refund.

From Offer::issuer or Refund::issuer.

pub fn message_paths(&self) -> &[BlindedPath]

Paths to the recipient originating from publicly reachable nodes.

From Offer::paths or Refund::paths.

pub fn supported_quantity(&self) -> Option<Quantity>

The quantity of items supported.

From Offer::supported_quantity; None if the invoice was created in response to a Refund.

pub fn payer_metadata(&self) -> &[u8]

An unpredictable series of bytes from the payer.

From InvoiceRequest::payer_metadata or Refund::payer_metadata.

pub fn invoice_request_features(&self) -> &Features<InvoiceRequestContext>

Features pertaining to requesting an invoice.

From InvoiceRequest::invoice_request_features or Refund::features.

pub fn quantity(&self) -> Option<u64>

The quantity of items requested or refunded for.

From InvoiceRequest::quantity or Refund::quantity.

pub fn payer_id(&self) -> PublicKey

A possibly transient pubkey used to sign the invoice request or to send an invoice for a refund in case there are no message_paths.

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

A payer-provided note reflected back in the invoice.

From InvoiceRequest::payer_note or Refund::payer_note.

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 invoice_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.

Trait Implementations§

§

impl AsRef<TaggedHash> for UnsignedBolt12Invoice

§

fn as_ref(&self) -> &TaggedHash

Converts this type into a shared reference of the (usually inferred) input type.
§

impl TryFrom<Vec<u8>> for UnsignedBolt12Invoice

§

type Error = Bolt12ParseError

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

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

Performs the conversion.
§

impl Writeable for UnsignedBolt12Invoice

§

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
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

§

impl<T> AsAny for T
where T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

§

fn type_name(&self) -> &'static str

Gets the type name of self
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

impl<T> Downcast for T
where T: AsAny + ?Sized,

§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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, 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