setProvider should not request accounts
The readme suggests to call defaultEvmStores.setProvider()
during mount for EIP1193 wallets. This does an eth_requestAccounts
in the background. From a UX perspective, that's problematic since it will prompt, e.g., Metamask to open the wallet connection dialog when opening the page for the first time which is off-putting.
An alternative would be to call defaultEvmStores.setProvider()
when the user clicks a connect
button or similar. That's much better when the user visits for the first time, but worse if the user is already connected. In the latter case, explicitly connecting is unnecessary (accounts should already be available via eth_accounts
).
So ideally, this would be broken into two steps: defaultEvmStores.setProvider()
intended to be called during mount only checks if a connection is already established. In case there's no connection, a new method such as defaultEvmStores.requestAccounts()
intended to be called on clicking a connect
button can be used to open one.