Closed ethanfrey closed 5 years ago
This adds support for serializing and deserializing more complex structs as I use in my app. This does add some code-size unfortunately, but gives us the full expressiveness of serde-json.
It let's us handle structs like this:
pub enum ContractResult { Ok(Response), Err(String), } #[derive(Serialize, Deserialize, Default)] pub struct Response { pub messages: Vec<CosmosMsg>, pub log: Option<String>, pub data: Option<String>, } #[derive(Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum CosmosMsg { Send { from_address: String, to_address: String, amount: Vec<Coin>, }, Contract { contract_addr: String, msg: String, }, Opaque { data: String, }, }
Oops again
This adds support for serializing and deserializing more complex structs as I use in my app. This does add some code-size unfortunately, but gives us the full expressiveness of serde-json.
It let's us handle structs like this: