Skip to content

Commit

Permalink
fix(provider): uncle methods for block hash (#587)
Browse files Browse the repository at this point in the history
* fix(provider): uncle methods for block hash

* doc nits

Co-authored-by: evalir <[email protected]>

---------

Co-authored-by: evalir <[email protected]>
  • Loading branch information
yash-atreya and Evalir authored Apr 19, 2024
1 parent c7a51e9 commit 31846e7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crates/provider/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,11 +812,13 @@ pub trait Provider<T: Transport + Clone = BoxTransport, N: Network = Ethereum>:
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<Option<Block>> {
/// Gets an uncle block through the tag [BlockId] and index [u64].
async fn get_uncle(&self, tag: BlockId, idx: u64) -> TransportResult<Option<Block>> {
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
Expand All @@ -829,7 +831,7 @@ pub trait Provider<T: Transport + Clone = BoxTransport, N: Network = Ethereum>:
match tag {
BlockId::Hash(hash) => self
.client()
.request("eth_getUncleCountByBlockHash", (hash,))
.request("eth_getUncleCountByBlockHash", (hash.block_hash,))
.await
.map(|count: U64| count.to::<u64>()),
BlockId::Number(number) => self
Expand Down

0 comments on commit 31846e7

Please sign in to comment.