diff --git a/apps/dcellar-web-ui/src/components/ConnectWallet/WalletConnectModal.tsx b/apps/dcellar-web-ui/src/components/ConnectWallet/WalletConnectModal.tsx index a9edd05f..a9efa193 100644 --- a/apps/dcellar-web-ui/src/components/ConnectWallet/WalletConnectModal.tsx +++ b/apps/dcellar-web-ui/src/components/ConnectWallet/WalletConnectModal.tsx @@ -9,8 +9,6 @@ import { useWallet } from '@/context/WalletConnectContext/hooks/useWallet'; import { GREENFIELD_CHAIN_ID } from '@/base/env'; import { useCallback, useEffect, useState } from 'react'; import { ConnectorNotFoundError } from 'wagmi'; -import { InjectedConnector } from 'wagmi/connectors/injected'; -import { MetaMaskConnector } from 'wagmi/connectors/metaMask'; import { useAppLogin } from '@/modules/welcome/hooks/useAppLogin'; import { useAppSelector } from '@/store'; @@ -32,9 +30,9 @@ export function WalletConnectModal(props: WalletConnectModalProps) { if (err instanceof ConnectorNotFoundError) { const { connector } = args; - if (connector instanceof InjectedConnector && connector.name === 'Trust Wallet') { + if (connector.id === 'trust') { window.open(TRUST_WALLET_DOWNLOAD_URL, '_blank'); - } else if (connector instanceof MetaMaskConnector) { + } else if (connector.id === 'metaMask') { window.open(METAMASK_DOWNLOAD_URL, '_blank'); } } diff --git a/apps/dcellar-web-ui/src/context/WalletConnectContext/connectors/TrustWalletConnector.ts b/apps/dcellar-web-ui/src/context/WalletConnectContext/connectors/TrustWalletConnector.ts index f47aa532..984ed3f0 100644 --- a/apps/dcellar-web-ui/src/context/WalletConnectContext/connectors/TrustWalletConnector.ts +++ b/apps/dcellar-web-ui/src/context/WalletConnectContext/connectors/TrustWalletConnector.ts @@ -9,7 +9,7 @@ export type TrustWalletConnectorOptions = { } export class TrustWalletConnector extends WagmiMetaMaskConnector { - readonly id: any = 'trustWallet'; + readonly id: any = 'trust'; constructor({ chains, diff --git a/apps/dcellar-web-ui/src/context/WalletConnectContext/error/handleWalletError.ts b/apps/dcellar-web-ui/src/context/WalletConnectContext/error/handleWalletError.ts index 06d0a557..ef629b21 100644 --- a/apps/dcellar-web-ui/src/context/WalletConnectContext/error/handleWalletError.ts +++ b/apps/dcellar-web-ui/src/context/WalletConnectContext/error/handleWalletError.ts @@ -1,8 +1,6 @@ import { ErrorMsgMap } from '@/context/WalletConnectContext/error/error'; import { toast } from '@totejs/uikit'; import { ConnectorNotFoundError } from 'wagmi'; -import { InjectedConnector } from 'wagmi/connectors/injected'; -import { MetaMaskConnector } from 'wagmi/connectors/metaMask'; export function handleWalletError(err: any, args: any, context: unknown) { let text = ''; @@ -10,9 +8,9 @@ export function handleWalletError(err: any, args: any, context: unknown) { switch (true) { case err instanceof ConnectorNotFoundError: const { connector } = args; - if (connector instanceof MetaMaskConnector) { + if (connector.id === 'metaMask') { text = `Metamask not installed. Please install and reconnect.`; - } else if (connector instanceof InjectedConnector && connector.name === 'Trust Wallet') { + } else if (connector.id === 'trust') { text = `Trust wallet not installed. Please install and reconnect.`; } else { text = `Wallet not installed. Please install and reconnect.`;