1

I am building a Web dApp and would like to show the users address. Is it possible read this from the signer object I get from MetaMask? Or is this intentionally not possible?

If it is not possible, what are common ways to achieve this goal? Ask the user explicitly? (This seems a bit cumbersome to me from a UI perspective but I can see how it is much better from the privacy perspective)

Thanks!

Edit: Clarify where the problem was for me.

  • Do you want the user's wallet address, their native asset balance (e.g. ETH), or an ERC-20 token balance? Please clarify your question. – Paul Razvan Berg Jun 27 '21 at 14:12
  • As per your clarification, this question is a duplicate. There are many other posts for looking up an ERC-20 token balance. Check them out! – Paul Razvan Berg Jun 27 '21 at 21:33

1 Answers1

1

I'm guessing you are using ethers.js in that case you can get the address from the signer object. Try:

signer.getAddress()
trizin
  • 914
  • 5
  • 11