Created
March 13, 2020 23:05
-
-
Save octavioamu/a8c80e147ca19ffb1c5594853dc47b65 to your computer and use it in GitHub Desktop.
metamask methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://medium.com/metamask/breaking-changes-to-the-metamask-inpage-provider-b4dde069dd0a | |
// https://docs.metamask.io/guide/ethereum-provider.html#methods-new-api | |
// avoid auto reload | |
ethereum.autoRefreshOnNetworkChange = false | |
// not working | |
ethereum.on('chainChanged', function(chainId){console.log(chainId)}) | |
// change network | |
ethereum.on('networkChanged', function (networkId) { | |
console.log(networkId) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment