Add a way to get block info from the node

This commit is contained in:
Omar Abdulla
2025-07-14 23:14:37 +03:00
parent ddd775d703
commit 68bda92465
3 changed files with 154 additions and 3 deletions
+10 -1
View File
@@ -1,6 +1,6 @@
//! This crate implements all node interactions.
use alloy::primitives::{Address, ChainId, U256};
use alloy::primitives::{Address, BlockHash, BlockNumber, BlockTimestamp, ChainId, U256};
use alloy::rpc::types::trace::geth::{DiffMode, GethTrace};
use alloy::rpc::types::{TransactionReceipt, TransactionRequest};
use anyhow::Result;
@@ -35,4 +35,13 @@ pub trait EthereumNode {
/// Returns the difficulty of the last block.
fn block_difficulty(&self) -> Result<U256>;
/// Returns the hash of the last block.
fn block_hash(&self) -> Result<BlockHash>;
/// Returns the timestamp of the last block,
fn block_timestamp(&self) -> Result<BlockTimestamp>;
/// Returns the number of the last block.
fn last_block_number(&self) -> Result<BlockNumber>;
}