|
@@ -29,20 +29,19 @@ token = "{}"
|
|
|
}
|
|
|
|
|
|
pub fn idl_ts(idl: &Idl) -> Result<String> {
|
|
|
- let mut idl = idl.clone();
|
|
|
- for acc in idl.accounts.iter_mut() {
|
|
|
+ let mut idl_types = idl.clone();
|
|
|
+ for acc in idl_types.accounts.iter_mut() {
|
|
|
acc.name = acc.name.to_mixed_case();
|
|
|
}
|
|
|
- let idl_json = serde_json::to_string_pretty(&idl)?;
|
|
|
Ok(format!(
|
|
|
r#"export type {} = {};
|
|
|
|
|
|
export const IDL: {} = {};
|
|
|
"#,
|
|
|
+ idl_types.name.to_camel_case(),
|
|
|
+ serde_json::to_string_pretty(&idl_types)?,
|
|
|
idl.name.to_camel_case(),
|
|
|
- idl_json,
|
|
|
- idl.name.to_camel_case(),
|
|
|
- idl_json
|
|
|
+ serde_json::to_string_pretty(&idl)?
|
|
|
))
|
|
|
}
|
|
|
|