Skip to content

Commit

Permalink
Display errors if other wallets are also installed alongside MetaMask (
Browse files Browse the repository at this point in the history
  • Loading branch information
zkokelj authored Mar 19, 2024
1 parent 46e0c32 commit a345708
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Binary file modified tools/walletextension/api/static/favicon.ico
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export const WalletConnectionProvider = ({
setVersion(await fetchVersion());
} catch (error) {
showToast(
ToastType.DESTRUCTIVE,
"Error initializing wallet connection. Please refresh the page."
);
ToastType.DESTRUCTIVE,
error instanceof Error ? error.message : "Error initializing wallet connection. Please refresh the page."
);
} finally {
setLoading(false);
}
Expand Down
17 changes: 17 additions & 0 deletions tools/walletextension/frontend/src/services/ethService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ const ethService = {
checkIfMetamaskIsLoaded: async (provider: ethers.providers.Web3Provider) => {
try {
if (ethereum) {

// There are some wallets that are conflicting with MetaMask - we want to check that and throw an error if they are connected
const conflictingWalletMap = {
'Exodus Wallet': ethereum.isExodus,
'Nest Wallet': ethereum.isNestWallet,
// Add other wallets here as needed
};

// Iterate over the wallet map and handle conflicts
for (const [walletName, isWalletConnected] of Object.entries(conflictingWalletMap)) {
if (isWalletConnected) {
const message = `${walletName} is connected and is conflicting with MetaMask. Please disable ${walletName} and try again.`;
showToast(ToastType.DESTRUCTIVE, message);
throw new Error(message);
}
}

return await ethService.handleEthereum(provider);
} else {
showToast(ToastType.INFO, "Connecting to MetaMask...");
Expand Down

0 comments on commit a345708

Please sign in to comment.