0

I'm trying to listen to all emitted events from a contract with Ethers.js and Websockets.

Any idea why this is not working?

var wsProvider = new ethers.providers.WebSocketProvider("wss://rinkeby.infura.io/ws/v3/idhere");

let contract = new ethers.Contract(rinkebyAddress, CONTRACT_ABI, wsProvider);

contract.on("*", (from, to, value, event) => {
  console.log("event: ", event);
});

The websockets connection seems to work because this returns all new blocks:

wsProvider.on('block', (blockNumber) => {
  console.log('New Block: ' + blockNumber);
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.