I deployed a contract and would like to watch for events on that contract.
var access_manager_erc20_abi = require('./AccessManagerERC20_abi.js'); //To read the abi.
//In this js file i export abi into a variable and use it while creating instance of contract below.
//Smart contract address
var AccessManagerERC20ContractAddress = "0x3267ced1528c7eabe69bd129b3d0faf9986d6b55";
//creating instance of contract
AccessManagerERC20Contract = await new web3.eth.Contract(access_manager_erc20_abi,AccessManagerERC20ContractAddress);
watching for events, followed documentation from https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#events
AccessManagerERC20Contract.events.getAccessERC20Event({
filter: {_producerGatewayID:acc[1]}}, function(error, event){ console.log(event); })
.on('data', function(event){
console.log(event); // same results as the optional callback above
})
.on('changed', function(event){
// remove event from local database
})
.on('error', console.error);
when I try to execute this piece of code, it says
TypeError: AccessManagerERC20Contract.events.getAccessERC20Event is not a function
Can someone help me please. I am using web 3 v1.0.0. beta.
Thanks in advance
getAccessERC20Event
? Could you share your contract code or ABI?AccessManagerERC20Contract.getAccessERC20Event().watch(function (error, result){ //do something with results here })