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<DeletePendingTransactionsResponse, 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<RelayerStatus, 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 check_health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Vec<HealthCheckFailure>>> + 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;
fn sign_transaction<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 SignTransactionRequest,
) -> Pin<Box<dyn Future<Output = Result<SignTransactionExternalResponse, RelayerError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: '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§
Sourcefn 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 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,
Sourcefn 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 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.
Sourcefn delete_pending_transactions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<DeletePendingTransactionsResponse, 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<DeletePendingTransactionsResponse, RelayerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Deletes all pending transactions.
§Returns
A Result containing a DeletePendingTransactionsResponse with details
about which transactions were cancelled and which failed, or a RelayerError on failure.
Sourcefn 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_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,
Sourcefn 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 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,
Sourcefn 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 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,
Sourcefn get_status<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<RelayerStatus, 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<RelayerStatus, RelayerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Retrieves the current status of the relayer.
§Returns
A Result containing RelayerStatus on success, or a
RelayerError on failure.
Sourcefn 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 initialize_relayer<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), RelayerError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn check_health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Vec<HealthCheckFailure>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn check_health<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Vec<HealthCheckFailure>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Runs health checks on the relayer without side effects.
This method performs all necessary health checks (RPC validation, balance checks, etc.) and returns the results without updating any state or sending notifications.
§Returns
Ok(())- All health checks passedErr(Vec<HealthCheckFailure>)- One or more health checks failed with specific reasons
Sourcefn 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,
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.