aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-16 03:24:48 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-16 03:24:48 +0800
commit0a38bf8fd6d2b98a84671a152cc380458d2e5e7e (patch)
treeb04c8a270446d9762f141d9ed038a28c689eebe6 /packages/instant
parent2e61050a223a52b4b984034463887b0d579ce9b8 (diff)
downloaddexon-sol-tools-0a38bf8fd6d2b98a84671a152cc380458d2e5e7e.tar
dexon-sol-tools-0a38bf8fd6d2b98a84671a152cc380458d2e5e7e.tar.gz
dexon-sol-tools-0a38bf8fd6d2b98a84671a152cc380458d2e5e7e.tar.bz2
dexon-sol-tools-0a38bf8fd6d2b98a84671a152cc380458d2e5e7e.tar.lz
dexon-sol-tools-0a38bf8fd6d2b98a84671a152cc380458d2e5e7e.tar.xz
dexon-sol-tools-0a38bf8fd6d2b98a84671a152cc380458d2e5e7e.tar.zst
dexon-sol-tools-0a38bf8fd6d2b98a84671a152cc380458d2e5e7e.zip
Report ETH in units
Diffstat (limited to 'packages/instant')
-rw-r--r--packages/instant/src/redux/analytics_middleware.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/instant/src/redux/analytics_middleware.ts b/packages/instant/src/redux/analytics_middleware.ts
index 8dd674e94..01be9b988 100644
--- a/packages/instant/src/redux/analytics_middleware.ts
+++ b/packages/instant/src/redux/analytics_middleware.ts
@@ -1,11 +1,14 @@
import { ObjectMap } from '@0x/types';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
import { Middleware } from 'redux';
+import { ETH_DECIMALS } from '../constants';
+import { AccountState } from '../types';
import { analytics } from '../util/analytics';
-import { AccountState } from './../types';
import { Action, ActionTypes } from './actions';
+
import { State } from './reducer';
export const analyticsMiddleware: Middleware = store => next => middlewareAction => {
@@ -29,8 +32,11 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
curAccount.ethBalanceInWei &&
!_.isEqual(curAccount, prevAccount)
) {
- const ethBalanceInWei = curAccount.ethBalanceInWei.toString();
- analytics.addUserProperties({ ethBalanceInWei });
+ const ethBalanceInUnitAmount = Web3Wrapper.toUnitAmount(
+ curAccount.ethBalanceInWei,
+ ETH_DECIMALS,
+ ).toString();
+ analytics.addUserProperties({ ethBalanceInUnitAmount });
}
}