diff options
author | Bryce <brycedneal@gmail.com> | 2018-06-23 07:39:58 +0800 |
---|---|---|
committer | Bryce <brycedneal@gmail.com> | 2018-06-23 07:41:47 +0800 |
commit | f7fe9b096115312f25f90a27a8f9e13e374dcc2b (patch) | |
tree | 9ad7cfb030db8172ceb90c74fbad4f996cb1e0d6 | |
parent | 9f8cad93f794b9a95b3a947c5c61eefcb603f2e9 (diff) | |
download | dexon-sol-tools-f7fe9b096115312f25f90a27a8f9e13e374dcc2b.tar.gz dexon-sol-tools-f7fe9b096115312f25f90a27a8f9e13e374dcc2b.tar.zst dexon-sol-tools-f7fe9b096115312f25f90a27a8f9e13e374dcc2b.zip |
Update at abi_decoder
-rw-r--r-- | packages/order-watcher/CHANGELOG.json | 4 | ||||
-rw-r--r-- | packages/order-watcher/package.json | 2 | ||||
-rw-r--r-- | packages/order-watcher/src/order_watcher/order_watcher.ts | 11 | ||||
-rw-r--r-- | packages/utils/CHANGELOG.json | 9 | ||||
-rw-r--r-- | packages/utils/package.json | 2 | ||||
-rw-r--r-- | packages/utils/src/abi_decoder.ts | 10 |
6 files changed, 22 insertions, 16 deletions
diff --git a/packages/order-watcher/CHANGELOG.json b/packages/order-watcher/CHANGELOG.json index 28b210b8e..00f6ad1b9 100644 --- a/packages/order-watcher/CHANGELOG.json +++ b/packages/order-watcher/CHANGELOG.json @@ -1,11 +1,9 @@ [ { - "timestamp": 1529701469, "version": "0.0.7", "changes": [ { - "note": "Fixes Uncaught Error in OrderWatcher", - "pr": 763 + "note": "Dependencies updated" } ] }, diff --git a/packages/order-watcher/package.json b/packages/order-watcher/package.json index efc44a89f..3335713a3 100644 --- a/packages/order-watcher/package.json +++ b/packages/order-watcher/package.json @@ -85,7 +85,7 @@ "@0xproject/order-utils": "^0.0.7", "@0xproject/types": "^0.8.1", "@0xproject/typescript-typings": "^0.4.1", - "@0xproject/utils": "^0.7.1", + "@0xproject/utils": "^0.7.3", "@0xproject/web3-wrapper": "^0.7.1", "ethereum-types": "^0.0.1", "bintrees": "^1.0.2", diff --git a/packages/order-watcher/src/order_watcher/order_watcher.ts b/packages/order-watcher/src/order_watcher/order_watcher.ts index bf31c9c4d..140aa341b 100644 --- a/packages/order-watcher/src/order_watcher/order_watcher.ts +++ b/packages/order-watcher/src/order_watcher/order_watcher.ts @@ -16,7 +16,6 @@ import { } from '@0xproject/types'; import { errorUtils, intervalUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; import * as _ from 'lodash'; import { artifacts } from '../artifacts'; @@ -242,15 +241,7 @@ export class OrderWatcher { return; } const log = logIfExists as LogEntryEvent; // At this moment we are sure that no error occured and log is defined. - let maybeDecodedLog; - try { - maybeDecodedLog = this._web3Wrapper.abiDecoder.tryToDecodeLogOrNoop<ContractEventArgs>(log); - } catch (error) { - if (error.code === ethers.errors.INVALID_ARGUMENT) { - return; // noop - } - throw error; - } + const maybeDecodedLog = this._web3Wrapper.abiDecoder.tryToDecodeLogOrNoop<ContractEventArgs>(log); const isLogDecoded = !_.isUndefined(((maybeDecodedLog as any) as LogWithDecodedArgs<ContractEventArgs>).event); if (!isLogDecoded) { return; // noop diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index ed5558981..1454312e9 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "version": "0.7.3", + "changes": [ + { + "note": "Fixes uncaught Error in abi_decoder", + "pr": 763 + } + ] + }, + { "version": "0.7.2", "changes": [ { diff --git a/packages/utils/package.json b/packages/utils/package.json index 06d67566c..ee5953801 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/utils", - "version": "0.7.1", + "version": "0.7.3", "engines": { "node": ">=6.12" }, diff --git a/packages/utils/src/abi_decoder.ts b/packages/utils/src/abi_decoder.ts index 931cb94b2..1f805c2f1 100644 --- a/packages/utils/src/abi_decoder.ts +++ b/packages/utils/src/abi_decoder.ts @@ -32,7 +32,15 @@ export class AbiDecoder { const decodedParams: DecodedLogArgs = {}; let topicsIndex = 1; - const decodedData = ethersInterface.events[event.name].parse(log.data); + let decodedData: any[]; + try { + decodedData = ethersInterface.events[event.name].parse(log.data); + } catch (error) { + if (error.code === ethers.errors.INVALID_ARGUMENT) { + return log; + } + throw error; + } let didFailToDecode = false; _.forEach(event.inputs, (param: EventParameter, i: number) => { |