瀏覽代碼

improve: mint info skip if none

thesimplekid 1 年之前
父節點
當前提交
79980556f7
共有 2 個文件被更改,包括 9 次插入0 次删除
  1. 1 0
      src/mint.rs
  2. 8 0
      src/nuts/nut09.rs

+ 1 - 0
src/mint.rs

@@ -16,6 +16,7 @@ use crate::nuts::*;
 use crate::Amount;
 
 pub struct Mint {
+    //    pub pubkey: PublicKey,
     pub active_keyset: nut02::mint::KeySet,
     pub inactive_keysets: HashMap<String, nut02::mint::KeySet>,
     pub spent_secrets: HashSet<String>,

+ 8 - 0
src/nuts/nut09.rs

@@ -43,19 +43,27 @@ impl<'de> Deserialize<'de> for MintVersion {
 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
 pub struct MintInfo {
     /// name of the mint and should be recognizable
+    #[serde(skip_serializing_if = "Option::is_none")]
     pub name: Option<String>,
     /// hex pubkey of the mint
+    #[serde(skip_serializing_if = "Option::is_none")]
     pub pubkey: Option<PublicKey>,
     /// implementation name and the version running
+    #[serde(skip_serializing_if = "Option::is_none")]
     pub version: Option<MintVersion>,
     /// short description of the mint
+    #[serde(skip_serializing_if = "Option::is_none")]
     pub description: Option<String>,
     /// long description
+    #[serde(skip_serializing_if = "Option::is_none")]
     pub description_long: Option<String>,
     /// contact methods to reach the mint operator
+    #[serde(skip_serializing_if = "Vec::is_empty")]
     pub contact: Vec<Vec<String>>,
     /// shows which NUTs the mint supports
+    #[serde(skip_serializing_if = "Vec::is_empty")]
     pub nuts: Vec<String>,
     /// message of the day that the wallet must display to the user
+    #[serde(skip_serializing_if = "Option::is_none")]
     pub motd: Option<String>,
 }