Skip to content

useName

The useName hook is used to get name from an onchain identity provider for a given address.

Supported providers:

  • ENS

Usage

import { useName } from '@coinbase/onchainkit/identity';
 
const { data: name, isLoading } = useName({ address: '0x1234' });

Returns

type UseNameOptions = {
  address: Address; // The Ethereum address for which the ENS name is to be fetched.
  chain?: Chain; // Optional chain for domain resolution
};
 
type UseNameQueryOptions = {
  enabled?: boolean;
  cacheTime?: number;
};