abi2solidity Published


I just published a super simple tool to convert an Ethereum ABI to a Solidity interface. The idea is to convert this:

[
  {
    "constant": false,
    "inputs": [
      {
        "name": "number",
        "type": "uint8"
      }
    ],
    "name": "guess",
    "outputs": [],
    "payable": true,
    "stateMutability": "payable",
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "isComplete",
    "outputs": [
      {
        "name": "",
        "type": "bool"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  },
  {
    "inputs": [],
    "payable": true,
    "stateMutability": "payable",
    "type": "constructor"
  }
]

to this:

interface GeneratedInterface {
  function guess ( uint8 number ) external payable;
  function isComplete (  ) external view returns ( bool );
}

And eventually reuse it in your projects or have fun with Remix or other tools to call some public methods on your favorite contracts ;).

The code is available on GitHub github.com/maxme/abi2solidity. I published it on npm as well, so you can install the cli using:

$ npm install --global abi2solidity
# OR
$ yarn global add abi2solidity