You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to listen for this event, we can either do contract.addListener("ChatSessionCreated", (...args) => console.log(args)) without any filtering or typed listener signature. As expected, args would be an array of three elements, eg:
All good so far. However, if I only add this, thing start to break. Despite having typing for the listener, args is an array only containing the object. The listener signature doesn't make a difference, either. Typings are wrong:
const filter = contract.filters.ChatSessionCreated()
await contract.on(filter, async (hash, creator, ...args) =>
console.log({ hash, creator })); // hash here is the object, creator is undefined!
To complicate things further, if I use two listeners again, but this time using filtering, only the "plain" listener will get the expected array of length 3. The filtered listener will only receive the object in the array:
Possibly related: #867
Let's say we have a contract that emits the following event:
event ChatSessionCreated(bytes32 indexed chatHash, address indexed creator);
When trying to listen for this event, we can either do
contract.addListener("ChatSessionCreated", (...args) => console.log(args))
without any filtering or typed listener signature. As expected, args would be an array of three elements, eg:If I add two event listeners, like below, it also works, printing the same array twice:
All good so far. However, if I only add this, thing start to break. Despite having typing for the listener,
args
is an array only containing the object. The listener signature doesn't make a difference, either. Typings are wrong:To complicate things further, if I use two listeners again, but this time using filtering, only the "plain" listener will get the expected array of length 3. The filtered listener will only receive the object in the array:
Not sure whether it's a TypeChain or Ethers issue.
The text was updated successfully, but these errors were encountered: