Skip to content

Commit

Permalink
Use TypeScript polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Nov 27, 2024
1 parent 4e8d217 commit 1b38229
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
7 changes: 5 additions & 2 deletions packages/cw-schema-codegen/src/rust/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ fn expand_node_name<'a>(
}
cw_schema::NodeType::Enum { .. } => node.name.as_ref().into(),

cw_schema::NodeType::Decimal { precision: _, signed: _ } => {
cw_schema::NodeType::Decimal {
precision: _,
signed: _,
} => {
// ToDo: Actually use a decimal type here
"String".into()
}
Expand All @@ -49,7 +52,7 @@ fn expand_node_name<'a>(
cw_schema::NodeType::HexBinary => {
// ToDo: Actually use a hex-encoded binary type here
"String".into()
},
}
cw_schema::NodeType::Timestamp => "cosmrs::tendermint::Time".into(),
cw_schema::NodeType::Unit => "()".into(),
}
Expand Down
10 changes: 8 additions & 2 deletions packages/cw-schema-codegen/src/typescript/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ fn expand_node_name<'a>(

cw_schema::NodeType::Decimal { .. } => "z.string()".into(),
cw_schema::NodeType::Address => "z.string()".into(),
cw_schema::NodeType::Checksum => todo!(),
cw_schema::NodeType::HexBinary => todo!(),
cw_schema::NodeType::Checksum => {
// ToDo: Use actual checksum types
"z.string()".into()
}
cw_schema::NodeType::HexBinary => {
// ToDo: Actually use a binary decoding hex type
"z.string()".into()
}
cw_schema::NodeType::Timestamp => {
// ToDo: Replace with better type
"z.string()".into()
Expand Down
10 changes: 5 additions & 5 deletions packages/cw-schema-codegen/tests/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ fn assert_validity() {

// make sure the dependencies are installed
let install_status = Command::new("npm")
.arg("i")
.current_dir(&e2e_dir)
.status()
.unwrap();
assert!(install_status.success());
.arg("i")
.current_dir(&e2e_dir)
.status()
.unwrap();
assert!(install_status.success());

let random_data: [u8; 255] = rand::random();
let mut unstructured = arbitrary::Unstructured::new(&random_data);
Expand Down

0 comments on commit 1b38229

Please sign in to comment.