wallet_disconnect
Disconnects the user's wallet from your dApp and clears the stored session. After disconnecting, the user will need to reconnect to interact with your app again. This is a client-side disconnect only - it doesn't revoke any onchain permissions.
Try it
Parameters
None.
Returns
boolean - Returns true on success.
Example
await provider.request({ method: 'wallet_disconnect' });
console.log('Disconnected');Events
After disconnecting, the provider emits:
accountsChangedwith an empty array[]disconnect
provider.on('accountsChanged', (accounts) => {
if (accounts.length === 0) {
console.log('User disconnected');
}
});
provider.on('disconnect', () => {
console.log('Wallet disconnected');
});Notes
- Clears the stored session from localStorage
- The user will need to reconnect to use the wallet again
- Does not revoke any onchain permissions