getName
The getName
utility is designed to retrieve a name from an onchain identity
provider for a specific address.
Consider the utility instead of the hook when you use it with Next.js or any Node.js backend.
Supported providers:
- ENS
Usage
Get ENS name from an address:
code
import { getName } from '@coinbase/onchainkit/identity';
const address = '0x02feeb0AdE57b6adEEdE5A4EEea6Cf8c21BeB6B1';
const name = await getName({ address });
Get a sliced address when showAddress
is true:
code
import { getName } from '@coinbase/onchainkit/identity';
const address = '0x02feeb0AdE57b6adEEdE5A4EEea6Cf8c21BeB6B1';
const name = await getName({ address, showAddress: true });