Struct lightning_signer::invoice::bolt12::InvoiceBuilder
source · pub struct InvoiceBuilder<'a, S>where
S: SigningPubkeyStrategy,{ /* private fields */ }
Expand description
Builds an Invoice
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.
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 Invoice::relative_expiry
as seconds since Invoice::created_at
. Any expiry
that has already passed is valid and can be checked for using Invoice::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 Invoice::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 Invoice::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 Invoice::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 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<UnsignedInvoice<'a>, SemanticError>
pub fn build(self) -> Result<UnsignedInvoice<'a>, SemanticError>
Builds an unsigned Invoice
after checking for valid semantics. It can be signed by
UnsignedInvoice::sign
.
source§impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey>
impl<'a> InvoiceBuilder<'a, DerivedSigningPubkey>
sourcepub fn build_and_sign<T>(
self,
secp_ctx: &Secp256k1<T>
) -> Result<Invoice, SemanticError>where
T: Signing,
pub fn build_and_sign<T>( self, secp_ctx: &Secp256k1<T> ) -> Result<Invoice, SemanticError>where T: Signing,
Builds a signed Invoice
after checking for valid semantics.