Coinbase Wallet SDK
eth_requestAccounts
Request account access and authorization from the user
Defined in EIP-1102
Requests that the user provides an Ethereum address to be identified by. This method will show a prompt to the user asking them to authorize the connection. Returns a promise that resolves to an array of accounts the user has authorized for the application.
Parameters
This method does not accept any parameters.
Returns
An array of Ethereum addresses (hexadecimal strings) that the user has authorized for the application. The array will typically contain a single address, which is the currently selected account in the wallet.
Error Handling
Code | Message | Description |
---|---|---|
4001 | User rejected the request | The user denied the connection request |
4100 | Requested method not supported | The provider does not support the eth_requestAccounts method |
4200 | Wallet not connected | The wallet is not available or connected |
Always handle the case where the user rejects the connection request (error code 4001) gracefully in your application.