pub struct PayRequestResponse {
pub callback: String,
pub max_sendable: u64,
pub min_sendable: u64,
pub tag: String,
pub metadata: String,
pub comment_allowed: Option<u64>,
}Fields§
§callback: String§max_sendable: u64§min_sendable: u64§tag: String§metadata: String§comment_allowed: Option<u64>Maximum comment length the service accepts (LUD-12). None or 0 means comments are not supported.
Implementations§
Source§impl PayRequestResponse
impl PayRequestResponse
Sourcepub fn description(&self) -> Option<String>
pub fn description(&self) -> Option<String>
Extract the “text/plain” description from the metadata JSON.
Sourcepub fn validate(&self, identifier: &str, amount_msats: u64) -> Result<()>
pub fn validate(&self, identifier: &str, amount_msats: u64) -> Result<()>
Validate this pay request response for a given amount.
Checks the tag, amount range, and — for lightning addresses — that the metadata contains a matching identifier.
Sourcepub async fn get_invoice<T: LnUrlHttpClient>(
&self,
http_client: &T,
amount_msats: u64,
comment: Option<&str>,
) -> Result<(String, Option<SuccessAction>)>
pub async fn get_invoice<T: LnUrlHttpClient>( &self, http_client: &T, amount_msats: u64, comment: Option<&str>, ) -> Result<(String, Option<SuccessAction>)>
Fetch an invoice from this pay request’s callback endpoint.
Builds the callback URL with the given amount and optional comment, fetches the invoice, validates it against the metadata, and returns the invoice string along with any success action.
Trait Implementations§
Source§impl Clone for PayRequestResponse
impl Clone for PayRequestResponse
Source§fn clone(&self) -> PayRequestResponse
fn clone(&self) -> PayRequestResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PayRequestResponse
impl Debug for PayRequestResponse
Source§impl<'de> Deserialize<'de> for PayRequestResponse
impl<'de> Deserialize<'de> for PayRequestResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PayRequestResponse
impl RefUnwindSafe for PayRequestResponse
impl Send for PayRequestResponse
impl Sync for PayRequestResponse
impl Unpin for PayRequestResponse
impl UnsafeUnpin for PayRequestResponse
impl UnwindSafe for PayRequestResponse
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for T
impl<T> Downcast for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
Converts
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>
Converts
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>
Wrap the input message
T in a tonic::Request