Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

BlockNumber doesn't implement Serialize and Deserialize traits #2804

Open
AdamDawidKrol opened this issue Jul 31, 2024 · 0 comments
Open

BlockNumber doesn't implement Serialize and Deserialize traits #2804

AdamDawidKrol opened this issue Jul 31, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@AdamDawidKrol
Copy link

AdamDawidKrol commented Jul 31, 2024

Version
2.0

Platform
Darwin MBP-Adam.home 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:54 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6030 arm64

Description
ethers_core::types::BlockNumber doesn't implement Serialize and Deserialize traits.

I tried this code:

fn main() {
    let block_number = BlockNumber::Number(42.into());
    let serialized = serde_json::to_string(&block_number).unwrap();
    println!("Serialized BlockNumber: {}", serialized);

    let latest_block_number = BlockNumber::Latest;
    let serialized_latest = serde_json::to_string(&latest_block_number).unwrap();
    println!("Serialized Latest BlockNumber: {}", serialized_latest);
}

I expected to see this happen:
It should serialize BlockNumber.

Instead, this happened:
BlockNumber is not serialized.

@AdamDawidKrol AdamDawidKrol added the bug Something isn't working label Jul 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant