Struct StaticInvoiceBuilder

Source
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>

Source

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.

Source

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.

Source

pub fn build_and_sign<T: Signing>( self, secp_ctx: &Secp256k1<T>, ) -> Result<StaticInvoice, Bolt12SemanticError>

Builds a signed StaticInvoice after checking for valid semantics.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn allow_mpp(self) -> Self

Sets StaticInvoice::invoice_features to indicate MPP may be used. Otherwise, MPP is disallowed.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V