From bbabf8800b800041e1d61a15ba208d504baa7436 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 11 Apr 2024 20:01:50 -0400 Subject: [PATCH] wallet connection fixes --- src/blockchain/wallet.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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 } } }