Hello,
So in my mint function on my smart conrtact I have a function that returns the cost of the NFT given the _mintAmount. I want to use this function to place into the msg.Value section on the async mint function. But when I do so, nothing happens when I click the mint button, and I check the console and nothing has logged. Has anybody else ran into this problem?
Here is my js code:
async function mint() {
await Moralis.enableWeb3({ provider: "metamask" });
console.log("HelloWorld");
const price = await Moralis.Web3API.native.runContractFunction(checkCost);
const sendOptions = {
contractAddress: "0xa1A3012FbB75157A63F032a635F8039ec2376DF9",
functionName: "checkCost",
abi: ABI,
params: {
_mintAmount: price,
}
};
console.log("Helloworld");
const mintAmount = document.getElementById("mintAmount").value;
const sendOptions = {
contractAddress: "0xa1A3012FbB75157A63F032a635F8039ec2376DF9",
functionName: "mint",
abi: ABI,
params: {
_mintAmount: mintAmount,
}, msgValue: Moralis.Units.Token(price);,
};
await Moralis.executeFunction(sendOptions);
await transaction.wait();
console.log(message);
}
document.getElementById("login").onclick = login;
document.getElementById("mint").onclick = mint;
document.getElementById("mintAmount").value = mintAmount;