The getAvatars utility is designed to retrieve multiple avatars from an onchain identity provider for an array of ENS names or Basenames in a single batch request. Consider the utility instead of the hook when you use it with Next.js or any Node.js backend.

Usage

Get avatars for multiple ENS names:
import { getAvatars } from '@coinbase/onchainkit/identity';

const ensNames = ['vitalik.eth', 'zizzamia.eth'];
const avatars = await getAvatars({ ensNames });
Get avatars for multiple Basenames:
import { getAvatars } from '@coinbase/onchainkit/identity';
import { base } from 'viem/chains';

const ensNames = ['zizzamia.base.eth', 'coinbase.base.eth'];
const avatars = await getAvatars({ ensNames, chain: base });
Get avatars for a mix of ENS names and Basenames:
import { getAvatars } from '@coinbase/onchainkit/identity';
import { base } from 'viem/chains';

const ensNames = ['vitalik.eth', 'zizzamia.base.eth'];
const avatars = await getAvatars({ ensNames, chain: base });

Returns

Array of GetAvatarReturnType

Parameters

GetAvatars

GetAvatars