For example, I would like to interact with the MetaMask plugin when the account has changed or I've changed the chainId of the network.
I've read the documentation that you can do this with.
ethereum.on('accountsChanged', (accounts) => {
// Handle the new accounts, or lack thereof.
// "accounts" will always be an array, but it can be empty.
});
ethereum.on('chainChanged', (chainId) => {
// Handle the new chain.
// Correctly handling chain changes can be complicated.
// We recommend reloading the page unless you have good reason not to.
window.location.reload();
});
How do I attach my angular application with a host listener that whenever I press that fox icon - it would log something and do what I want?