From 1043def46c137c9d308b3201eddc0d08afa34b10 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 6 Oct 2017 12:58:17 +0300 Subject: Install js-sha3 and use it for keccak256 --- src/utils/filter_utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/utils/filter_utils.ts') diff --git a/src/utils/filter_utils.ts b/src/utils/filter_utils.ts index ee39b6836..2bd745815 100644 --- a/src/utils/filter_utils.ts +++ b/src/utils/filter_utils.ts @@ -2,6 +2,7 @@ import * as _ from 'lodash'; import * as Web3 from 'web3'; import * as uuid from 'uuid/v4'; import * as ethUtil from 'ethereumjs-util'; +import * as jsSHA3 from 'js-sha3'; import {ContractEvents, IndexedFilterValues, SubscriptionOpts} from '../types'; const TOPIC_LENGTH = 32; @@ -10,12 +11,12 @@ export const filterUtils = { generateUUID(): string { return uuid(); }, - getFilter(keccak256: (data: string) => string, address: string, eventName: ContractEvents, + getFilter(address: string, eventName: ContractEvents, indexFilterValues: IndexedFilterValues, abi: Web3.ContractAbi, subscriptionOpts?: SubscriptionOpts): Web3.FilterObject { const eventAbi = _.find(abi, {name: eventName}) as Web3.EventAbi; const eventSignature = filterUtils.getEventSignatureFromAbiByName(eventAbi, eventName); - const topicForEventSignature = keccak256(eventSignature); + const topicForEventSignature = jsSHA3.keccak256(eventSignature); const topicsForIndexedArgs = filterUtils.getTopicsForIndexedArgs(eventAbi, indexFilterValues); const topics = [topicForEventSignature, ...topicsForIndexedArgs]; let filter: Web3.FilterObject = { -- cgit v1.2.3