tessl install tessl/pypi-web3@7.13.0A Python library for interacting with Ethereum blockchain
Agent Success
Agent success rate when using this tile
88%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.01x
Baseline
Agent success rate without this tile
87%
Build a simple account balance checker that connects to an Ethereum node and retrieves balance information for Ethereum addresses.
Your implementation should:
@generates
class BalanceChecker:
"""
A class for checking Ethereum account balances.
"""
def __init__(self, provider_url: str):
"""
Initialize the balance checker with an Ethereum node URL.
Args:
provider_url: HTTP URL of the Ethereum node (e.g., 'http://localhost:8545')
"""
pass
def get_balance_wei(self, address: str) -> int:
"""
Get the balance of an address in wei.
Args:
address: Ethereum address or ENS name
Returns:
Balance in wei as an integer
"""
pass
def get_balance_ether(self, address: str) -> float:
"""
Get the balance of an address in ether.
Args:
address: Ethereum address or ENS name
Returns:
Balance in ether as a float
"""
pass
def is_connected(self) -> bool:
"""
Check if the connection to the Ethereum node is active.
Returns:
True if connected, False otherwise
"""
passProvides Ethereum blockchain interaction capabilities including connecting to nodes, querying balances, unit conversion, and ENS resolution.