Skip to main content

Detecting the Provider

In order to check if Nightly is already installed, application should test if sui object exists.

Though if Nightly is not yet installed in application, you may redirect users to our website.

  private get _provider(): SuiNightly {
if ((window as any)?.nightly.sui) {
return (window as any).nightly.sui
} else {
throw new Error('SuiNightly: sui is not defined')
}
}