Catalog PyPI
PACKAGE EXPLORERView in registry

abi2solc

PyPI

A library for generating Solidity interfaces from ABIs.

abiethereumsolcsolidity
Versions collected1
Direct dependencies0From release 0.1.0
Last observed20 Oct, 17:24 UTC

README

Version 0.1.0 documentation

abi2solc

Pypi Status Build Status Coverage Status

A library for generating Solidity interfaces from ABIs.

Installation

You can install the latest release via pip:

$ pip install abi2solc

Or clone the repo and use setuptools for the most up-to-date version:

$ python setup.py install

Usage

>>> import abi2solc

>>> abi = [{'constant': False, 'inputs': [{'name': 'spender', 'type': 'address'}, ...
>>> interface = abi2solc.generate_interface(abi, "TestInterface")

>>> print(interface)
'''pragma solidity ^0.5.0;

interface ExampleInterface {
     event Approval (address indexed tokenOwner, address indexed spender, uint256 tokens);
     event Transfer (address indexed from, address indexed to, uint256 tokens);

     function approve (address spender, uint256 tokens) external returns (bool success);
     function transfer (address to, uint256 tokens) external returns (bool success);
     function transferFrom (address from, address to, uint256 tokens) external returns (bool success);
     function allowance (address tokenOwner, address spender) external view returns (uint256 remaining);
     function balanceOf (address tokenOwner) external view returns (uint256 balance);
     function totalSupply () external view returns (uint256);
}'''

Supported Versions

  • By default, abi2solc generates interfaces with pragma ^0.5.0
  • With the solc4=True kwarg, interfaces are generated with pragma ^0.4.17
  • If solc4=True and the ABI also contains tuple types, an abstract base contract is generated with pragma ^0.4.22

Tests

To run the test suite:

$ tox

Tests make use of py-solc-x.

Development

This project is still under active development and should be considered a beta. Comments, questions, criticisms and pull requests are welcomed! Feel free to open an issue if you encounter a problem or would like to suggest a new feature.

License

This project is licensed under the MIT license.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.030 Sept 20190

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
iamdefinitelyahuman/abi2solc

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:24 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:d65f3644c2c4ac4c5009171da791d8a73406fd5309a82cac057f3224a4129c2e