diff --git a/src/utils/wallets/getBrowserWalletLabelAndIcon.ts b/src/utils/wallets/getBrowserWalletLabelAndIcon.ts index d4cb0ea..e839cce 100644 --- a/src/utils/wallets/getBrowserWalletLabelAndIcon.ts +++ b/src/utils/wallets/getBrowserWalletLabelAndIcon.ts @@ -3,21 +3,25 @@ import { defaultWallet } from './wallets/defaultWallet'; export function getBrowserWalletLabelAndIcon() { if (typeof window !== 'undefined') { - const userBrowserWallets = wallets.filter( - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - (wallet) => !!window.ethereum[wallet.identityFlag] - ); - if (userBrowserWallets.length > 1 || userBrowserWallets.length === 0) { - return { - label: defaultWallet.label, - icon: defaultWallet.icon, - }; + if (!!window.ethereum) { + const userBrowserWallets = wallets.filter( + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + (wallet) => !!window.ethereum[wallet.identityFlag] + ); + if (userBrowserWallets.length > 1 || userBrowserWallets.length === 0) { + return { + label: defaultWallet.label, + icon: defaultWallet.icon, + }; + } else { + return { + label: userBrowserWallets[0].label, + icon: userBrowserWallets[0].icon, + }; + } } else { - return { - label: userBrowserWallets[0].label, - icon: userBrowserWallets[0].icon, - }; + return undefined; } } else { return undefined;