Skip to main content

Detecting the Provider

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

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

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