eigen_client_eth/
client.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[derive(Debug)]
pub struct Client {}

use alloy::eips::BlockNumberOrTag;
use alloy::primitives::BlockNumber;
use alloy::rpc::types::eth::Block;

#[async_trait::async_trait]
pub trait BackendClient {
    type Error;

    /// Get the latest block number.
    ///
    /// # Returns
    ///
    /// The latest block number.
    async fn block_number(&self) -> Result<BlockNumber, Self::Error>;

    /// Get the block hash given its block number.
    ///
    /// # Arguments
    ///
    /// * `number` - The block number.
    ///
    /// # Returns
    ///
    /// The block having that number.
    async fn block_by_number(&self, number: BlockNumberOrTag)
        -> Result<Option<Block>, Self::Error>;
}