Wagmi doesn't support custom UniversalResolver yet, as shown in https://github.com/wagmi-dev/wagmi/blob/main/packages/core/src/actions/ens/fetchEnsAddress.ts
export type FetchEnsAddressArgs = {
/** Chain id to use for Public Client. */
chainId?: number
/** ENS name to resolve */
name: string
}
Type FetchEnsAddressArgs doesn't support passing custom universalResolverAddress
This disables many opportunities for ENS Ecosystem development, especially if that protocol leverage ENSIP-10: Wildcard Resolution, ERC-3668: CCIP Read: Secure offchain data retrieval or ENS Layer2 and offchain data support
We have added custom UniversalResolver support to Wagmi library and submitted a pull request to Wagmi repository: https://github.com/wagmi-dev/wagmi/pull/2559
This pull request adds custom UniversalResolver support, as shown in
export type FetchEnsAddressArgs = {
/** Chain id to use for Public Client. */
chainId?: number
/** ENS name to resolve */
name: string
/** Universal Resolver contract address */
universalResolverAddress?: `0x${string}`
}
Type FetchEnsAddressArgs now support passing custom universalResolverAddress
export function useEnsAddress({
cacheTime,
chainId: chainId_,
enabled = true,
name,
scopeKey,
universalResolverAddress,
staleTime = 1_000 * 60 * 60 * 24, // 24 hours
suspense,
onError,
onSettled,
onSuccess,
}: UseEnsAddressArgs & UseEnsAddressConfig = {}) {
const chainId = useChainId({ chainId: chainId_ })
return useQuery(
queryKey({ chainId, name, scopeKey, universalResolverAddress }),
queryFn,
{
cacheTime,
enabled: Boolean(enabled && chainId && name),
staleTime,
suspense,
onError,
onSettled,
onSuccess,
},
)
}
useEnsAddress now supports passing custom universalResolverAddress
Benefits of supporting custom UniversalResolver include but are not limited to
An example of utilizing a custom universal resolver address in Wagmi can be found in Opti.domains's Rainbowkit customization that has added ENS name resolution support on the Optimism chain.
https://github.com/Opti-domains/rainbowkit/tree/universal-registry
These benefits will apply to apps and libraries using Wagmi, such as Rainbowkit (the ENS website is using it).
Vote if you want to see more contributions like this.