For the complete documentation index, see llms.txt. This page is also available as Markdown.

mega.disconnect()

Terminate the active wallet session and return the resulting disconnected state.

Signature

mega.disconnect(): Promise<ConnectionStatus>

Parameters

None.

Example

const state = await mega.disconnect();

if (state.status === 'disconnected') {
  // Clear app-side wallet/session state.
}

Response

type ConnectionStatus = {
  status: 'connected' | 'disconnected' | 'cancelled';
  address?: `0x${string}`;
  network: 'mainnet' | 'testnet';
};

Notes

Use disconnect() only when the product clearly intends to terminate the session — typically as part of an explicit "Sign out" affordance. The wallet may also be disconnected externally; subscribe to events.onStatusChange to stay in sync.

Last updated