aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils/utils.ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon@0xproject.com>2018-07-03 09:26:16 +0800
committerGitHub <noreply@github.com>2018-07-03 09:26:16 +0800
commit328da21420e54ac0f2d9e2d7bcb894cc13f3bea8 (patch)
treeea78066d9aeac56dabd0ffb0437055955c7923ea /packages/website/ts/utils/utils.ts
parent81062d20ebd88cea7980fa06606f07c56e453f2f (diff)
parent04d11d6fac265d8e43de8c14cab78655bb90d035 (diff)
downloaddexon-0x-contracts-328da21420e54ac0f2d9e2d7bcb894cc13f3bea8.tar.gz
dexon-0x-contracts-328da21420e54ac0f2d9e2d7bcb894cc13f3bea8.tar.zst
dexon-0x-contracts-328da21420e54ac0f2d9e2d7bcb894cc13f3bea8.zip
Merge pull request #806 from 0xProject/feature/website/mobile-readable-web3-names
Add detection logic for Toshi and Cipher
Diffstat (limited to 'packages/website/ts/utils/utils.ts')
-rw-r--r--packages/website/ts/utils/utils.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index b27c6e48b..fc7901463 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -326,6 +326,7 @@ export const utils = {
getProviderType(provider: Provider): Providers | string {
const constructorName = provider.constructor.name;
let parsedProviderName = constructorName;
+ // https://ethereum.stackexchange.com/questions/24266/elegant-way-to-detect-current-provider-int-web3-js
switch (constructorName) {
case 'EthereumProvider':
parsedProviderName = Providers.Mist;
@@ -339,6 +340,10 @@ export const utils = {
parsedProviderName = Providers.Parity;
} else if ((provider as any).isMetaMask) {
parsedProviderName = Providers.Metamask;
+ } else if (!_.isUndefined(_.get(window, 'SOFA'))) {
+ parsedProviderName = Providers.Toshi;
+ } else if (!_.isUndefined(_.get(window, '__CIPHER__'))) {
+ parsedProviderName = Providers.Cipher;
}
return parsedProviderName;
},