Contract.methods.mint is not a function [SOLVED]

Supp guys… When click to mint returns contract.methods.mint is not a function. My contractAbi is the problem? How can I solve this, pls

it could be the abi if the abi doesn’t have that mint function

1 Like

i just copy contractAbi from remix. My abi is not valid? Maybe could be a wrong config?

This is my mint function

async function mint() {
    let tokenId = parseInt(document.getElementById("token_id_input").value);
    let address = document.getElementById("address_input").value
    let amount = parseInt(document.getElementById("amount_input").value)
    const accounts = await web3.eth.getAccounts();
    const contract = new web3.eth.Contract(contractAbi, CONTRACT_ADDRESS);
    contract.methods.mint(address, tokenId, amount).send({from: accounts[0], value: 0})
    .on("receipt", function(receipt){
        alert("Mint done")
    })
}
1 Like

that contractAbi could be a problem, depending what you have there

This is my abi.js. The mint function exists…

It looks like it has too many [ at the beginning

if you click on the original file, its okay, without many [

ABI has only one [ ]. Just remove one pair of [ ]

1 Like

Solved… my bad!! I didn’t pay attention to it.

1 Like