Trait ink_env::test::ChainExtension

pub trait ChainExtension {
    // Required methods
    fn ext_id(&self) -> u16;
    fn call(&mut self, func_id: u16, input: &[u8], output: &mut Vec<u8>) -> u32;
}
Expand description

Types implementing this trait can be used as chain extensions.

This trait is only useful for testing contract via the off-chain environment.

Required Methods§

fn ext_id(&self) -> u16

The static ID of the chain extension.

§Note

This is expected to return a constant value.

fn call(&mut self, func_id: u16, input: &[u8], output: &mut Vec<u8>) -> u32

Calls the chain extension with the given input.

Returns an error code and may fill the output buffer with a SCALE encoded result.

Implementors§