Detect an Account Change
Last updated
When a user switches their account to another one, the information that the web application has initially retrieved may not match the current account. To display the correct information and request transaction approvals to the matching account, the web application must track account changes happening on Adena with the function below.
adena.On("changedAccount", (address: string) => void);key
'changedAccount'
The event key of the 'changedAccount'
function
(address: string) => void
The function that gets triggered by the event
//this will emit an account change when the user switches the current account on Adena
adena.On("changedAccount", (address) => {
console.log("changed address is " + address);
});Last updated