pub struct StaticInvoiceBuilder<'a> { /* private fields */ }Expand description
Builds a StaticInvoice from an Offer.
This is not exported to bindings users as builder patterns don’t map outside of move semantics.
Implementations§
Source§impl<'a> StaticInvoiceBuilder<'a>
impl<'a> StaticInvoiceBuilder<'a>
Sourcepub fn for_offer_using_derived_keys<T: Signing>(
offer: &'a Offer,
payment_paths: Vec<BlindedPaymentPath>,
message_paths: Vec<BlindedMessagePath>,
created_at: Duration,
expanded_key: &ExpandedKey,
nonce: Nonce,
secp_ctx: &Secp256k1<T>,
) -> Result<Self, Bolt12SemanticError>
pub fn for_offer_using_derived_keys<T: Signing>( offer: &'a Offer, payment_paths: Vec<BlindedPaymentPath>, message_paths: Vec<BlindedMessagePath>, created_at: Duration, expanded_key: &ExpandedKey, nonce: Nonce, secp_ctx: &Secp256k1<T>, ) -> Result<Self, Bolt12SemanticError>
Initialize a StaticInvoiceBuilder from the given Offer.
The invoice’s expiration will default to DEFAULT_RELATIVE_EXPIRY after created_at unless
overridden by StaticInvoiceBuilder::relative_expiry.
Sourcepub fn build(
self,
) -> Result<(UnsignedStaticInvoice, Keypair), Bolt12SemanticError>
pub fn build( self, ) -> Result<(UnsignedStaticInvoice, Keypair), Bolt12SemanticError>
Builds an UnsignedStaticInvoice after checking for valid semantics, returning it along with
the Keypair needed to sign it.
Sourcepub fn build_and_sign<T: Signing>(
self,
secp_ctx: &Secp256k1<T>,
) -> Result<StaticInvoice, Bolt12SemanticError>
pub fn build_and_sign<T: Signing>( self, secp_ctx: &Secp256k1<T>, ) -> Result<StaticInvoice, Bolt12SemanticError>
Builds a signed StaticInvoice after checking for valid semantics.
Sourcepub fn relative_expiry(self, relative_expiry_secs: u32) -> Self
pub fn relative_expiry(self, relative_expiry_secs: u32) -> Self
Sets the StaticInvoice::relative_expiry
as seconds since StaticInvoice::created_at.
Any expiry that has already passed is valid and can be checked for using
StaticInvoice::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 StaticInvoice::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 StaticInvoice::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 StaticInvoice::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 StaticInvoice::invoice_features
to indicate MPP may be used. Otherwise, MPP is disallowed.