Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to detect account change in metamask

window.ethereum.on('accountsChanged', function (accounts) {
  // Time to reload your interface with accounts[0]!
})

window.ethereum.on('networkChanged', function (networkId) {
  // Time to reload your interface with the new networkId
})
Source by ethereum.stackexchange.com #
 
PREVIOUS NEXT
Tagged: #detect #account #change #metamask
ADD COMMENT
Topic
Name
3+3 =