From 1f0aec4063acfed9e69232ecb4d5976cd831fe3b Mon Sep 17 00:00:00 2001 From: Marche Date: Sun, 25 Jun 2023 14:21:57 -0300 Subject: [PATCH] fix IDL struct (#91) --- crate/src/structs.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crate/src/structs.rs b/crate/src/structs.rs index c8da3e8..e9eb090 100644 --- a/crate/src/structs.rs +++ b/crate/src/structs.rs @@ -95,6 +95,7 @@ pub struct Instruction { #[derive(Deserialize, Serialize, Debug, Clone)] pub struct Accounts { + #[serde(default)] pub(crate) name: String, #[serde(default)] #[serde(rename = "type")] @@ -145,6 +146,7 @@ pub struct InstructionArgs { #[derive(Deserialize, Serialize, Debug, Clone)] pub struct Type { pub(crate) kind: String, + #[serde(default)] pub(crate) fields: Vec, } @@ -206,6 +208,12 @@ pub enum InstructionType { option(OptionType), } +impl Default for InstructionType { + fn default() -> Self { + InstructionType::String("".to_string()) + } +} + #[derive(Deserialize, Serialize, Debug, Clone)] #[serde(untagged)] pub enum InstructionTypeVec { @@ -244,6 +252,7 @@ pub struct Name { #[derive(Deserialize, Serialize, Debug, Clone)] pub struct TypeFields { pub(crate) name: String, + #[serde(default)] #[serde(rename = "type")] pub(crate) type_: InstructionType, }