update switch chain error requirements check

This commit is contained in:
Aleka Cheung 2024-02-12 13:01:24 -05:00
parent 8818d64c3e
commit 91bedd9fec
No known key found for this signature in database
GPG Key ID: 53E472E5EF4F4102
2 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,7 @@ export enum WalletErrorType {
// General
ChainMismatch,
UserCanceled,
SwitchChainFailed,
SwitchChainMethodMissing,
// Non-Deterministic
NonDeterministicWallet,

View File

@ -92,8 +92,8 @@ export const getWalletErrorType = ({ error }: { error: Error }) => {
return WalletErrorType.ChainMismatch;
}
if (messageLower.includes('switch chain')) {
return WalletErrorType.SwitchChainFailed;
if (messageLower.includes('Missing or invalid. request() method: wallet_switchEthereumChain')) {
return WalletErrorType.SwitchChainMethodMissing;
}
// ImToken - User canceled
@ -122,7 +122,7 @@ export const parseWalletError = ({
switch (walletErrorType) {
case WalletErrorType.ChainMismatch:
case WalletErrorType.UserCanceled:
case WalletErrorType.SwitchChainFailed: {
case WalletErrorType.SwitchChainMethodMissing: {
isErrorExpected = true;
message = error.message;
break;