i have an issue to pass value from DAPP to Smart Contract. i need work around on how to do it,
DAPP code go’s as follows:
from moralis import evm_api
api_key = “797977”
params = {
“address”: “0xA515e77Db1A9EA8135E5Ca7091ee62050781DdFB”,
“function_name”: “store”,
“chain”: “goerli”,
}
body = {
“abi”: [
{
“inputs”: [],
“name”: “retrieve”,
“outputs”: [
{
“internalType”: “uint256”,
“name”: “”,
“type”: “uint256”
}
],
“stateMutability”: “view”,
“type”: “function”
},
{
“inputs”: [
{
“internalType”: “uint256”,
“name”: “num”,
“type”: “uint256”
}
],
“name”: “store”,
“outputs”: [],
“stateMutability”: “nonpayable”,
“type”: “function”
}
],
“params”: {
“num”:333
},
}
result = evm_api.utils.run_contract_function(
api_key=api_key,
params=params,
body=body,
)
print(result)
error i am geting is:
File “C:\Python311\Lib\site-packages\openapi_evm_api\paths\address_function\post.py”, line 282, in _run_contract_function_oapg
raise exceptions.ApiException(api_response=api_response)
openapi_evm_api.exceptions.ApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({‘Date’: ‘Thu, 09 Feb 2023 07:36:56 GMT’, ‘Content-Type’: ‘application/json; charset=utf-8’, ‘Content-Length’: ‘47’, ‘Connection’: ‘keep-alive’, ‘CF-Ray’: ‘796aefd7dd293c0d-BLR’, ‘Access-Control-Allow-Origin’: ‘*’, ‘ETag’: ‘W/“2f-hO0GhDo9V2p5XHBGaziMPes/LWE”’, ‘Vary’: ‘Accept-Encoding’, ‘CF-Cache-Status’: ‘DYNAMIC’, ‘X-Powered-By’: ‘Express’, ‘x-request-weight’: ‘2’, ‘Server’: ‘cloudflare’})
HTTP response body: b’{“message”:“Function store
is not read only”}’