@ethersproject/providers
Advanced tools
Comparing version 5.0.0-beta.123 to 5.0.0-beta.124
@@ -35,19 +35,25 @@ "use strict"; | ||
// Event Serializeing | ||
function checkTopic(topic) { | ||
if (topic == null) { | ||
return "null"; | ||
} | ||
if (bytes_1.hexDataLength(topic) !== 32) { | ||
errors.throwArgumentError("invalid topic", "topic", topic); | ||
} | ||
return topic.toLowerCase(); | ||
} | ||
function serializeTopics(topics) { | ||
return topics.map(function (topic) { | ||
if (typeof (topic) === "string") { | ||
return topic; | ||
} | ||
else if (Array.isArray(topic)) { | ||
if (Array.isArray(topic)) { | ||
var unique_1 = {}; | ||
topic.forEach(function (topic) { | ||
if (topic !== null && bytes_1.hexDataLength(topic) !== 32) { | ||
errors.throwError("invalid topic", errors.INVALID_ARGUMENT, { argument: "topic", value: topic }); | ||
} | ||
unique_1[checkTopic(topic)] = true; | ||
}); | ||
return topic.join(","); | ||
var sorted = Object.keys(unique_1); | ||
sorted.sort(); | ||
return sorted.join("|"); | ||
} | ||
else if (topic === null) { | ||
return ""; | ||
else { | ||
return checkTopic(topic); | ||
} | ||
return errors.throwError("invalid topic value", errors.INVALID_ARGUMENT, { argument: "topic", value: topic }); | ||
}).join("&"); | ||
@@ -57,14 +63,4 @@ } | ||
return data.split(/&/g).map(function (topic) { | ||
var comps = topic.split(","); | ||
if (comps.length === 1) { | ||
if (comps[0] === "") { | ||
return null; | ||
} | ||
return topic; | ||
} | ||
return comps.map(function (topic) { | ||
if (topic === "") { | ||
return null; | ||
} | ||
return topic; | ||
return topic.split("|").map(function (topic) { | ||
return ((topic === "null") ? null : topic); | ||
}); | ||
@@ -84,6 +80,6 @@ }); | ||
else if (Array.isArray(eventName)) { | ||
return "filter::" + serializeTopics(eventName); | ||
return "filter:*:" + serializeTopics(eventName); | ||
} | ||
else if (eventName && typeof (eventName) === "object") { | ||
return "filter:" + (eventName.address || "") + ":" + serializeTopics(eventName.topics || []); | ||
return "filter:" + (eventName.address || "*") + ":" + serializeTopics(eventName.topics || []); | ||
} | ||
@@ -90,0 +86,0 @@ throw new Error("invalid event - " + eventName); |
{ | ||
"name": "@ethersproject/providers", | ||
"version": "5.0.0-beta.123", | ||
"version": "5.0.0-beta.124", | ||
"description": "Error utility functions for ethers.", | ||
@@ -38,3 +38,3 @@ "main": "index.js", | ||
}, | ||
"tarballHash": "0x0cef712ab8bff712929945a3aae05e76a1a7243aad0199af4cd62f6d9ff9a299" | ||
"tarballHash": "0x6a324d78294d3c81eb29f899c574b25ccc6b6e1d74e72a9e921817c7ddfa3552" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115711
2640