Detect Nightly
In order to detect Nightly Wallet in your sui app we recommend you use the @mysten/wallet-standard package, like so.
note
Before fetching detected wallets, install the package by running the following command in your terminal
# Using NPM
npm i @mysten/wallet-standard
# Using Yarn
yarn add @mysten/wallet-standard
After installing the package use this code to get access to all detected wallets.
import { getWallets } from '@mysten/wallet-standard'
const { get } = getWallets()
const allWallets = get()
Then, to filter out the wallets that aren't compatible with the sui standard.
import { isWalletWithRequiredFeatureSet } from '@mysten/wallet-standard'
const suiWallets = allWallets.filter(isWalletWithRequiredFeatureSet)
Now, after finding the Nightly wallet in the suiWallets
object, you will have access to all of the functions such as connect
, which we will talk about in the next section.
Accessing the nightly object is also possible by finding the nightly.sui
object on the window.
const nightlySui = window.nightly?.sui