NEWTON
Asked
3 months ago
15
views
0
I try to execute a code with get_balance_sync
method:
However, I got this error:
starknet_py.net.client_errors.ClientError: Client failed with code 500: {"code": "StarknetErrorCode.ENTRY_POINT_NOT_FOUND_IN_CONTRACT", "message": "Error at pc=0:10:\nGot an exception while executing a hint.\nCairo traceback (most recent call last):\nUnknown location (pc=0:228)\nUnknown location (pc=0:214)\n\nError in the called contract (0x7f81ea93daf9c49494e3131b95646c3a8df5d97d151cc6484d49eaebe3e3d0a):\nEntry point 0x2e4263afad30923c891518314c3c95dbe830a16874e8abc5777a9a20b54c76e not found in contract with class hash 0x3ae692aaf1ded26a0b58cf42490f757563850acea887ed57b4894fee8279063."}
Can you help me to resolve this?
Newton
asked
3 months ago
0
Accepted answer
This error means that the function you tried to call does not exist in the contract (AccountClient.get_balance()
takes token_address
as optional input, and calls "balanceOf"
function on the contract deployed at token_address).
Your code is almost correct, except for the last part, where you specify token_address
in
call_result = account_client_testnet.get_balance_sync()
So, the full code for getting the balance of an account should be:
account = AccountClient(
client=GatewayClient(net="mainnet"),
address="0x07f81ea93daf9c49494e3131b95646c3a8df5d97d151cc6484d49eaebe3e3d0a",
key_pair=KeyPair(private_key=123, public_key=456),
chain=StarknetChainId.MAINNET,
)
balance = account.get_balance_sync()
Newton
answered
3 months ago
Declaring a StarkNet contract on DevNet with Account() but I get GatewayError in StarkNetJS
A plan to get better visibility when a transaction got received but not placed into a block?
Why does range_check_ptr chek for [0, 2^128) instead of [0, P/2)
StarknetErrorCode.ENTRY_POINT_NOT_FOUND_IN_CONTRACT error in Cairo. Can anyone help?
What is the inefficiency in this cairo code using alloc_locals
Checking result of an L1 -> L2 message/invoke in Starknet
What is SHARP in Cairo Language?
What is Starknet.js?
How do I create account using starknetjs?
How to select the network my Pathfinder node runs on?
How do I create AX (ArgentX) contract using starknetjs?
How do I get started with starknetjs?
What resources (Github repos, projects) do you follow about Cairo Language? Why?
The only way to invoke a contract is using migrations (this applies for both devnet and testnet?)