Retrieving user address

Ok, I’ve a stupid question I can’t find the answer to. I need to get the current user’s wallet address(s?). I’m trying to simplify the transactions display by filtering out ‘home base’ and adjusting the sign of the value according to if tokens coming or going. But my usrAddress keeps coming back undefined regardless of how I try to spell or punctuate Moralis.User.Address. I’m expecting some function like that to return to me an array of addresses, or even a chain array of arrays of addresses on each chain. But I’m getting nothing. Does this functionality exist somewhere? I can’t find it in the docs.

Here’s some nifty ReactJS hook code on the topic to make me look smarter while asking this really dumb question:

import { useEffect, useState } from "react";
import { useMoralis } from "react-moralis";

const emptyList = [];

export const useTransactions = (props) => {
  const { isAuthenticated, Moralis } = useMoralis();
  const [Txs, setTxs] = useState(emptyList);
  const [isLoading, setIsLoading] = useState(true);
  const usrAddress = Moralis.User.Address;
    isAuthenticated ? usrAddress + " is authenticated." : "Unauthenticated."

  useEffect(() => {
    if (isAuthenticated) {
      Moralis.Web3.getTransactions({ usePost: true }).then((userTrans) => {
        let newTxs = => {
          const output = { ...Tx };
          if (Tx.from_address === usrAddress) {
            output.counterparty = Tx.to_address;
            output.amount = -1 * parseFloat(Tx.value);
          } else {
            output.counterparty = Tx.from_address;
            output.amount = parseFloat(Tx.value);
          return output;
    } else {
  }, [Moralis.Web3, isAuthenticated, usrAddress]);

  console.log(isLoading ? "Transactions loading..." : "Returning Txs: ", Txs);

  return { Txs, isLoading };

But all it ever gives me is “undefined is authenticated” and a list of nothing but deposits that should be withdraws (and half the time I’m my own counterparty). I see my address in the output. But how do you tell React which one is mine?


1 Like

Hey @TheBubbleGuy

In React you should use user:

const { user } = useMoralis();

export const useTransactions = (props) => {
const [address, setAddress] = useState();
  useEffect(() => {
    if (isAuthenticated) {
  }, [isAuthenticated]);

Also you can get an array of his addresses:


One of the ways to get the networks in which there were transactions is to check whether the transactions of tokens from this address were in the required network or not. Usually we use the same ethadress in different networks.

And stop scolding yourself. You are making great progress! :muscle:

1 Like

You can also pass ethAddressas as a prop instead of calling the user.attributes.ethAddress several times.

Ah. “attributes” was the string I was missing in my documents search. Just searching on ‘user address’ does not bring back:

This thread evolved from a ‘how to get the user address from Moralis’ to ‘how do you compare user addresses?’. I’m continuing the problem under the ‘JavaScript’ category here:

Hi, please is there any way to get the balance of wallet?

And please where is the full document of the User class

You can create a new forum thread.

Documentation can be found at

you can check in the moralis react library

thank you man, I will make a new thread

thank you man, I will check it