inkpad/cmd/
deploy.rs

1//! Call a deploy method
2use crate::{Result, Tx};
3use inkpad_runtime::Runtime;
4use inkpad_support::convert::step_hex;
5
6/// Call a deploy 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("Arguments should be hex encoded")?);
11    }
12
13    rt.deploy(&tx.method, args, Some(tx.tx()?))?;
14
15    println!("\n\tDeploy contract succeed!\n");
16    Ok(())
17}