ethpm_types: Implementation of EIP-2678
Project description
Quick Start
EthPM is an Ethereum package manifest containing data types for contracts, deployments, and source code using EIP-2678. The library validates and serializes contract related data and provides JSON schemas.
Dependencies
- python3 version 3.9 to 3.12.
Installation
via pip
You can install the latest release via pip:
pip install ethpm-types
via setuptools
You can clone the repository and use setuptools for the most up-to-date version:
git clone https://github.com/ApeWorX/ethpm-types.git
cd ethpm-types
python3 setup.py install
Quick Usage
Starting with a dictionary of attribute data, such as a contract instance, you can build an EthPM typed object.
from ethpm_types import ContractInstance
contract = ContractInstance(contractType="ContractClassName", address="0x123...")
print(contract.contract_type)
Contract Type
Perhaps the most common artifact type from ethmp_types is ContractType.
ContractType represents components of a compiled contract, such as the .abi or the .runtime_bytecode.
from ethpm_types import ContractType
contract = ContractType(abi=[], runtimeBytecode="0x...")
For convenience, you can also initialize a ContractType using the .from_signature() classmethod:
from ethpm_types.abi import MethodABI, EventABI
MethodABI.from_signature("function_name(uint256 arg1)")
# => MethodABI(type='function', name='function_name', inputs=[...], ...)
EventABI.from_signature("Transfer(address indexed from, address indexed to, uint256 value)")
# => EventABI(type='event', name='Transfer', inputs=[...], ...)
ABI JSON
To easily acquire the ABI JSON for a ContractType artifact, .model_dump_json() the .abi property:
from ethpm_types import ContractType
contract_type = ContractType(abi=[], runtimeBytecode="0x...")
# Use the ABI in other application requiring ABI JSON.
abi = contract_type.abi.model_dump_json()
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 ethpm_types-0.6.30.tar.gz.
File metadata
- Download URL: ethpm_types-0.6.30.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb79b4fc8789e13ab67d6f378ae2e7503286f0c51c50941b593fc56663cbc15e
|
|
| MD5 |
f13fd4fea132104f5f2d108cf044b147
|
|
| BLAKE2b-256 |
13172656a7739c80774d10c0f2ed90b2df41dd12f7c6b4a6b88b3fbb7e8e958e
|
Provenance
The following attestation bundles were made for ethpm_types-0.6.30.tar.gz:
Publisher:
publish.yaml on ApeWorX/ethpm-types
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ethpm_types-0.6.30.tar.gz -
Subject digest:
eb79b4fc8789e13ab67d6f378ae2e7503286f0c51c50941b593fc56663cbc15e - Sigstore transparency entry: 955799733
- Sigstore integration time:
-
Permalink:
ApeWorX/ethpm-types@d7b0e7afa710abbc390c65b0fddd810792215019 -
Branch / Tag:
refs/tags/v0.6.30 - Owner: https://github.com/ApeWorX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@d7b0e7afa710abbc390c65b0fddd810792215019 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ethpm_types-0.6.30-py3-none-any.whl.
File metadata
- Download URL: ethpm_types-0.6.30-py3-none-any.whl
- Upload date:
- Size: 35.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b49aeeefec6d57d5af4a83055bcc7978be5a3717f87363c90c52e1196613dd9
|
|
| MD5 |
38e27272165c2410c6c8d4be46ea1218
|
|
| BLAKE2b-256 |
1eba62a261bbcbfa0795d61e2cfda802681ec0fb81d17bea691646e2e168b2a5
|
Provenance
The following attestation bundles were made for ethpm_types-0.6.30-py3-none-any.whl:
Publisher:
publish.yaml on ApeWorX/ethpm-types
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ethpm_types-0.6.30-py3-none-any.whl -
Subject digest:
7b49aeeefec6d57d5af4a83055bcc7978be5a3717f87363c90c52e1196613dd9 - Sigstore transparency entry: 955799736
- Sigstore integration time:
-
Permalink:
ApeWorX/ethpm-types@d7b0e7afa710abbc390c65b0fddd810792215019 -
Branch / Tag:
refs/tags/v0.6.30 - Owner: https://github.com/ApeWorX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@d7b0e7afa710abbc390c65b0fddd810792215019 -
Trigger Event:
release
-
Statement type: