Struct InvoiceBuilder
pub struct InvoiceBuilder<'a, S>where
S: SigningPubkeyStrategy,{ /* private fields */ }
Expand description
Builds a Bolt12Invoice
from either:
- an
InvoiceRequest
for the “offer to be paid” flow or - a
Refund
for the “offer for money” flow.
See module-level documentation for usage.
This is not exported to bindings users as builder patterns don’t map outside of move semantics.
Implementations§
§impl<'a, S> InvoiceBuilder<'a, S>where
S: SigningPubkeyStrategy,
impl<'a, S> InvoiceBuilder<'a, S>where
S: SigningPubkeyStrategy,
pub fn relative_expiry(self, relative_expiry_secs: u32) -> InvoiceBuilder<'a, S>
pub fn relative_expiry(self, relative_expiry_secs: u32) -> InvoiceBuilder<'a, S>
Sets the Bolt12Invoice::relative_expiry
as seconds since Bolt12Invoice::created_at
.
Any expiry that has already passed is valid and can be checked for using
Bolt12Invoice::is_expired
.
Successive calls to this method will override the previous setting.
pub fn fallback_v0_p2wsh(
self,
script_hash: &WScriptHash,
) -> InvoiceBuilder<'a, S>
pub fn fallback_v0_p2wsh( self, script_hash: &WScriptHash, ) -> InvoiceBuilder<'a, S>
Adds a P2WSH address to Bolt12Invoice::fallbacks
.
Successive calls to this method will add another address. Caller is responsible for not adding duplicate addresses and only calling if capable of receiving to P2WSH addresses.
pub fn fallback_v0_p2wpkh(
self,
pubkey_hash: &WPubkeyHash,
) -> InvoiceBuilder<'a, S>
pub fn fallback_v0_p2wpkh( self, pubkey_hash: &WPubkeyHash, ) -> InvoiceBuilder<'a, S>
Adds a P2WPKH address to Bolt12Invoice::fallbacks
.
Successive calls to this method will add another address. Caller is responsible for not adding duplicate addresses and only calling if capable of receiving to P2WPKH addresses.
pub fn fallback_v1_p2tr_tweaked(
self,
output_key: &TweakedPublicKey,
) -> InvoiceBuilder<'a, S>
pub fn fallback_v1_p2tr_tweaked( self, output_key: &TweakedPublicKey, ) -> InvoiceBuilder<'a, S>
Adds a P2TR address to Bolt12Invoice::fallbacks
.
Successive calls to this method will add another address. Caller is responsible for not adding duplicate addresses and only calling if capable of receiving to P2TR addresses.
pub fn allow_mpp(self) -> InvoiceBuilder<'a, S>
pub fn allow_mpp(self) -> InvoiceBuilder<'a, S>
Sets Bolt12Invoice::invoice_features
to indicate MPP may be used. Otherwise, MPP is
disallowed.
§impl<'a> InvoiceBuilder<'a, ExplicitSigningPubkey>
impl<'a> InvoiceBuilder<'a, ExplicitSigningPubkey>
pub fn build(self) -> Result<UnsignedBolt12Invoice, Bolt12SemanticError>
pub fn build(self) -> Result<UnsignedBolt12Invoice, Bolt12SemanticError>
Builds an unsigned Bolt12Invoice
after checking for valid semantics. It can be signed by
UnsignedBolt12Invoice::sign
.
§impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey>
impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey>
pub fn build_and_sign<T>(
self,
secp_ctx: &Secp256k1<T>,
) -> Result<Bolt12Invoice, Bolt12SemanticError>where
T: Signing,
pub fn build_and_sign<T>(
self,
secp_ctx: &Secp256k1<T>,
) -> Result<Bolt12Invoice, Bolt12SemanticError>where
T: Signing,
Builds a signed Bolt12Invoice
after checking for valid semantics.
Auto Trait Implementations§
impl<'a, S> Freeze for InvoiceBuilder<'a, S>where
S: Freeze,
impl<'a, S> RefUnwindSafe for InvoiceBuilder<'a, S>where
S: RefUnwindSafe,
impl<'a, S> Send for InvoiceBuilder<'a, S>where
S: Send,
impl<'a, S> Sync for InvoiceBuilder<'a, S>where
S: Sync,
impl<'a, S> Unpin for InvoiceBuilder<'a, S>where
S: Unpin,
impl<'a, S> UnwindSafe for InvoiceBuilder<'a, S>where
S: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§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