agent0.ethpy.base.rpc_interface

Functions for interfacing with the anvil or ethereum RPC endpoint

Functions

set_account_balance(→ web3.types.RPCResponse)

Set the eth balance of the the account using the web3 provider.

get_account_balance(→ int | None)

Get the balance for an account deployed on the web3 provider.

Module Contents

agent0.ethpy.base.rpc_interface.set_account_balance(web3: web3.Web3, account_address: str, amount_wei: int) web3.types.RPCResponse

Set the eth balance of the the account using the web3 provider.

Parameters:
  • web3 (Web3) – The instantiated web3 provider.

  • account_address (str) – The address of the account to fund.

  • amount_wei (int) – Amount_wei to fund, in wei.

Returns:

success can be checked by inspecting rpc_response.error

Return type:

RPCResponse

agent0.ethpy.base.rpc_interface.get_account_balance(web3: web3.Web3, account_address: str) int | None

Get the balance for an account deployed on the web3 provider.

Parameters:
  • web3 (Web3) – The instantiated web3 provider.

  • account_address (str) – The address of the account to fund.

Returns:

The balance of the account in wei, or None if the rpc call failed.

Return type:

int | None