I'm using "web3": "^1.2.4"
This is how I connect to 'wss://kovan.infura.io/ws'
const web3 = new Web3(new Web3.providers.WebsocketProvider('wss://kovan.infura.io/ws'))
instance = new web3.eth.Contract(ABI, ADDRESS);
Here I am trying to call PastEvents and for listening
const eventOptions = { filter: {}, fromBlock: lastBlock, toBlock: 'latest' };
const events = await instance.getPastEvents('MyEvent', eventOptions);
instance.events.MyEvent(async function (error, result) {
console.log(result)
});
How to overcome this error?
wss://kovan.infura.io/yourProjectId/ws
).