Hey guys, Iām implementing an NFT Staking on my website using Moralis. I canāt find a way to executeFunction
where the user needs to approve on Metamask for the transaction. Looks like for executeFunction, approval isnāt needed, but for something like actually staking, i need for metamask to popup the approval screen for the user.
I also tried using return Moralis.Web3API.native.runContractFunction(options);
but not asking for permission either from Metamask.
Iām constantly getting an error
execution reverted: ERC721: transfer caller is not owner nor approved"
This is what Iām sending:
stakeNFTSBatchByTokenIds: function (tokenIds, abiData) {
const options = {
chain: process.env === "production" ? "matic" : "mumbai",
contractAddress: process.env.VUE_APP_STAKE_CONTRACT_TEST,
functionName: "stakeBatch",
abi: abiData,
params: {
tokenIds: tokenIds
}
};
return Moralis.executeFunction(options);
}
Effectively, my account is the owner of those NFTs so it shouldnāt be an āownershipā thing. Metamask is never showing any approval screen so my guess is that the problem comes from that.
Does anyone know how to accomplish it? Thanks in advance.