Hello, I am trying to run below snippet, it is throwing an error.
from starknet_py.contract import Contract
from starknet_py.net.client import Client
client = Client("testnet")
contract_address = "0x01336fa7c870a7403aced14dda865b75f29113230ed84e3a661f7af70fe83e7b"
key = 12345678
contract = Contract.from_address_sync(contract_address, client)
invocation = contract.functions["set_value"].invoke_sync(key, 7, max_fee=500)
invocation.wait_for_acceptance_sync()
_Got BadRequest while trying to access https://alpha4.starknet.io/gateway/add_transaction. Status code: 500; text: {"code": "StarknetErrorCode.UNSUPPORTED_SELECTOR_FOR_FEE", "message": "All transactions should go through the execute entrypoint."}.
Traceback (most recent call last):
File "/home/iodishar/.local/lib/python3.8/site-packages/services/external_api/client.py", line 121, in _send_request raise BadRequest(status_code=response.status, text=text)
services.external_api.client.BadRequest: HTTP error ocurred. Status: 500. Text: {"code": "StarknetErrorCode.UNSUPPORTED_SELECTOR_FOR_FEE", "message": "All transactions should go through the execute entrypoint."}
Traceback (most recent call last):
File "app/test.py", line 10, in
invocation = contract.functions["set_value"].invoke_sync(key, 7, max_fee=500)
File "/home/iodishar/.local/lib/python3.8/site-packages/starknet_py/utils/sync/sync.py", line 15, in impl
return sync_fun(*args, **kwargs)
File "/home/iodishar/.local/lib/python3.8/site-packages/asgiref/sync.py", line 218, in call
return call_result.result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 437, in result
return self.__get_result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
raise self._exception
File "/home/iodishar/.local/lib/python3.8/site-packages/asgiref/sync.py", line 284, in main_wrap
result = await self.awaitable(*args, **kwargs)
File "/home/iodishar/.local/lib/python3.8/site-packages/starknet_py/contract.py", line 354, in invoke
return await prepared_call.invoke(max_fee=max_fee, auto_estimate=auto_estimate)
File "/home/iodishar/.local/lib/python3.8/site-packages/starknet_py/contract.py", line 241, in invoke
response = await self._client.add_transaction(tx=tx)
File "/home/iodishar/.local/lib/python3.8/site-packages/starknet_py/net/client.py", line 248, in add_transaction
return await self._gateway.add_transaction(tx, token)
File "/home/iodishar/.local/lib/python3.8/site-packages/starkware/starknet/services/api/gateway/gateway_client.py", line 16, in add_transaction
raw_response = await self._send_request(
File "/home/iodishar/.local/lib/python3.8/site-packages/services/external_api/client.py", line 121, in send_request
raise BadRequest(status_code=response.status, text=text)
services.external_api.client.BadRequest: HTTP error ocurred. Status: 500. Text: {"code": "StarknetErrorCode.UNSUPPORTED_SELECTOR_FOR_FEE", "message": "All transactions should go through the execute entrypoint."}