1

I successfully installed and used anvil from the wsl shell.

I have some rust code, where i want to import foundry anvil instead of running from shell, cause i want to be able to control it from the app itself , reset it, fork a newblock, simulate transactions. Im trying this for 2 days already, without success.

1 Answer 1

2
async fn anvil_mine() -> Result<(), reqwest::Error> { let client = reqwest::Client::new(); let res = client.post("http://127.0.0.1:8545") .json(&serde_json::json!({ "jsonrpc": "2.0", "method": "anvil_mine", "params": [], "id": 1 })) .send() .await?; println!("{:#?}", res.text().await?); Ok(()) } 

Run

anvil

in a terminal (default RPC url is http://127.0.0.1:8545). Then use this code to interact with it.
You can replace "anvil_mine" by any of these:

https://book.getfoundry.sh/reference/anvil

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.