2

I am creating a React app and I want to integrate a connect wallet button that can then return the users wallet address, similar to JPEG.store. What is the best way to approach this. I tried using Cardano connect with wallet https://github.com/cardano-foundation/cardano-connect-with-wallet but I cant figure out how to return the users address after they have signed in with their wallet. Any help is appreciated.

1 Answer 1

2

This could be solved by variety of tools:

  1. Using Lucid, you can first enable (connect) with wallet as outlined in this simple example. Then get address via lucid.wallet.address() (it returns a Promise, so you might need to use async / await). This address is basically obtained from CIP-30's, getUsedAddresses()'s first element.
  2. Like what you have shared in question, Mesh has a prebuilt component for it, which can be seen here. Once connected, you can get address as mentioned in this page.
  3. Regarding library in question, can use decodeHexAddress on browser wallet api's, getUsedAddresses()'s first element.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.