openzeppelin_relayer::domain

Trait Relayer

Source
pub trait Relayer {
    // Required methods
    fn process_transaction_request<'life0, 'async_trait>(
        &'life0 self,
        tx_request: NetworkTransactionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RelayerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_balance<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<BalanceResponse, RelayerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_pending_transactions<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool, RelayerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sign_data<'life0, 'async_trait>(
        &'life0 self,
        request: SignDataRequest,
    ) -> Pin<Box<dyn Future<Output = Result<SignDataResponse, RelayerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn sign_typed_data<'life0, 'async_trait>(
        &'life0 self,
        request: SignTypedDataRequest,
    ) -> Pin<Box<dyn Future<Output = Result<SignDataResponse, RelayerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn rpc<'life0, 'async_trait>(
        &'life0 self,
        request: JsonRpcRequest<NetworkRpcRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse<NetworkRpcResult>, RelayerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_status<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<bool, RelayerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn initialize_relayer<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), RelayerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn validate_min_balance<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), RelayerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The Relayer trait defines the core functionality required for a relayer in the system. Implementors of this trait are responsible for handling transaction requests, managing balances, and interacting with the network.

Required Methods§

Source

fn process_transaction_request<'life0, 'async_trait>( &'life0 self, tx_request: NetworkTransactionRequest, ) -> Pin<Box<dyn Future<Output = Result<TransactionRepoModel, RelayerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Processes a transaction request and returns the result.

§Arguments
  • tx_request - The transaction request to be processed.
§Returns

A Result containing a TransactionRepoModel on success, or a RelayerError on failure.

Source

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

Retrieves the current balance of the relayer.

§Returns

A Result containing a BalanceResponse on success, or a RelayerError on failure.

Source

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

Deletes all pending transactions.

§Returns

A Result containing true if transactions were successfully deleted, or a RelayerError on failure.

Source

fn sign_data<'life0, 'async_trait>( &'life0 self, request: SignDataRequest, ) -> Pin<Box<dyn Future<Output = Result<SignDataResponse, RelayerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Signs data using the relayer’s credentials.

§Arguments
  • request - The data to be signed.
§Returns

A Result containing a SignDataResponse on success, or a RelayerError on failure.

Source

fn sign_typed_data<'life0, 'async_trait>( &'life0 self, request: SignTypedDataRequest, ) -> Pin<Box<dyn Future<Output = Result<SignDataResponse, RelayerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Signs typed data using the relayer’s credentials.

§Arguments
  • request - The typed data to be signed.
§Returns

A Result containing a SignDataResponse on success, or a RelayerError on failure.

Source

fn rpc<'life0, 'async_trait>( &'life0 self, request: JsonRpcRequest<NetworkRpcRequest>, ) -> Pin<Box<dyn Future<Output = Result<JsonRpcResponse<NetworkRpcResult>, RelayerError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Executes a JSON-RPC request.

§Arguments
  • request - The JSON-RPC request to be executed.
§Returns

A Result containing a JsonRpcResponse on success, or a RelayerError on failure.

Source

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

Retrieves the current status of the relayer.

§Returns

A Result containing true if the relayer is active, or a RelayerError on failure.

Source

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

Initializes the relayer.

§Returns

A Result indicating success, or a RelayerError on failure.

Source

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

Validates that the relayer’s balance meets the minimum required.

§Returns

A Result indicating success, or a RelayerError on failure.

Implementors§