Skip to main content

Connect Nightly

This part of documentation assumes you have already completed the detection step and have

access to the Nightly wallet object. :::


To view the implementation of the connect method, and the ones described in the later chapters, visit our source code.

Source code: https://github.com/nightly-labs/iota-web3-template/blob/main/app/components/StickyHeader.tsx​


In order to start using Nightly extension, an app needs to establish a connection. Once the connection request is initiated on the application side, it will prompt the user to provide permission to connect to the app with Nightly.


Connect​

To allow seamless interaction, you should use the features object on the adapter instance which should be of type WalletWithFeatures from the @iota/wallet-standard.

We recommend calling connect() function, in order to establish connection with Nightly.

import type {
IotaFeatures,
StandardConnectFeature,
StandardDisconnectFeature,
StandardEventsFeature,
WalletWithFeatures
} from '@iota/wallet-standard'

// Assuming nightly is the detected Nightly Wallet object
const adapter = nightly.standardWallet as WalletWithFeatures<
StandardConnectFeature &
StandardEventsFeature &
IotaFeatures &
Partial<StandardDisconnectFeature>
>

await adapter.features['standard:connect'].connect()

Disconnect​

We recommend calling disconnect() function, in order to break connection with Nightly.

await adapter.features['standard:disconnect'].disconnect()