anvil

Function try_spawn

Source
pub async fn try_spawn(config: NodeConfig) -> Result<(EthApi, NodeHandle)>
Expand description

Creates the node and runs the server

Returns the EthApi that can be used to interact with the node and the [JoinHandle] of the task.

ยงExamples

let config = NodeConfig::default();
let (api, handle) = anvil::try_spawn(config).await?;

// use api

// wait forever
handle.await??;