Skip to content

Commit

Permalink
Fixed filtering with null non-indexed parameters (#305).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Oct 13, 2018
1 parent 6996dd8 commit 6ac2d92
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src.ts/utils/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,21 @@ class _EventDescription extends Description implements EventDescription {

let topics: Array<string> = [];
if (!this.anonymous) { topics.push(this.topic); }

params.forEach((arg, index) => {
if (arg === null) {
topics.push(null);
return;
}

let param = this.inputs[index];

if (!param.indexed) {
errors.throwError('cannot filter non-indexed parameters; must be null', errors.INVALID_ARGUMENT, { argument: (param.name || index), value: arg });
if (arg != null) {
errors.throwError('cannot filter non-indexed parameters; must be null', errors.INVALID_ARGUMENT, { argument: (param.name || index), value: arg });
}
return;
}

if (param.type === 'string') {
if (arg == null) {
topics.push(null);
} else if (param.type === 'string') {
topics.push(id(arg));
} else if (param.type === 'bytes') {
topics.push(keccak256(arg));
Expand Down

0 comments on commit 6ac2d92

Please sign in to comment.