-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use reverse resolution to fetch main ENS name from address #190
Conversation
Tasks done: explore subgraph queries that allow us to identify the main ENS record from an address. Ended up implementing reverse resolution using etherjs |
322870a
to
1a5ab31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@santteegt Is there no way to get this from the subgraph?
I was really hoping to avoid dependency on the rpc provider. You're importing HAUS_RPC for that - which is fine for mos of our apps - but what if someone is using this package outside of daohaus connect they will need a way to pass the provider/rivet key.
If there is no way to use the subgraph, maybe this function should take a provider url as an argument. our apps can pass it from HAUS_RPC. But then others can use it and pass their own. |
After digging a little bit more into how to get the same data from the subgraph, I found this in the docs:
Going through the issues I found the following here:
It looks like this is still WIP. On the other hand, I also found a PR that Bryan pushed for DAOHaus V2 however it also relies on an RPC endpoint. Until there's primary ens domain data indexed by the subgraph, I think it's better to use |
Cool. I'd say pass the provider url and set up ethers in the function. |
You can call the reverse resolution directly through a fetch call w/o needing ethers |
GitHub Issue
Fixes #186
Changes
Apparently, it's no that easy to identify the main ENS name from an address using the subgraph. Going through the ENS docs, I find out how it uses Reverse Resolution using a special purpose domain to set the primary ENS name a.k.a main reverse record. The recommended approach is to use an
etherjs
provider and calllookupAddress
, otherwise seems that we need to manually concatenate.${address}.addr.reverse
,namehash
it and look for the resolver in the subgraph.I used the recommended approach to fetch the main ENS record. If not found, it fallbacks to query the subgraph for the first non-expired ens domain registered by an account address.
Packages Added
None
Checks
Before making your PR, please check the following: