From 32ffede2ecaa8999a92f2d485f30db411d61f514 Mon Sep 17 00:00:00 2001 From: armaniferrante Date: Mon, 25 Oct 2021 12:38:18 -0700 Subject: [PATCH] cli: Fix IDL json generation --- cli/src/template.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cli/src/template.rs b/cli/src/template.rs index 9db4205f..dbe8a041 100644 --- a/cli/src/template.rs +++ b/cli/src/template.rs @@ -29,8 +29,8 @@ token = "{}" } pub fn idl_ts(idl: &Idl) -> Result { - let mut idl = idl.clone(); - idl.accounts = idl + let mut idl_type = idl.clone(); + idl_type.accounts = idl_type .accounts .into_iter() .map(|acc| { @@ -39,6 +39,7 @@ pub fn idl_ts(idl: &Idl) -> Result { acc }) .collect(); + let idl_type = serde_json::to_string_pretty(&idl_type)?; let idl_json = serde_json::to_string_pretty(&idl)?; Ok(format!( r#"export type {} = {}; @@ -46,7 +47,7 @@ pub fn idl_ts(idl: &Idl) -> Result { export const IDL: {} = {}; "#, idl.name.to_camel_case(), - idl_json, + idl_type, idl.name.to_camel_case(), idl_json ))