Search
 
SCRIPT & CODE EXAMPLE
 

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
})
Comment

how to detect account change in metamask

var account = web3.eth.accounts[0];
var accountInterval = setInterval(function() {
  if (web3.eth.accounts[0] !== account) {
    account = web3.eth.accounts[0];
    updateInterface();
  }
}, 100);
Comment

How can I detect change in account in Metamask?

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

PREVIOUS NEXT
Code Example
Javascript :: array remove empty entrys js 
Javascript :: npm install run audit fix 
Javascript :: javascript how to set cursor for whole page 
Javascript :: toggle bollean value in js 
Javascript :: get pods running on a node 
Javascript :: convert to datetime in jquery 
Javascript :: parseint() js 
Javascript :: js get element type 
Javascript :: how to delete node_modules file 
Javascript :: detect dark mode javascript 
Javascript :: get element by multiple class javascript 
Javascript :: Module Error (from ./node_modules/eslint-loader/dist/cjs.js): 
Javascript :: useref not defined : error 
Javascript :: ajax uploading progress 
Javascript :: how to test usestate in jest 
Javascript :: console log object js 
Javascript :: padstart and padend javascript 
Javascript :: jquery click hold down 
Javascript :: redux logger 
Javascript :: mongoose unique field 
Javascript :: string array to int array javascript 
Javascript :: js sort 1 or -1 
Javascript :: newtonsoft.json string to object 
Javascript :: flutter parse json 
Javascript :: adding firebase to angular 
Javascript :: react query dev tools 
Javascript :: how to get the first letter of a string in jquery 
Javascript :: what is the use of angularjs 
Javascript :: moment get week day 
Javascript :: examples of toastr in jquery 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =