Skip to content

Commit a56a0a3

Browse files
committed
Fixed listenerCount for contract when requesting for all events (#1205).
1 parent 4ad47b1 commit a56a0a3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/contracts/src.ts/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,11 @@ export class Contract {
10161016

10171017
listenerCount(eventName?: EventFilter | string): number {
10181018
if (!this.provider) { return 0; }
1019+
if (eventName == null) {
1020+
return Object.keys(this._runningEvents).reduce((accum, key) => {
1021+
return accum + this._runningEvents[key].listenerCount();
1022+
}, 0);
1023+
}
10191024
return this._getRunningEvent(eventName).listenerCount();
10201025
}
10211026

0 commit comments

Comments
 (0)