diff --git a/src/blockchain/wallet.js b/src/blockchain/wallet.js index c5d6ce9..c3b3239 100644 --- a/src/blockchain/wallet.js +++ b/src/blockchain/wallet.js @@ -140,17 +140,17 @@ const errorHandlingProxy = { export async function connectWallet(chainId) { console.log('connectWallet', chainId) - await switchChain(chainId) - if (provider!==null) { - try { - console.log('getSigner') - const p = new BrowserProvider(window.ethereum, chainId) - await p.getSigner() - await updateAccounts(chainId, p) - } - catch (e) { - if (e.reason!=='rejected') - console.error(e, e.reason) + try { + await switchChain(chainId) + console.log('getSigner') + const p = new BrowserProvider(window.ethereum, chainId) + await p.getSigner() + await updateAccounts(chainId, p) + } + catch (e) { + if (e.reason!=='rejected') { + console.error(e, e.reason) + throw e } } }