Skip to content

Commit

Permalink
serialize BlockId directly for block_receipts
Browse files Browse the repository at this point in the history
  • Loading branch information
incrypto32 committed May 8, 2024
1 parent d9ba4ff commit 9f143a9
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/api/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,8 @@ impl<T: Transport> Eth<T> {

/// Get block receipts
pub fn block_receipts(&self, block: BlockId) -> CallFuture<Option<Vec<TransactionReceipt>>, 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)
}
Expand Down Expand Up @@ -521,7 +513,7 @@ mod tests {
"status": "0x1",
"effectiveGasPrice": "0x100"
}"#;

const EXAMPLE_BLOCK_RECEIPTS: &str = r#"[{
"transactionHash": "0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238",
"transactionIndex": "0x1",
Expand Down

0 comments on commit 9f143a9

Please sign in to comment.