-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db8ee33
commit fd215a8
Showing
7 changed files
with
29 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,35 @@ | ||
use schemars::schema_for; | ||
use std::fs; | ||
use program::{UserConfig, AuxData}; | ||
use program::{UserConfig, AuxData, ORACLE_DATA}; | ||
use codec::Encode; | ||
|
||
pub fn generate_types() { | ||
let schema_config = schema_for!(UserConfig); | ||
fs::write( | ||
"./{{project-name}}_serialized_config_type.txt", | ||
"./tests_serialized_config_type.txt", | ||
format!( | ||
"{:?}", | ||
serde_json::to_vec(&schema_config) | ||
.expect("error converting user config for device key proxy") | ||
.expect("error converting user config") | ||
), | ||
) | ||
.expect("Failed to write to device key proxy config"); | ||
.expect("Failed to write to config"); | ||
|
||
let schema_aux_data = schema_for!(AuxData); | ||
fs::write( | ||
"./{{project-name}}_serialized_aux_data_type.txt", | ||
"./tests_serialized_aux_data_type.txt", | ||
format!( | ||
"{:?}", | ||
serde_json::to_vec(&schema_aux_data) | ||
.expect("error converting user aux_data for device key proxy") | ||
.expect("error converting user aux_data") | ||
), | ||
) | ||
.expect("Failed to write to device key proxy aux_data"); | ||
} | ||
.expect("Failed to write to proxy aux_data"); | ||
|
||
let oracle_data = ORACLE_DATA.iter().map(|x| x.encode()).collect::<Vec<_>>(); | ||
fs::write( | ||
"./tests_serialized_oracle_data_type.txt", | ||
serde_json::to_vec(&oracle_data).expect("error converting user oracle_data") | ||
) | ||
.expect("Failed to write oracle_data"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters