avatar text record, allowing users to associate an image with their identity.
Supported URI Schemes
Avatars can be stored as:- HTTP(S): A direct link to an image.
- IPFS: An
ipfs://CID. - Data: A base64 encoded image data URI.
- NFTs: An
eip155:URI pointing to an NFT on Citrea or other EVM chains.
Resolving Avatars
Using Wagmi
Wagmi’suseEnsAvatar hook handles the complexity of resolving different URI schemes and even fetching the image metadata for NFTs.
Using Viem
Reverse Resolution for Avatars
If you only have a user’s address and want to display their avatar, you should first perform reverse resolution to find their primary name, and then resolve the avatar for that name. Wagmi handles this automatically if you pass anaddress to useEnsAvatar.