Documentation Index
Fetch the complete documentation index at: https://base-a060aa97-pat-schemav2-docs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
The useAvatar hook is used to get avatar image URL from an onchain identity
provider for a given name.
It is implemented with useQuery from @tanstack/react-query, and returns a UseQueryResult object, allowing you to pass through all @tanstack/react-query options.
Usage
import { useAvatar } from '@coinbase/onchainkit/identity';
const { data: avatar, isLoading } = useAvatar({ ensName: 'vitalik.eth' });
Returns
useQuery<Promise<GetAvatarReturnType>>
type GetAvatarReturnType = string | null;
Parameters
UseAvatarParams
type UseAvatarParams = {
/** ENS name to resolve */
ensName: string;
/** Optional chain for domain resolution */
chain?: Chain;
};
UseQueryOptions
type UseQueryOptions<TData = unknown> = Omit<
TanstackUseQueryOptions<TData>,
'queryKey' | 'queryFn'
>;