Skip to main content

Resolving ENS names

Dealing with ENS names can result in making a lot of RPC calls, resulting in high bills and long load times in your. With Basement's GraphQL API you can resolve ENS names, their profiles, and the reverse record of any address in a single query.

Bsement's ENS API is built for high throughput and low latency, so you can focus on building your app, rather than dealing with nodes. Our ENS data is also available for any address throughout the GraphQL API, so you can always get the enriched profile, in a single round trip.

Resolving multiple names

You can resolve multiple ENS names and profiles, by passing any address through the addresses or address root query. The example below resolves a list of hex addresses and ENS names, and returns their profiles.

fragment ProfileFields on Profile {
name
avatar
twitter: text(key: "com.twitter")
email: text(key: "email")
}

{
addresses(
addresses: [
"gotu.eth"
"0x17cd072cBd45031EFc21Da538c783E0ed3b25DCc"
"wilsoncusack.eth"
]
) {
address
# Profile only returns a profile if the address was queried by its ENS name
# Use reverseProfile to find the primary ENS for a name
# Note: profile and reverseProfile do not necessarily match
profile {
...ProfileFields
}
reverseProfile {
...ProfileFields
}
}
}

On Profile and ReverseProfile

The profile field returns the profile of the name you specified while querying. The reverseProfile field returns the profile in the Reverse Record of the address. These two fields do not necessarily match, as an address can have multiple ENS names resolve to itself, while the reverse record can be set to any of them.

Address type

Head to the documentation of the Address type for further reading on the fields you can query.