Skip to main content

SystemAPI

Trait SystemAPI 

Source
pub trait SystemAPI {
    type T: Config;

    // Required methods
    fn build_block(&mut self) -> BlockNumberFor<Self::T>;
    fn build_blocks(&mut self, n: u32) -> BlockNumberFor<Self::T>;
    fn block_number(&mut self) -> BlockNumberFor<Self::T>;
    fn events(&mut self) -> Vec<EventRecordOf<Self::T>> ;
    fn reset_events(&mut self);
    fn runtime_call<Origin: Into<<RuntimeCall<Self::T> as Dispatchable>::RuntimeOrigin>>(
        &mut self,
        call: RuntimeCall<Self::T>,
        origin: Origin,
    ) -> DispatchResultWithInfo<<RuntimeCall<Self::T> as Dispatchable>::PostInfo>;
}
Expand description

System API for the sandbox.

Required Associated Types§

Source

type T: Config

The runtime system config.

Required Methods§

Source

fn build_block(&mut self) -> BlockNumberFor<Self::T>

Build a new empty block and return the new height.

Source

fn build_blocks(&mut self, n: u32) -> BlockNumberFor<Self::T>

Build n empty blocks and return the new height.

§Arguments
  • n - The number of blocks to build.
Source

fn block_number(&mut self) -> BlockNumberFor<Self::T>

Return the current height of the chain.

Source

fn events(&mut self) -> Vec<EventRecordOf<Self::T>>

Return the events of the current block so far.

Source

fn reset_events(&mut self)

Reset the events of the current block.

Source

fn runtime_call<Origin: Into<<RuntimeCall<Self::T> as Dispatchable>::RuntimeOrigin>>( &mut self, call: RuntimeCall<Self::T>, origin: Origin, ) -> DispatchResultWithInfo<<RuntimeCall<Self::T> as Dispatchable>::PostInfo>

Execute a runtime call (dispatchable).

§Arguments
  • call - The runtime call to execute.
  • origin - The origin of the call.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T> SystemAPI for T
where T: Sandbox, T::Runtime: Config,

Source§

type T = <T as Sandbox>::Runtime