$(document).ready(function(){
web3c = new Web3(ethereum);
const contractAddress="0x6eACA1A0406Def265a1ccbb193e09DA4Fd93635D";
const contractABI= [
{
"inputs": [
{
"internalType": "string",
"name": "messageData",
"type": "string"
}
],
"stateMutability": "view",
"type": "function",
"constant": true
}
],
ContractObj = new web3c.eth.Contract(contractABI,contractAddress);
})
async function setData(){
value = document.getElementById("dataValue").value;
tx= await ContractObj.methods.storeData(value).send({from: ethereum.selectedAddress});
console.log(tx);
}
async function getData(){
result = await ContractObj.methods.getData().call();
console.log(result);
alert("Result "+ result);
}
Here ContractObj not defined error occuring ...I am a beginner..Anyone pls help
change
to
or
initialize ContractObj as a variable above your code.