diff --git a/layer/store/wallet.ts b/layer/store/wallet.ts index ad537822..27341b77 100644 --- a/layer/store/wallet.ts +++ b/layer/store/wallet.ts @@ -102,11 +102,9 @@ export const useSharedWalletStore = defineStore('sharedWallet', { } }, - async validateAndQueue() { + queue() { const walletStore = useSharedWalletStore() - await walletStore.validate() - if (walletStore.queueStatus === StatusType.Loading) { throw new Error('You have a pending transaction.') } else { @@ -116,6 +114,14 @@ export const useSharedWalletStore = defineStore('sharedWallet', { } }, + async validateAndQueue() { + const sharedWalletStore = useSharedWalletStore() + + await sharedWalletStore.validate() + + sharedWalletStore.queue() + }, + async init() { const walletStore = useSharedWalletStore() diff --git a/layer/wallet/metamask.ts b/layer/wallet/metamask.ts index f078372d..48238667 100644 --- a/layer/wallet/metamask.ts +++ b/layer/wallet/metamask.ts @@ -55,32 +55,7 @@ export const validateMetamask = async (address: string) => { const metamaskChainIdDoesntMatchTheActiveChainId = chainId !== metamaskChainId if (metamaskChainIdDoesntMatchTheActiveChainId) { - if (chainId === EthereumChainId.Kovan) { - throw new MetamaskException( - new Error('Please change your Metamask network to Kovan Test Network'), - { - code: UnspecifiedErrorCode, - type: ErrorType.WalletError - } - ) - } - if (chainId === EthereumChainId.Goerli) { - throw new MetamaskException( - new Error('Please change your Metamask network to Goerli Test Network'), - { - code: UnspecifiedErrorCode, - type: ErrorType.WalletError - } - ) - } - - throw new MetamaskException( - new Error('Please change your Metamask network to Ethereum Mainnet'), - { - code: UnspecifiedErrorCode, - type: ErrorType.WalletError - } - ) + return await UtilsWallets.updateMetamaskNetwork(chainId) } const metamaskProvider = await UtilsWallets.getMetamaskProvider()