Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth_accounts method triggering connection request #287

Closed
glitch-txs opened this issue May 8, 2023 · 5 comments
Closed

eth_accounts method triggering connection request #287

glitch-txs opened this issue May 8, 2023 · 5 comments

Comments

@glitch-txs
Copy link

Hi, I'm currently using eth_accounts method on page load to check if the user is connected but with enKrypt it triggers the connection request which is not the intended behaviour, is it possible to make this method silent? For connection requests I'm using eth_requestAccounts This is how most wallets work. Ideally connection request should happen when user interacts with the page (e.g. clicking a button) and not on page load. Thanks!

@kvhnuke
Copy link
Contributor

kvhnuke commented May 15, 2023

eth_accounts is also a call to get user accounts, I would suggest to use eth_requestAccounts before doing eth_accounts, you can detect whether user is using enkrypt by either checking window.ethereum.isEnkrypt or window.enkrypt

@glitch-txs
Copy link
Author

eth_accounts is used to get the user account but not for requesting permission, that's requestAccounts method. Otherwise why having two method that do the same thing?

I'm using eth_accounts to get the user account silently in case is connected since I'm not saving sessions on localStorage I need a way to know whether the user is connected or not without requesting a connection

@kvhnuke
Copy link
Contributor

kvhnuke commented May 23, 2023

eth_accounts is the standard way of getting user accounts, and eth_requestAccounts is something metamask introduced along the way and is not part of the standard. We want to make sure our users are aware whenever a dapp try to get user accounts using either way.

@glitch-txs
Copy link
Author

glitch-txs commented May 24, 2023

Actually 'eth_requestAccounts' is mentioned on EIP-1193 and 1102:

The return value of eth_accounts is ultimately controlled by the Wallet or Client. In order to protect user privacy, the authors recommend not exposing any accounts by default. Instead, Providers should support RPC methods for explicitly requesting account access, such as eth_requestAccounts (see EIP-1102) or wallet_requestPermissions (see EIP-2255).

@kvhnuke
Copy link
Contributor

kvhnuke commented Jul 10, 2023

Actually 'eth_requestAccounts' is mentioned on EIP-1193 and 1102:

The return value of eth_accounts is ultimately controlled by the Wallet or Client. In order to protect user privacy, the authors recommend not exposing any accounts by default. Instead, Providers should support RPC methods for explicitly requesting account access, such as eth_requestAccounts (see EIP-1102) or wallet_requestPermissions (see EIP-2255).

Yes thats why we have support for both, you'd be surprised how many dapps dont use eth_requestAccounts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants