You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This section provides instructions on how to initialize the WalletKit client, approve sessions with supported namespaces, and respond to session requests, enabling easy integration of Web3 wallets with dapps through a simple and intuitive interface.
7
+
## Overview
8
+
9
+
WalletConnect makes distributing your Web wallet (such as Safe, Abstract Global Wallet, and many more) much faster. By integrating the WalletKit SDK, your web wallet will be able to connect to any dApp that supports WalletConnect and will be available in the list of wallets on both WalletConnect, Reown AppKit, and others.
10
+
11
+
<Framecaption="Web Wallet in Reown AppKit & WalletButtons">
12
+
<imgheight="400"width="300"src="/images/web-wallet-safe.png"alt="Web Wallet in Reown AppKit" />
13
+
14
+
<imgheight="600"width="300"src="/images/web-wallet-button.png"alt="Web Wallet in WalletConnect" />
15
+
</Frame>
16
+
Additionally, you don't need to build SDKs in native languages such as Swift, Kotlin, Flutter, Unity, or React Native. This means your wallet can be available not just for web dApps, but also for native dApps, all from a single codebase.
17
+
18
+
This section provides instructions on how to initialize the WalletKit client, approve sessions with supported namespaces, and respond to session requests, enabling easy integration of Web3 wallets with dApps through a simple and intuitive interface.
19
+
20
+
## User Experience
21
+
22
+
### Default Integration
23
+
24
+
This integration automatically opens a new web wallet tab when a user clicks "Connect" in a dApp. The wallet handles the WalletConnect URI automatically, meaning users don't need to manually copy and paste the URI. This provides a seamless, one-click connection experience.
25
+
26
+
<Framecaption="Abstract Global Wallet to Wolfswap">
27
+
<video
28
+
controls
29
+
autoPlay
30
+
className="w-full aspect-video"
31
+
src="/images/web-wallet-demo.mp4"
32
+
></video>
33
+
</Frame>
34
+
35
+
### QR Code Integration
36
+
37
+
This integration only handles the session proposal and approval via the WalletConnect QR code. The user will need to manually copy and paste the WalletConnect URI into the wallet.
38
+
39
+
<Framecaption="Safe Wallet Connecting to AppKit Lab">
A session is a connection between a dapp and a wallet. It is established when a user approves a session proposal from a dapp. A session is active until the user disconnects from the dapp or the session expires.
45
84
85
+
### Handling Session Proposals
86
+
87
+
You can connect your web wallet to a dApp in three ways:
88
+
89
+
1. Retrieve the WC URI from the dApp via query parameters
90
+
2. Implement a scanner to read the WC URI from a WalletConnect QR code
91
+
3. Allow users to manually enter the WC URI in an input field
92
+
93
+
When opening the wallet directly from the dApp, the `WC_URI` will be in the following format in the query parameters:
94
+
95
+
```
96
+
{YOUR_WALLET_URL}/wc?uri={WC_URI}
97
+
```
98
+
99
+
We recommend closing the web wallet tab after the user approves the request and redirecting back to the dApp. For web requests, redirect to the original browser tab, and for mobile requests, redirect to the native mobile dApp.
100
+
101
+
<Note>
102
+
To test your web wallet connection flow, use our [Appkit Laboratory](https://appkit-lab.reown.com/) by adding a custom wallet with your web wallet URL.
103
+
</Note>
104
+
105
+
### Handling Session Requests
106
+
107
+
When a dApp sends a session request to your wallet, the request will be available in the following format in the query parameters:
This format allows your wallet to identify both the specific request and the session it belongs to.
114
+
115
+
<Note>
116
+
To test your web wallet connection flow, use our [Appkit Laboratory](https://appkit-lab.reown.com/) by adding a custom wallet with your web wallet URL.
117
+
</Note>
118
+
119
+
### Handling Redirects
120
+
121
+
When handling redirects after session approval or request completion, you should:
122
+
123
+
1. For web dApps:
124
+
- Redirect back to the original browser tab using `window.opener.location.href`
125
+
- Close the current wallet tab using `window.close()`
126
+
127
+
2. For native dApps:
128
+
- Check the peer metadata for a `redirect` URL in the session proposal
129
+
- If available, use deep linking to redirect to the native app
130
+
- If no redirect URL is found, display a "Return to App" message to the user
With WalletKit (and @walletconnect/utils) we've published a helper utility that greatly reduces the complexity of parsing the `required` and `optional` namespaces. It accepts as parameters a `session proposal` along with your user's `chains/methods/events/accounts` and returns ready-to-use `namespaces` object.
0 commit comments