Hi, So I want to execute a function from a deployed contract address. The contract was deployed to Rinkeby testnet and the address is
0x3104d924a36A55D054544A8bAbFbeb1bd2ea7E5d
For reference, I have been able to execute a read only function that returns fata from the smart Contract. For this, I used both the runContract() method and the the executeFunction() method. And each time, the function was executed properly. However, as you know, the runContract method can only run a function that does returns data from the contract. I.e a function marked as view.
Basically, I want to execute a function that takes one parameter and makes changes to the blockchain (not read values off of it).
So for my payable function, I have tried to use the executeFunction() method. Please find the code belowâŚ
//code to run an async function hooked up to a button
async function extraMint(){
const ABI = [{âinputsâ:
[{âinternalTypeâ:âuint256â,ânameâ:âamountâ,âtypeâ:âuint256â}],ânameâ:"_extraMint",âoutputsâ:[],âstateMutabilityâ:âpayableâ,âtypeâ:âfunctionâ}
]
let options = {
contractAddress: 0x3104d924a36A55D054544A8bAbFbeb1bd2ea7E5d",
functionName: â_extraMintâ.
abi: ABI,
params: {
amount: 1000 //I tried using a dynamic input from the html where I read the value of an input field and convert it to an integer, it was throwing errors, decided to use a static input to test the process.
}
}
//in some cases, I added a web3 instance here. To be honest, I donât know what that does.
await Moralis.executeFunction(options)
}
The error generated says something about matching failure. I will attach an image of my console.
Remember, I already used Moralis to execute a function from this same deployed address and it worked smoothly. So I am sure itâs not my syntax or anything local from my PC. Thanks a lot.