Refactor Fragment selector and topichash calculation in Contract (#3353).

This commit is contained in:
Richard Moore 2022-09-15 22:27:21 -04:00
parent d7c6252521
commit 12a13c6d56

View File

@ -354,7 +354,7 @@ async function getSubTag(contract: BaseContract, event: ContractEventName): Prom
} else if (typeof(event) === "string") {
// Event name (name or signature); `"Transfer"`
fragment = contract.interface.getEvent(event);
topics = [ contract.interface.getEventTopic(fragment) ];
topics = [ fragment.topicHash ];
} else if (isDeferred(event)) {
// Deferred Topic Filter; e.g. `contract.filter.Transfer(from)`
@ -364,7 +364,7 @@ async function getSubTag(contract: BaseContract, event: ContractEventName): Prom
} else if ("fragment" in event) {
// ContractEvent; e.g. `contract.filter.Transfer`
fragment = event.fragment;
topics = [ contract.interface.getEventTopic(fragment) ];
topics = [ fragment.topicHash ];
} else {
console.log(event);