Skip to content
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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant