In javascript to connect metamask it uses window.ethereum
if (window.ethereum) {
window.ethereum
.request({ method: "eth_requestAccounts" })
.then((res) => accountChangeHandler(res[0]));
} else {
alert("install metamask extension!!");
}
How to do that in yew.rs?
if web_sys::window().unwrap().ethereum {
let eth = web_sys::window().unwrap().ethereum;
log!(eth);
} else {
log!("install metamask extension!!");
}
Code error: no field ethereum
on type Window