Struct RefundBuilder
pub struct RefundBuilder<'a, T>where
T: Signing,{ /* private fields */ }Expand description
Builds a Refund for the “offer for money” 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> RefundBuilder<'a, SignOnly>
impl<'a> RefundBuilder<'a, SignOnly>
pub fn new(
metadata: Vec<u8>,
payer_id: PublicKey,
amount_msats: u64,
) -> Result<RefundBuilder<'a, SignOnly>, Bolt12SemanticError>
pub fn new( metadata: Vec<u8>, payer_id: PublicKey, amount_msats: u64, ) -> Result<RefundBuilder<'a, SignOnly>, Bolt12SemanticError>
Creates a new builder for a refund using the Refund::payer_id for the public node id to
send to if no Refund::paths are set. Otherwise, it may be a transient pubkey.
Additionally, sets the required (empty) Refund::description, Refund::payer_metadata,
and Refund::amount_msats.
§Note
If constructing a Refund for use with a ChannelManager, use
ChannelManager::create_refund_builder instead of RefundBuilder::new.
§impl<'a, T> RefundBuilder<'a, T>where
T: Signing,
impl<'a, T> RefundBuilder<'a, T>where
T: Signing,
pub fn deriving_payer_id<ES>(
node_id: PublicKey,
expanded_key: &ExpandedKey,
entropy_source: ES,
secp_ctx: &'a Secp256k1<T>,
amount_msats: u64,
payment_id: PaymentId,
) -> Result<RefundBuilder<'a, T>, Bolt12SemanticError>
pub fn deriving_payer_id<ES>( node_id: PublicKey, expanded_key: &ExpandedKey, entropy_source: ES, secp_ctx: &'a Secp256k1<T>, amount_msats: u64, payment_id: PaymentId, ) -> Result<RefundBuilder<'a, T>, Bolt12SemanticError>
Similar to RefundBuilder::new except, if RefundBuilder::path is called, the payer id
is derived from the given ExpandedKey and nonce. This provides sender privacy by using a
different payer id for each refund, assuming a different nonce is used. Otherwise, the
provided node_id is used for the payer id.
Also, sets the metadata when RefundBuilder::build is called such that it can be used to
verify that an InvoiceRequest was produced for the refund given an ExpandedKey.
The payment_id is encrypted in the metadata and should be unique. This ensures that only
one invoice will be paid for the refund and that payments can be uniquely identified.
pub fn description(self, description: String) -> RefundBuilder<'a, T>
pub fn description(self, description: String) -> RefundBuilder<'a, T>
Sets the Refund::description.
Successive calls to this method will override the previous setting.
pub fn absolute_expiry(self, absolute_expiry: Duration) -> RefundBuilder<'a, T>
pub fn absolute_expiry(self, absolute_expiry: Duration) -> RefundBuilder<'a, T>
Sets the Refund::absolute_expiry as seconds since the Unix epoch. Any expiry that has
already passed is valid and can be checked for using Refund::is_expired.
Successive calls to this method will override the previous setting.
pub fn issuer(self, issuer: String) -> RefundBuilder<'a, T>
pub fn issuer(self, issuer: String) -> RefundBuilder<'a, T>
Sets the Refund::issuer.
Successive calls to this method will override the previous setting.
pub fn path(self, path: BlindedPath) -> RefundBuilder<'a, T>
pub fn path(self, path: BlindedPath) -> RefundBuilder<'a, T>
Adds a blinded path to Refund::paths. Must include at least one path if only connected
by private channels or if Refund::payer_id 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 chain(self, network: Network) -> RefundBuilder<'a, T>
pub fn chain(self, network: Network) -> RefundBuilder<'a, T>
Sets the Refund::chain of the given Network for paying an invoice. If not
called, Network::Bitcoin is assumed.
Successive calls to this method will override the previous setting.
pub fn quantity(self, quantity: u64) -> RefundBuilder<'a, T>
pub fn quantity(self, quantity: u64) -> RefundBuilder<'a, T>
Sets Refund::quantity of items. This is purely for informational purposes. It is useful
when the refund pertains to a Bolt12Invoice that paid for more than one item from an
Offer as specified by InvoiceRequest::quantity.
Successive calls to this method will override the previous setting.
pub fn payer_note(self, payer_note: String) -> RefundBuilder<'a, T>
pub fn payer_note(self, payer_note: String) -> RefundBuilder<'a, T>
Sets the Refund::payer_note.
Successive calls to this method will override the previous setting.
pub fn build(self) -> Result<Refund, Bolt12SemanticError>
pub fn build(self) -> Result<Refund, Bolt12SemanticError>
Builds a Refund after checking for valid semantics.
Auto Trait Implementations§
impl<'a, T> Freeze for RefundBuilder<'a, T>
impl<'a, T> RefUnwindSafe for RefundBuilder<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for RefundBuilder<'a, T>
impl<'a, T> Sync for RefundBuilder<'a, T>
impl<'a, T> Unpin for RefundBuilder<'a, T>
impl<'a, T> UnwindSafe for RefundBuilder<'a, T>where
T: RefUnwindSafe,
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request