diff --git a/src/eth_provider/provider.rs b/src/eth_provider/provider.rs index fefa40121..e05fc858a 100644 --- a/src/eth_provider/provider.rs +++ b/src/eth_provider/provider.rs @@ -668,10 +668,10 @@ where match tag { BlockNumberOrTag::Earliest => Ok(U64::ZERO), BlockNumberOrTag::Number(number) => Ok(U64::from(number)), - BlockNumberOrTag::Latest | BlockNumberOrTag::Finalized | BlockNumberOrTag::Safe => { - self.block_number().await - } - BlockNumberOrTag::Pending => todo!("pending block number not implemented"), + BlockNumberOrTag::Latest + | BlockNumberOrTag::Finalized + | BlockNumberOrTag::Safe + | BlockNumberOrTag::Pending => self.block_number().await, } } } diff --git a/src/models/block.rs b/src/models/block.rs index 7930ad589..8166c40fe 100644 --- a/src/models/block.rs +++ b/src/models/block.rs @@ -50,11 +50,13 @@ impl From for StarknetBlockId { fn from(block_number_or_tag: EthBlockNumberOrTag) -> Self { let block_number_or_tag = block_number_or_tag.into(); match block_number_or_tag { - BlockNumberOrTag::Safe | BlockNumberOrTag::Latest | BlockNumberOrTag::Finalized => { - Self::Tag(BlockTag::Latest) + BlockNumberOrTag::Latest | BlockNumberOrTag::Pending => { + // We set to pending because in Starknet, a pending block is an unsealed block, + // With a centralized sequencer, the latest block is the pending block being filled. + Self::Tag(BlockTag::Pending) } + BlockNumberOrTag::Safe | BlockNumberOrTag::Finalized => Self::Tag(BlockTag::Latest), BlockNumberOrTag::Earliest => Self::Number(0), - BlockNumberOrTag::Pending => Self::Tag(BlockTag::Pending), BlockNumberOrTag::Number(number) => Self::Number(number), } }