aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utils/event_utils.ts7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/utils/event_utils.ts b/src/utils/event_utils.ts
index 07418cbc4..e8f30e1a8 100644
--- a/src/utils/event_utils.ts
+++ b/src/utils/event_utils.ts
@@ -1,5 +1,4 @@
import * as _ from 'lodash';
-import * as Web3 from 'web3';
import {EventCallback, ContractEventArg, ContractEvent, ContractEventObj, ContractEventEmitter} from '../types';
import * as BigNumber from 'bignumber.js';
import promisify = require('es6-promisify');
@@ -29,10 +28,8 @@ export const eventUtils = {
const wrapIfBigNumber = (value: ContractEventArg): ContractEventArg => {
// HACK: The old version of BigNumber used by Web3@0.19.0 does not support the `isBigNumber`
// and checking for a BigNumber instance using `instanceof` does not work either. We therefore
- // compare the constructor functions of the possible BigNumber instance and the BigNumber used by
- // Web3.
- const web3BigNumber = (Web3.prototype as any).BigNumber;
- const isWeb3BigNumber = web3BigNumber.toString() === value.constructor.toString();
+ // check if the value constructor is a bignumber constructor.
+ const isWeb3BigNumber = _.startsWith(value.constructor.toString(), 'function BigNumber(');
return isWeb3BigNumber ? new BigNumber(value) : value;
};
event.args = _.mapValues(event.args, wrapIfBigNumber);