Refactor abi decoder

This commit is contained in:
Leonid Logvinov
2017-10-03 15:52:28 +03:00
parent efa85f844b
commit 87374d7f46

View File

@@ -1,7 +1,7 @@
import * as Web3 from 'web3'; import * as Web3 from 'web3';
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as BigNumber from 'bignumber.js'; import * as BigNumber from 'bignumber.js';
import {AbiType, DecodedLogArgs, DecodedArgs, LogWithDecodedArgs} from '../types'; import {AbiType, DecodedLogArgs, DecodedArgs, LogWithDecodedArgs, RawLog} from '../types';
import * as SolidityCoder from 'web3/lib/solidity/coder'; import * as SolidityCoder from 'web3/lib/solidity/coder';
export class AbiDecoder { export class AbiDecoder {
@@ -10,7 +10,7 @@ export class AbiDecoder {
constructor(abiArrays: Web3.AbiDefinition[][]) { constructor(abiArrays: Web3.AbiDefinition[][]) {
_.map(abiArrays, this.addABI.bind(this)); _.map(abiArrays, this.addABI.bind(this));
} }
public tryToDecodeLogOrNoOp(log: Web3.LogEntry): LogWithDecodedArgs|Web3.LogEntry { public tryToDecodeLogOrNoOp(log: Web3.LogEntry): LogWithDecodedArgs|RawLog {
const methodId = log.topics[0]; const methodId = log.topics[0];
const event = this.methodIds[methodId]; const event = this.methodIds[methodId];
if (_.isUndefined(event)) { if (_.isUndefined(event)) {