eth_requestAccounts
Prompts the user to connect their wallet to your dApp. If the user hasn't authenticated before, this opens the passkey registration/login flow. If already authenticated but not connected to your app, it shows a lightweight connect prompt. This is the standard method for initiating wallet connection.
Try it
Parameters
None.
Returns
string[] - Array of account addresses that the user has authorized.
Example
try {
const accounts = await provider.request({ method: 'eth_requestAccounts' });
console.log('Connected as:', accounts[0]);
} catch (error) {
if (error.message.includes('cancelled')) {
console.log('User cancelled the connection');
}
}Behavior
- If the user is already connected, returns the stored account immediately
- If not connected, opens the lightweight connect modal
- If the user has never authenticated, shows the full auth modal with passkey registration/login
- The user can approve or cancel the connection request
Notes
- This is the standard way to request wallet connection
- Equivalent to calling
wallet_connect - The returned address is the user's smart account address