CallInWasm

Trait CallInWasm 

Source
pub trait CallInWasm: Send + Sync {
    // Required method
    fn call_in_wasm(
        &self,
        wasm_code: &[u8],
        code_hash: Option<Vec<u8>>,
        method: &str,
        call_data: &[u8],
        ext: &mut dyn Externalities,
        missing_host_functions: MissingHostFunctions,
    ) -> Result<Vec<u8>, String>;
}
Expand description

Something that can call a method in a WASM blob.

Required Methods§

Source

fn call_in_wasm( &self, wasm_code: &[u8], code_hash: Option<Vec<u8>>, method: &str, call_data: &[u8], ext: &mut dyn Externalities, missing_host_functions: MissingHostFunctions, ) -> Result<Vec<u8>, String>

Call the given method in the given wasm_blob using call_data (SCALE encoded arguments) to decode the arguments for the method.

Returns the SCALE encoded return value of the method.

§Note

If code_hash is Some(_) the wasm_code module and instance will be cached internally, otherwise it is thrown away after the call.

Implementors§