Client to interact with multiple EVM blockchain
Project description
Easy to use Python client to interact with multiple EVM blockchain.
Features
- Easily create a client to interact with EVM-compatible chains.
- Preconfigured for the most popular chains: Ethereum, Binance, Avalanche, Cronos, etc.
- Support for ERC20 operations, using the token name (e.g. USDC) instead of address.
- Exposes the underlying web3.py client to allow for more flexibility
Examples
Get the latest block on both Ethereum, BNB Chain and Avalanche:
from web3factory.factory import make_client
eth_block = make_client('ethereum').getLatestBlock()
bnb_block = make_client('binance').getLatestBlock()
avax_block = make_client('avalanche').getLatestBlock()
Get the USDC balance of the Ethereum foundation, and the BUSD balance of Binance's hot wallet:
from web3factory.factory import make_erc20_client
ef_address = "0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae"
ef_usdc = make_erc20_client("USDC", "ethereum").balanceOf(ef_address) / 10**6
bw_address = "0x8894e0a0c962cb723c1976a4421c95949be2d4e3"
bw_busd = make_erc20_client("BUSD", "binance").balanceOf(bw_address) / 10**18
Install
pip3 install -U web3client
It doesn't work 😡
Don't panic! Instead...
- Please check if your issue is listed in the Issues tab.
- If not, consider writing a new issue 🙂
Testing
pytest tests
TO DO
- Test ERC20 read functions
- Harmonize between camel case and snake case
- Easy accessors for token and network props
- Add write examples and tests
- Add Uniswap V2 LP contracts
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
web3client-0.3.4.tar.gz
(13.9 kB
view hashes)
Built Distribution
web3client-0.3.4-py3-none-any.whl
(15.4 kB
view hashes)
Close
Hashes for web3client-0.3.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f626846108cb350688b333e18d1e97e195ead597ba554e5e071cdf69e7c4247 |
|
MD5 | 85958815dbc933ae5635f548062f39b1 |
|
BLAKE2b-256 | e72928134bb3767f40b6539d95a90aa79fc92e012a0c07c66cf8bec3af5abdc7 |