Hi !
I am developing my page and I have added this block of code to have minted count update all the time but it requered Ethers.Now problem is that if someone doesn’t have Meta Mask installed page will be blank/white for them.Is there any way to fix that ? Note that code works as it suppose to,minted count is updating but yea website doesn’t load if Metamask is not installed.
I don’t use ethers for anything else but this.
Thanks !
const { ethers } = require("ethers");
const provider = new ethers.providers.Web3Provider(window.ethereum)
const fetchRemaining = useCallback(async () => {
if (!contract) return;
const res = await contract.methods.totalSupply().call();
setMintedCount(parseInt(res));
}, [contract]);
useEffect(() => {
fetchRemaining();
}, [contract, fetchRemaining]);
provider?.on("block", (blockNumber) => {
console.log("Current block: ", blockNumber);
fetchRemaining();
})