EthApiSpec

Trait EthApiSpec 

pub trait EthApiSpec: RpcNodeCore{
    type Transaction;
    type Rpc: RpcTypes;

    // Required methods
    fn starting_block(&self) -> Uint<256, 4>;
    fn signers(
        &self,
    ) -> &RwLock<RawRwLock, Vec<Box<dyn EthSigner<Self::Transaction, <Self::Rpc as RpcTypes>::TransactionRequest>>>>;

    // Provided methods
    fn protocol_version(
        &self,
    ) -> impl Future<Output = Result<Uint<64, 1>, RethError>> + Send { ... }
    fn chain_id(&self) -> Uint<64, 1> { ... }
    fn chain_info(&self) -> Result<ChainInfo, RethError> { ... }
    fn accounts(&self) -> Vec<Address> { ... }
    fn is_syncing(&self) -> bool { ... }
    fn sync_status(&self) -> Result<SyncStatus, RethError> { ... }
}
Expand description

Eth API trait.

Defines core functionality of the eth API implementation.

Required Associated Types§

type Transaction

The transaction type signers are using.

type Rpc: RpcTypes

The RPC requests and responses.

Required Methods§

fn starting_block(&self) -> Uint<256, 4>

Returns the block node is started on.

fn signers( &self, ) -> &RwLock<RawRwLock, Vec<Box<dyn EthSigner<Self::Transaction, <Self::Rpc as RpcTypes>::TransactionRequest>>>>

Returns a handle to the signers owned by provider.

Provided Methods§

fn protocol_version( &self, ) -> impl Future<Output = Result<Uint<64, 1>, RethError>> + Send

Returns the current ethereum protocol version.

fn chain_id(&self) -> Uint<64, 1>

Returns the chain id

fn chain_info(&self) -> Result<ChainInfo, RethError>

Returns provider chain info

fn accounts(&self) -> Vec<Address>

Returns a list of addresses owned by provider.

fn is_syncing(&self) -> bool

Returns true if the network is undergoing sync.

fn sync_status(&self) -> Result<SyncStatus, RethError>

Returns the SyncStatus of the network

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

§

impl<'a, T> EthApiSpec for &'a T

§

type Transaction = <T as EthApiSpec>::Transaction

§

type Rpc = <T as EthApiSpec>::Rpc

§

fn starting_block(&self) -> Uint<256, 4>

§

fn signers( &self, ) -> &RwLock<RawRwLock, Vec<Box<dyn EthSigner<<&'a T as EthApiSpec>::Transaction, <<&'a T as EthApiSpec>::Rpc as RpcTypes>::TransactionRequest>>>>

§

fn protocol_version( &self, ) -> impl Future<Output = Result<Uint<64, 1>, RethError>> + Send

§

fn chain_id(&self) -> Uint<64, 1>

§

fn chain_info(&self) -> Result<ChainInfo, RethError>

§

fn accounts(&self) -> Vec<Address>

§

fn is_syncing(&self) -> bool

§

fn sync_status(&self) -> Result<SyncStatus, RethError>

§

impl<T> EthApiSpec for Arc<T>

§

type Transaction = <T as EthApiSpec>::Transaction

§

type Rpc = <T as EthApiSpec>::Rpc

§

fn starting_block(&self) -> Uint<256, 4>

§

fn signers( &self, ) -> &RwLock<RawRwLock, Vec<Box<dyn EthSigner<<Arc<T> as EthApiSpec>::Transaction, <<Arc<T> as EthApiSpec>::Rpc as RpcTypes>::TransactionRequest>>>>

§

fn protocol_version( &self, ) -> impl Future<Output = Result<Uint<64, 1>, RethError>> + Send

§

fn chain_id(&self) -> Uint<64, 1>

§

fn chain_info(&self) -> Result<ChainInfo, RethError>

§

fn accounts(&self) -> Vec<Address>

§

fn is_syncing(&self) -> bool

§

fn sync_status(&self) -> Result<SyncStatus, RethError>

Implementors§

Source§

impl<N, Rpc> EthApiSpec for EthApi<N, Rpc>
where N: RpcNodeCore, Rpc: RpcConvert<Primitives = <N as RpcNodeCore>::Primitives>,