pub struct NativeExecutor { /* private fields */ }
Implementations§
Source§impl NativeExecutor
impl NativeExecutor
Sourcepub fn new_storage_slots(&self) -> Result<Slots, ContractError>
pub fn new_storage_slots(&self) -> Result<Slots, ContractError>
Create a new [Slots
] instance with system contracts already deployed
Sourcepub fn builder(shard_index: ShardIndex) -> NativeExecutorBuilder
pub fn builder(shard_index: ShardIndex) -> NativeExecutorBuilder
Builder of native executor for specified shard index
Sourcepub fn transaction_verify(
&self,
transaction: Transaction<'_>,
slots: &Slots,
) -> Result<(), ContractError>
pub fn transaction_verify( &self, transaction: Transaction<'_>, slots: &Slots, ) -> Result<(), ContractError>
Verify the provided transaction.
Self::transaction_execute()
can be used for transaction execution if needed.
Self::transaction_verify_execute()
can be used to verify and execute a transaction with
a single call.
Sourcepub fn transaction_execute(
&self,
transaction: Transaction<'_>,
slots: &mut Slots,
) -> Result<(), ContractError>
pub fn transaction_execute( &self, transaction: Transaction<'_>, slots: &mut Slots, ) -> Result<(), ContractError>
Execute the previously verified transaction.
Self::transaction_verify()
must be used for verification.
Self::transaction_verify_execute()
can be used to verify and execute a transaction with
a single call.
Sourcepub fn transaction_verify_execute(
&self,
transaction: Transaction<'_>,
slots: &mut Slots,
) -> Result<(), ContractError>
pub fn transaction_verify_execute( &self, transaction: Transaction<'_>, slots: &mut Slots, ) -> Result<(), ContractError>
Verify and execute provided transaction.
A shortcut for Self::transaction_verify()
+ Self::transaction_execute()
.
Sourcepub fn transaction_emulate<Calls, T>(
&self,
contract: Address,
slots: &mut Slots,
calls: Calls,
) -> Twhere
Calls: FnOnce(&mut Env<'_>) -> T,
pub fn transaction_emulate<Calls, T>(
&self,
contract: Address,
slots: &mut Slots,
calls: Calls,
) -> Twhere
Calls: FnOnce(&mut Env<'_>) -> T,
Emulate a transaction submitted by contract
with method calls happening inside calls
without going through TxHandler
.
NOTE: This is primarily useful for testing environment, usually changes are done in the
transaction execution using Self::transaction_execute()
.
Returns None
if read-only [Slots
] instance was given.
Sourcepub fn with_env_ro<Callback, T>(&self, slots: &Slots, callback: Callback) -> Twhere
Callback: FnOnce(&Env<'_>) -> T,
pub fn with_env_ro<Callback, T>(&self, slots: &Slots, callback: Callback) -> Twhere
Callback: FnOnce(&Env<'_>) -> T,
Get a read-only Env
instance for calling #[view]
methods on it directly.
For stateful methods, execute a transaction using Self::transaction_execute()
or
emulate one with Self::transaction_emulate()
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NativeExecutor
impl RefUnwindSafe for NativeExecutor
impl Send for NativeExecutor
impl Sync for NativeExecutor
impl Unpin for NativeExecutor
impl UnwindSafe for NativeExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more