Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty printed ABI from Forge Inspect #2433

Closed
maurelian opened this issue Jul 21, 2022 · 11 comments
Closed

Pretty printed ABI from Forge Inspect #2433

maurelian opened this issue Jul 21, 2022 · 11 comments
Labels
C-forge Command: forge Cmd-forge-inspect Command: forge inspect D-easy Difficulty: easy first issue A good way to start contributing P-low Priority: low T-feature Type: feature

Comments

@maurelian
Copy link

maurelian commented Jul 21, 2022

Component

Forge

Describe the feature you would like

Issue

forge inspect <ContractName> abi only prints a json formatted abi.

That wouldn't be an issue, if it were possible to easily pipe the output to jq however the warnings printed at the beginning of the output prevent that work working.

Suggested Feature

A --pretty formatting (similar to what's available for storageLayout) of the output would be great to have.

Additional context

Current output looks like this (I see now that the warnings are pretty easy to resolve):

$ forge inspect --pretty L1CrossDomainMessenger abi
warning: Unknown section [ci] found in foundry.toml. This notation for profiles has been deprecated and may result in the profile not being registered in future versions. Please use [profile.default] instead or run `forge config --fix`.
warning: Unknown section [default] found in foundry.toml. This notation for profiles has been deprecated and may result in the profile not being registered in future versions. Please use [profile.default] instead or run `forge config --fix`.
warning: Unknown section [default] found in node_modules/excessively-safe-call/foundry.toml. This notation for profiles has been deprecated and may result in the profile not being registered in future versions. Please use [profile.default] instead or run `forge config --fix`.
[
  {
    "inputs": [
      {
        "internalType": "contract OptimismPortal",
        "name": "_portal",
        "type": "address"
      }
    ],
    ...
@maurelian maurelian added the T-feature Type: feature label Jul 21, 2022
@gakonst gakonst added this to Foundry Jul 21, 2022
@gakonst gakonst moved this to Todo in Foundry Jul 21, 2022
@onbjerg
Copy link
Member

onbjerg commented Jul 21, 2022

Not following entirely: do you want --pretty to print a table? If so, any thoughts on events vs functions in this output? 😄

@onbjerg onbjerg added first issue A good way to start contributing C-forge Command: forge Cmd-forge-inspect Command: forge inspect D-easy Difficulty: easy labels Jul 21, 2022
@sambacha
Copy link
Contributor

He wants something along the lines of:

forge $cmd | tail -n +2 | tee $outputFile

@onbjerg
Copy link
Member

onbjerg commented Jul 21, 2022

No, removing the warnings seems secondary - the only reason the warnings are wanted to be gone is because the output is not pipeable into jq, so it is not possible to construct a prettified output yourself. I'm fairly confident it is about wanting a table?

@mds1
Copy link
Collaborator

mds1 commented Jul 21, 2022

One idea is to have --pretty print the interfaces the same way that cast interface does, e.g. as a Solidity interface. Though cast interface doesn't handle structs well and just prints tuples with generic variable names of a, b, etc.

@maurelian
Copy link
Author

A table would be fine.
So would something like cast interface.
Ideally it has all of the info available in an abi entry, just easier to read.

@maurelian maurelian changed the title Pretty printed ABI Pretty printed ABI from Forge Inspect Jul 22, 2022
@onbjerg onbjerg added the P-low Priority: low label Aug 11, 2022
@ghost
Copy link

ghost commented Nov 8, 2022

@maurelian is this still open and in need of work? If yes, can I pick it up?

@maurelian
Copy link
Author

@maurelian is this still open and in need of work? If yes, can I pick it up?

@timofeli I'm just a user. @gakonst wdyt?

@gakonst
Copy link
Member

gakonst commented Nov 17, 2022

Yes! Go for it @timofeli

@drortirosh
Copy link

I think that in general, warnings should be sent to stderr, not stdout

@zerosnacks
Copy link
Member

Marking this as resolved, forge inspect Counter abi now outputs in pretty print format

@pstephenwille
Copy link

this is pretty helpful
forge inspect ./src/TicTacToe.sol:TicTacToe abi > ttt.abi.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-forge Command: forge Cmd-forge-inspect Command: forge inspect D-easy Difficulty: easy first issue A good way to start contributing P-low Priority: low T-feature Type: feature
Projects
Archived in project
8 participants