diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-01 01:14:23 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-01 02:04:05 +0800 |
commit | fa3d011f68630e36b1a3812dd493a5144ebc6c53 (patch) | |
tree | 61bb2d6030e573f4777f477fa94ecc0533cf9f8b /packages/contracts/src/utils/log_decoder.ts | |
parent | a7fc9caacb7b98c7d79333e60ee9862945a67ecc (diff) | |
download | dexon-sol-tools-fa3d011f68630e36b1a3812dd493a5144ebc6c53.tar.gz dexon-sol-tools-fa3d011f68630e36b1a3812dd493a5144ebc6c53.tar.zst dexon-sol-tools-fa3d011f68630e36b1a3812dd493a5144ebc6c53.zip |
Add ethereum-types to extraFileIncludes
Diffstat (limited to 'packages/contracts/src/utils/log_decoder.ts')
-rw-r--r-- | packages/contracts/src/utils/log_decoder.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/packages/contracts/src/utils/log_decoder.ts b/packages/contracts/src/utils/log_decoder.ts index 2839cfe84..07d10e69d 100644 --- a/packages/contracts/src/utils/log_decoder.ts +++ b/packages/contracts/src/utils/log_decoder.ts @@ -1,7 +1,14 @@ import { ContractArtifact } from '@0xproject/sol-compiler'; import { AbiDecoder, BigNumber } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import { AbiDefinition, LogEntry, LogWithDecodedArgs, RawLog, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; +import { + AbiDefinition, + DecodedLogArgs, + LogEntry, + LogWithDecodedArgs, + RawLog, + TransactionReceiptWithDecodedLogs, +} from 'ethereum-types'; import * as _ from 'lodash'; import { artifacts } from './artifacts'; @@ -30,7 +37,7 @@ export class LogDecoder { }); this._abiDecoder = new AbiDecoder(abiArrays); } - public decodeLogOrThrow<ArgsType>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog { + public decodeLogOrThrow<ArgsType extends DecodedLogArgs>(log: LogEntry): LogWithDecodedArgs<ArgsType> | RawLog { const logWithDecodedArgsOrLog = this._abiDecoder.tryToDecodeLogOrNoop(log); if (_.isUndefined((logWithDecodedArgsOrLog as LogWithDecodedArgs<ArgsType>).args)) { throw new Error(`Unable to decode log: ${JSON.stringify(log)}`); |