param.substring not a function- web3.js, ganache

Viewed 135

I get a param.substring is not a function error when trying to call a smart contract function (deployed using ganache and truffle).

This is my code.

 const  web3 = new Web3(window.ethereum);
   const MyContract = new web3.eth.Contract(ABI, ContractAddress);
   console.log(MyContract);

   const create= await MyContract.methods.createToken(hash,letterid).send({ from: window.ethereum.selectedAddress });

This is the error.

This is the error.

please help!

ganache version- 2.5.4 web3 version- 1.7.4

1 Answers

param.substring is not a function is an error associated with parsing data that is not of type string as one. Check where your ABI is defined and ensure the JSON code is parsed .toString().

If that is already the case, kindly check if Metamask is installed in your browser.

Related