You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm using this library to get the ERC20TokenTransferEvent from etherscan and then save it into a JSON file.
But when deserialize the JSON file, I had this Error value: Error("digit 33 is out of range for base 16", line: 3, column: 39)'. It seems like the number in the JSON file is saved in the hex format.
Can someone help me to solve this issue?
Test code
mod test {use std::str::FromStr;use alloy_chains::Chain;use alloy_primitives::Address;use foundry_block_explorers::{account::ERC20TokenTransferEvent,Client};#[tokio::test]asyncfntest_serde(){let client = Client::new(Chain::from_id(137),"<API-KEY>>").unwrap();let addr = Address::from_str("<Address>").unwrap();let events = client
.get_erc20_token_transfer_events(
foundry_block_explorers::account::TokenQueryOption::ByAddress(addr),Some(foundry_block_explorers::account::TxListParams{start_block:0,end_block:99999999,page:1,offset:1,sort: foundry_block_explorers::account::Sort::Desc,}),).await.unwrap();let data = serde_json::to_string_pretty(&events).unwrap();println!("{}", data);let de_events:Vec<ERC20TokenTransferEvent> = serde_json::from_str(&data).unwrap();assert_eq!(events.len(),de_events.len())}}
Cargo.toml
[dependencies]
alloy-chains = "0.1.4"alloy-primitives = { version = "0.5.2", features = ["serde", "std"] }
alloy-json-abi = { version = "0.5", default-features = false, features = [
"std",
"serde_json",
] }
anyhow = "1.0.75"foundry-block-explorers = "0.1.1"rust_decimal = { version = "1.33.1", features = ["maths"] }
serde = "1.0.193"serde_json = "1.0.108"tokio = { version = "1.34.0", features = ["macros", "rt-multi-thread"] }
The text was updated successfully, but these errors were encountered:
Hi, I'm using this library to get the ERC20TokenTransferEvent from etherscan and then save it into a JSON file.
But when deserialize the JSON file, I had this Error
value: Error("digit 33 is out of range for base 16", line: 3, column: 39)'
. It seems like the number in the JSON file is saved in the hex format.Can someone help me to solve this issue?
Test code
Cargo.toml
The text was updated successfully, but these errors were encountered: