From 31846e7a0e57afbf898f56b8073afc1fffcee577 Mon Sep 17 00:00:00 2001 From: Yash Atreya <44857776+yash-atreya@users.noreply.github.com> Date: Fri, 19 Apr 2024 12:12:48 -0700 Subject: [PATCH] fix(provider): uncle methods for block hash (#587) * fix(provider): uncle methods for block hash * doc nits Co-authored-by: evalir --------- Co-authored-by: evalir --- crates/provider/src/provider.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/provider/src/provider.rs b/crates/provider/src/provider.rs index 7ddfcf59032..23cfbec5bca 100644 --- a/crates/provider/src/provider.rs +++ b/crates/provider/src/provider.rs @@ -812,11 +812,13 @@ pub trait Provider: self.client().request("eth_getBlockReceipts", (block,)).await } - /// Gets an uncle block through the tag [BlockId] and index [U64]. - async fn get_uncle(&self, tag: BlockId, idx: U64) -> TransportResult> { + /// Gets an uncle block through the tag [BlockId] and index [u64]. + async fn get_uncle(&self, tag: BlockId, idx: u64) -> TransportResult> { match tag { BlockId::Hash(hash) => { - self.client().request("eth_getUncleByBlockHashAndIndex", (hash, idx)).await + self.client() + .request("eth_getUncleByBlockHashAndIndex", (hash.block_hash, idx)) + .await } BlockId::Number(number) => { self.client().request("eth_getUncleByBlockNumberAndIndex", (number, idx)).await @@ -829,7 +831,7 @@ pub trait Provider: match tag { BlockId::Hash(hash) => self .client() - .request("eth_getUncleCountByBlockHash", (hash,)) + .request("eth_getUncleCountByBlockHash", (hash.block_hash,)) .await .map(|count: U64| count.to::()), BlockId::Number(number) => self