Struct lightning_signer::invoice::bolt12::InvoiceBuilder
source · 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§
source§impl<'a, S> InvoiceBuilder<'a, S>where
S: SigningPubkeyStrategy,
impl<'a, S> InvoiceBuilder<'a, S>where
S: SigningPubkeyStrategy,
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub 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.
sourcepub fn allow_mpp(self) -> InvoiceBuilder<'a, S>
pub fn allow_mpp(self) -> InvoiceBuilder<'a, S>
Sets Bolt12Invoice::features
to indicate MPP may be used. Otherwise, MPP is disallowed.
source§impl<'a> InvoiceBuilder<'a, ExplicitSigningPubkey>
impl<'a> InvoiceBuilder<'a, ExplicitSigningPubkey>
sourcepub fn build(self) -> Result<UnsignedBolt12Invoice<'a>, Bolt12SemanticError>
pub fn build(self) -> Result<UnsignedBolt12Invoice<'a>, Bolt12SemanticError>
Builds an unsigned Bolt12Invoice
after checking for valid semantics. It can be signed by
UnsignedBolt12Invoice::sign
.
source§impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey>
impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey>
sourcepub 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>
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§
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more