mega.connect()
Last updated
Open the MOSS wallet UI and prompt the user to authenticate. Resolves with the resulting connection status. If the user dismisses the auth flow, the promise resolves with status: 'cancelled' rather than throwing.
mega.connect(): Promise<ConnectionStatus>
None.
const result = await mega.connect();
if (result.status === 'connected') {
console.log('Connected', result.address);
} else if (result.status === 'cancelled') {
console.log('User cancelled wallet authentication');
}Trigger from a deliberate user action (button click), not on page load.
For account onboarding copy, prefer "Creating your account" / "Restoring account" — see Best Practices.
After connect, subscribe to events.onStatusChange so your UI tracks disconnects that happen outside your app.
Last updated
type ConnectionStatus = {
status: 'connected' | 'disconnected' | 'cancelled';
address?: `0x${string}`;
network: 'mainnet' | 'testnet';
};