Skip to main content

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

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

ethpm_types-0.6.30.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.30-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

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

Hashes for ethpm_types-0.6.30.tar.gz
Algorithm Hash digest
SHA256 eb79b4fc8789e13ab67d6f378ae2e7503286f0c51c50941b593fc56663cbc15e
MD5 f13fd4fea132104f5f2d108cf044b147
BLAKE2b-256 13172656a7739c80774d10c0f2ed90b2df41dd12f7c6b4a6b88b3fbb7e8e958e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ethpm_types-0.6.30.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.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

Hashes for ethpm_types-0.6.30-py3-none-any.whl
Algorithm Hash digest
SHA256 7b49aeeefec6d57d5af4a83055bcc7978be5a3717f87363c90c52e1196613dd9
MD5 38e27272165c2410c6c8d4be46ea1218
BLAKE2b-256 1eba62a261bbcbfa0795d61e2cfda802681ec0fb81d17bea691646e2e168b2a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for ethpm_types-0.6.30-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.

Supported by

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