All Projects → gnidan → abi-to-sol

gnidan / abi-to-sol

Licence: MIT license
Generate Solidity interface from ABI JSON

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
HTML
75241 projects

Projects that are alternatives of or similar to abi-to-sol

abireport
Tool to create ABI reports from ELF binaries in packaging
Stars: ✭ 16 (-92.49%)
Mutual labels:  abi
ethjs-contract
A simple contract object for the Ethereum RPC layer.
Stars: ✭ 21 (-90.14%)
Mutual labels:  abi
abi-code-gen
Generic code generator from abi
Stars: ✭ 21 (-90.14%)
Mutual labels:  abi
eth-reveal
Dig into Ethereum transactions and reveal their secrets; kinda like having Etherscan in your code.
Stars: ✭ 62 (-70.89%)
Mutual labels:  abi
hardhat-abi-exporter
🧰 Export Solidity contract ABIs on compilation ⚙️
Stars: ✭ 29 (-86.38%)
Mutual labels:  abi
TypeChain
🔌 TypeScript bindings for Ethereum smart contracts
Stars: ✭ 1,881 (+783.1%)
Mutual labels:  abi
eth-sdk
Type-safe, lightweight SDKs for Ethereum smart contracts
Stars: ✭ 283 (+32.86%)
Mutual labels:  abi
lambda-libs
DEPRECATED: remove EVM from lambda chain
Stars: ✭ 20 (-90.61%)
Mutual labels:  abi
eth.rb
a straightforward library to build, sign, and broadcast ethereum transactions anywhere you can run ruby.
Stars: ✭ 111 (-47.89%)
Mutual labels:  abi
hardhat-contract-sizer
Output Ethereum contract sizes with Hardhat 📐
Stars: ✭ 55 (-74.18%)
Mutual labels:  abi
splunk-connect-for-ethereum
Splunk Connect for Ethereum
Stars: ✭ 50 (-76.53%)
Mutual labels:  abi
online-ethereum-abi-encoder-decoder
A quick online tool to abi-encode and abi-decode constructor arguments used in ethereum's solidity. https://adibas03.github.io/online-ethereum-abi-encoder-decoder/
Stars: ✭ 37 (-82.63%)
Mutual labels:  abi

abi-to-sol

npm version Join the chat at https://gitter.im/gnidan/abi-to-sol gitpoap badge

Generate Solidity interface source from a given ABI JSON!

Try online!

Skip the terminal and just use the hosted Web UI.

CLI instructions

Install globally via:

$ npm install -g abi-to-sol

Installing locally should work fine as well, but you may have to jump through hoops to get the abi-to-sol script available on your PATH.

Usage

Pipe ABI JSON to stdin, get Solidity on stdout.

abi-to-sol [--solidity-version=<solidityVersion>] [--license=<license>] [--validate] [<name>]
abi-to-sol -h | --help
abi-to-sol --version

Options:

<name>
  Name of generated interface. Default: MyInterface

--validate
  Validate JSON before starting

-V --solidity-version
  Version of Solidity (for pragma). Default: >=0.7.0 <0.9.0

-L --license
  SPDX license identifier. default: UNLICENSED

-h --help     Show this screen.
--version     Show version.

Example

Run the following command:

$ echo '[{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"resolver","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"label","type":"bytes32"},{"name":"owner","type":"address"}],"name":"setSubnodeOwner","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"ttl","type":"uint64"}],"name":"setTTL","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"node","type":"bytes32"}],"name":"ttl","outputs":[{"name":"","type":"uint64"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"resolver","type":"address"}],"name":"setResolver","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"node","type":"bytes32"},{"name":"owner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"owner","type":"address"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":true,"name":"label","type":"bytes32"},{"indexed":false,"name":"owner","type":"address"}],"name":"NewOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"resolver","type":"address"}],"name":"NewResolver","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"node","type":"bytes32"},{"indexed":false,"name":"ttl","type":"uint64"}],"name":"NewTTL","type":"event"}]' \
  | npx abi-to-sol ENS

Get this output:

// SPDX-License-Identifier: UNLICENSED
// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol. SEE BELOW FOR SOURCE. !!
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;

interface ENS {
  function resolver(bytes32 node) external view returns (address);

  function owner(bytes32 node) external view returns (address);

  function setSubnodeOwner(
    bytes32 node,
    bytes32 label,
    address owner
  ) external;

  function setTTL(bytes32 node, uint64 ttl) external;

  function ttl(bytes32 node) external view returns (uint64);

  function setResolver(bytes32 node, address resolver) external;

  function setOwner(bytes32 node, address owner) external;

  event Transfer(bytes32 indexed node, address owner);
  event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);
  event NewResolver(bytes32 indexed node, address resolver);
  event NewTTL(bytes32 indexed node, uint64 ttl);
}

// THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON:
/* ... */

Currently unsupported (PRs welcome! 😉)

Is this project useful to you?

Feel free to donate to gnidan.eth ❤️

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].