0xSpaceShard / starknet-devnet-rs

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

Expose Devnet provider API in Rust #502

Open ivpavici opened 5 months ago

ivpavici commented 5 months 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 5 months ago

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

ivpavici commented 5 months ago

yes!

FabijanC commented 4 months 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

FabijanC commented 3 months ago

Closed via https://github.com/0xSpaceShard/starknet-devnet-js/pull/15. Consider reopening if needed as a Rust feature.

FabijanC commented 3 months ago

Reopening because it seems we need this as a Rust feature, too. We could expose the BackgroundDevnet that we already have, perhaps in a new or an existing crate, or we could open a new repo, similar to starknet-devnet-js.