Trait novax_executor::TransactionExecutor
source · pub trait TransactionExecutor: Send + Sync {
// Required methods
fn sc_call<'life0, 'life1, 'async_trait, OriginalResult>(
&'life0 mut self,
sc_call_step: &'life1 mut TypedScCall<OriginalResult>
) -> Pin<Box<dyn Future<Output = Result<(), ExecutorError>> + Send + 'async_trait>>
where OriginalResult: 'async_trait + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn should_skip_deserialization<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
A trait defining the necessary operations for executing smart contract transactions.
Implementations of this trait can vary based on the specific environment (e.g., real blockchain, mock blockchain).
Required Methods§
sourcefn sc_call<'life0, 'life1, 'async_trait, OriginalResult>(
&'life0 mut self,
sc_call_step: &'life1 mut TypedScCall<OriginalResult>
) -> Pin<Box<dyn Future<Output = Result<(), ExecutorError>> + Send + 'async_trait>>where
OriginalResult: 'async_trait + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn sc_call<'life0, 'life1, 'async_trait, OriginalResult>( &'life0 mut self, sc_call_step: &'life1 mut TypedScCall<OriginalResult> ) -> Pin<Box<dyn Future<Output = Result<(), ExecutorError>> + Send + 'async_trait>>where OriginalResult: 'async_trait + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Executes a smart contract call with the specified parameters.
Parameters
sc_call_step: A mutable reference to the typed smart contract call step.
Type Parameters
OriginalResult: The type of the result expected from the smart contract call. Must implement theSendtrait.
Returns
- A
Resultwith an emptyOk(())value if the call is successful, or anErr(ExecutorError)if the call fails.
sourcefn should_skip_deserialization<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn should_skip_deserialization<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Determines whether deserialization should be skipped during the smart contract call execution.
This method is particularly useful for implementations like DummyExecutor which do not perform
any actual calls, thus deserializing a non-existent result would lead to an error. In such cases,
this method should return true to skip deserialization, preventing potential errors.
Returns
- A
boolindicating whether deserialization should be skipped.
Object Safety§
Implementations on Foreign Types§
source§impl<T: TransactionExecutor> TransactionExecutor for Arc<Mutex<T>>
impl<T: TransactionExecutor> TransactionExecutor for Arc<Mutex<T>>
An implementation of TransactionExecutor trait for types wrapped in Arc<Mutex<T>>.
This implementation allows shared access to a transaction executor instance across multiple threads.
source§fn sc_call<'life0, 'life1, 'async_trait, OriginalResult>(
&'life0 mut self,
sc_call_step: &'life1 mut TypedScCall<OriginalResult>
) -> Pin<Box<dyn Future<Output = Result<(), ExecutorError>> + Send + 'async_trait>>where
OriginalResult: 'async_trait + Send,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn sc_call<'life0, 'life1, 'async_trait, OriginalResult>( &'life0 mut self, sc_call_step: &'life1 mut TypedScCall<OriginalResult> ) -> Pin<Box<dyn Future<Output = Result<(), ExecutorError>> + Send + 'async_trait>>where OriginalResult: 'async_trait + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Executes a smart contract call using the underlying TransactionExecutor implementation.