I am using this code to find a usdt balance of a wallet
from tronpy import Tron
from tronpy.providers import HTTPProvider
client = Tron(network="nile")
# cntr = client.get_contract("THi2qJf6XmvTJSpZHc17HgQsmJop6kb3ia")
# print(dir(cntr.functions))
# client = Tron(network="nile")
cntr = client.get_contract("TXLAQ63Xg1NAzckPwKHvzw7CSEmLMEqcdj")
tron_account_address = "THYkuRwPKuSM4xbfoYqg8Nyn5UAw5kAVVR"
usdt_balance = cntr.functions.balanceOf(tron_account_address)
print(f"USDT Balance of {tron_account_address}: {usdt_balance / 10**6} USDT")
RESPONSE: USDT Balance of THYkuRwPKuSM4xbfoYqg8Nyn5UAw5kAVVR: 50000.0 USDT
And this works fine but the moment I go to use trongrid creds I get an error saying I cant call a contract without an ABI
from tronpy import Tron
from tronpy.providers import HTTPProvider
client = Tron(
HTTPProvider(api_key="insert_key"), network="nile"
)
cntr = client.get_contract("TXLAQ63Xg1NAzckPwKHvzw7CSEmLMEqcdj")
tron_account_address = "THYkuRwPKuSM4xbfoYqg8Nyn5UAw5kAVVR"
usdt_balance = cntr.functions.balanceOf(tron_account_address)
print(f"USDT Balance of {tron_account_address}: {usdt_balance / 10**6} USDT")
RESPONSE: raise ValueError("can not call a contract without ABI") ValueError: can not call a contract without ABI
Is anyone able to give me a little bit of guidance on whats happening here without the trongrid api key it works fine but with trongrid its no longe fetching the abi on its own?
Hi there,
I am using this code to find a usdt balance of a wallet
RESPONSE:
USDT Balance of THYkuRwPKuSM4xbfoYqg8Nyn5UAw5kAVVR: 50000.0 USDT
And this works fine but the moment I go to use trongrid creds I get an error saying I cant call a contract without an ABI
RESPONSE:
raise ValueError("can not call a contract without ABI") ValueError: can not call a contract without ABI
Is anyone able to give me a little bit of guidance on whats happening here without the trongrid api key it works fine but with trongrid its no longe fetching the abi on its own?