Veriteos Ethereum ABI Utils
Project description
# Ethereum Contract
[](https://circleci.com/gh/ethereum/eth-abi) [](https://readthedocs.org/projects/eth-abi/?badge=latest) [](https://pypi.python.org/pypi/eth-abi)
Python utilities for working with the Ethereum ABI
## Installation
`sh pip install eth-abi `
## Documentation
### Decoding
These functions are intended for decoding return values from the EVM.
eth_abi.decode_single(type, data)
This function tries to decode data into the python type that corresponds to the provided type. This function accepts data of type bytes.
>>> decode_single('uint256', b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0009')
12345
The value parameter is expected to be one of the recognized EVM types.
eth_abi.decode_abi(types, data)
This function decodes data into the python type corresponding to the provided types. This function accepts arrays of type byte.
>>> decode_abi(['uint256'], b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0009')
[12345]
>>> decode_abi(['bytes32', 'bytes32'], b'a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
['a', 'b']
The values parameter is expected to be an iterable whose values are all one of the recognized EVM types.
### Encoding
These functions are intended for encoding python values into representations that are suitable for interacting with the EVM.
eth_abi.encode_single(type, value)
This function encodes value in the ABI encoding for the provided type.
>>> encode_single('uint256', 12345)
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0009'
The value parameter is expected to be one of the recognized EVM types.
eth_abi.encode_abi(types, values)
This function encodes values in the ABI encoding for the corresponding type provided by the types argument.
>>> encode_abi(['uint256'], [12345])
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0009'
>>> encode_abi(['bytes32', 'bytes32'], ['a', 'b'])
b'a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
The values parameter is expected to be an iterable whose values are all one of the recognized EVM types.
## Development
Clone the repository and then run:
`sh pip install -e . -r requirements-dev.txt `
### Running the tests
You can run the tests with:
`sh py.test tests `
Or you can install tox to run the full test suite.
### Releasing
Pandoc is required for transforming the markdown README to the proper format to render correctly on pypi.
For Debian-like systems:
` apt install pandoc `
Or on OSX:
`sh brew install pandoc `
To release a new version:
`sh make release bump=$$VERSION_PART_TO_BUMP$$ `
#### How to bumpversion
The version format for this repo is {major}.{minor}.{patch} for stable, and {major}.{minor}.{patch}-{stage}.{devnum} for unstable (stage can be alpha or beta).
To issue the next version in line, specify which part to bump, like make release bump=minor or make release bump=devnum.
If you are in a beta version, make release bump=stage will switch to a stable.
To issue an unstable version when the current version is stable, specify the new version explicitly, like make release bump=”–new-version 4.0.0-alpha.1 devnum”
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file veriteos-eth-abi-1.2.0.post0.tar.gz.
File metadata
- Download URL: veriteos-eth-abi-1.2.0.post0.tar.gz
- Upload date:
- Size: 44.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.21.0 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70f12fa50917c198b1406dc695b96e257b6dc9885ca2d04931383e57be0b3b46
|
|
| MD5 |
f5215341df43ed2b905e4bf92bb45c51
|
|
| BLAKE2b-256 |
e5ed63914c131201844e2935d0835c3b0daebeea7c1fb2373f7b9bd0ef6000ef
|
File details
Details for the file veriteos_eth_abi-1.2.0.post0-py2-none-any.whl.
File metadata
- Download URL: veriteos_eth_abi-1.2.0.post0-py2-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.21.0 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a35952df26b2ecc28fc7bbcd2093fa137d6b20271e47d2c4b814a47c750fded8
|
|
| MD5 |
884ee32dcb507aff161088accf707bd8
|
|
| BLAKE2b-256 |
1a903410db6d2c15255dc7551b3771d868875dfe8ff787486ac5d206eebe32a0
|