(bytes: &[u8])
| 22 | } |
| 23 | |
| 24 | fn load_contract(bytes: &[u8]) -> Result<(Store<i32>, Instance)> { |
| 25 | let mut config = Config::new(); |
| 26 | |
| 27 | Config::wasm_component_model(&mut config, true); |
| 28 | |
| 29 | let engine = Engine::new(&config)?; |
| 30 | let mut store = Store::new(&engine, 0); |
| 31 | let linker = Linker::new(&engine); |
| 32 | |
| 33 | let component_bytes = ComponentEncoder::default() |
| 34 | .module(bytes)? |
| 35 | .validate(true) |
| 36 | .encode()?; |
| 37 | let component = Component::from_binary(&engine, &component_bytes)?; |
| 38 | let instance = linker.instantiate(&mut store, &component)?; |
| 39 | |
| 40 | Ok((store, instance)) |
| 41 | } |
| 42 | |
| 43 | // TODO(ddimaria): remove unwrap |
| 44 | fn parse_params(chunk: &[&str]) -> Result<Val> { |
no outgoing calls