Keep extra filter topics when using Frgment filters in Contracts.
This commit is contained in:
parent
d88ee45937
commit
efaafb203f
@ -346,10 +346,17 @@ class FragmentRunningEvent extends RunningEvent {
|
|||||||
readonly interface: Interface;
|
readonly interface: Interface;
|
||||||
readonly fragment: EventFragment;
|
readonly fragment: EventFragment;
|
||||||
|
|
||||||
constructor(address: string, contractInterface: Interface, fragment: EventFragment) {
|
constructor(address: string, contractInterface: Interface, fragment: EventFragment, topics?: Array<string>) {
|
||||||
let filter = {
|
let filter: EventFilter = {
|
||||||
address: address,
|
address: address
|
||||||
topics: [ contractInterface.getEventTopic(fragment) ]
|
}
|
||||||
|
|
||||||
|
let topic = contractInterface.getEventTopic(fragment);
|
||||||
|
if (topics) {
|
||||||
|
if (topic !== topics[0]) { errors.throwArgumentError("topic mismatch", "topics", topics); }
|
||||||
|
filter.topics = topics.slice();
|
||||||
|
} else {
|
||||||
|
filter.topics = [ topic ];
|
||||||
}
|
}
|
||||||
|
|
||||||
super(getEventTag(filter), filter);
|
super(getEventTag(filter), filter);
|
||||||
@ -646,7 +653,7 @@ export class Contract {
|
|||||||
if (eventName.topics[0]) {
|
if (eventName.topics[0]) {
|
||||||
let fragment = this.interface.getEvent(eventName.topics[0]);
|
let fragment = this.interface.getEvent(eventName.topics[0]);
|
||||||
if (fragment) {
|
if (fragment) {
|
||||||
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment));
|
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user