diff --git a/crates/providers/src/provider.rs b/crates/providers/src/provider.rs index e8a2dc79782..3c8cbaf22ef 100644 --- a/crates/providers/src/provider.rs +++ b/crates/providers/src/provider.rs @@ -62,6 +62,18 @@ pub trait TempProvider: Send + Sync { where Self: Sync; + /// Gets a block by either its hash, tag, or number, with full transactions or only hashes. + async fn get_block( + &self, + id: BlockId, + full: bool, + ) -> RpcResult, Box, TransportError> { + match id { + BlockId::Hash(hash) => self.get_block_by_hash(hash.into(), full).await, + BlockId::Number(number) => self.get_block_by_number(number, full).await, + } + } + /// Gets a block by its [BlockHash], with full transactions or only hashes. async fn get_block_by_hash( &self, @@ -683,7 +695,7 @@ mod providers_test { let count = provider .get_transaction_count( address!("328375e18E7db8F1CA9d9bA8bF3E9C94ee34136A"), - Some(BlockNumberOrTag::Latest), + Some(BlockNumberOrTag::Latest.into()), ) .await .unwrap();