Adena Docs
  • Intro
  • â„šī¸User Guide
    • Download
    • Sign In
      • Connect Hardware Wallet
        • Ledger
        • Keystone
      • Set Up Air-gap Account
        • Air-gap Account
      • Advanced options
        • Create New Wallet
        • Import Wallet
        • Sign In With Google
    • Sidebar Menu
      • Account Details
      • Add Account
      • Settings
        • Connected Apps
        • Address Book
        • Change Network
        • Security & Privacy
          • Change Password
          • Reveal Seed Phrase
          • Export Private Key
          • Remove Account
          • Reset Wallet
        • About Adena
    • Wallet
      • Deposit
      • Send
        • Hardware Wallets
        • Air-gap Accounts
        • Advanced Accounts
      • Manage Tokens
    • NFTs
      • Asset Details
      • Manage Collectables
      • Deposit NFT
      • Send NFT
    • Explore
    • History
    • Web3 Interactions
      • Connect to a Dapp
      • Approve a Transaction
      • Add a Network
      • Switch Networks
  • đŸ› ī¸Integrations
    • Detect Wallet
    • Establish Connection
    • Get Account Info
    • Transactions
      • Sign & Send a Transaction
      • Sign Amino
      • Sign a Transaction
    • Network
      • Add a Custom Network
      • Switch Network
    • Detect Events
      • Detect an Account Change
      • Detect a Network Change
    • Use Adena Wallet SDK
      • JavaScript
    • Errors
    • Displaying Your App
    • Sample Usage
  • 📚Resources
    • FAQ
    • Audits
    • Brand Assets
      • Download Logo
      • Style Guide
      • Components
Powered by GitBook
On this page
  1. Integrations
  2. Detect Events

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);
});
PreviousDetect EventsNextDetect a Network Change

Last updated 6 months ago

đŸ› ī¸