Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
values.forEach((value, index) => {
let param = eventFragment.inputs[index];
if (!param.indexed) {
if (value != null) {
logger.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value);
}
return;
}
if (value == null) {
topics.push(null);
}
else if (param.type === "string") {
topics.push(id(value));
}
else if (param.type === "bytes") {
topics.push(keccak256(hexlify(value)));
}
else if (param.type.indexOf("[") !== -1 || param.type.substring(0, 5) === "tuple") {
logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value);
}
else {
// Check addresses are valid
if (param.type === "address") {
this._abiCoder.encode(["address"], [value]);
}
topics.push(hexZeroPad(hexlify(value), 32));
}
});
// Trim off trailing nulls
values.forEach(function (value, index) {
var param = eventFragment.inputs[index];
if (!param.indexed) {
if (value != null) {
logger.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value);
}
return;
}
if (value == null) {
topics.push(null);
}
else if (param.type === "string") {
topics.push(hash_1.id(value));
}
else if (param.type === "bytes") {
topics.push(keccak256_1.keccak256(bytes_1.hexlify(value)));
}
else if (param.type.indexOf("[") !== -1 || param.type.substring(0, 5) === "tuple") {
logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value);
}
else {
// Check addresses are valid
if (param.type === "address") {
_this._abiCoder.encode(["address"], [value]);
}
topics.push(bytes_1.hexZeroPad(bytes_1.hexlify(value), 32));
}
});
// Trim off trailing nulls
Wordlist.check = function (wordlist) {
var words = [];
for (var i = 0; i < 2048; i++) {
var word = wordlist.getWord(i);
if (i !== wordlist.getWordIndex(word)) {
return "0x";
}
words.push(word);
}
return hash_1.id(words.join("\n") + "\n");
};
Wordlist.register = function (lang, name) {
Interface.prototype._sighashify = function (functionFragment) {
return bytes_1.hexDataSlice(hash_1.id(functionFragment.format()), 0, 4);
};
Interface.prototype._topicify = function (eventFragment) {
function check(wordlist) {
var words = [];
for (var i = 0; i < 2048; i++) {
var word = wordlist.getWord(i);
if (i !== wordlist.getWordIndex(word)) {
return "0x";
}
words.push(word);
}
return hash_1.id(words.join("\n") + "\n");
}
exports.check = check;
_sighashify(functionFragment) {
return hexDataSlice(id(functionFragment.format()), 0, 4);
}
_topicify(eventFragment) {
static check(wordlist) {
const words = [];
for (let i = 0; i < 2048; i++) {
const word = wordlist.getWord(i);
if (i !== wordlist.getWordIndex(word)) {
return "0x";
}
words.push(word);
}
return id(words.join("\n") + "\n");
}
static register(lang, name) {
_topicify(eventFragment) {
return id(eventFragment.format());
}
getFunction(nameOrSignatureOrSighash) {