pub trait BlockchainProxy: Clone + Send + Sync {
    // Required methods
    fn new(gateway_url: &str) -> Self;
    fn execute_vmquery<'life0, 'life1, 'async_trait>(
        &'life0 self,
        vm_request: &'life1 VmValueRequest
    ) -> Pin<Box<dyn Future<Output = Result<VmValuesResponseData, ExecutorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

The BlockchainProxy trait provides an abstraction over the CommunicationProxy struct from the multiversx-sdk crate. The main goal of this abstraction is to allow developers to mock the CommunicationProxy struct for testing purposes, by providing a set of common behaviors required for interacting with the blockchain gateway.

Required Methods§

source

fn new(gateway_url: &str) -> Self

Creates a new instance of a type implementing BlockchainProxy, initialized with the provided gateway URL.

Parameters
  • gateway_url: A string slice representing the URL of the blockchain gateway.
Returns
  • Self: A new instance of the implementing type.
source

fn execute_vmquery<'life0, 'life1, 'async_trait>( &'life0 self, vm_request: &'life1 VmValueRequest ) -> Pin<Box<dyn Future<Output = Result<VmValuesResponseData, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Asynchronously executes a virtual machine (VM) query on the blockchain, using the provided VM request.

Parameters
  • vm_request: A reference to a VmValueRequest object containing the details of the VM query.
Returns
  • Result<VmValuesResponseData, ExecutorError>: A result containing the VM query response data, or an ExecutorError if the query fails.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl BlockchainProxy for CommunicationProxy

Implementation of the BlockchainProxy trait for the CommunicationProxy struct from the multiversx-sdk crate. This implementation provides concrete methods to communicate with the blockchain gateway.

source§

fn new(gateway_url: &str) -> Self

Creates a new CommunicationProxy instance using the specified blockchain gateway URL.

Parameters
  • gateway_url: A string slice representing the URL of the blockchain gateway.
Returns
  • Self: A new CommunicationProxy instance.
source§

fn execute_vmquery<'life0, 'life1, 'async_trait>( &'life0 self, vm_request: &'life1 VmValueRequest ) -> Pin<Box<dyn Future<Output = Result<VmValuesResponseData, ExecutorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Asynchronously executes a VM query on the blockchain using the provided VM request, and returns the response data.

Parameters
  • vm_request: A reference to a VmValueRequest object containing the details of the VM query.
Returns
  • Result<VmValuesResponseData, ExecutorError>: A result containing the VM query response data, or an ExecutorError if the query fails.

Implementors§