From 2063f594f6f34d5c82d455251b3d3d79fdfbd40d Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 30 Oct 2020 20:55:09 +0100 Subject: [PATCH] disable walletconnect, metamask download fallback (#183) --- src/components/molecules/Wallet/Account.tsx | 8 ++++++-- src/utils/wallet.ts | 14 +++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/components/molecules/Wallet/Account.tsx b/src/components/molecules/Wallet/Account.tsx index 4231b5a25..6d4a1fc22 100644 --- a/src/components/molecules/Wallet/Account.tsx +++ b/src/components/molecules/Wallet/Account.tsx @@ -25,11 +25,15 @@ const Blockies = ({ account }: { account: string | undefined }) => { const Account = React.forwardRef((props, ref: any) => { const { accountId, status, connect, networkId } = useOcean() const hasSuccess = status === 1 && networkId === 1 + const canHandleWeb3 = window?.web3 || window?.ethereum async function handleActivation(e: FormEvent) { // prevent accidentially submitting a form the button might be in e.preventDefault() - await connect() + + canHandleWeb3 + ? await connect() + : (location.href = 'https://metamask.io/download.html') } // prevent accidentially submitting a form the button might be in @@ -61,7 +65,7 @@ const Account = React.forwardRef((props, ref: any) => { // the Tippy to show in this state. ref={ref} > - Connect Wallet + {canHandleWeb3 ? 'Connect Wallet' : 'Get MetaMask'} ) }) diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index 0c80fe859..93060d26e 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -1,5 +1,5 @@ import { infuraProjectId, network } from '../../app.config' -import WalletConnectProvider from '@walletconnect/web3-provider' +// import WalletConnectProvider from '@walletconnect/web3-provider' // import Torus from '@toruslabs/torus-embed' const web3ModalTheme = { @@ -11,12 +11,12 @@ const web3ModalTheme = { } const providerOptions = { - walletconnect: { - package: WalletConnectProvider, - options: { - infuraId: infuraProjectId - } - } + // walletconnect: { + // package: WalletConnectProvider, + // options: { + // infuraId: infuraProjectId + // } + // } // torus: { // package: Torus, // options: {