Skip to content

Commit

Permalink
Minor revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Radinyn committed Jul 5, 2023
1 parent 159cd83 commit 9fff67f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions protostar-rust/src/cheatcodes_hint_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ fn execute_cheatcode_hint(
let mut paths = std::fs::read_dir(&current_dir)
.expect("Failed to read ./target/dev, scarb build probably failed");

let starknet_artifacts = &paths
let starknet_artifacts_entry = &paths
.find_map(|path| match path {
Ok(path) => {
let name = path.file_name().into_string().ok()?;
Expand All @@ -239,11 +239,20 @@ fn execute_cheatcode_hint(
Err(_) => None,
})
.expect("Failed to find starknet_artifacts.json file");
let starknet_artifacts = fs::read_to_string(starknet_artifacts.path())
.expect("Failed to read starknet_artifacts.json contents");
let starknet_artifacts = fs::read_to_string(starknet_artifacts_entry.path())
.unwrap_or_else(|_| {
panic!(
"Failed to read {:?} contents",
starknet_artifacts_entry.file_name()
)
});
let starknet_artifacts: ScarbStarknetArtifacts =
serde_json::from_str(starknet_artifacts.as_str())
.expect("Failed to parse starknet_artifacts.json contents");
serde_json::from_str(starknet_artifacts.as_str()).unwrap_or_else(|_| {
panic!(
"Failed to parse {:?} contents",
starknet_artifacts_entry.file_name()
)
});

let Some(sierra_path) = starknet_artifacts.contracts.iter().find_map(|contract| {
if contract.contract_name == contract_value_as_short_str {
Expand Down

0 comments on commit 9fff67f

Please sign in to comment.