0

Using Web3to execute transactions, and getting the following error:

Unhandled Rejection (TypeError): param.map is not a function Uncaught (in promise) TypeError: param.map is not a function at ABICoder.push../node_modules/web3-eth/node_modules/web3-eth-abi/lib/index.js.ABICoder.formatParam

Here is the snippet of code:

const detectEth = async () => {
    if (window.ethereum) {
      window.web3 = new web3(window.ethereum);
      await window.ethereum.enable()
    }
    else if (window.web3) {
      window.web3 = new web3(window.web3.currentProvider);
    }
    else {
      window.alert('Non-Ethereum browser detected. You should consider trying MetaMask!')
    }
  };

const mint = async () => {
    detectEth();

    const web3 = window.web3;

    const contract = new web3.eth.Contract(NFT_ABI, NFT_CONTRACT_ADDRESS, { gasLimit: "1000000" });

// This function works well
    const mintFees = await nftContract.methods.mintFees().call({
      from: accountAddress,
      to: NFT_CONTRACT_ADDRESS
    });

// ERROR coming from this line
    contract.methods.claim(index, hash, proof, id).send({
      from: accountAddress,
      value: mintFees
    }, (error, transactionHash) => {
        if (error) {
          console.log('In Error');
          console.log(error);
          hideSpinner();
        }
      });
}

Thanks for helping.

0

The issue was having undefined params.

1
  • Do you mean that some of the call parameters contract.methods.claim(index, hash, proof, id) were undefined?
    – Ismael
    Aug 15 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.