//! Mint Information // https://github.com/cashubtc/nuts/blob/main/09.md use serde::{Deserialize, Deserializer, Serialize, Serializer}; use super::nut01::PublicKey; /// Mint Version #[derive(Debug, Clone, PartialEq, Eq)] pub struct MintVersion { pub name: String, pub version: String, } impl Serialize for MintVersion { fn serialize(&self, serializer: S) -> Result where S: Serializer, { let combined = format!("{}/{}", self.name, self.version); serializer.serialize_str(&combined) } } impl<'de> Deserialize<'de> for MintVersion { fn deserialize(deserializer: D) -> Result where D: Deserializer<'de>, { let combined = String::deserialize(deserializer)?; let parts: Vec<&str> = combined.split('/').collect(); if parts.len() != 2 { return Err(serde::de::Error::custom("Invalid input string")); } Ok(MintVersion { name: parts[0].to_string(), version: parts[1].to_string(), }) } } /// Mint Info [NIP-09] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct MintInfo { /// name of the mint and should be recognizable pub name: Option, /// hex pubkey of the mint pub pubkey: Option, /// implementation name and the version running pub version: Option, /// short description of the mint pub description: Option, /// long description pub description_long: Option, /// contact methods to reach the mint operator pub contact: Vec>, /// shows which NUTs the mint supports pub nuts: Vec, /// message of the day that the wallet must display to the user pub motd: Option, }