aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-17 07:41:54 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-17 07:41:54 +0800
commit1564415e5dc29cd76ac17f679ed83e0973764153 (patch)
treeefeba5d9948e588dc2ff9c36575c0c2d1a2b2e74 /packages/instant
parent83a6d7b97d9bea901c4d02d1a46186e64e3db367 (diff)
downloaddexon-sol-tools-1564415e5dc29cd76ac17f679ed83e0973764153.tar
dexon-sol-tools-1564415e5dc29cd76ac17f679ed83e0973764153.tar.gz
dexon-sol-tools-1564415e5dc29cd76ac17f679ed83e0973764153.tar.bz2
dexon-sol-tools-1564415e5dc29cd76ac17f679ed83e0973764153.tar.lz
dexon-sol-tools-1564415e5dc29cd76ac17f679ed83e0973764153.tar.xz
dexon-sol-tools-1564415e5dc29cd76ac17f679ed83e0973764153.tar.zst
dexon-sol-tools-1564415e5dc29cd76ac17f679ed83e0973764153.zip
Specify fallback web3 provider in analytics
Diffstat (limited to 'packages/instant')
-rw-r--r--packages/instant/src/constants.ts1
-rw-r--r--packages/instant/src/types.ts1
-rw-r--r--packages/instant/src/util/env.ts2
-rw-r--r--packages/instant/src/util/provider_factory.ts4
4 files changed, 8 insertions, 0 deletions
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
index 80c93c431..26d5ff436 100644
--- a/packages/instant/src/constants.ts
+++ b/packages/instant/src/constants.ts
@@ -50,4 +50,5 @@ export const PROVIDER_TYPE_TO_NAME: { [key in ProviderType]: string } = {
[ProviderType.Mist]: 'Mist',
[ProviderType.CoinbaseWallet]: 'Coinbase Wallet',
[ProviderType.Parity]: 'Parity',
+ [ProviderType.Fallback]: 'Fallback',
};
diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts
index 67f21a396..31162e471 100644
--- a/packages/instant/src/types.ts
+++ b/packages/instant/src/types.ts
@@ -164,4 +164,5 @@ export enum ProviderType {
Mist = 'MIST',
CoinbaseWallet = 'COINBASE_WALLET',
Cipher = 'CIPHER',
+ Fallback = 'FALLBACK',
}
diff --git a/packages/instant/src/util/env.ts b/packages/instant/src/util/env.ts
index 4a32f9cb1..59b47d1e3 100644
--- a/packages/instant/src/util/env.ts
+++ b/packages/instant/src/util/env.ts
@@ -52,6 +52,8 @@ export const envUtil = {
return ProviderType.CoinbaseWallet;
} else if (!_.isUndefined(_.get(window, '__CIPHER__'))) {
return ProviderType.Cipher;
+ } else if ((provider as any).zeroExInstantFallbackEngine) {
+ return ProviderType.Fallback;
}
return;
},
diff --git a/packages/instant/src/util/provider_factory.ts b/packages/instant/src/util/provider_factory.ts
index 603f7674d..d77407521 100644
--- a/packages/instant/src/util/provider_factory.ts
+++ b/packages/instant/src/util/provider_factory.ts
@@ -29,6 +29,10 @@ export const providerFactory = {
providerEngine.addProvider(new RPCSubprovider(rpcUrl));
// // Start the Provider Engine
providerEngine.start();
+ // This feels a bit dirty, but was the only way I could think of
+ // checking to see if this engine is our fallback engine, and not
+ // another Web3Provider engine provided by some dapp browser
+ (providerEngine as any).zeroExInstantFallbackEngine = true;
return providerEngine;
},
};