pub struct OfferBuilder<'a, M: MetadataStrategy, T: Signing> { /* 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§
Source§impl<'a, M: MetadataStrategy, T: Signing> OfferBuilder<'a, M, T>
impl<'a, M: MetadataStrategy, T: Signing> OfferBuilder<'a, M, T>
Sourcepub fn chain(self, network: Network) -> Self
pub fn chain(self, network: Network) -> Self
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.
Sourcepub fn amount_msats(self, amount_msats: u64) -> Self
pub fn amount_msats(self, amount_msats: u64) -> Self
Sets the Offer::amount as an Amount::Bitcoin.
Successive calls to this method will override the previous setting.
Sourcepub fn absolute_expiry(self, absolute_expiry: Duration) -> Self
pub fn absolute_expiry(self, absolute_expiry: Duration) -> Self
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.
Sourcepub fn description(self, description: String) -> Self
pub fn description(self, description: String) -> Self
Sets the Offer::description.
Successive calls to this method will override the previous setting.
Sourcepub fn issuer(self, issuer: String) -> Self
pub fn issuer(self, issuer: String) -> Self
Sets the Offer::issuer.
Successive calls to this method will override the previous setting.
Sourcepub fn path(self, path: BlindedMessagePath) -> Self
pub fn path(self, path: BlindedMessagePath) -> Self
Adds a blinded path to Offer::paths. Must include at least one path if only connected by
private channels or if Offer::issuer_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.
Sourcepub fn supported_quantity(self, quantity: Quantity) -> Self
pub fn supported_quantity(self, quantity: Quantity) -> Self
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.
Source§impl<'a> OfferBuilder<'a, ExplicitMetadata, SignOnly>
impl<'a> OfferBuilder<'a, ExplicitMetadata, SignOnly>
Sourcepub fn new(signing_pubkey: PublicKey) -> Self
pub fn new(signing_pubkey: PublicKey) -> Self
Creates a new builder for an offer using the 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.
Sourcepub fn metadata(self, metadata: Vec<u8>) -> Result<Self, Bolt12SemanticError>
pub fn metadata(self, metadata: Vec<u8>) -> Result<Self, Bolt12SemanticError>
Sets the Offer::metadata to the given bytes.
Successive calls to this method will override the previous setting.
Source§impl<'a, T: Signing> OfferBuilder<'a, DerivedMetadata, T>
impl<'a, T: Signing> OfferBuilder<'a, DerivedMetadata, T>
Sourcepub fn deriving_signing_pubkey(
node_id: PublicKey,
expanded_key: &ExpandedKey,
nonce: Nonce,
secp_ctx: &'a Secp256k1<T>,
) -> Self
pub fn deriving_signing_pubkey( node_id: PublicKey, expanded_key: &ExpandedKey, nonce: Nonce, secp_ctx: &'a Secp256k1<T>, ) -> Self
Similar to OfferBuilder::new except, if OfferBuilder::path is called, the signing
pubkey is derived from the given ExpandedKey and Nonce. This provides recipient
privacy by using a different signing pubkey for each offer. Otherwise, the provided
node_id is used for Offer::issuer_signing_pubkey.
Also, sets the metadata when OfferBuilder::build is called such that it can be used by
InvoiceRequest::verify_using_metadata to determine if the request was produced for the
offer given an ExpandedKey. However, if OfferBuilder::path is called, then the
metadata will not be set and must be included in each BlindedMessagePath instead. In this case,
use InvoiceRequest::verify_using_recipient_data.