diff options
author | Francesco Agosti <francesco.agosti93@gmail.com> | 2019-01-11 02:48:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-11 02:48:06 +0800 |
commit | 749312c0e87be91aeef0a7e9a8f431b7e6b2616c (patch) | |
tree | 92434ee62da4ccf512fa0b695ad03a816bbf3599 /packages | |
parent | bf332d578c5d229b3a8d39bf5935233ecf9526c8 (diff) | |
parent | ffd14ab2f2b625574bdd1e8ce96189ef18782f3b (diff) | |
download | dexon-sol-tools-749312c0e87be91aeef0a7e9a8f431b7e6b2616c.tar dexon-sol-tools-749312c0e87be91aeef0a7e9a8f431b7e6b2616c.tar.gz dexon-sol-tools-749312c0e87be91aeef0a7e9a8f431b7e6b2616c.tar.bz2 dexon-sol-tools-749312c0e87be91aeef0a7e9a8f431b7e6b2616c.tar.lz dexon-sol-tools-749312c0e87be91aeef0a7e9a8f431b7e6b2616c.tar.xz dexon-sol-tools-749312c0e87be91aeef0a7e9a8f431b7e6b2616c.tar.zst dexon-sol-tools-749312c0e87be91aeef0a7e9a8f431b7e6b2616c.zip |
Merge pull request #1506 from 0xProject/feature/instant/opera-followups
[instant] Implement logging and friendly wallet name for Opera
Diffstat (limited to 'packages')
-rw-r--r-- | packages/instant/src/constants.ts | 1 | ||||
-rw-r--r-- | packages/instant/src/types.ts | 1 | ||||
-rw-r--r-- | packages/instant/src/util/env.ts | 9 |
3 files changed, 8 insertions, 3 deletions
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts index 67558c84a..bfd9e9098 100644 --- a/packages/instant/src/constants.ts +++ b/packages/instant/src/constants.ts @@ -74,5 +74,6 @@ export const PROVIDER_TYPE_TO_NAME: { [key in ProviderType]: string } = { [ProviderType.CoinbaseWallet]: 'Coinbase Wallet', [ProviderType.Parity]: 'Parity', [ProviderType.TrustWallet]: 'Trust Wallet', + [ProviderType.Opera]: 'Opera Wallet', [ProviderType.Fallback]: 'Fallback', }; diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts index ae672c919..f07a407da 100644 --- a/packages/instant/src/types.ts +++ b/packages/instant/src/types.ts @@ -183,6 +183,7 @@ export enum ProviderType { CoinbaseWallet = 'COINBASE_WALLET', Cipher = 'CIPHER', TrustWallet = 'TRUST_WALLET', + Opera = 'OPERA', Fallback = 'FALLBACK', } diff --git a/packages/instant/src/util/env.ts b/packages/instant/src/util/env.ts index aedf4f5d6..7d4f836ff 100644 --- a/packages/instant/src/util/env.ts +++ b/packages/instant/src/util/env.ts @@ -42,18 +42,21 @@ export const envUtil = { } }, getProviderType(provider: Provider): ProviderType | undefined { + const anyProvider = provider as any; if (provider.constructor.name === 'EthereumProvider') { return ProviderType.Mist; - } else if ((provider as any).isTrust) { + } else if (anyProvider.isTrust) { return ProviderType.TrustWallet; - } else if ((provider as any).isParity) { + } else if (anyProvider.isParity) { return ProviderType.Parity; - } else if ((provider as any).isMetaMask) { + } else if (anyProvider.isMetaMask) { return ProviderType.MetaMask; } else if (!_.isUndefined(_.get(window, 'SOFA'))) { return ProviderType.CoinbaseWallet; } else if (!_.isUndefined(_.get(window, '__CIPHER__'))) { return ProviderType.Cipher; + } else if (envUtil.getBrowser() === Browser.Opera && !anyProvider.isMetaMask) { + return ProviderType.Opera; } return; }, |