Does any know know how does metamask lock function works? In certain Dapps, you can disconnect the wallet from the Dapp itself. But all they are doing is that changing the account state to empty string.
const [currentAccount, setCurrentAccount] = useState("");
const disconnectWallet = () => {
try {
setCurrentAccount("");
window.location.reload(false);
} catch (error) {
console.log(error);
}
};
Something like this. But In reality, it is just changing the account address to empty so the Dapp could no longer can detect the account.
You can recognize similar behaviour in Uniswap too. First time when you are connecting the Dapp, it will ask password. And next time when you disconnect and connect from Dapp, it will just directly connect because uniswap already present in connected sites.
In my case, I want to know how metamask "lock" works and is it possible to imitate the lock from Dapp.