ape.types

Miscellaneous

class ape.types.BaseContractLog(*, event_name: str, contract_address: ChecksumAddress, event_arguments: Dict[str, Any])

Base class representing information relevant to an event instance.

contract_address: ChecksumAddress

The contract responsible for emitting the log.

event_arguments: Dict[str, Any]

The arguments to the event, including both indexed and non-indexed data.

event_name: str

The name of the event.

ape.types.BlockID

An ID that can match a block, such as the literals "earliest", "latest", or "pending" as well as a block number or hash (HexBytes).

alias of Union[int, HexStr, HexBytes, Literal[‘earliest’, ‘latest’, ‘pending’]]

class ape.types.ContractLog(*, event_name: str, contract_address: ChecksumAddress, event_arguments: Dict[str, Any], transaction_hash: Any = None, block_number: int, block_hash: Any = None, log_index: int, transaction_index: int | None = None)

An instance of a log from a contract.

block_hash: Any

The hash of the block containing the transaction that produced this log.

block_number: int

The number of the block containing the transaction that produced this log.

log_index: int

The index of the log on the transaction.

transaction_hash: Any

The hash of the transaction containing this log.

transaction_index: int | None

The index of the transaction’s position when the log was created. Is None when from the pending block.

class ape.types.MockContractLog(*, event_name: str, contract_address: ChecksumAddress, event_arguments: Dict[str, Any])

A mock version of the ContractLog class used for testing purposes. This class is designed to match a subset of event arguments in a ContractLog instance by only comparing those event arguments that the user explicitly provides.

Inherits from BaseContractLog, and overrides the equality method for custom comparison of event arguments between a MockContractLog and a ContractLog instance.

Signatures

class ape.types.signatures.MessageSignature(v: int, r: bytes, s: bytes)

Bases: _Signature

A ECDSA signature (vrs) of a message.

class ape.types.signatures.SignableMessage(version: bytes, header: bytes, body: bytes)

Bases: NamedTuple

A message compatible with EIP-191_ that is ready to be signed.

The properties are components of an EIP-191_ signable message. Other message formats can be encoded into this format for easy signing. This data structure doesn’t need to know about the original message format. For example, you can think of EIP-712 as compiling down to an EIP-191 message.

In typical usage, you should never need to create these by hand. Instead, use one of the available encode_* methods in this module, like:

  • encode_structured_data()

  • encode_intended_validator()

  • encode_defunct()

body: bytes

Alias for field number 2

header: bytes

Alias for field number 1

version: bytes

Alias for field number 0

class ape.types.signatures.TransactionSignature(v: int, r: bytes, s: bytes)

Bases: _Signature

A ECDSA signature (vrs) of a transaction.