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

An InvoiceRequest is a request for an Invoice formulated from an Offer.

An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request specifies these such that its recipient can send an invoice for payment.

Implementations§

source§

impl InvoiceRequest

source

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

An unpredictable series of bytes, typically containing information about the derivation of payer_id.

source

pub fn chain(&self) -> ChainHash

A chain from Offer::chains that the offer is valid for.

source

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

The amount to pay in msats (i.e., the minimum lightning-payable unit for chain), which must be greater than or equal to Offer::amount, converted if necessary.

source

pub fn features(&self) -> &InvoiceRequestFeatures

Features pertaining to requesting an invoice.

source

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

The quantity of the offer’s item conforming to Offer::is_valid_quantity.

source

pub fn payer_id(&self) -> PublicKey

A possibly transient pubkey used to sign the invoice request.

source

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

A payer-provided note which will be seen by the recipient and reflected back in the invoice response.

source

pub fn signature(&self) -> Signature

Signature of the invoice request using payer_id.

source

pub fn respond_with( &self, payment_paths: Vec<(BlindedPath, BlindedPayInfo)>, payment_hash: PaymentHash ) -> Result<InvoiceBuilder<'_>, SemanticError>

Available on crate feature std only.

Creates an Invoice for the request with the given required fields and using the Duration since std::time::SystemTime::UNIX_EPOCH as the creation time.

See InvoiceRequest::respond_with_no_std for further details where the aforementioned creation time is used for the created_at parameter.

source

pub fn respond_with_no_std( &self, payment_paths: Vec<(BlindedPath, BlindedPayInfo)>, payment_hash: PaymentHash, created_at: Duration ) -> Result<InvoiceBuilder<'_>, SemanticError>

Creates an Invoice for the request with the given required fields.

Unless InvoiceBuilder::relative_expiry is set, the invoice will expire two hours after created_at, which is used to set Invoice::created_at. Useful for no-std builds where std::time::SystemTime is not available.

The caller is expected to remember the preimage of payment_hash in order to claim a payment for the invoice.

The payment_paths parameter is useful for maintaining the payment recipient’s privacy. It must contain one or more elements ordered from most-preferred to least-preferred, if there’s a preference. Note, however, that any privacy is lost if a public node id was used for Offer::signing_pubkey.

Errors if the request contains unknown required features.

Trait Implementations§

source§

impl Clone for InvoiceRequest

source§

fn clone(&self) -> InvoiceRequest

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
source§

impl Debug for InvoiceRequest

source§

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

Formats the value using the given formatter. Read more
source§

impl PartialEq<InvoiceRequest> for InvoiceRequest

source§

fn eq(&self, other: &InvoiceRequest) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<Vec<u8, Global>> for InvoiceRequest

§

type Error = ParseError

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

fn try_from(bytes: Vec<u8>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Writeable for InvoiceRequest

source§

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

Writes self out to the given Writer.
source§

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

Writes self out to a Vec<u8>.
source§

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.
source§

impl StructuralPartialEq for InvoiceRequest

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> ToOwned for Twhere 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.