I have developed a contract having mint, sell and buy functionality (GOERLI TESTNET). The token is being minted via contract (remix ethereum) but when we call the function from the moralis execute function, the metamask transaction message doesn’t confirm the transaction (the confirm button does nothing) Can anyone help me through this? Thank you.
Here is moralis discord link of my post in moralis discord https://discord.com/channels/819584798443569182/1042413979953287220
Smart Contract Function
using Counters for Counters.Counter;
address payable OwnerAddress = payable(walletaddress);
Counters.Counter private _tokenIds;
mapping(address => uint) public lastMintedId;
constructor() ERC721("nftname","nftsymbol"){}
function mintToken(string calldata tokenURI)
public
payable
{
require (msg.value == 0.004 ether);
payable(OwnerAddress).transfer(msg.value);
uint256 newItemId=_tokenIds.current();
_tokenIds.increment();
_safeMint(msg.sender,newItemId);
_setTokenURI(newItemId,tokenURI);
lastMintedId[msg.sender] = newItemId;
}
Front End Moralis
try {
await Moralis.executeFunction({
contractAddress: "contract address",
functionName: "mintToken",
abi: this.contractABI,
params: {
tokenURI: "http://gateway.moralisipfs.com/ipfs/QmcSEkHT5KKZhUQixweiBQwrD1bfYJyahJ11Y3UiU2xiD9",
},
msgValue: Moralis.Units.ETH(0.004),
onSuccess: (tx: any) => console.log(tx),
onError: (error: any) => console.log(error)
}).then(async (res) => {
console.log("minted NFT", res);
});
}
catch (error) {
console.log("error from minting", error);
}