Hello guys. I'm stuck here. I want to get token balance for a given eth address using web3 or whatever you want. If I search online there are just answer 4/5 years old.
The last code I tried but got error was in a post on this subreddit:
from web3 import Web3, IPCProvider
import json
token_t_abi = json.loads('[{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]')
wallet_w = '0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE'
w3 = Web3(IPCProvider())
token = w3.eth.contract(
'0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE',
abi=token_t_abi,
)
print(
token.call
().balanceOf(wallet_w))
Somebody can help me?
[link] [comments]
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments