Struct breez_sdk_liquid::lightning::offers::offer::OfferBuilder

pub struct OfferBuilder<'a, M, T>{ /* private fields */ }
Expand description

Builds an Offer for the “offer to be paid” 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§

§

impl<'a> OfferBuilder<'a, ExplicitMetadata, SignOnly>

pub fn new( description: String, signing_pubkey: PublicKey, ) -> OfferBuilder<'a, ExplicitMetadata, SignOnly>

Creates a new builder for an offer setting the Offer::description and using the Offer::signing_pubkey for signing invoices. The associated secret key must be remembered while the offer is valid.

Use a different pubkey per offer to avoid correlating offers.

§Note

If constructing an Offer for use with a ChannelManager, use ChannelManager::create_offer_builder instead of OfferBuilder::new.

pub fn metadata( self, metadata: Vec<u8>, ) -> Result<OfferBuilder<'a, ExplicitMetadata, SignOnly>, Bolt12SemanticError>

Sets the Offer::metadata to the given bytes.

Successive calls to this method will override the previous setting.

§

impl<'a, T> OfferBuilder<'a, DerivedMetadata, T>
where T: Signing,

pub fn deriving_signing_pubkey<ES>( description: String, node_id: PublicKey, expanded_key: &ExpandedKey, entropy_source: ES, secp_ctx: &'a Secp256k1<T>, ) -> OfferBuilder<'a, DerivedMetadata, T>
where ES: Deref, <ES as Deref>::Target: EntropySource,

Similar to OfferBuilder::new except, if OfferBuilder::path is called, the signing pubkey is derived from the given ExpandedKey and EntropySource. This provides recipient privacy by using a different signing pubkey for each offer. Otherwise, the provided node_id is used for the signing pubkey.

Also, sets the metadata when OfferBuilder::build is called such that it can be used by InvoiceRequest::verify to determine if the request was produced for the offer given an ExpandedKey.

§

impl<'a, M, T> OfferBuilder<'a, M, T>

pub fn chain(self, network: Network) -> OfferBuilder<'a, M, T>

Adds the chain hash of the given Network to Offer::chains. If not called, the chain hash of Network::Bitcoin is assumed to be the only one supported.

See Offer::chains on how this relates to the payment currency.

Successive calls to this method will add another chain hash.

pub fn amount_msats(self, amount_msats: u64) -> OfferBuilder<'a, M, T>

Sets the Offer::amount as an Amount::Bitcoin.

Successive calls to this method will override the previous setting.

pub fn absolute_expiry( self, absolute_expiry: Duration, ) -> OfferBuilder<'a, M, T>

Sets the Offer::absolute_expiry as seconds since the Unix epoch. Any expiry that has already passed is valid and can be checked for using Offer::is_expired.

Successive calls to this method will override the previous setting.

pub fn issuer(self, issuer: String) -> OfferBuilder<'a, M, T>

Sets the Offer::issuer.

Successive calls to this method will override the previous setting.

pub fn path(self, path: BlindedPath) -> OfferBuilder<'a, M, T>

Adds a blinded path to Offer::paths. Must include at least one path if only connected by private channels or if Offer::signing_pubkey is not a public node id.

Successive calls to this method will add another blinded path. Caller is responsible for not adding duplicate paths.

pub fn supported_quantity(self, quantity: Quantity) -> OfferBuilder<'a, M, T>

Sets the quantity of items for Offer::supported_quantity. If not called, defaults to Quantity::One.

Successive calls to this method will override the previous setting.

pub fn build(self) -> Result<Offer, Bolt12SemanticError>

Builds an Offer from the builder’s settings.

Auto Trait Implementations§

§

impl<'a, M, T> Freeze for OfferBuilder<'a, M, T>

§

impl<'a, M, T> RefUnwindSafe for OfferBuilder<'a, M, T>

§

impl<'a, M, T> Send for OfferBuilder<'a, M, T>
where M: Send,

§

impl<'a, M, T> Sync for OfferBuilder<'a, M, T>
where M: Sync,

§

impl<'a, M, T> Unpin for OfferBuilder<'a, M, T>
where M: Unpin,

§

impl<'a, M, T> UnwindSafe for OfferBuilder<'a, M, T>

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> DartSafe for T

§

impl<T> TaskRetFutTrait for T
where T: Send,