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<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 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§

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<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.

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<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.

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.

Source

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,

Signs a transaction using the relayer’s credentials.

§Arguments
  • unsigned_xdr - The unsigned transaction XDR string to be signed.
§Returns

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

Implementors§

Source§

impl<J: JobProducerTrait + 'static, T: TransactionRepository + Repository<TransactionRepoModel, String> + Send + Sync + 'static, RR: RelayerRepository + Repository<RelayerRepoModel, String> + Send + Sync + 'static, NR: NetworkRepository + Repository<NetworkRepoModel, String> + Send + Sync + 'static, TCR: TransactionCounterTrait + Send + Sync + 'static> Relayer for NetworkRelayer<J, T, RR, NR, TCR>

Source§

impl<P, RR, NR, TR, J, S, TCS> Relayer for EvmRelayer<P, RR, NR, TR, J, S, TCS>

Source§

impl<P, RR, NR, TR, J, TCS, S> Relayer for StellarRelayer<P, RR, NR, TR, J, TCS, S>