aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src/utils/log_decoder.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/contracts/src/utils/log_decoder.ts')
-rw-r--r--packages/contracts/src/utils/log_decoder.ts11
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)}`);