# WalletConnect
# EVM(WebApp)
WalletConnect is an open protocol for connecting wallets and DApps (Web3 applications), which uses a bridge server to establish a remote connection between two applications and/or devices, scan a QR code to establish a connection and start communication. Bitget Wallet App now supports WalletConnect。
For more detailed document, please refer to the https://docs.walletconnect.com (opens new window)
- react-app.walletconnect.com (opens new window)
- Web3 Provider (opens new window)
- Standalone Client (opens new window)
- example (opens new window)
we provide a simple demo (opens new window)
npm install --save @walletconnect/client @walletconnect/qrcode-modal
import WalletConnect from '@walletconnect/client';
import QRCodeModal from '@walletconnect/qrcode-modal';
// Create a connector
const connector = new WalletConnect({
bridge: 'https://bridge.walletconnect.org', // Required
qrcodeModal: QRCodeModal,
});
// Check if connection is already established
if (!connector.connected) {
// create new session
connector.createSession();
}
// Subscribe to connection events
connector.on('connect', (error, payload) => {
if (error) {
throw error;
}
// Get provided accounts and chainId
const { accounts, chainId } = payload.params[0];
});
connector.on('session_update', (error, payload) => {
if (error) {
throw error;
}
// Get updated accounts and chainId
const { accounts, chainId } = payload.params[0];
});
connector.on('disconnect', (error, payload) => {
if (error) {
throw error;
}
// Delete connector
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# EVM(Native App SDK)
TIP
Precondition: The application has integrated the Wallet Connect (opens new window)feature.
# Quick access
- Please download Bitget Wallet (opens new window) if it is not yet installed
- You can refer to the official WalletConnect V2 documentation for integration: Official Documentation (opens new window)
Note: WalletConnect no longer supports version 1.0. Bitget Wallet is preparing sample code for WalletConnect V2 and will release it in the near future.