Open adraffy opened 2 months ago
I'm using the following workaround, which delays interacting with the window.ethereum
until it's initialized or force-reload the page after a fixed (arbitrary) timeout.
if (window.ethereum) {
if (ethereum._state) {
let killer = setTimeout(() => window.location.reload(), 2000);
let monitor = setInterval(() => {
if (ethereum._state.initialized) {
clearInterval(monitor);
clearTimeout(killer);
init();
}
}, 100);
} else {
init();
}
}
function init() {
window_provider = new ethers.BrowserProvider(ethereum, 'any');
}
Describe the bug
on browser launch,
window.ethereum
is frequently stuck in some limbo state where it will either already be connected or emit aconnect
event, yetchainChanged
event will never fire.Only reloading the page fixes the problem.
Expected behavior
After
connect
,initialized
should betrue
.Screenshots/Recordings
Steps to reproduce
Error messages or log output
No response
Detection stage
In production (default)
Version
12.0.6
Build type
None
Browser
Firefox
Operating system
Windows
Hardware wallet
No response
Additional context
No response
Severity
No response