example.rs (491B)
1 use anyhow::Result; 2 use borsh::BorshSerialize; 3 use pasta_curves::pallas; 4 use wasm_runtime::{runtime::Runtime, util::serialize_payload}; 5 6 use smart_contract::Args; 7 8 fn main() -> Result<()> { 9 let wasm_bytes = std::fs::read("smart_contract.wasm")?; 10 let mut runtime = Runtime::new(&wasm_bytes)?; 11 12 let args = Args { a: pallas::Base::from(777), b: pallas::Base::from(666) }; 13 let payload = args.try_to_vec()?; 14 let input = serialize_payload(&payload); 15 16 runtime.run(&input) 17 }