erc20_rpc_pool/rpc_pool/
eth_block.rs1use super::eth_generic_call::EthMethod;
5use super::Web3RpcPool;
6use std::sync::Arc;
7use web3::api::Eth;
8use web3::helpers::CallFuture;
9use web3::types::*;
10
11pub struct EthBlock;
12
13#[rustfmt::skip]
14impl<T: web3::Transport> EthMethod<T> for EthBlock {
15 const METHOD: &'static str = "block";
16 type Args = (BlockId,);
17 type Return = Option<Block<H256>>;
18
19 fn do_call(
20 eth: Eth<T>,
21 args: Self::Args,
22 ) -> CallFuture<Self::Return, <T as web3::Transport>::Out> {
23 eth.block(args.0)
24 }
25}
26
27#[rustfmt::skip]
28impl Web3RpcPool {
29 pub async fn eth_block(
30 self: Arc<Self>,
31 block: BlockId,
32 ) -> Result<Option<Block<H256>>, web3::Error> {
33 self.eth_generic_call::<EthBlock>(
34 (block,)
35 ).await
36 }
37}