0xSpaceShard / starknet-devnet-rs

A local testnet for Starknet... in Rust
https://0xspaceshard.github.io/starknet-devnet-rs/
MIT License
100 stars 56 forks source link

Easily spawn devnet inside of tests #502

Open ivpavici opened 1 month ago

ivpavici commented 1 month ago

Let's see for the future the possibility of instantiating devnet inside tests, like so:

// Ensure `anvil` is available in $PATH.
let anvil = Anvil::new().fork("https://eth.merkle.io").try_spawn()?;

println!("Anvil running at `{}`", anvil.endpoint());

reference and more examples: https://alloy.rs/examples/anvil/fork_anvil.html

FabijanC commented 1 month ago

Inside of tests of people using Rust SDKs for interacting with Starknet?

ivpavici commented 1 month ago

yes!

FabijanC commented 2 weeks ago

This could also be a part of starknet-devnet-js. That library could: 1) export a provider (already does) 2) export a Devnet wrapper: new StarknetDevnet();

Inspiration could be taken from the Devnet class of starknet-hardhat-plugin: https://github.com/0xSpaceShard/starknet-hardhat-plugin/blob/master/src/types/devnet.ts