openzeppelin_monitor::services::blockchain

Trait BlockchainTransport

Source
pub trait BlockchainTransport: Send + Sync {
    // Required methods
    fn get_current_url<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send_raw_request<'life0, 'life1, 'async_trait, P>(
        &'life0 self,
        method: &'life1 str,
        params: Option<P>,
    ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
       where P: Into<Value> + Send + Clone + Serialize + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_retry_policy(
        &mut self,
        retry_policy: ExponentialBackoff,
        retry_strategy: Option<TransientErrorRetryStrategy>,
    ) -> Result<(), Error>;
    fn update_endpoint_manager_client(
        &mut self,
        client: ClientWithMiddleware,
    ) -> Result<(), Error>;

    // Provided method
    fn customize_request<'life0, 'life1, 'async_trait, P>(
        &'life0 self,
        method: &'life1 str,
        params: Option<P>,
    ) -> Pin<Box<dyn Future<Output = Value> + Send + 'async_trait>>
       where P: Into<Value> + Send + Clone + Serialize + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Base trait for all blockchain transport clients

Required Methods§

Source

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

Get the current URL being used by the transport

Source

fn send_raw_request<'life0, 'life1, 'async_trait, P>( &'life0 self, method: &'life1 str, params: Option<P>, ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
where P: Into<Value> + Send + Clone + Serialize + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a raw request to the blockchain

Source

fn set_retry_policy( &mut self, retry_policy: ExponentialBackoff, retry_strategy: Option<TransientErrorRetryStrategy>, ) -> Result<(), Error>

Sets the retry policy for the transport

Source

fn update_endpoint_manager_client( &mut self, client: ClientWithMiddleware, ) -> Result<(), Error>

Update endpoint manager with a new client

Provided Methods§

Source

fn customize_request<'life0, 'life1, 'async_trait, P>( &'life0 self, method: &'life1 str, params: Option<P>, ) -> Pin<Box<dyn Future<Output = Value> + Send + 'async_trait>>
where P: Into<Value> + Send + Clone + Serialize + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Customizes the request for specific blockchain requirements

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.

Implementors§