aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/utils
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-07-03 04:38:02 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-07-03 07:37:22 +0800
commit04d11d6fac265d8e43de8c14cab78655bb90d035 (patch)
treeca60c3dd7899eb3539bd083acc33f3f3cb054931 /packages/website/ts/utils
parent2eede4a09ecd17cade6623b4a770a62bee57a2e8 (diff)
downloaddexon-sol-tools-04d11d6fac265d8e43de8c14cab78655bb90d035.tar
dexon-sol-tools-04d11d6fac265d8e43de8c14cab78655bb90d035.tar.gz
dexon-sol-tools-04d11d6fac265d8e43de8c14cab78655bb90d035.tar.bz2
dexon-sol-tools-04d11d6fac265d8e43de8c14cab78655bb90d035.tar.lz
dexon-sol-tools-04d11d6fac265d8e43de8c14cab78655bb90d035.tar.xz
dexon-sol-tools-04d11d6fac265d8e43de8c14cab78655bb90d035.tar.zst
dexon-sol-tools-04d11d6fac265d8e43de8c14cab78655bb90d035.zip
Add human readable names for Toshi and Cipher
Diffstat (limited to 'packages/website/ts/utils')
-rw-r--r--packages/website/ts/utils/constants.ts2
-rw-r--r--packages/website/ts/utils/utils.ts5
2 files changed, 7 insertions, 0 deletions
diff --git a/packages/website/ts/utils/constants.ts b/packages/website/ts/utils/constants.ts
index d3a2aa107..b0cb2fa08 100644
--- a/packages/website/ts/utils/constants.ts
+++ b/packages/website/ts/utils/constants.ts
@@ -29,6 +29,8 @@ export const constants = {
PROVIDER_NAME_METAMASK: 'MetaMask',
PROVIDER_NAME_PARITY_SIGNER: 'Parity Signer',
PROVIDER_NAME_MIST: 'Mist',
+ PROVIDER_NAME_CIPHER: 'Cipher Browser',
+ PROVIDER_NAME_TOSHI: 'Toshi',
PROVIDER_NAME_GENERIC: 'Injected Web3',
PROVIDER_NAME_PUBLIC: '0x Public',
ROLLBAR_ACCESS_TOKEN: 'a6619002b51c4464928201e6ea94de65',
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index 726e1815f..0ef3d6723 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -324,6 +324,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;
@@ -337,6 +338,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;
},