0

I'm facing this error while I'm trying to mint with sending transaction

                const tx = {
                  from: accounts[0],
                  to: ContractAddress,
                  value: ethers.utils.parseEther("0.0005"),
                  nonce: await provider.getTransactionCount(
                    accounts[0],
                    "latest"
                  ),
                  gasLimit: ethers.utils.hexlify(10000),
                  gasPrice: ethers.utils.hexlify(
                    parseInt(await provider.getGasPrice())
                  ),
                };

                await contract.CustomMint(1, tx);
                signer.sendTransaction(tx).then((transaction) => {
                  console.dir(transaction);
                  alert("Send finished!");
                  if (transaction) {
                    alert("Minted! Check Your Opensea Account For CrownNFT!");
                    handleNewNotification("Success");
                    SetMinting(false);
                  }
                });
              }
            } catch (error) {
              console.log(error);
            }
3
  • Your approach is very strange. Why you need to send the tx as a paramter to the CustomMint call? Apr 25 at 11:34
  • So how can I use this approach? because the mint function is payable. I want to mint nft with a custom price which is described on my dapp so which approach is possible for that? Apr 25 at 11:49
  • 1
    Can you edit your question and add the CustomMint() function code? Apr 25 at 11:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.