Reduce nesting
This commit is contained in:
@@ -63,16 +63,17 @@ export class ContractWrapper {
|
|||||||
private _getTopicsForIndexedArgs(abi: Web3.EventAbi, indexFilterValues: IndexedFilterValues): Array<string|null> {
|
private _getTopicsForIndexedArgs(abi: Web3.EventAbi, indexFilterValues: IndexedFilterValues): Array<string|null> {
|
||||||
const topics: Array<string|null> = [];
|
const topics: Array<string|null> = [];
|
||||||
for (const eventInput of abi.inputs) {
|
for (const eventInput of abi.inputs) {
|
||||||
if (eventInput.indexed) {
|
if (!eventInput.indexed) {
|
||||||
if (_.isUndefined(indexFilterValues[eventInput.name])) {
|
continue;
|
||||||
topics.push(null);
|
}
|
||||||
} else {
|
if (_.isUndefined(indexFilterValues[eventInput.name])) {
|
||||||
const value = indexFilterValues[eventInput.name] as string;
|
topics.push(null);
|
||||||
const buffer = ethUtil.toBuffer(value);
|
} else {
|
||||||
const paddedBuffer = ethUtil.setLengthLeft(buffer, TOPIC_LENGTH);
|
const value = indexFilterValues[eventInput.name] as string;
|
||||||
const topic = ethUtil.bufferToHex(paddedBuffer);
|
const buffer = ethUtil.toBuffer(value);
|
||||||
topics.push(topic);
|
const paddedBuffer = ethUtil.setLengthLeft(buffer, TOPIC_LENGTH);
|
||||||
}
|
const topic = ethUtil.bufferToHex(paddedBuffer);
|
||||||
|
topics.push(topic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return topics;
|
return topics;
|
||||||
|
Reference in New Issue
Block a user