abi2solc
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,
abi2solcgenerates interfaces with pragma^0.5.0 - With the
solc4=Truekwarg, interfaces are generated with pragma^0.4.17 - If
solc4=Trueand 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.
Metadata
Release files for abi2solc 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| abi2solc-0.1.0.tar.gz | 4.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| abi2solc-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / abi2solc-0.1.0.tar.gz
| Download URL | abi2solc-0.1.0.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a7a214b4ab645fb69e5a570feda9ccbb2d69793ed510c147b3846ee97014caf
|
|
BLAKE2b-256 checksum How to use checksums |
cd582e3e69384b776f6756a7efa313ebe7b15dc7633e480d12cea582fc63a7ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
|
Release files / abi2solc-0.1.0-py3-none-any.whl
| Download URL | abi2solc-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61ab3975e6b5247a8a069b04a645c2e43ab985f4cd062b7726654ea87a3eed68
|
|
BLAKE2b-256 checksum How to use checksums |
092cc941d6311ae79373ce911ed24c9d4efb49537494f0220db2a139ad5fd439
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8
|
Security for abi2solc 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.