From e3e7b2924a39b59286ccf65f577f7c490a8fe3cc Mon Sep 17 00:00:00 2001 From: devformatters2 <177856586+devformatters2@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:18:56 +0800 Subject: [PATCH] feat(auth): use injected connector instead of metamask connector --- src/common/utils/wallet.ts | 6 +++--- src/components/AuthMethodFeed/AuthWalletFeed.tsx | 2 +- src/components/Forms/SelectAuthMethodForm/index.tsx | 2 +- src/components/Forms/WalletAuthForm/Select.tsx | 2 +- src/components/GlobalDialogs/UniversalAuthDialog/index.tsx | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/utils/wallet.ts b/src/common/utils/wallet.ts index 66763aa759..98aa371d45 100644 --- a/src/common/utils/wallet.ts +++ b/src/common/utils/wallet.ts @@ -7,7 +7,7 @@ import { polygon, polygonMumbai, } from 'wagmi/chains' -import { MetaMaskConnector } from 'wagmi/connectors/metaMask' +import { InjectedConnector } from 'wagmi/connectors/injected' import { WalletConnectConnector } from 'wagmi/connectors/walletConnect' import { alchemyProvider } from 'wagmi/providers/alchemy' @@ -43,12 +43,12 @@ export const { publicClient, chains } = configureChains(defaultChains, [ export const wagmiConfig = createConfig({ autoConnect: true, connectors: [ - new MetaMaskConnector({ + new InjectedConnector({ chains, options: { // For disconnecting from metamask shimDisconnect: true, - UNSTABLE_shimOnConnectSelectAccount: true, + // UNSTABLE_shimOnConnectSelectAccount: true, }, }), ...(isTest diff --git a/src/components/AuthMethodFeed/AuthWalletFeed.tsx b/src/components/AuthMethodFeed/AuthWalletFeed.tsx index ba13e90c09..b82dae51ac 100644 --- a/src/components/AuthMethodFeed/AuthWalletFeed.tsx +++ b/src/components/AuthMethodFeed/AuthWalletFeed.tsx @@ -35,7 +35,7 @@ export const AuthWalletFeed: React.FC = ({ const [walletType, setWalletType] = useState('MetaMask') const [showLoading, setShowLoading] = useState(true) - const injectedConnector = connectors.find((c) => c.id === 'metaMask') + const injectedConnector = connectors.find((c) => c.id === 'injected') const walletConnectConnector = connectors.find( (c) => c.id === 'walletConnect' ) diff --git a/src/components/Forms/SelectAuthMethodForm/index.tsx b/src/components/Forms/SelectAuthMethodForm/index.tsx index 580d0aa5a9..2cd2d80a76 100644 --- a/src/components/Forms/SelectAuthMethodForm/index.tsx +++ b/src/components/Forms/SelectAuthMethodForm/index.tsx @@ -41,7 +41,7 @@ export const SelectAuthMethodForm: React.FC = ({ const isWallet = authFeedType === 'wallet' const { connectors } = useConnect() - const injectedConnector = connectors.find((c) => c.id === 'metaMask') + const injectedConnector = connectors.find((c) => c.id === 'injected') useEffect(() => { if (injectedConnector?.ready && checkWallet) { diff --git a/src/components/Forms/WalletAuthForm/Select.tsx b/src/components/Forms/WalletAuthForm/Select.tsx index f25ce30afa..b9ea039662 100644 --- a/src/components/Forms/WalletAuthForm/Select.tsx +++ b/src/components/Forms/WalletAuthForm/Select.tsx @@ -98,7 +98,7 @@ const Select: React.FC = ({ const { address: account, isConnecting } = useAccount() const errorMessage = connectError?.message - const injectedConnector = connectors.find((c) => c.id === 'metaMask') + const injectedConnector = connectors.find((c) => c.id === 'injected') const walletConnectConnector = connectors.find( (c) => c.id === 'walletConnect' ) diff --git a/src/components/GlobalDialogs/UniversalAuthDialog/index.tsx b/src/components/GlobalDialogs/UniversalAuthDialog/index.tsx index 9ccdb241cd..5dff723534 100644 --- a/src/components/GlobalDialogs/UniversalAuthDialog/index.tsx +++ b/src/components/GlobalDialogs/UniversalAuthDialog/index.tsx @@ -42,7 +42,7 @@ const BaseUniversalAuthDialog = () => { const [firstRender, setFirstRender] = useState(true) const { connectors } = useConnect() - const injectedConnector = connectors.find((c) => c.id === 'metaMask') + const injectedConnector = connectors.find((c) => c.id === 'injected') const [authFeedType, setAuthFeedType] = useState('normal') useEffect(() => {