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

mega.connect()

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.

Signature

mega.connect(): Promise<ConnectionStatus>

Parameters

None.

Example

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');
}

Response

Notes

  • 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