From ccdd4784b26302ab2cee48430e118318442d3605 Mon Sep 17 00:00:00 2001 From: ngutech21 Date: Tue, 9 Jan 2024 13:14:26 +0100 Subject: [PATCH] chore: add optional unit to TokenV3 --- moksha-core/src/token.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/moksha-core/src/token.rs b/moksha-core/src/token.rs index 7b8cdd62..8a85a9f5 100644 --- a/moksha-core/src/token.rs +++ b/moksha-core/src/token.rs @@ -7,7 +7,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_with::skip_serializing_none; use url::Url; -use crate::{error::MokshaCoreError, proof::Proofs}; +use crate::{error::MokshaCoreError, primitives::CurrencyUnit, proof::Proofs}; const TOKEN_PREFIX_V3: &str = "cashuA"; @@ -52,6 +52,7 @@ pub struct TokenV3 { #[serde(rename = "token")] pub tokens: Vec, pub memo: Option, + pub unit: Option, } impl TokenV3 { @@ -59,6 +60,7 @@ impl TokenV3 { Self { tokens: vec![token], memo: None, + unit: None, } } @@ -66,6 +68,7 @@ impl TokenV3 { Self { tokens: vec![], memo: None, + unit: None, } } @@ -143,6 +146,7 @@ impl From<(Url, Proofs)> for TokenV3 { proofs: from.1, }], memo: None, + unit: None, } } } @@ -204,6 +208,7 @@ mod tests { let tokens = super::TokenV3 { tokens: vec![token], memo: Some("my memo".to_string()), + unit: None, }; let serialized: String = tokens.try_into()?;