From 3f9da88690cadcb60fb61265c56b90ad16d4b3f9 Mon Sep 17 00:00:00 2001 From: elmattic Date: Fri, 10 Jan 2025 14:14:39 +0100 Subject: [PATCH] Remove schemars attribute and fix from_str ctor --- src/rpc/methods/eth.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rpc/methods/eth.rs b/src/rpc/methods/eth.rs index 7a798bb7121..7558b547904 100644 --- a/src/rpc/methods/eth.rs +++ b/src/rpc/methods/eth.rs @@ -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), @@ -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))