Skip to main content
If you are planning to build a dApp that connects client wallets using WalletConnect QR in a chain-agnostic environment, the best way is to use our Universal Connector, which simplifies the integration process, provides flexibility across multiple networks, and ensures a consistent user experience. In this recipe, you will learn how to:
  • Use Universal Connector to connect a wallet using WalletConnect QR Code
  • Configure supported networks for your dApp
  • Manage session state for connected wallets
This guide takes approximately 20 minutes to complete. Let’s dive in! WalletConnect QR Code

Prerequisites

Final project

WalletConnect SDK with QR Code

Download the full project to try it directly on your computer using Universal Connector.

Try the demo

Installation

In order to set up the project, you need to install the following packages:

Start building with Universal Connector

You can configure with the networks you want to support. For more information, please visit RPC Reference section from our docs. We recommend creating a config file to establish a singleton instance for the Universal Connector:
As you can see, we are importing the UniversalConnector class from the @reown/appkit-universal-connector package. Then you can use the projectId that you can get from the Reown Dashboard. After that you can configure the networks you want to support. The method init receives the projectId, the metadata and the networks you want to support. In the App.tsx file you can add :
This ensures: The Universal Connector is initialized when the component mounts. The session state updates whenever the connected wallet session changes. With this setup, you’re now ready to build wallet connections in a chain-agnostic way using WalletConnect QR codes.

Connect a Wallet

The following function initializes the connection and stores the session:
Once the wallet is connected, the session information (such as accounts and namespaces) will be available in your app. You can then use this session to perform actions like signing messages or sending transactions.

Sign a Message

Once your wallet is connected, you can also use the Universal Connector to sign messages. This is useful for authentication or verifying ownership of an address. Here’s an example of how to sign a personal message on Sui:
You can trigger this function with a simple button:
This will prompt the connected wallet to sign the message “Hello Reown AppKit!” and log the result in the console.

Disconnect a Wallet

It’s important to give users the option to disconnect their wallet from your dApp. This clears the active session and ensures the wallet is no longer linked until the user chooses to reconnect. Here’s a simple function to handle disconnection:
When called, this will terminate the session and reset the state in your app. You can bind it to a “Disconnect” button in your UI to make it accessible to users.