How is it possible to set an event listener for changes to
If you want to see when the selected address changes, and if you're using web3, then Web3.currentProvider.publicConfigStore has some events which you'll want to watch:
Subscribe to the update function with
Where callback is a function which takes the form
The new selected address can be accessed within that function as
But be aware that the event will fire in cases other than when
selectedAddress has been updated, so you'll need an if statement in there.
So I'm not entirely sure but I think no. The closest thing I can think of for getting info within Solidity on what is stored in
eth.accounts would be calling
msg.sender in your code. That would return the contract address of the sender, but only the sender.
You could have an event in the code that takes
msg.sender as an indexed argument (see Solidity in Depth on wiki), and then do something with that value using filters in the UI. Best I can think of, good luck.
I think if you wanted to check if there were any changes to accounts it would go in the code you write for the user interface to the dapp.