| title | wallet_connect |
|---|---|
| description | Connect wallet and request account access |
Custom Coinbase Wallet method for establishing connection
Requests that the wallet connects to the dApp and provides account access. This is similar to `eth_requestAccounts` but provides additional connection features. Optional configuration object for the connection. The wallet connect version to use. The JSON-RPC version (typically "2.0"). Optional capabilities to request during connection, such as signInWithEthereum for authentication. Request SIWE (Sign-In With Ethereum) authentication during connection. A unique random string to prevent replay attacks. The chain ID as a hexadecimal string (e.g., "0x2105" for Base Mainnet). Connection result object containing account information and capabilities results. Array of connected account objects. The account address. Capabilities results if requested during connection. SIWE authentication result if requested. The SIWE-formatted message that was signed. The cryptographic signature of the message. The current chain ID as a hexadecimal string. Whether the wallet is connected. ```json Basic Connection { "id": 1, "jsonrpc": "2.0", "method": "wallet_connect", "params": [{}] } ```{
"id": 1,
"jsonrpc": "2.0",
"method": "wallet_connect",
"params": [{
"version": "1.0",
"jsonrpc": "2.0"
}]
}{
"id": 1,
"jsonrpc": "2.0",
"method": "wallet_connect",
"params": [{
"version": "1",
"capabilities": {
"signInWithEthereum": {
"nonce": "abc123def456",
"chainId": "0x2105"
}
}
}]
}{
"id": 1,
"jsonrpc": "2.0",
"result": {
"accounts": [{
"address": "0x407d73d8a49eeb85d32cf465507dd71d507100c1",
"capabilities": {
"signInWithEthereum": {
"message": "localhost:3000 wants you to sign in with your Ethereum account:\n0x407d73d8a49eeb85d32cf465507dd71d507100c1\n\nSign in with Ethereum to the app.\n\nURI: http://localhost:3000\nVersion: 1\nChain ID: 8453\nNonce: abc123def456\nIssued At: 2024-01-15T10:30:00Z",
"signature": "0x1234567890abcdef..."
}
}
}],
"chainId": "0x2105",
"isConnected": true
}
}| Code | Message | Description |
|---|---|---|
| 4001 | User rejected the request | User denied the connection request |
| 4100 | Requested method not supported | The method is not supported by the wallet |
| 4200 | Wallet not available | The wallet is not installed or available |
| -32602 | Invalid params | Invalid nonce or chainId in signInWithEthereum capability |
You can use the wallet_connect with the signInWithEthereum capability to authenticate the user.
import PolicyBanner from "/snippets/PolicyBanner.mdx";