foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Add options for state changes output and json output in cast run command

Open cassc opened this issue 1 year ago • 3 comments

Motivation

The current human-readable output from cast run is great for manual interpretation but requires additional parsing to be used programmatically. Additionally, there is a need to inspect storage changes for each call, but currently, these changes are not recorded.

Solution

This PR introduces a -j option for cast run to output traces in JSON format, making it easier to consume programmatically. It also adds a --with-state-changes option that outputs storage changes.

Example usage:

cast run 0xefc789b63631b255aeb6f97d948c9eac14bae4b7f021122fe24c7c6e4f34667f \
  -r https://eth.llamarpc.com -q --decode-internal --with-state-changes -j | \
  jq -R 'select(try fromjson? | . != null) | fromjson'

cassc avatar Oct 03 '24 08:10 cassc