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

BlockNumber doesn't implement Serialize and Deserialize traits #2804

@AdamDawidKrol

Description

@AdamDawidKrol

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions