Skip to content

Commit

Permalink
Remove schemars attribute and fix from_str ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
elmattic committed Jan 10, 2025
1 parent a253956 commit 3f9da88
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ pub struct BlockHash {
#[derive(PartialEq, Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[serde(untagged)]
pub enum BlockNumberOrHash {
#[schemars(with = "String")]
PredefinedBlock(Predefined),
BlockNumber(EthInt64),
BlockHash(EthHash),
Expand Down Expand Up @@ -294,6 +293,9 @@ impl BlockNumberOrHash {
match s {
"latest" | "" => Ok(BlockNumberOrHash::from_predefined(Predefined::Latest)),
"earliest" => Ok(BlockNumberOrHash::from_predefined(Predefined::Earliest)),
"pending" => Ok(BlockNumberOrHash::from_predefined(Predefined::Pending)),
"safe" => Ok(BlockNumberOrHash::from_predefined(Predefined::Safe)),
"finalized" => Ok(BlockNumberOrHash::from_predefined(Predefined::Finalized)),
hex if hex.starts_with("0x") => {
let epoch = hex_str_to_epoch(hex)?;
Ok(BlockNumberOrHash::from_block_number(epoch))
Expand Down

0 comments on commit 3f9da88

Please sign in to comment.