Skip to content

Commit

Permalink
fix: serialize block num w/o leading zeros (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
onbjerg authored Nov 21, 2023
1 parent 9f9202c commit 8a5f495
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/rpc-types/src/eth/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ impl Serialize for BlockNumberOrTag {
S: Serializer,
{
match *self {
BlockNumberOrTag::Number(ref x) => serializer.serialize_str(&format!("0x{x:x}")),
BlockNumberOrTag::Number(ref x) => {
serializer.serialize_str(&format!("0x{:x}", x.to::<u64>()))
},
BlockNumberOrTag::Latest => serializer.serialize_str("latest"),
BlockNumberOrTag::Finalized => serializer.serialize_str("finalized"),
BlockNumberOrTag::Safe => serializer.serialize_str("safe"),
Expand Down

0 comments on commit 8a5f495

Please sign in to comment.