Trait sp_api::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,
    ) -> 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 the 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, ) -> 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.

Implementations on Foreign Types§

source§

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

§

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, ) -> 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§