Struct lightning::offers::invoice::InvoiceBuilder
source · pub struct InvoiceBuilder<'a, 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: SigningPubkeyStrategy> InvoiceBuilder<'a, S>
impl<'a, S: SigningPubkeyStrategy> InvoiceBuilder<'a, S>
sourcepub fn relative_expiry(self, relative_expiry_secs: u32) -> Self
pub fn relative_expiry(self, relative_expiry_secs: u32) -> Self
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) -> Self
pub fn fallback_v0_p2wsh(self, script_hash: &WScriptHash) -> Self
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) -> Self
pub fn fallback_v0_p2wpkh(self, pubkey_hash: &WPubkeyHash) -> Self
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) -> Self
pub fn fallback_v1_p2tr_tweaked(self, output_key: &TweakedPublicKey) -> Self
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) -> Self
pub fn allow_mpp(self) -> Self
Sets Bolt12Invoice::invoice_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, Bolt12SemanticError>
pub fn build(self) -> Result<UnsignedBolt12Invoice, 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: Signing>(
self,
secp_ctx: &Secp256k1<T>
) -> Result<Bolt12Invoice, Bolt12SemanticError>
pub fn build_and_sign<T: Signing>( self, secp_ctx: &Secp256k1<T> ) -> Result<Bolt12Invoice, Bolt12SemanticError>
Builds a signed Bolt12Invoice
after checking for valid semantics.