How do I stop Metamask estimating its gas from my websites estimate (Its higher than metamasks)

Hi,
When I make a purchase through my Dapp it always gives me a gas recommendation from my website which is quite a bit higher in gas than if I cancel and choose metamasks gas fees.
Is this as intended or have I got something in my code wrong? I will link code below, and last question I promise haha.

Thanks for any help

async function mintXXXXX(how_many_XXXXX) {

if (XXXXXContract) {



  const price = Number(XXXXXPrice)  * how_many_XXXXX

  const gasAmount = await XXXXXContract.methods.mintXXXXX(how_many_XXXXX)

  console.log({from: walletAddress, value: price})

  cryptokiwisContract.methods

        .mintXXXXX(how_many_XXXXX)

        .send({from: walletAddress, value: price, gas: 0})

        .on('transactionHash', function(hash){

          console.log("transactionHash", hash)

        })

     

} else {

    console.log("Wallet not connected")

}

This topic was automatically closed after 30 days. New replies are no longer allowed.