aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-04 05:34:51 +0800
committerFabio Berger <me@fabioberger.com>2018-07-04 05:34:51 +0800
commitd09711363951f7ae25b3b3d5e091df7a420caf9f (patch)
tree05dc5ed5ccf151e9e2f99feb32b2d72faec0ffb7 /packages/website/ts/utils
parentcce2fb40a130edfd5116d74b294b5e8062751ffb (diff)
downloaddexon-sol-tools-d09711363951f7ae25b3b3d5e091df7a420caf9f.tar
dexon-sol-tools-d09711363951f7ae25b3b3d5e091df7a420caf9f.tar.gz
dexon-sol-tools-d09711363951f7ae25b3b3d5e091df7a420caf9f.tar.bz2
dexon-sol-tools-d09711363951f7ae25b3b3d5e091df7a420caf9f.tar.lz
dexon-sol-tools-d09711363951f7ae25b3b3d5e091df7a420caf9f.tar.xz
dexon-sol-tools-d09711363951f7ae25b3b3d5e091df7a420caf9f.tar.zst
dexon-sol-tools-d09711363951f7ae25b3b3d5e091df7a420caf9f.zip
Remove dep on Web3 in Website. Introduced InjectedWeb3 type.
Diffstat (limited to 'packages/website/ts/utils')
-rw-r--r--packages/website/ts/utils/analytics.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/website/ts/utils/analytics.ts b/packages/website/ts/utils/analytics.ts
index 928e45bc3..f4bfa083f 100644
--- a/packages/website/ts/utils/analytics.ts
+++ b/packages/website/ts/utils/analytics.ts
@@ -1,8 +1,8 @@
import * as _ from 'lodash';
import * as ReactGA from 'react-ga';
+import { InjectedWeb3 } from 'ts/types';
import { configs } from 'ts/utils/configs';
import { utils } from 'ts/utils/utils';
-import * as Web3 from 'web3';
export const analytics = {
init(): void {
@@ -16,11 +16,12 @@ export const analytics = {
value,
});
},
- async logProviderAsync(web3IfExists: Web3): Promise<void> {
+ async logProviderAsync(web3IfExists: InjectedWeb3): Promise<void> {
await utils.onPageLoadAsync();
- const providerType = !_.isUndefined(web3IfExists)
- ? utils.getProviderType(web3IfExists.currentProvider)
- : 'NONE';
+ const providerType =
+ !_.isUndefined(web3IfExists) && !_.isUndefined(web3IfExists.currentProvider)
+ ? utils.getProviderType(web3IfExists.currentProvider)
+ : 'NONE';
ReactGA.ga('set', 'dimension1', providerType);
},
};