No, I mean in admin.moralis.io.
What is the connection with tables?
There is a function at the end, one specific to runContractFunction
Ok I guess itās not the problem with connection between next app and moralis, but weirdā¦ There should be data for this address, what is other way to check the data of my address if it got those rewards etc.
Try to format that parameter. It didnāt work yet
example that should work:
curl -X 'POST' \
'https://deep-index.moralis.io/api/v2/0xe11b8e0243e3eed9df387ca279caad4d2b35951a/function?chain=rinkeby&function_name=uri' \
-H 'accept: application/json' \
-H 'X-API-Key: API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"abi": [{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}],
"params": {"id": 100 }
}'
Are you French? (Just curious, Iām not), but if itās you, you amazed me with this image
Ok it finally worked with different function, still got troubles with ārewardsā function, but Iām on a good path, daaamnā¦
Wow, I would say it works, thank you so much <3 Iāve spent so many days on thisā¦ Now I have to do the same inside next app, maybe it will work The only thing that curious me is that it show different value than it should be What function would you recommend for write functions, like stakeā¦ executeFunction? Could you type example code? Thanks! Youāre amazing, I hope you get paid well, awesome moderationā¦ 20 mins for response, have a good day
Moralis.executeFunction should work, there is also an equivalent in react for it
Ok, thanksā¦ I will try it out, we will see
Wait noā¦ It doesnāt change anything, Iāve used the ABI from my code, admin panel returns value, but I didnāt get data with useApiContract
what do you see in network tab? still 400 error?
I think I might find a solution, but not sure how to fix thatā¦ If I put wallet address inside " " it returns normal address inside āā, but if I donāt use " " it returns that
Maybe it canāt be inside " " to find data of that address inside contract, but it itās too long and not inside " " it changes the input toā¦ You know
it should be inside those " " so it sees it as a string
Ok so still 400 error
can you paste the server url?
const {
runContractFunction,
data,
error,
onSuccess,
onError,
} = useApiContract({
address: "0xE0C255a5D89b6D9fedb5C4e43c11341a072e3bcc",
functionName: "rewards",
abi: {
"constant": true,
"inputs": [
{
"internalType": "address",
"name": "_address",
"type": "address"
}
],
"name": "rewards",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
chain: 'bsc',
params: { _address: '0xF009428BE1A9a550f2d5DB7e49FF439617928097' }
});
useEffect(() => {
if(isInitialized) runContractFunction({
onSuccess: (res) => console.log(res),
onError: (err) => console.log(err),
});
}, [isInitialized])
console.log(data);
you just have to write the abi in another format, to also have [], just add [ and ] for your abi