Skip to main content

Establishing a Connection


This part of documentation is targeted to applications that want to implement nightly connect as wallet interface.

To get started, we need to connect the user to the application. In order to do so, application generates the sessionId, a unique id that identifies each connection.

This process is initialized by one side displaying a sessionId through QR code (see the screenshot). The other peer needs just to scan the QR code on its device. Extension wallets are auto detected so you are always up to date and dont need to upgrade your dapp.



Application builds a connection using build() or buildLazy() function that returns interface to communicated with remote user. App should define AppMetadata so wallets will be able to show it to user.

To start sending request like signTransaction user first need to connect to session. Once user establishes connection, application will get public key and the connection will be confirmed.

API of application client is fit to match currently existing standards of corresponding blockchains

interface AppMetadata {
name: string;
url?: string;
description?: string;
icon?: string; // Url of app image
additionalInfo?: string;

We have ready to use templates that you can try here.


Source code:

You can implement nightly connect as full selector or use it with popular solana adapter

import { NightlyConnectAdapter } from '@nightlylabs/wallet-selector-solana'
import { WalletAdapterNetwork } from '@solana/wallet-adapter-base'
import { ConnectionProvider, WalletProvider } from '@solana/wallet-adapter-react'
import { WalletModalProvider, WalletMultiButton } from '@solana/wallet-adapter-react-ui'
import { UnsafeBurnerWalletAdapter } from '@solana/wallet-adapter-wallets'
import { clusterApiUrl } from '@solana/web3.js'
import type { FC, ReactNode } from 'react'
import React, { useMemo } from 'react'
export const App: FC = () => {
return (
<Content />
const Context: FC<{ children: ReactNode }> = ({ children }) => {
// The network can be set to 'devnet', 'testnet', or 'mainnet-beta'.
const network = WalletAdapterNetwork.Devnet
// You can also provide a custom RPC endpoint.
const endpoint = useMemo(() => clusterApiUrl(network), [network])
const wallets = useMemo(
() => [
* Wallets that implement either of these standards will be available automatically.
* - Solana Mobile Stack Mobile Wallet Adapter Protocol
* (
* - Solana Wallet Standard
* (
* If you wish to support a wallet that supports neither of those standards,
* instantiate its legacy wallet adapter here. Common legacy adapters can be found
* in the npm package `@solana/wallet-adapter-wallets`.
new UnsafeBurnerWalletAdapter(),
appMetadata: {
name: 'SolanaAdapter',
description: 'Solana Adapter Test',
icon: '',
additionalInfo: 'Courtesy of Nightly Connect team'
// eslint-disable-next-line react-hooks/exhaustive-deps
return (
<ConnectionProvider endpoint={endpoint}>
<WalletProvider wallets={wallets} autoConnect>
const Content: FC = () => {
return <WalletMultiButton />



Both client and application can initiate disconnection. User can force session termination in case of abuse. Only when application disconnects and session is not persistent, session is completely removed.