Trait BlockchainAPI

Source
pub trait BlockchainAPI {
    // Required methods
    fn get_param(&self, param_id: u32) -> Result<Vec<u8>, HostError>;
    fn as_any(&mut self) -> &mut dyn Any;
}
Expand description

the blockchain APIs that should be provided by the host. It can’t be copied or cloned since it doesn’t have Copy and Clone traits.

Required Methods§

Source

fn get_param(&self, param_id: u32) -> Result<Vec<u8>, HostError>

This API requests the host to return the associated value to the given param_id.

Source

fn as_any(&mut self) -> &mut dyn Any

It is useful for downcasting the trait to the underling struct. For example we can downcast the trait to the mocked object.

Implementors§