Skip to content

Commit

Permalink
Fixed getLogs filter deserialization (#805).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Apr 28, 2020
1 parent 000aaaf commit 393c0c7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/providers/src.ts/base-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function serializeTopics(topics: Array<string | Array<string>>): string {
sorted.sort();

return sorted.join("|");

} else {
return checkTopic(topic);
}
Expand All @@ -58,10 +59,15 @@ function serializeTopics(topics: Array<string | Array<string>>): string {

function deserializeTopics(data: string): Array<string | Array<string>> {
if (data === "") { return [ ]; }

return data.split(/&/g).map((topic) => {
return topic.split("|").map((topic) => {
if (topic === "") { return [ ]; }

const comps = topic.split("|").map((topic) => {
return ((topic === "null") ? null: topic);
});

return ((comps.length === 1) ? comps[0]: comps);
});
}

Expand Down

0 comments on commit 393c0c7

Please sign in to comment.