> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# wallet_connect

> Connect wallet and request account access

Custom Coinbase Wallet method for establishing connection

> [!NOTE]
>
> Requests that the wallet connects to the dApp and provides account access. This is similar to `eth_requestAccounts` but provides additional connection features.

## Parameters

**options** `object`

Optional configuration object for the connection.

**Options Properties**

**version** `string`

The wallet connect version to use.

**jsonrpc** `string`

The JSON-RPC version (typically "2.0").

**capabilities** `object`

Optional capabilities to request during connection, such as signInWithEthereum for authentication.

**Available Capabilities**

**signInWithEthereum** `object`

Request SIWE (Sign-In With Ethereum) authentication during connection.

**signInWithEthereum Properties**

**nonce** `string` *required*

A unique random string to prevent replay attacks.

**chainId** `string` *required*

The chain ID as a hexadecimal string (e.g., "0x2105" for Base Mainnet).

## Returns

**result** `object`

Connection result object containing account information and capabilities results.

**Result Properties**

**accounts** `array`

Array of connected account objects.

**Account Object Properties**

**address** `string`

The account address.

**capabilities** `object`

Capabilities results if requested during connection.

**Capabilities Results**

**signInWithEthereum** `object`

SIWE authentication result if requested.

**signInWithEthereum Result**

**message** `string`

The SIWE-formatted message that was signed.

**signature** `string`

The cryptographic signature of the message.

**chainId** `string`

The current chain ID as a hexadecimal string.

**isConnected** `boolean`

Whether the wallet is connected.

```json Basic Connection theme={null}
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "wallet_connect",
  "params": [{}]
}
```

```json With Options lines wrap expandable theme={null}
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "wallet_connect",
  "params": [{
    "version": "1.0",
    "jsonrpc": "2.0"
  }]
}
```

```json With signInWithEthereum Capability lines wrap expandable theme={null}
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "wallet_connect",
  "params": [{
    "version": "1",
    "capabilities": {
      "signInWithEthereum": {
        "nonce": "abc123def456",
        "chainId": "0x2105"
      }
    }
  }]
}
```

```json Basic Connection Response lines wrap expandable theme={null}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "accounts": [{
      "address": "0x407d73d8a49eeb85d32cf465507dd71d507100c1"
    }],
    "chainId": "0x2105",
    "isConnected": true
  }
}
```

```json signInWithEthereum Response lines wrap expandable theme={null}
{
  "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
  }
}
```

## Error Handling

| 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 |

> [!WARNING]
>
> This is a Coinbase Wallet-specific method and may not be available in other wallets.

> [!NOTE]
>
> After successful connection, the wallet will emit connection events and provide access to account information.

> [!TIP]
>
> When using the `signInWithEthereum` capability, always generate a fresh, unique nonce for each authentication attempt to prevent replay attacks. The signature can be verified on your backend using libraries like viem.

## Usage with Capabilities

You can use the `wallet_connect` with the [`signInWithEthereum`](https://docs.cdp.coinbase.com/coinbase-wallet/reference/core/capabilities/signInWithEthereum) capability to authenticate the user.
