Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions crates/nxm-engine/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@ impl shepherd::cow::cow::Host for HostState {
}

impl shepherd::cow::order::Host for HostState {
async fn submit(
&mut self,
_chain_id: u64,
_order_data: Vec<u8>,
) -> Result<String, String> {
async fn submit(&mut self, _chain_id: u64, _order_data: Vec<u8>) -> Result<String, String> {
let start = Instant::now();
eprintln!("[order] submit");
let result = Err("not implemented".into());
Expand Down Expand Up @@ -242,9 +238,7 @@ async fn main() -> anyhow::Result<()> {
)?;
wasmtime_wasi::p2::add_to_linker_async(&mut linker)?;

let wasi = WasiCtxBuilder::new()
.inherit_stdio()
.build();
let wasi = WasiCtxBuilder::new().inherit_stdio().build();

let mut store = Store::new(
&engine,
Expand All @@ -262,9 +256,7 @@ async fn main() -> anyhow::Result<()> {

// Call init with config
println!("nxm-engine: calling init...");
let config_entries: Config = vec![
("name".into(), "example".into()),
];
let config_entries: Config = vec![("name".into(), "example".into())];
let start = Instant::now();
match bindings.call_init(&mut store, &config_entries).await? {
Ok(()) => println!("nxm-engine: init succeeded"),
Expand Down
14 changes: 9 additions & 5 deletions modules/example/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// wit_bindgen::generate! expands to host-import shims whose arity matches
// the WIT signatures, which can exceed clippy's too-many-arguments threshold.
#![allow(clippy::too_many_arguments)]

wit_bindgen::generate!({
path: "../../wit/web3-runtime",
world: "headless-module",
Expand All @@ -15,7 +19,10 @@ impl Guest for ExampleModule {
.find(|(k, _)| k == "name")
.map(|(_, v)| v.as_str())
.unwrap_or("unknown");
logging::log(logging::Level::Info, &format!("example module init (name={name})"));
logging::log(
logging::Level::Info,
&format!("example module init (name={name})"),
);
Ok(())
}

Expand All @@ -37,10 +44,7 @@ impl Guest for ExampleModule {
);
}
types::Event::Timer(ts) => {
logging::log(
logging::Level::Info,
&format!("timer fired at {ts}"),
);
logging::log(logging::Level::Info, &format!("timer fired at {ts}"));
}
types::Event::Message(msg) => {
logging::log(
Expand Down