From 9f143a96e8f67a48ce32e4655a79fd78ae5bfb5f Mon Sep 17 00:00:00 2001 From: incrypto32 Date: Wed, 8 May 2024 19:29:33 +0400 Subject: [PATCH 1/3] serialize BlockId directly for block_receipts --- src/api/eth.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/api/eth.rs b/src/api/eth.rs index a2db0c76..7ee99e39 100644 --- a/src/api/eth.rs +++ b/src/api/eth.rs @@ -141,16 +141,8 @@ impl Eth { /// Get block receipts pub fn block_receipts(&self, block: BlockId) -> CallFuture>, T::Out> { - let result = match block { - BlockId::Hash(hash) => { - let hash = helpers::serialize(&hash); - self.transport.execute("eth_getBlockReceipts", vec![hash]) - } - BlockId::Number(num) => { - let num = helpers::serialize(&num); - self.transport.execute("eth_getBlockReceipts", vec![num]) - } - }; + let block: serde_json::Value = helpers::serialize(&block); + let result = self.transport.execute("eth_getBlockReceipts", vec![block]); CallFuture::new(result) } @@ -521,7 +513,7 @@ mod tests { "status": "0x1", "effectiveGasPrice": "0x100" }"#; - + const EXAMPLE_BLOCK_RECEIPTS: &str = r#"[{ "transactionHash": "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238", "transactionIndex": "0x1", From e94acdd71046fe3d48287cbc2c9082402556a5e8 Mon Sep 17 00:00:00 2001 From: incrypto32 Date: Thu, 16 May 2024 22:11:23 +0400 Subject: [PATCH 2/3] Fix cargo deny failing --- deny.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deny.toml b/deny.toml index d6467f7f..0e9c33ab 100644 --- a/deny.toml +++ b/deny.toml @@ -30,7 +30,7 @@ targets = [ # The path where the advisory database is cloned/fetched into db-path = "~/.cargo/advisory-db" # The url of the advisory database to use -db-url = "https://github.com/rustsec/advisory-db" +db-urls = ["https://github.com/rustsec/advisory-db"] # The lint level for security vulnerabilities vulnerability = "warn" # The lint level for unmaintained crates From d51894ec6a4dd9e8e1162bcf03790916d641fe65 Mon Sep 17 00:00:00 2001 From: incrypto32 Date: Fri, 17 May 2024 13:44:01 +0400 Subject: [PATCH 3/3] Fix warnings about missing imports --- src/types/uint.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/types/uint.rs b/src/types/uint.rs index dc62b2d1..51daad51 100644 --- a/src/types/uint.rs +++ b/src/types/uint.rs @@ -1,8 +1,9 @@ -pub use ethereum_types::{BigEndianHash, Bloom as H2048, H128, H160, H256, H512, H520, H64, U128, U256, U64}; +pub use ethereum_types::{Bloom as H2048, H128, H160, H256, H512, H520, H64, U128, U256, U64}; #[cfg(test)] mod tests { use super::*; + use ethereum_types::BigEndianHash; use wasm_bindgen_test::*; type Res = Result;