aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/utils/abi_decoder.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/0x.js/src/utils/abi_decoder.ts')
-rw-r--r--packages/0x.js/src/utils/abi_decoder.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/packages/0x.js/src/utils/abi_decoder.ts b/packages/0x.js/src/utils/abi_decoder.ts
index 6d15f1d6f..2d4e92558 100644
--- a/packages/0x.js/src/utils/abi_decoder.ts
+++ b/packages/0x.js/src/utils/abi_decoder.ts
@@ -3,11 +3,11 @@ import * as _ from 'lodash';
import * as Web3 from 'web3';
import * as SolidityCoder from 'web3/lib/solidity/coder';
-import {AbiType, ContractEventArgs, DecodedLogArgs, LogWithDecodedArgs, RawLog, SolidityTypes} from '../types';
+import { AbiType, ContractEventArgs, DecodedLogArgs, LogWithDecodedArgs, RawLog, SolidityTypes } from '../types';
export class AbiDecoder {
private _savedABIs: Web3.AbiDefinition[] = [];
- private _methodIds: {[signatureHash: string]: Web3.EventAbi} = {};
+ private _methodIds: { [signatureHash: string]: Web3.EventAbi } = {};
private static _padZeros(address: string) {
let formatted = address;
if (_.startsWith(formatted, '0x')) {
@@ -22,7 +22,8 @@ export class AbiDecoder {
}
// This method can only decode logs from the 0x & ERC20 smart contracts
public tryToDecodeLogOrNoop<ArgsType extends ContractEventArgs>(
- log: Web3.LogEntry): LogWithDecodedArgs<ArgsType>|RawLog {
+ log: Web3.LogEntry,
+ ): LogWithDecodedArgs<ArgsType> | RawLog {
const methodId = log.topics[0];
const event = this._methodIds[methodId];
if (_.isUndefined(event)) {
@@ -42,9 +43,11 @@ export class AbiDecoder {
let value = param.indexed ? log.topics[topicsIndex++] : decodedData[dataIndex++];
if (param.type === SolidityTypes.Address) {
value = AbiDecoder._padZeros(new BigNumber(value).toString(16));
- } else if (param.type === SolidityTypes.Uint256 ||
- param.type === SolidityTypes.Uint8 ||
- param.type === SolidityTypes.Uint) {
+ } else if (
+ param.type === SolidityTypes.Uint256 ||
+ param.type === SolidityTypes.Uint8 ||
+ param.type === SolidityTypes.Uint
+ ) {
value = new BigNumber(value);
}
decodedParams[param.name] = value;