1

What is the best way to detect account switching in Phantom Wallet? I am using Nextjs.

1 Answer 1

1

From the docs: establishing-a-connection#changing-accounts

There are different methods to detect the provider.

provider.on('accountChanged', (publicKey) => {
    if (publicKey) {
        // Set new public key and continue as usual
        console.log(`Switched to account ${publicKey.toBase58()}`);
    } 
});
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.