From 9f143a96e8f67a48ce32e4655a79fd78ae5bfb5f Mon Sep 17 00:00:00 2001 From: incrypto32 Date: Wed, 8 May 2024 19:29:33 +0400 Subject: [PATCH] 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",