1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

disable walletconnect, metamask download fallback (#183)

This commit is contained in:
Matthias Kretschmann 2020-10-30 20:55:09 +01:00 committed by GitHub
parent d5c217dc46
commit 2063f594f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 9 deletions

View File

@ -25,11 +25,15 @@ const Blockies = ({ account }: { account: string | undefined }) => {
const Account = React.forwardRef((props, ref: any) => { const Account = React.forwardRef((props, ref: any) => {
const { accountId, status, connect, networkId } = useOcean() const { accountId, status, connect, networkId } = useOcean()
const hasSuccess = status === 1 && networkId === 1 const hasSuccess = status === 1 && networkId === 1
const canHandleWeb3 = window?.web3 || window?.ethereum
async function handleActivation(e: FormEvent<HTMLButtonElement>) { async function handleActivation(e: FormEvent<HTMLButtonElement>) {
// prevent accidentially submitting a form the button might be in // prevent accidentially submitting a form the button might be in
e.preventDefault() e.preventDefault()
await connect()
canHandleWeb3
? await connect()
: (location.href = 'https://metamask.io/download.html')
} }
// prevent accidentially submitting a form the button might be in // 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. // the Tippy to show in this state.
ref={ref} ref={ref}
> >
Connect Wallet {canHandleWeb3 ? 'Connect Wallet' : 'Get MetaMask'}
</button> </button>
) )
}) })

View File

@ -1,5 +1,5 @@
import { infuraProjectId, network } from '../../app.config' import { infuraProjectId, network } from '../../app.config'
import WalletConnectProvider from '@walletconnect/web3-provider' // import WalletConnectProvider from '@walletconnect/web3-provider'
// import Torus from '@toruslabs/torus-embed' // import Torus from '@toruslabs/torus-embed'
const web3ModalTheme = { const web3ModalTheme = {
@ -11,12 +11,12 @@ const web3ModalTheme = {
} }
const providerOptions = { const providerOptions = {
walletconnect: { // walletconnect: {
package: WalletConnectProvider, // package: WalletConnectProvider,
options: { // options: {
infuraId: infuraProjectId // infuraId: infuraProjectId
} // }
} // }
// torus: { // torus: {
// package: Torus, // package: Torus,
// options: { // options: {