From a34570854d454e009d6c55cb2b3ebdf8dcf7132f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Kokelj?= Date: Tue, 19 Mar 2024 12:51:36 +0100 Subject: [PATCH] Display errors if other wallets are also installed alongside MetaMask (#1837) --- tools/walletextension/api/static/favicon.ico | Bin 996 -> 1260 bytes .../components/providers/wallet-provider.tsx | 6 +++--- .../frontend/src/services/ethService.ts | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tools/walletextension/api/static/favicon.ico b/tools/walletextension/api/static/favicon.ico index 1bb8f324a18a956628274ccbacffa64f1eeabc5f..0e8dea2f715d4fdc30aa83101021fe05fb3e2c21 100644 GIT binary patch delta 1197 zcmV;e1XBCt2kZ%uB#}WBks}>{1c6CJK~#7F?U_j^eQ^}WzmLD6Orgvf7HpI$A(<8| z2n)l;v=G^{FlJ#&5h6q)SqPa{giH&vu#qzC3>g-p$Qi$@58K z{UHZ3A~Q2nRU=HK2wz=YAt@;dJ3Bj&gGQsl`1m-|($b(7k_;f!FrvG=8@ai;PyA# z;@5-jDK9TaPfrh&AlZe!!o|e}adB~oh=@QyKmdys3Rpvs@^y7}XlZGIQdBcQ9}5c$ zBqt{$IyxE&2?_A@^weIft*uo>dEyU@#M9FgCMPG^L0M;MX$e7pK|xR(Sur4$*Vk9J zfyKwiYhCT_?G5Ye>rjd!7pktVMtXYsm)FC?!}0w5tUb4}vBBKj9E%a6p`igyO-)dO z;ushj8v3#{pcJWV0AXuui|OfUwh0nSjZh_sv$L~VwW<%LNOB*2oSd96I5>!ym>71h z#0XV_czAeNlDwsVr6pWlUA5U1^G8E_w3kzBqLq}Cr6{Mhw3z70QH8rd>CPqg`QCL{`L59-j z%*>47ZhU=x&01Fa6@%g|q_2E`e?Lk}N@b&e7WrZB=9frzrx}KAh!=6R; zk|^j6$UW@r?6|(ZKJFd*&nx>u#?8%*+uz@3*ZJ~+tE{a2_L-fXo!rC21IIT`qI6JH z3$?emqoAOG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@&uBAF|X+q<|}~m@^V&gjH%^pJ3KsOB~M^$U~_Ym6+lBn11mQb6&0=>%h^Ykz!IR7 zm=!>6ZLMjs3=a>p0ysN6gWcU-Q&aH>R0u+SeLW;3#D7G8`&bs4Q996#u%n~HG^*k8 z?d{Dt`Az2M=k2!U=4PZV)a*xfKGKxnD67_KYiq;I%uFmPDZ#0!DQ>ao>+7?}r0)#& zB2G_F+kPJtI&JIe>ET<+F*`eJ_oWXXSKZ{t#>R$S$Yp0|v)AJ8?#{lS$m0HgGBPq) z$&rNvj5?{cwH2tsHLvNL1Fo*FOl@#(#dCmFR#w8`;Gh{d zIXUUt(PGiR(5OZypc { 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...");