Pons, an async Ethereum RPC client#
A quick usage example:
import trio
from eth_account import Account
from pons import Client, HTTPProvider, AccountSigner, Address, Amount
async def main():
provider = HTTPProvider("<your provider's https endpoint>")
client = Client(provider)
acc = Account.from_key("0x<your secret key>")
signer = AccountSigner(acc)
async with client.session() as session:
my_balance = await session.eth_get_balance(signer.address)
print("My balance:", my_balance.as_ether(), "ETH")
another_address = Address.from_hex("0x<another_address>")
await session.transfer(signer, another_address, Amount.ether(1.5))
another_balance = await session.eth_get_balance(another_address)
print("Another balance:", another_balance.as_ether(), "ETH")
trio.run(main)
My balance: 100.0 ETH
Another balance: 1.5 ETH
For more usage information, proceed to Tutorial.