-
Notifications
You must be signed in to change notification settings - Fork 98
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
Showing
4 changed files
with
113 additions
and
80 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
26 changes: 26 additions & 0 deletions
26
framework/scenario/src/scenario/model/transaction/tx_response_utils.rs
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
pub fn process_topics_error(topics: Option<&Vec<String>>) -> Option<String> { | ||
if topics.is_none() { | ||
return Some("missing topics".to_string()); | ||
} | ||
|
||
let topics = topics.unwrap(); | ||
return if topics.len() != 2 { | ||
Check warning on line 7 in framework/scenario/src/scenario/model/transaction/tx_response_utils.rs GitHub Actions / clippy[clippy] framework/scenario/src/scenario/model/transaction/tx_response_utils.rs#L7
Raw output
Check warning on line 7 in framework/scenario/src/scenario/model/transaction/tx_response_utils.rs GitHub Actions / clippy[clippy] framework/scenario/src/scenario/model/transaction/tx_response_utils.rs#L7
Raw output
|
||
Some(format!( | ||
"expected to have 2 topics, found {} instead", | ||
topics.len() | ||
)) | ||
} else { | ||
None | ||
}; | ||
} | ||
|
||
pub fn decode_scr_data_or_panic(data: &str) -> Vec<Vec<u8>> { | ||
let mut split = data.split('@'); | ||
let _ = split.next().expect("SCR data should start with '@'"); | ||
let result_code = split.next().expect("missing result code"); | ||
assert_eq!(result_code, "6f6b", "result code is not 'ok'"); | ||
|
||
split | ||
.map(|encoded_arg| hex::decode(encoded_arg).expect("error hex-decoding result")) | ||
.collect() | ||
} |