openzeppelin_relayer::services::provider::evm

Trait EvmProviderTrait

Source
pub trait EvmProviderTrait: Send + Sync {
    // Required methods
    fn get_balance<'life0, 'life1, 'async_trait>(
        &'life0 self,
        address: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<U256>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_block_number<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn estimate_gas<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx: &'life1 EvmTransactionData,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_gas_price<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u128>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_transaction<'life0, 'async_trait>(
        &'life0 self,
        tx: TransactionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_raw_transaction<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_transaction_count<'life0, 'life1, 'async_trait>(
        &'life0 self,
        address: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_fee_history<'life0, 'async_trait>(
        &'life0 self,
        block_count: u64,
        newest_block: BlockNumberOrTag,
        reward_percentiles: Vec<f64>,
    ) -> Pin<Box<dyn Future<Output = Result<FeeHistory>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_block_by_number<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<BlockResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_transaction_receipt<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx_hash: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<TransactionReceipt>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn call_contract<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tx: &'life1 TransactionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait defining the interface for EVM blockchain interactions.

This trait provides methods for common blockchain operations like querying balances, sending transactions, and getting network state.

Required Methods§

Source

fn get_balance<'life0, 'life1, 'async_trait>( &'life0 self, address: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<U256>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the balance of an address in the native currency.

§Arguments
  • address - The address to query the balance for
Source

fn get_block_number<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the current block number of the chain.

Source

fn estimate_gas<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 EvmTransactionData, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Estimates the gas required for a transaction.

§Arguments
  • tx - The transaction data to estimate gas for
Source

fn get_gas_price<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u128>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the current gas price from the network.

Source

fn send_transaction<'life0, 'async_trait>( &'life0 self, tx: TransactionRequest, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends a transaction to the network.

§Arguments
  • tx - The transaction request to send
Source

fn send_raw_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sends a raw signed transaction to the network.

§Arguments
  • tx - The raw transaction bytes to send
Source

fn health_check<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Performs a health check by attempting to get the latest block number.

Source

fn get_transaction_count<'life0, 'life1, 'async_trait>( &'life0 self, address: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the transaction count (nonce) for an address.

§Arguments
  • address - The address to query the transaction count for
Source

fn get_fee_history<'life0, 'async_trait>( &'life0 self, block_count: u64, newest_block: BlockNumberOrTag, reward_percentiles: Vec<f64>, ) -> Pin<Box<dyn Future<Output = Result<FeeHistory>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the fee history for a range of blocks.

§Arguments
  • block_count - Number of blocks to get fee history for
  • newest_block - The newest block to start from
  • reward_percentiles - Percentiles to sample reward data from
Source

fn get_block_by_number<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BlockResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the latest block from the network.

Source

fn get_transaction_receipt<'life0, 'life1, 'async_trait>( &'life0 self, tx_hash: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<TransactionReceipt>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets a transaction receipt by its hash.

§Arguments
  • tx_hash - The transaction hash to query
Source

fn call_contract<'life0, 'life1, 'async_trait>( &'life0 self, tx: &'life1 TransactionRequest, ) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Calls a contract function.

§Arguments
  • tx - The transaction request to call the contract function

Implementors§