pub struct LnurlPayRequestMetadata {
pub description: String,
pub long_description: Option<String>,
pub image_png_base64: Option<String>,
pub image_jpeg_base64: Option<String>,
pub identifier: Option<String>,
pub email: Option<String>,
pub description_hash: [u8; 32],
pub raw: String,
}Expand description
The metadata inside a LnurlPayRequest.
Fields§
§description: StringShort description from text/plain (required, LUD-06).
long_description: Option<String>Long description from text/long-desc (optional, LUD-06).
Can be displayed to the user when prompting the user for an amount.
image_png_base64: Option<String>PNG thumbnail from image/png;base64 (optional, LUD-06).
Can be displayed to the user when prompting the user for an amount.
image_jpeg_base64: Option<String>JPEG thumbnail from image/jpeg;base64 (optional, LUD-06).
Can be displayed to the user when prompting the user for an amount.
identifier: Option<String>Internet identifier from text/identifier (LUD-16).
LNURL-Pay via LUD-16 requires this or text/email to be set.
email: Option<String>Email address from text/email (LUD-16).
LNURL-Pay via LUD-16 requires this or text/identifier to be set.
description_hash: [u8; 32]SHA256 hash of raw metadata for invoice validation.
raw: StringThe original unparsed metadata string.
Implementations§
Source§impl LnurlPayRequestMetadata
impl LnurlPayRequestMetadata
pub fn from_email(email: &str) -> LnurlPayRequestMetadata
Sourcepub fn from_raw_string(raw: String) -> Result<LnurlPayRequestMetadata, Error>
pub fn from_raw_string(raw: String) -> Result<LnurlPayRequestMetadata, Error>
Parses LNURL-pay metadata string into structured metadata.
LUD-06 metadata field is a JSON array encoded as a string:
"[[\"text/plain\", \"lorem ipsum blah blah\"]]".
Sourcepub fn to_raw_string(&self) -> String
pub fn to_raw_string(&self) -> String
Serializes the metadata back into the raw LNURL-pay metadata string.
Generates a JSON array encoded as a string, suitable for use in LNURL-pay requests. The order of entries is deterministic.
Trait Implementations§
Source§impl Clone for LnurlPayRequestMetadata
impl Clone for LnurlPayRequestMetadata
Source§fn clone(&self) -> LnurlPayRequestMetadata
fn clone(&self) -> LnurlPayRequestMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LnurlPayRequestMetadata
impl Debug for LnurlPayRequestMetadata
Source§impl PartialEq for LnurlPayRequestMetadata
impl PartialEq for LnurlPayRequestMetadata
impl Eq for LnurlPayRequestMetadata
impl StructuralPartialEq for LnurlPayRequestMetadata
Auto Trait Implementations§
impl Freeze for LnurlPayRequestMetadata
impl RefUnwindSafe for LnurlPayRequestMetadata
impl Send for LnurlPayRequestMetadata
impl Sync for LnurlPayRequestMetadata
impl Unpin for LnurlPayRequestMetadata
impl UnsafeUnpin for LnurlPayRequestMetadata
impl UnwindSafe for LnurlPayRequestMetadata
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.