web3_multicall
Project description
web3_multicall
Description
web3_multicall
Install
pip install web3_multicall
# or
pip3 install web3_multicall
Usage
from kw3 import KWeb3
from web3_multicall import Multicall
w3 = KWeb3('https://bsc-dataseed.binance.org/')
busd = w3.busd()
multicall = Multicall(w3.eth) # address is not needed, unless you are on an unsupported chain (check 'web3_multicall/models/enums/network.py')
multicall_result = multicall.aggregate([
busd.name_method(),
busd.symbol_method(),
busd.decimals_method(),
busd.total_supply_method(),
busd.balance_of_method('YOUR_ADDRESS')
])
multicall_result.jsonprint()
# Prints
#
# {
# "block_number": 7714239,
# "results": [
# {
# "contract_address": "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
# "function_name": "name",
# "inputs": [],
# "results": [
# "BUSD Token"
# ]
# },
# {
# "contract_address": "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
# "function_name": "symbol",
# "inputs": [],
# "results": [
# "BUSD"
# ]
# },
# {
# "contract_address": "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
# "function_name": "decimals",
# "inputs": [],
# "results": [
# 18
# ]
# },
# {
# "contract_address": "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
# "function_name": "totalSupply",
# "inputs": [],
# "results": [
# 4200999999996203280118545633
# ]
# },
# {
# "contract_address": "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",
# "function_name": "balanceOf",
# "inputs": [
# {
# "name": "account",
# "value": "YOUR_ADDRESS",
# "solidity_type": "address"
# }
# ],
# "results": [
# 0
# ]
# }
# ]
# }
Dependencies
eth-abi, eth-utils, jsoncodable, kw3, web3, web3-wrapped-contract
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
web3_multicall-0.0.7.tar.gz
(6.4 kB
view hashes)
Built Distribution
Close
Hashes for web3_multicall-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 818016a382a4adc761272c651ab65d7aa7ef30b87654ff4fad5d084c28b3a500 |
|
MD5 | 19a7d2720f430de2564cac173319aed1 |
|
BLAKE2b-256 | 8b1c485bbcd20fd0275cd8d6b2366f75fc811d6634a8bb1e3a87458017100507 |