From 944f51d66c5afb92008ddd1bff9fe83ce51a5e10 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 4 Oct 2017 12:55:16 +0300 Subject: Use SolidityTypes --- src/utils/abi_decoder.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/utils') diff --git a/src/utils/abi_decoder.ts b/src/utils/abi_decoder.ts index 4646016f2..e9ba3bc5a 100644 --- a/src/utils/abi_decoder.ts +++ b/src/utils/abi_decoder.ts @@ -1,7 +1,7 @@ import * as Web3 from 'web3'; import * as _ from 'lodash'; import * as BigNumber from 'bignumber.js'; -import {AbiType, DecodedLogArgs, DecodedArgs, LogWithDecodedArgs, RawLog} from '../types'; +import {AbiType, DecodedLogArgs, DecodedArgs, LogWithDecodedArgs, RawLog, SolidityTypes} from '../types'; import * as SolidityCoder from 'web3/lib/solidity/coder'; export class AbiDecoder { @@ -35,9 +35,11 @@ export class AbiDecoder { value = decodedData[dataIndex]; dataIndex++; } - if (param.type === 'address') { + if (param.type === SolidityTypes.Address) { value = this.padZeros(new BigNumber(value).toString(16)); - } else if (param.type === 'uint256' || param.type === 'uint8' || param.type === 'int' ) { + } else if (param.type === SolidityTypes.Uint256 || + param.type === SolidityTypes.Uint8 || + param.type === SolidityTypes.Uint ) { value = new BigNumber(value); } decodedParams[param.name] = value; -- cgit v1.2.3