Skip to main content
Version: Next

environment_helper

PendingTx Objects

class PendingTx()

PendingTx The PendingTx class is used to represent a pending transaction in the tx pool

EnvironmentHelperInterface Objects

class EnvironmentHelperInterface(ABC)

EnvironmentHelperInterface The EnvironmentHelperInterface is used to provide access to the environment's state

get_alias

@abstractmethod
def get_alias() -> str

Get the alias of the environment

Returns

str: The alias of the environment

get_state

@abstractmethod
def get_state() -> object

Get the state of the environment The state of the environment can be used to store information about the environment and retrieve it later

Returns

object: The state of the environment

get_settings

@abstractmethod
def get_settings() -> object

Get the settings of the environment The settings of the environment can be used to store information about the environment and retrieve it later

Returns

object: The settings of the environment

get_contract

@abstractmethod
def get_contract(name: str,
address: str | None = None) -> ContractInterface | None

Get a contract by its name and address

Arguments:


  • name str - The name of the contract
  • address str, optional - The address for a contract if the contract is dynamic. Defaults to None.

Returns:


ContractInterface | None: The contract if it exists

get_protocol

@abstractmethod
def get_protocol(name: str) -> ProtocolInterface | None

Get a protocol by its name

Arguments:


  • name str - The name of the protocol

Returns:


ProtocolInterface | None: The protocol if it exists

get_token

@abstractmethod
def get_token(name: str) -> TokenInterface | None

Get a token by its name

Arguments:


  • name str - The symbol of the token, e.g. 'ETH'

Returns:


TokenInterface | None: The token if it exists

get_token_by_address

@abstractmethod
def get_token_by_address(address: str) -> TokenInterface | None

Get a token by its address Native tokens like ETH can not be retrieved by their address

Arguments:


  • address str - The address of the token, e.g. '0x1234...'

Returns:


TokenInterface | None: The token if it exists

get_tokens

@abstractmethod
def get_tokens() -> list[TokenInterface]

Get all tokens in the environment

Returns

List[TokenInterface]: All tokens in the environment

get_tx_pool

@abstractmethod
def get_tx_pool() -> list[PendingTx]

Get the transactions in the tx pool

Returns

List[PendingTx]: The transactions in the tx pool