How to get metamsk address

How to get metamsk address without make any changes on it like convert all capital letters to small letters
Note: I’m using react.js

Hi, can you share how you do it now?
Also maybe explaining what it the output you have and what you would expect to get.

const {user} = useMoralis();
console.log(user.get(“ethAddress”)); // output

And what is different from what you expect got get as output?

the address should contain a capital letters and the output convert all the letters to small letters, so this is the problem here, I wanna it to return it without any filtering on it

You can convert it to any format you want, there isn’t a standard format for an address.

how to do that, how to recovert it to the right address?

Can you give an example from what to what to convert, so I can understand better what you need? Most of the time you can convert all string to uppercase or lowercase using a built in function.

ok, let me give an example:
let’s assume my metamask wallet address is this: 0xF12bbGH…, ok!
when i try to get the metamask addres, it’s just return to me like this: 0xf12bbgh,
so as you see here all the capital letters are converted to lowercase, and if u try to use “toUppercase” built in function, it will convert every lettter to uppercase and this is not correct becouse the metamask addres contain lower and uppercase. so this is the problem, I wanna it to return to me like this: 0xF12bbGH… without any changes on it

In practice all those address formats are equivalent, only how they are displayed looks different. Unless you are talking about EIP-55 format.

1 Like

@mohammadNow, this is what you may want: Web3.utils.toChecksumAddress("0xb0557906c617f0048a700758606f64b33d0c41a6") => '0xb0557906c617f0048A700758606f64b33D0C41A6'