Abinator
Define ABI for your smart contract with dataclass-like style.
Quick example
Define your abi as Abi child. Abi.to_abi() returns abi as json, so you can use it with web3py and web3-premium.
from abinator import Abi, uint256, uint8
class ERC20Fragment(Abi):
decimals: uint8
@view
def balanceOf(account: address) -> uint256:
...
ERC20Fragment.to_abi() # returns json with abi
Documentation
State mutability
You can use view, pure, payable decoratos for state mutabilty.
from abinator import Abi, uint256
class Contract(Abi):
@view
def balanceOf(account: address) -> uint256:
...
@payable
def deposit():
...
@pure
def safe_add(a: uint256, b: uint256) -> uint256:
...
Events
Define events with child class of Event inside your abi class.
You can use indexed decorator for topics.
from abinator import Abi, Event, address, uint256, indexed
class ERC20Fragment(Abi):
class Transfer(Event):
from_: indexed(address)
to: indexed(address)
value: uint256
Also there is anonymous for event class:
from abinator import Abi, Event, anonymous, uint256
class Contract(Abi):
@anonymous
class AnonymousEvent(Event):
value: uint256
Structs and tuple
Define structs with child class of Struct inside your abi class.
from abinator import Abi, Struct, payable, address, uint24, int24, uint256
class NonfungiblePositionManager(Abi):
class MintParams(Struct):
token0: address
token1: address
fee: uint24
tickLower: int24
tickUpper: int24
amount0Desired: uint256
amount1Desired: uint256
amount0Min: uint256
amount1Min: uint256
recipient: address
deadline: uint256
@payable
def mint(params: MintParams) -> tuple[uint256, uint128, uint256, uint256]:
...
Metadata
Release files for abinator 0.0.6
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 | Actions |
|---|---|---|---|---|
| abinator-0.0.6.tar.gz | 6.3 kB | Without provenance | Details for abinator-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| abinator-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for abinator-0.0.6-py3-none-any.whl |
Total release size: 13.9 kB
Release files / abinator-0.0.6.tar.gz
| Download URL | abinator-0.0.6.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
575c63b78aa20537f9716c803fb8d518333e0c52ff4425417ec1ebce0ed1343b
|
|
BLAKE2b-256 checksum How to use checksums |
3790c156aa8ad4ee9e7668b050be24de4e312069c93dab208f2aa363fd92a780
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.0
|
Release files / abinator-0.0.6-py3-none-any.whl
| Download URL | abinator-0.0.6-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b89e6c520813e93829d49cd4170ea47f40fde5de19384dc8ea9a19d9b261e6e3
|
|
BLAKE2b-256 checksum How to use checksums |
90e244636d055e88a5baf8122ce54d747f509082fb0cdccc24e809de64d9d0e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.0
|
Security for abinator 0.0.6
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.