Attribute Macro sewup_derive::ewasm_fn[][src]

#[ewasm_fn]
Expand description

helps you to build your handlers in the contract

This macro also generate the function signature, you can use ewasm_fn_sig! macro to get your function signature;

#[ewasm_fn]
fn check_input_object(s: SimpleStruct) -> anyhow::Result<()> {
    Ok(())
}

#[ewasm_main]
fn main() -> Result<()> {
    let contract = Contract::new()?;
    match contract.get_function_selector()? {
        ewasm_fn_sig!(check_input_object) => ewasm_input_from!(contract move check_input_object)?,
        _ => return Err(Error::UnknownHandle.into()),
    };
    Ok(())
}