Skip to main content

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

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()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ethpm_types-0.6.31.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ethpm_types-0.6.31-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file ethpm_types-0.6.31.tar.gz.

File metadata

  • Download URL: ethpm_types-0.6.31.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ethpm_types-0.6.31.tar.gz
Algorithm Hash digest
SHA256 3ed406b94599e058a19464185126e6f20308721cef5035397a4e536cf11168af
MD5 78b5c9a635f0cd6fec0e4eb73e58844f
BLAKE2b-256 6ed804de6aeadba9e70391f15427786d71b07c7a89f5095c624a6db44679162f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ethpm_types-0.6.31.tar.gz:

Publisher: publish.yaml on ApeWorX/ethpm-types

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ethpm_types-0.6.31-py3-none-any.whl.

File metadata

  • Download URL: ethpm_types-0.6.31-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.12

File hashes

Hashes for ethpm_types-0.6.31-py3-none-any.whl
Algorithm Hash digest
SHA256 66201ed77d46193d677cc0488bde5bdf1344b775b287dede2c942cecea565a96
MD5 97adacc0dd32f2c44ea859b6b218f1a2
BLAKE2b-256 a22459471952a332f29916a12c3a4c418776e035651af74aedef025d1e72a58d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ethpm_types-0.6.31-py3-none-any.whl:

Publisher: publish.yaml on ApeWorX/ethpm-types

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page