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

Dumping UX can be improved #529

Closed FabijanC closed 1 week ago

FabijanC commented 2 weeks ago

Problem

Currently if you just want to dump on request, you need to start Devnet with --dump-on <SOMETHING> and --dump-path <PATH>.

Proposal

Add --dump-on request which doesn't require --dump-path to be set.

Additionally, in the /dump endpoint, if no path is specified in the request body (and if none is provided on startup with --dump-path), default to dumping to stdout. This will allow the common pattern of:

curl -X POST <DEVNET_URL>/dump > dump.json

Needed changes

Something should probably be done here: https://github.com/0xSpaceShard/starknet-devnet-rs/blob/1d959080db5520f670ea5253b905c334d0e874e1/crates/starknet-devnet/src/cli.rs#L141-L158

Might be useful: https://docs.rs/clap/latest/clap/struct.Arg.html#method.requires_if