-
Notifications
You must be signed in to change notification settings - Fork 152
Migrate get_orders_by_tx endpoint to alloy #3883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
+173
−132
Conversation
This file contains hidden or 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
squadgazzz
approved these changes
Nov 7, 2025
m-sz
approved these changes
Nov 10, 2025
Contributor
m-sz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| .await | ||
| .unwrap(); | ||
| assert_eq!(result.0, H256::from_str(hash_str).unwrap().0); | ||
| assert_eq!(result.0, B256::from_str(hash_str).unwrap().0); |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alloy's from_str calls from_hex
Making use of hex::decode_to_array
Creates an instance of type Self from the given hex string, or fails with a custom error type.
Both, upper and lower case characters are valid and can even be mixed (e.g. f9b4ca, F9B4CA and f9B4Ca are all valid strings).
H256 from_str:
/// Creates a hash type instance from the given string.
///
/// # Note
///
/// The given input string is interpreted in big endian.
///
/// # Errors
///
/// - When encountering invalid non hex-digits
/// - Upon empty string input or invalid input length in general
fn from_str(input: &str) -> $crate::core_::result::Result<$name, $crate::rustc_hex::FromHexError> {
let input = input.strip_prefix("0x").unwrap_or(input);
let mut iter = $crate::rustc_hex::FromHexIter::new(input);
let mut result = Self::zero();
for byte in result.as_mut() {
*byte = iter.next().ok_or(Self::Err::InvalidHexLength)??;
}
if iter.next().is_some() {
return Err(Self::Err::InvalidHexLength)
}
Ok(result)
}
Both methods strip the prefix and seem to work the same.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Migrate get_orders_by_tx endpoint to alloy
Changes
How to test
Existing tests