Skip to content

Commit

Permalink
fix IDL struct (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanMarchetto authored Jun 25, 2023
1 parent 6e250fb commit 1f0aec4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crate/src/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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<TypeFields>,
}

Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
}
Expand Down

0 comments on commit 1f0aec4

Please sign in to comment.