Skip to main content

Get user’s wallet addresses


This guide explains how to fetch a user's Ronin addresses from the using the window.ronin.provider provider object.

Get user's addresses

To obtain the current account's addresses, two methods can be used:

  • eth_requestAccounts
  • eth_accounts

The eth_requestAccounts method requests the user to approve a session between your app and wallet. If the user rejects the session, an error is returned. If the user approves the session, the method resolves the list of the user's approved addresses.

const requestSession = async () => {
try {
const approvedAddresses = await window.ronin.provider.request({
method: "eth_requestAccounts"
return addresses
} catch (error) {
alert("User has rejected the request.")



The eth_accounts method resolves with the list user addresses only. If the wallet is locked or there is no session between your app and wallet, the method returns an empty array.

const getUserAddresses = async () => {
const addresses = await window.ronin.provider.request({
method: "eth_accounts"

return addresses


Detect account change

Users can change their account when using Ronin Wallet. The provider emits the accountChanged event upon changing accounts.

const listenToAccountChange = async () => {
const addresses = await window.ronin.provider.addListener(
newAddresses => {
console.log("Account is changed to: ", newAddresses[0])

Was this helpful?
Happy React is loading...