wallet connection fixes

This commit is contained in:
Tim
2024-04-11 20:01:50 -04:00
parent b7198ef7db
commit bbabf8800b

View File

@@ -140,17 +140,17 @@ const errorHandlingProxy = {
export async function connectWallet(chainId) { export async function connectWallet(chainId) {
console.log('connectWallet', chainId) console.log('connectWallet', chainId)
await switchChain(chainId)
if (provider!==null) {
try { try {
await switchChain(chainId)
console.log('getSigner') console.log('getSigner')
const p = new BrowserProvider(window.ethereum, chainId) const p = new BrowserProvider(window.ethereum, chainId)
await p.getSigner() await p.getSigner()
await updateAccounts(chainId, p) await updateAccounts(chainId, p)
} }
catch (e) { catch (e) {
if (e.reason!=='rejected') if (e.reason!=='rejected') {
console.error(e, e.reason) console.error(e, e.reason)
throw e
} }
} }
} }