Detect an Account Change

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.

Code

adena.On("changedAccount", (address: string) => void);

Params

Key
Type
Description

key

'changedAccount'

The event key of the 'changedAccount'

function

(address: string) => void

The function that gets triggered by the event

Sample Request

//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