How to list owned ENS by address?

Hey everyone, looking for some guidance on how I can achieve this.

I’m working on a project (NextJS) and would like to get a list of all my ENS names that I own. The ownership identifier would be my address, which I get from logging in via meta mask.

I’m completely new to smart contract development (doing a couple of tutorials) and was attempting to find a function in the registry smart contracts, which would let me achieve just this.

However I’m not really able to find anything obvious.

Could someone point me in the right direction please? Thank you!

1 Like

Hey my question is referring to the context of programmatically getting a list of ENS names owned by my address.

I think I know what I have to do:

Since ENS names are erc20 tokens, I should be able to use something like ether js to retrieve the balance of my tokens based on the ENS contract. I’m going to try this out.

Nvm I’m wrong. I’m thinking of the actual ENS token haha.

Back to square one.

I looked at the registry & resolver contracts, not able to find any function that lets you query owned namehashes by caller address. Any ideas?

I was able to find the solution.

I would need to query the chain for all transactions involving registering ENS names to account addresses. So I am using the graph, with the ens protocol, and this query:

{

  account(
    id:"0x123"
  ) {
    id
    domains {
      id
    } 
  }
}

To get a full list of domain ids owned by the address.

2 Likes

You can use Rainbow to look up wallet addresses and view their NFT’s or add them to your address book.

Here’s the link to their Twitter account and their post about the above bro.