From 2ced40914162c8e2e30ffa7b010c4042be3b6030 Mon Sep 17 00:00:00 2001 From: cakevm Date: Fri, 18 Jul 2025 18:37:10 +0200 Subject: [PATCH] feat(alloy-provider): implement methods for BlockReaderIdExt (#17491) --- crates/alloy-provider/src/lib.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/alloy-provider/src/lib.rs b/crates/alloy-provider/src/lib.rs index c5df823d72..c2d2b5d15d 100644 --- a/crates/alloy-provider/src/lib.rs +++ b/crates/alloy-provider/src/lib.rs @@ -464,20 +464,26 @@ where { fn block_by_id(&self, id: BlockId) -> ProviderResult> { match id { - BlockId::Number(number_or_tag) => self.block_by_number_or_tag(number_or_tag), BlockId::Hash(hash) => self.block_by_hash(hash.block_hash), + BlockId::Number(number_or_tag) => self.block_by_number_or_tag(number_or_tag), } } fn sealed_header_by_id( &self, - _id: BlockId, + id: BlockId, ) -> ProviderResult>> { - Err(ProviderError::UnsupportedProvider) + match id { + BlockId::Hash(hash) => self.sealed_header_by_hash(hash.block_hash), + BlockId::Number(number_or_tag) => self.sealed_header_by_number_or_tag(number_or_tag), + } } - fn header_by_id(&self, _id: BlockId) -> ProviderResult> { - Err(ProviderError::UnsupportedProvider) + fn header_by_id(&self, id: BlockId) -> ProviderResult> { + match id { + BlockId::Hash(hash) => self.header_by_hash_or_number(hash.block_hash.into()), + BlockId::Number(number_or_tag) => self.header_by_number_or_tag(number_or_tag), + } } }