abi-to-sol

Generate Solidity interface from ABI JSON

MIT License

Downloads
4.8K
Stars
323
Committers
5

Bot releases are visible (Hide)

abi-to-sol - v0.8.0 Latest Release

Published by gnidan over 1 year ago

abi-to-sol v0.8.0

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).

Cautionary notes / please give me a heads up if there are problems!

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 structs.). 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!

Release changes

New features

Project updates

abi-to-sol - v0.7.1

Published by gnidan over 1 year ago

abi-to-sol v0.7.1

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!

Release changes

Bug fixes

Dependency updates

abi-to-sol - v0.7.0

Published by haltman-at over 1 year ago

abi-to-sol v0.7.0

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" }.

Release changes

New features

  • Allow producing embeddable output, e.g. no pragma (#91 by @gnidan)

Project updates

Dependency updates

abi-to-sol - v0.6.6

Published by gnidan about 2 years ago

abi-to-sol v0.6.6

Just a few dependency updates and import statement cleanup. Thank you @benjamincburns and @cds-amal for doing the legwork on #92!

Release changes

Internal improvements

Dependency updates

  • Bump @truffle/abi-utils to ^0.3.0, drop dependency @truffle/codec (#92 by @benjamincburns)
abi-to-sol - v0.6.5

Published by gnidan about 2 years ago

abi-to-sol v0.6.5

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)

Release changes

Project updates

  • Update README to remove npx support (#83 by @gnidan)

Dependency updates

abi-to-sol - v0.6.4

Published by gnidan over 2 years ago

abi-to-sol v0.6.4

This is just a dependency update to bring prettier and prettier-plugin-solidity to latest.

Release changes

Dependency updates

  • Upgrade prettier-plugin-solidity and prettier to latest (#80 by @gnidan)
abi-to-sol - v0.6.3

Published by gnidan over 2 years ago

abi-to-sol v0.6.3

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!

Release changes

Bug fixes

  • Produce valid syntax for function type params (#77 by @gnidan)

Dependency updates

abi-to-sol - v0.6.2

Published by gnidan over 2 years ago

abi-to-sol v0.6.2

Just a quick dependency update; thanks @cds-amal for contributing!

Release changes

Dependency updates

  • Bump @truffle/codec from ^0.11.24 to ^0.13.2 (#72 by @cds-amal)
abi-to-sol - v0.6.1

Published by gnidan over 2 years ago

abi-to-sol v0.6.1

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 output

Thanks 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.)

Release changes

New features

  • Add --no-attribution and --no-source flags (#69 by @gnidan)

Internal improvements

  • Update to Node.js LTS (#63 by @gnidan)

  • Update copyright notice (#64 by @gnidan)

  • Add version feature knowledge for user-defined value types (#65 by @gnidan)

Dependency updates

abi-to-sol - v0.5.3

Published by gnidan over 2 years ago

abi-to-sol v0.5.3

Just some dependency updates (mostly dependabot, but also a @truffle/codec dependency that was causing security warnings)

Release changes

Dependency updates

abi-to-sol - v0.5.2

Published by gnidan almost 3 years ago

abi-to-sol v0.5.2

Upgrading some dependencies to resolve some dependabot alerts

Release changes

Dependency updates

abi-to-sol - v0.5.1

Published by gnidan almost 3 years ago

abi-to-sol v0.5.1

Just some internals :)

Release changes

Internal improvements

  • Add script for upgrading dependencies (#37 by @gnidan)
  • Upgrade typescript to ^4.4.4 (#38 by @gnidan)
abi-to-sol - v0.5.0

Published by gnidan about 3 years ago

abi-to-sol v0.5.0

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!

Release changes

New features

Fixes

  • Properly error when generating structs on unsupported Solidity versions (#32 by @gnidan)
  • Fix version-feature checks to succeed only when entire range has feature (#35 by @gnidan)

Internal improvements

  • Enforce CHANGELOG entries in pull requests (#30 by @gnidan)

Dependency updates

  • Update dependency: @truffle/abi-utils@^0.2.2 (#29 by @gnidan)

web-ui changes

  • Switch to react-simple-code-editor (#31 by @gnidan)
abi-to-sol - v0.4.0

Published by gnidan about 3 years ago

abi-to-sol v0.4.0

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)

New features

  • Error upon Solidity version syntax ambiguity (#21 by @gnidan)

Enhancements

  • Include package version in autogen notice (#25 by @gnidan)
  • Only emit pragma experimental ABIEncoderV2 when necessary (#22 by @gnidan)

Bug fixes

  • Put structs in the right places (#24 by @gnidan)

Housekeeping

  • Note lack of support for ABI errors (#26 by @gnidan)
  • Change default version to >=0.7.0 <0.9.0 (#20 by @gnidan)

Internal improvements

web-ui changes

  • Show errors from generateSolidity (#19 by @gnidan)
abi-to-sol - v0.3.0

Published by gnidan over 3 years ago

abi-to-sol v0.3.0

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:

  • Array arguments are now specified as having location 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).
  • Solidity now distinguishes between 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. structs 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.

New features

  • Export GenerateSolidityOptions interface type (#13 by @gnidan)
  • Allow disabling prettier (#14 by [@gnidan])
  • Add web UI (#16 by [@gnidan])
  • Begin to differ output based on Solidity version / features used by ABI (#17 by [@gnidan])

Bug fixes

  • Replace invalid characters in internalTypes (#15 by [@gnidan])
abi-to-sol - v0.2.1

Published by gnidan over 3 years ago

abi-to-sol v0.2.1

For some reason @drizzle/store was being listed as a dependency of this package. This package does not use @drizzle/store, so this release removes the dependency.

Dependency updates

  • Remove unused @drizzle/store dependency (#12 by @gnidan)
abi-to-sol - v0.2.0

Published by gnidan almost 4 years ago

abi-to-sol v0.2.0

This release moves some logic to the new @truffle/abi-utils package and updates internal naming conventions accordingly.

Dependency updates

  • Switch to using @truffle/abi-utils (#11 by @gnidan)
abi-to-sol - v0.1.6

Published by gnidan about 4 years ago

abi-to-sol v0.1.6

This release upgrades prettier-plugin-solidity to support anonymous events.

Enhancements

Dependency updates

  • Upgrade prettier-plugin-solidity to v1.0.0-alpha.59 (#6 by @gnidan)

Internal improvements

abi-to-sol - v0.1.5

Published by gnidan about 4 years ago

abi-to-sol v0.1.5

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)

Enhancements

  • Broaden default Solidity version to >=0.5.0 <0.8.0 (and centralize defaulting logic) (#1 by @gnidan)
  • Add runtime source map support (#4 by @gnidan)

Internal improvements

Package Rankings
Top 2.27% on Npmjs.org
Badges
Extracted from project README
npm version gitpoap badge