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) {
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
}
}
}