Making Requests
Getting Ethereum Accounts
This page explains how to fetch accounts from a Web3 provider.
Getting Ethereum accounts with EIP-1102
Use EIP-1102 to obtain authorization and get Ethereum accounts. Invoking EIP-1102 shows a QR code dialog if the user’s mobile wallet is not already connected to your app.
The following code runs in response to a user-initiated action such as clicking a button to ensure the pop up is not blocked by the browser.
Once the user obtains authorization, the Web3 object (web3
) and the Web3 Provider (ethereum
) are ready to be used.
If you were using ethereum.on("accountsChanged")
, remove it and obtain addresses with EIP-1102 callbacks instead. It was removed to improve compatibility with the latest web3.js
.
Next steps: