Specify fallback web3 provider in analytics

This commit is contained in:
Steve Klebanoff
2018-11-16 15:41:54 -08:00
parent 83a6d7b97d
commit 1564415e5d
4 changed files with 8 additions and 0 deletions

View File

@@ -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',
};

View File

@@ -164,4 +164,5 @@ export enum ProviderType {
Mist = 'MIST',
CoinbaseWallet = 'COINBASE_WALLET',
Cipher = 'CIPHER',
Fallback = 'FALLBACK',
}

View File

@@ -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;
},

View File

@@ -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;
},
};