import { useEffect, useState } from 'react' import { useEthers } from './useEthers' /** * `useLookupAddress` is a hook that is used to retrieve the ENS (e.g. `name.eth`) for a specific address. * @param address address to lookup * @returns {} Object with the following: - `ens: string | null | undefined` - ENS name of the account or null if not found. - `isLoading: boolean` - indicates whether the lookup is in progress. - `error: Error | null` - error that occurred during the lookup or null if no error occurred. * @public * @example * const { account } = useEthers() * const { ens } = useLookupAddress(account) * * return ( *
Account: {ens ?? account}
* ) */ export function useLookupAddress(address: string | undefined) { const { library } = useEthers() const [ens, setENS] = useState