5

What I´m trying to do is to condition some option/modal to be shown in the screen depending on the logged user/account being the owner or not so to have something similar to:

accountPair.address === NFT.owner

I know it has to be related with the addresses inside keyring. But how do I identify the current account being logged in the UI? I´m working with the front end template of polkadot js.

1 Answer 1

1

Use the hook useSubstrateState (see the code here). An example is:

const { api, currentAccount } = useSubstrateState()
const yourAddress = currentAccount.address;

Your Answer

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

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