Generate Solidity interface from ABI JSON
MIT License
Bot releases are hidden (Show)
This release adds support for user-defined value types, introduced in Solidity v0.8.8. If you supply an ABI JSON that uses UDVTs in its external interface, abi-to-sol will now output a type MyUdvt is uint256
(e.g.) statement and use that name in the ABI functions/events that use it (provided that your desired solc range is at least ^0.8.8
).
This release is quite large in terms of internal changes. Originally, I built abi-to-sol to keep track only of the struct types that a given ABI uses, so the internals were pretty naive. Since UDVTs can now possibly appear as part of a contract's ABI, it's become worthwhile to redo how abi-to-sol keeps track of everything that needs a declaration. (Notice how the "BunchaStructs" example in the abi-to-sol web UI shows how diffrent type declarations get grouped into their pre-defined namespaces.)
Looking ahead towards addressing #41, I really want abi-to-sol to be able to accept multiple ABIs for multiple contracts in the same project (e.g., specify the various ABIs you need for Uniswap v3, all at once), since doing those one-at-a-time today means you'll be deleting a lot of duplicative struct
s.). The work in this release to support UDVTs should hopefully pave the way for this new behavior, which seems like a good v1.0.0 target.
In the meantime, I'd appreciate any testing you all could provide! I tried to be quite thorough in checking for software regressions, but it's possible I missed something with a change this large. Please do open an issue at the first sign of trouble!
Published by gnidan over 1 year ago
This release fixes a breakage where abi-to-sol did not properly handle large JSON inputs. Thanks @gsscoder for reporting this and @SuperGNUS for figuring it out!
Published by haltman-at over 1 year ago
This release adds a new feature to allow abi-to-sol to generate embeddable output -- that is to say, output that can be appended to an existing Solidity file; no pragma, no license identifier, etc. You can specify this with the command-line option --embedded
(or -E
); when used as a library, it's specified by the option { mode: "embedded" }
, as opposed to the default { mode: "normal" }
.
Published by gnidan about 2 years ago
Just a few dependency updates and import statement cleanup. Thank you @benjamincburns and @cds-amal for doing the legwork on #92!
Published by gnidan about 2 years ago
This release is mostly dependency updates, plus a minor change to requirements: abi-to-sol no longer recommends usage via npx
without being installed first. (See https://github.com/gnidan/abi-to-sol/issues/67 for why)
Bump terser from 4.8.0 to 4.8.1 (#84 by @dependabot)
Published by gnidan over 2 years ago
This release fixes a bug where abi-to-sol wasn't producing syntactically-valid output for Solidity function type parameters. This has now been fixed!
Note: for best results, please ensure the input ABI JSON includes the non-spec internalType
field. For details on this, please see issue #76, specifically the comment about handling when this field is missing.
Thanks to @esaulpaugh for identifying this problem!
Published by gnidan over 2 years ago
This "new feature" release adds two CLI flags:
--no-source
(or -S
) omits the source ABI JSON listing at the end of output--no-attribution
(or -A
) omits the "autogenerated by abi-to-sol" notice at the top of outputThanks for the suggestion, @jorijnsmit!
In addition, this release marks the switch in Node.js's maintenance lifecycle: this package now supports Node.js >=14 <19. (Node.js v12 has been dropped, and Node.js v18 has been added.)
Published by gnidan over 2 years ago
Just some dependency updates (mostly dependabot, but also a @truffle/codec dependency that was causing security warnings)
Bump follow-redirects from 1.14.1 to 1.14.7 (#50 by @dependabot)
Bump nanoid from 3.1.23 to 3.2.0 (#51 by @dependabot)
Bump node-fetch from 2.6.1 to 2.6.7 (#52 by @dependabot)
Bump trim-off-newlines from 1.0.1 to 1.0.3 (#53 by @dependabot)
Bump follow-redirects from 1.14.7 to 1.14.8 (#55 by @dependabot)
Bump url-parse from 1.5.3 to 1.5.10 (#57 by @dependabot)
Bump minimist from 1.2.5 to 1.2.6 (#58 by @dependabot)
Bump async from 2.6.3 to 2.6.4 (#59 by @dependabot)
Bump simple-get from 2.8.1 to 2.8.2 (#60 by @dependabot)
Published by gnidan almost 3 years ago
Upgrading some dependencies to resolve some dependabot alerts
Update dependency: [email protected] (#43 by @gnidan)
Update dependency: better-ajv-errors@^0.8.2 (#43 by @gnidan)
Bump tar from 4.4.13 to 4.4.19 (#45 by @dependabot)
Bump tmpl from 1.0.4 to 1.0.5 (#46 by @dependabot)
Bump url-parse from 1.5.1 to 1.5.3 (#47 by @dependabot)
Published by gnidan about 3 years ago
abi-to-sol now accepts custom errors in input ABIs and outputs corresponding custom Solidity errors in the interfaces it generates.
Solidity added custom errors in v0.8.4 (see their blog post about it!) To use ABIs with custom errors, abi-to-sol now requires the selected output version range to include only versions greater than or equal to this version. Note that abi-to-sol's default version of >=0.7.0 <0.9.0
does not support this new feature; you'll need to pass -V
explicitly or select ^0.8.4
in the web UI. (Please open a discussion or an issue if you feel the behavior here should be more permissive and not throw an exception!)
This release also includes a change to the Web UI, to use react-simple-code-editor instead of react-ace, hopefully improving the experience on mobile.
Also of note: this project now keeps a full CHANGELOG.
Thanks for reading!
Published by gnidan about 3 years ago
This release updates abi-to-sol to be more robust in light of differences between Solidity versions (and more attentive to what Solidity features are actually needed by a given input ABI)
Note: since you can request a desired Solidity range for output, abi-to-sol will now error if the input ABI uses features that would result in more than one syntax form across versions in the desired range. For instance: if the input ABI defines a fallback function, abi-to-sol won't let you generate >=0.4.0
(since the syntax changed in v0.5.0)
pragma experimental ABIEncoderV2
when necessary (#22 by @gnidan)Published by gnidan over 3 years ago
abi-to-sol now has a web UI! ๐ See it in action here.
In addition, this release begins to add functionality for producing output to match syntax of older Solidity versions. Previously, the -V
/ solidityVersion
option only affected the pragma, but the rest of output might not compile on the version specified. This release starts to change that with support for the following two Solidity changes:
memory
. Previously, they were specified as calldata
or listed without location. This tool now handles this distinction back to ^0.4.24 (or maybe a bit earlier).fallback
and receive
. This tool now handles that syntax change across Solidity's past, and will even generate function () external payable;
when given an ABI with a receive
.There are still various other version-specific differences to account for (e.g. struct
s outside of contracts), but those will have to come later. In the meantime: enjoy! โ๏ธ
Note: this release marks a git history change to convert to a lerna monorepo. In the process, this removes support for Node v10 (i.e. I've turned off the CI job due. Please open an issue if you need Node v10 support... maybe it's an easy fix). This also pins prettier-plugin solidity to 1.0.0-alpha.59
due to problems with later versions.
Published by gnidan over 3 years ago
Published by gnidan about 4 years ago
Published by gnidan about 4 years ago
This release changes the default Solidity pragma from ^0.7.0
to the more general >=0.5.0 <0.8.0
. It also adds runtime support for source maps (e.g. for exception stack traces)
>=0.5.0 <0.8.0
(and centralize defaulting logic) (#1 by @gnidan)