I am attempting to call a method from a smart contract from my chrome console. My dApps index.html file is deployed locally at http://127.0.0.1:5500.
I set up web3 and instantiate a smart contract with the following code:
window.addEventListener('load', async () => {
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider);
console.log('metamask success');
await window.ethereum.enable();
web3.eth.defaultAccount = web3.eth.accounts.givenProvider.selectedAddress;
} else { // I removed this code for brevity
abi = [ { constant: false, ... // I removed the full abi for conciseness
MyContract = web3.eth.contract(abi);
contractInstance = MyContract.at("0xd01e06f2e70bea9ae7640367bdf0b24ac5f35ed1");
I can successfully make the following transaction from my console in Google Chrome:
web3.eth.sendTransaction({value: web3.utils.toWei('.1'), to: "0x493b6DEb52B40A517Fa64f580B5bfd325537764E"}, (e,r) =>{console.log(e,r)})
But when I try an make the following transaction:
contractInstance.notarize(item, (e,r) => {console.log(e,r)})
I get the following error message in my Chrome console:
Uncaught TypeError: Cannot read property 'match' of undefined
Any ideas on what is going on here?