agent0.ethpy.base.transactions

Web3 powered functions for interfacing with smart contracts.

Functions

async_wait_for_transaction_receipt(→ web3.types.TxReceipt)

Retrieve the transaction receipt asynchronously, retrying with exponential backoff.

Module Contents

async agent0.ethpy.base.transactions.async_wait_for_transaction_receipt(contract_function: pypechain.core.PypechainContractFunction, transaction_hash: hexbytes.HexBytes, timeout: float | None = None, start_latency: float = 0.01, backoff_multiplier: float = 2, validate_transaction: bool = False) web3.types.TxReceipt

Retrieve the transaction receipt asynchronously, retrying with exponential backoff.

This function is copied from web3.eth.wait_for_transaction_receipt, but using exponential backoff and async await. This function also takes the place of sign_transact_and_wait, except it uses async await. This is due to agent0 using the sync version of web3py, but we wrap things in async calls.

Parameters:
  • contract_function (PypechainContractFunction) – The contract function that was called.

  • transaction_hash (HexBytes) – The hash of the transaction.

  • timeout (float | None, optional) – The amount of time in seconds to time out the connection. Default is 30.

  • start_latency (float) – The starting amount of time in seconds to wait between polls.

  • backoff_multiplier (float) – The backoff factor for the exponential backoff.

  • validate_transaction (bool, optional) – Whether to validate the transaction. If True, will throw an exception if the resulting tx_receipt returned a failure status.

Returns:

The transaction receipt

Return type:

TxReceipt