Skip to main content

CallApiAt

Trait CallApiAt 

Source
pub trait CallApiAt<Block: BlockT> {
    type StateBackend: StateBackend<HashingFor<Block>> + AsTrieBackend<HashingFor<Block>>;

    // Required methods
    fn call_api_at(
        &self,
        params: CallApiAtParams<'_, Block>,
    ) -> Result<Vec<u8>, ApiError>;
    fn runtime_version_at(
        &self,
        at_hash: Block::Hash,
        call_context: CallContext,
    ) -> Result<RuntimeVersion, ApiError>;
    fn state_at(&self, at: Block::Hash) -> Result<Self::StateBackend, ApiError>;
    fn initialize_extensions(
        &self,
        at: Block::Hash,
        extensions: &mut Extensions,
    ) -> Result<(), ApiError>;
}
Expand description

Something that can call into an api at a given block.

Required Associated Types§

Source

type StateBackend: StateBackend<HashingFor<Block>> + AsTrieBackend<HashingFor<Block>>

The state backend that is used to store the block states.

Required Methods§

Source

fn call_api_at( &self, params: CallApiAtParams<'_, Block>, ) -> Result<Vec<u8>, ApiError>

Calls the given api function with the given encoded arguments at the given block and returns the encoded result.

Source

fn runtime_version_at( &self, at_hash: Block::Hash, call_context: CallContext, ) -> Result<RuntimeVersion, ApiError>

Returns the runtime version at the given block.

Source

fn state_at(&self, at: Block::Hash) -> Result<Self::StateBackend, ApiError>

Get the state at the given block.

Source

fn initialize_extensions( &self, at: Block::Hash, extensions: &mut Extensions, ) -> Result<(), ApiError>

Initialize the extensions for the given block at by using the global extensions factory.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<Block: BlockT, T: CallApiAt<Block>> CallApiAt<Block> for Arc<T>

Available on crate feature std only.
Source§

type StateBackend = <T as CallApiAt<Block>>::StateBackend

Source§

fn call_api_at( &self, params: CallApiAtParams<'_, Block>, ) -> Result<Vec<u8>, ApiError>

Source§

fn runtime_version_at( &self, at_hash: <Block as BlockT>::Hash, call_context: CallContext, ) -> Result<RuntimeVersion, ApiError>

Source§

fn state_at( &self, at: <Block as BlockT>::Hash, ) -> Result<Self::StateBackend, ApiError>

Source§

fn initialize_extensions( &self, at: <Block as BlockT>::Hash, extensions: &mut Extensions, ) -> Result<(), ApiError>

Implementors§