pub async fn spawn(config: NodeConfig) -> (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.
§Panics
Panics if any error occurs. For a non-panicking version, use try_spawn
.
§Examples
let config = NodeConfig::default();
let (api, handle) = anvil::spawn(config).await;
// use api
// wait forever
handle.await.unwrap().unwrap();