ceres_cli/cmd/
call.rs

1//! Call a call method
2use crate::{Result, Tx};
3use ceres_runtime::Runtime;
4use ceres_support::convert::step_hex;
5
6/// Call a call method
7pub fn exec(rt: &mut Runtime, tx: Tx) -> Result<()> {
8    let mut args: Vec<Vec<u8>> = Vec::new();
9    for arg in tx.args.iter() {
10        args.push(step_hex(arg).ok_or("argument should be hex encoded")?);
11    }
12
13    println!(
14        "\n\tresult: {:?}\n",
15        rt.call(&tx.method, args, Some(tx.tx()?))?
16    );
17    Ok(())
18}