|
@@ -116,13 +116,19 @@ pub mod wallet {
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
pub struct Token {
|
|
pub struct Token {
|
|
pub token: Vec<MintProofs>,
|
|
pub token: Vec<MintProofs>,
|
|
|
|
+ /// Memo for token
|
|
|
|
+ #[serde(skip_serializing_if = "Option::is_none")]
|
|
pub memo: Option<String>,
|
|
pub memo: Option<String>,
|
|
|
|
+ #[serde(skip_serializing_if = "Option::is_none")]
|
|
|
|
+ /// Unit of the token eg: sats, usd
|
|
|
|
+ pub unit: Option<String>,
|
|
}
|
|
}
|
|
|
|
|
|
impl Token {
|
|
impl Token {
|
|
pub fn new(
|
|
pub fn new(
|
|
mint_url: UncheckedUrl,
|
|
mint_url: UncheckedUrl,
|
|
proofs: Proofs,
|
|
proofs: Proofs,
|
|
|
|
+ unit: Option<String>,
|
|
memo: Option<String>,
|
|
memo: Option<String>,
|
|
) -> Result<Self, wallet::Error> {
|
|
) -> Result<Self, wallet::Error> {
|
|
if proofs.is_empty() {
|
|
if proofs.is_empty() {
|
|
@@ -135,6 +141,7 @@ pub mod wallet {
|
|
Ok(Self {
|
|
Ok(Self {
|
|
token: vec![MintProofs::new(mint_url, proofs)],
|
|
token: vec![MintProofs::new(mint_url, proofs)],
|
|
memo,
|
|
memo,
|
|
|
|
+ unit,
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -316,6 +323,7 @@ mod tests {
|
|
UncheckedUrl::from_str("https://localhost:5000/cashu").unwrap(),
|
|
UncheckedUrl::from_str("https://localhost:5000/cashu").unwrap(),
|
|
proof,
|
|
proof,
|
|
None,
|
|
None,
|
|
|
|
+ None,
|
|
)
|
|
)
|
|
.unwrap();
|
|
.unwrap();
|
|
|
|
|