Struct breez_sdk_liquid::lightning::offers::invoice_request::InvoiceRequest
pub struct InvoiceRequest { /* private fields */ }
Expand description
An InvoiceRequest
is a request for a Bolt12Invoice
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§
§impl InvoiceRequest
impl InvoiceRequest
pub fn metadata(&self) -> &[u8] ⓘ
pub fn metadata(&self) -> &[u8] ⓘ
An unpredictable series of bytes, typically containing information about the derivation of
payer_id
.
pub fn chain(&self) -> ChainHash
pub fn chain(&self) -> ChainHash
A chain from Offer::chains
that the offer is valid for.
pub fn amount_msats(&self) -> Option<u64>
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.
pub fn features(&self) -> &Features<InvoiceRequestContext>
pub fn features(&self) -> &Features<InvoiceRequestContext>
Features pertaining to requesting an invoice.
pub fn quantity(&self) -> Option<u64>
pub fn quantity(&self) -> Option<u64>
The quantity of the offer’s item conforming to Offer::is_valid_quantity
.
pub fn payer_note(&self) -> Option<PrintableString<'_>>
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.
pub fn respond_with(
&self,
payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
pub fn respond_with( &self, payment_paths: Vec<(BlindedPayInfo, BlindedPath)>, payment_hash: PaymentHash, ) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
Creates an InvoiceBuilder
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.
This is not exported to bindings users as builder patterns don’t map outside of move semantics.
pub fn respond_with_no_std(
&self,
payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
created_at: Duration,
) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
pub fn respond_with_no_std( &self, payment_paths: Vec<(BlindedPayInfo, BlindedPath)>, payment_hash: PaymentHash, created_at: Duration, ) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
Creates an InvoiceBuilder
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 Bolt12Invoice::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.
This is not exported to bindings users as builder patterns don’t map outside of move semantics.
pub fn verify_and_respond_using_derived_keys<T>(
&self,
payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
expanded_key: &ExpandedKey,
secp_ctx: &Secp256k1<T>,
) -> Result<InvoiceBuilder<'_, DerivedSigningPubkey>, Bolt12SemanticError>where
T: Signing,
pub fn verify_and_respond_using_derived_keys<T>(
&self,
payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
expanded_key: &ExpandedKey,
secp_ctx: &Secp256k1<T>,
) -> Result<InvoiceBuilder<'_, DerivedSigningPubkey>, Bolt12SemanticError>where
T: Signing,
Creates an InvoiceBuilder
for the request using the given required fields and that uses
derived signing keys from the originating Offer
to sign the Bolt12Invoice
. Must use
the same ExpandedKey
as the one used to create the offer.
See InvoiceRequest::respond_with
for further details.
This is not exported to bindings users as builder patterns don’t map outside of move semantics.
pub fn verify_and_respond_using_derived_keys_no_std<T>(
&self,
payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
created_at: Duration,
expanded_key: &ExpandedKey,
secp_ctx: &Secp256k1<T>,
) -> Result<InvoiceBuilder<'_, DerivedSigningPubkey>, Bolt12SemanticError>where
T: Signing,
pub fn verify_and_respond_using_derived_keys_no_std<T>(
&self,
payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
created_at: Duration,
expanded_key: &ExpandedKey,
secp_ctx: &Secp256k1<T>,
) -> Result<InvoiceBuilder<'_, DerivedSigningPubkey>, Bolt12SemanticError>where
T: Signing,
Creates an InvoiceBuilder
for the request using the given required fields and that uses
derived signing keys from the originating Offer
to sign the Bolt12Invoice
. Must use
the same ExpandedKey
as the one used to create the offer.
See InvoiceRequest::respond_with_no_std
for further details.
This is not exported to bindings users as builder patterns don’t map outside of move semantics.
pub fn verify<T>(
&self,
key: &ExpandedKey,
secp_ctx: &Secp256k1<T>,
) -> Result<Option<KeyPair>, ()>where
T: Signing,
pub fn verify<T>(
&self,
key: &ExpandedKey,
secp_ctx: &Secp256k1<T>,
) -> Result<Option<KeyPair>, ()>where
T: Signing,
Verifies that the request was for an offer created using the given key. Returns the derived
keys need to sign an Bolt12Invoice
for the request if they could be extracted from the
metadata.
Trait Implementations§
§impl Clone for InvoiceRequest
impl Clone for InvoiceRequest
§fn clone(&self) -> InvoiceRequest
fn clone(&self) -> InvoiceRequest
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for InvoiceRequest
impl Debug for InvoiceRequest
§impl TryFrom<Vec<u8>> for InvoiceRequest
impl TryFrom<Vec<u8>> for InvoiceRequest
§type Error = Bolt12ParseError
type Error = Bolt12ParseError
§impl Writeable for InvoiceRequest
impl Writeable for InvoiceRequest
Auto Trait Implementations§
impl Freeze for InvoiceRequest
impl RefUnwindSafe for InvoiceRequest
impl Send for InvoiceRequest
impl Sync for InvoiceRequest
impl Unpin for InvoiceRequest
impl UnwindSafe for InvoiceRequest
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request