Struct breez_sdk_core::lightning::offers::refund::Refund
pub struct Refund { /* private fields */ }
Expand description
A Refund
is a request to send an Bolt12Invoice
without a preceding Offer
.
Typically, after an invoice is paid, the recipient may publish a refund allowing the sender to recoup their funds. A refund may be used more generally as an “offer for money”, such as with a bitcoin ATM.
Implementations§
§impl Refund
impl Refund
pub fn description(&self) -> PrintableString<'_>
pub fn description(&self) -> PrintableString<'_>
A complete description of the purpose of the refund. Intended to be displayed to the user but with the caveat that it has not been verified in any way.
pub fn absolute_expiry(&self) -> Option<Duration>
pub fn absolute_expiry(&self) -> Option<Duration>
Duration since the Unix epoch when an invoice should no longer be sent.
If None
, the refund does not expire.
pub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Whether the refund has expired.
pub fn issuer(&self) -> Option<PrintableString<'_>>
pub fn issuer(&self) -> Option<PrintableString<'_>>
The issuer of the refund, possibly beginning with user@domain
or domain
. Intended to be
displayed to the user but with the caveat that it has not been verified in any way.
pub fn paths(&self) -> &[BlindedPath]
pub fn paths(&self) -> &[BlindedPath]
Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender privacy by obfuscating its node id.
pub fn payer_metadata(&self) -> &[u8] ⓘ
pub fn payer_metadata(&self) -> &[u8] ⓘ
An unpredictable series of bytes, typically containing information about the derivation of
payer_id
.
pub fn amount_msats(&self) -> u64
pub fn amount_msats(&self) -> u64
The amount to refund in msats (i.e., the minimum lightning-payable unit for chain
).
pub fn features(&self) -> &Features<InvoiceRequestContext>
pub fn features(&self) -> &Features<InvoiceRequestContext>
Features pertaining to requesting an invoice.
pub fn payer_id(&self) -> PublicKey
pub fn payer_id(&self) -> PublicKey
A public node id to send to in the case where there are no paths
. Otherwise, a possibly
transient pubkey.
pub fn payer_note(&self) -> Option<PrintableString<'_>>
pub fn payer_note(&self) -> Option<PrintableString<'_>>
Payer provided note to include in the invoice.
pub fn respond_with(
&self,
payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
signing_pubkey: PublicKey,
) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
pub fn respond_with( &self, payment_paths: Vec<(BlindedPayInfo, BlindedPath)>, payment_hash: PaymentHash, signing_pubkey: PublicKey, ) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
Creates an InvoiceBuilder
for the refund with the given required fields and using the
Duration
since std::time::SystemTime::UNIX_EPOCH
as the creation time.
See Refund::respond_with_no_std
for further details where the aforementioned creation
time is used for the created_at
parameter.
This is not exported to bindings users as builder patterns don’t map outside of move semantics.
pub fn respond_with_no_std(
&self,
payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
signing_pubkey: PublicKey,
created_at: Duration,
) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
pub fn respond_with_no_std( &self, payment_paths: Vec<(BlindedPayInfo, BlindedPath)>, payment_hash: PaymentHash, signing_pubkey: PublicKey, created_at: Duration, ) -> Result<InvoiceBuilder<'_, ExplicitSigningPubkey>, Bolt12SemanticError>
Creates an InvoiceBuilder
for the refund with the given required fields.
Unless InvoiceBuilder::relative_expiry
is set, the invoice will expire two hours after
created_at
, which is used to set Bolt12Invoice::created_at
. Useful for no-std
builds
where std::time::SystemTime
is not available.
The caller is expected to remember the preimage of payment_hash
in order to
claim a payment for the invoice.
The signing_pubkey
is required to sign the invoice since refunds are not in response to an
offer, which does have a signing_pubkey
.
The payment_paths
parameter is useful for maintaining the payment recipient’s privacy. It
must contain one or more elements ordered from most-preferred to least-preferred, if there’s
a preference. Note, however, that any privacy is lost if a public node id is used for
signing_pubkey
.
Errors if the request contains unknown required features.
This is not exported to bindings users as builder patterns don’t map outside of move semantics.
pub fn respond_using_derived_keys<ES>(
&self,
payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
expanded_key: &ExpandedKey,
entropy_source: ES,
) -> Result<InvoiceBuilder<'_, DerivedSigningPubkey>, Bolt12SemanticError>
pub fn respond_using_derived_keys<ES>( &self, payment_paths: Vec<(BlindedPayInfo, BlindedPath)>, payment_hash: PaymentHash, expanded_key: &ExpandedKey, entropy_source: ES, ) -> Result<InvoiceBuilder<'_, DerivedSigningPubkey>, Bolt12SemanticError>
Creates an InvoiceBuilder
for the refund using the given required fields and that uses
derived signing keys to sign the Bolt12Invoice
.
See Refund::respond_with
for further details.
This is not exported to bindings users as builder patterns don’t map outside of move semantics.
pub fn respond_using_derived_keys_no_std<ES>(
&self,
payment_paths: Vec<(BlindedPayInfo, BlindedPath)>,
payment_hash: PaymentHash,
created_at: Duration,
expanded_key: &ExpandedKey,
entropy_source: ES,
) -> Result<InvoiceBuilder<'_, DerivedSigningPubkey>, Bolt12SemanticError>
pub fn respond_using_derived_keys_no_std<ES>( &self, payment_paths: Vec<(BlindedPayInfo, BlindedPath)>, payment_hash: PaymentHash, created_at: Duration, expanded_key: &ExpandedKey, entropy_source: ES, ) -> Result<InvoiceBuilder<'_, DerivedSigningPubkey>, Bolt12SemanticError>
Creates an InvoiceBuilder
for the refund using the given required fields and that uses
derived signing keys to sign the Bolt12Invoice
.
See Refund::respond_with_no_std
for further details.
This is not exported to bindings users as builder patterns don’t map outside of move semantics.
Trait Implementations§
§impl Writeable for Refund
impl Writeable for Refund
Auto Trait Implementations§
impl Freeze for Refund
impl RefUnwindSafe for Refund
impl Send for Refund
impl Sync for Refund
impl Unpin for Refund
impl UnwindSafe for Refund
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,
§impl<T> Base32Len for T
impl<T> Base32Len for T
§fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
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> CheckBase32<Vec<u5>> for T
impl<T> CheckBase32<Vec<u5>> for T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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> 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
§impl<T> ToBase32 for T
impl<T> ToBase32 for T
§fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
fn write_base32<W>(&self, writer: &mut W) -> Result<(), <W as WriteBase32>::Err>where
W: WriteBase32,
source§impl<T> ToHex for T
impl<T> ToHex for T
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Lower case
letters are used (e.g. f9b4ca
)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self
into the result. Upper case
letters are used (e.g. F9B4CA
)