I am trying to get the key of phantom account when the user switches to new account. It work fine when multi chain is on but when I turn it off the event doesn't gets triggered.
Here is the code
provider.on('accountChanged', (publicKey: PublicKey) => {
if (publicKey) {
console.log('publicKey: ', publicKey.toString())
}
})
I have tried the documentation of Phantom but the don't have an answer to my problem. I have also opened a issue but haven't recieeved any response yet.
If you look at the code of the wallet adapter when the account change, phantom emit a
connectevent.