getEnsAvatar 
Gets the avatar of an ENS name.
Calls getEnsText with key set to 'avatar'.
Usage 
ts
import { normalize } from 'viem/ens'
import { publicClient } from './client'
 
const ensText = await publicClient.getEnsAvatar({
  name: normalize('wagmi-dev.eth'),
})
// 'https://ipfs.io/ipfs/Qma8mnp6xV3J2cRNf3mTth5C8nV11CAnceVinc3y8jSbio'ts
import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
export const publicClient = createPublicClient({
  chain: mainnet,
  transport: http()
})WARNING
Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to normalize ENS names with UTS-46 normalization before passing them to getEnsAddress. You can use the built-in normalize function for this.
Returns 
string | null
The avatar URI for ENS name.
Returns null if the avatar cannot be resolved from the ENS name.
Parameters 
name 
- Type: 
string 
ENS name to get Text for.
ts
const ensText = await publicClient.getEnsAvatar({
  name: normalize('wagmi-dev.eth'), 
})blockNumber (optional) 
- Type: 
number 
The block number to perform the read against.
ts
const ensText = await publicClient.getEnsAvatar({
  name: normalize('wagmi-dev.eth'),
  blockNumber: 15121123n, 
})blockTag (optional) 
- Type: 
'latest' | 'earliest' | 'pending' | 'safe' | 'finalized' - Default: 
'latest' 
The block tag to perform the read against.
ts
const ensText = await publicClient.getEnsAvatar({
  name: normalize('wagmi-dev.eth'),
  blockTag: 'safe', 
})gatewayUrls 
- Type: 
{ ipfs?: string; arweave?: string } 
Gateway urls to resolve IPFS and/or Arweave assets.
ts
const ensText = await publicClient.getEnsAvatar({
  name: normalize('wagmi-dev.eth'),
  gatewayUrls: { 
    ipfs: 'https://cloudflare-ipfs.com'
  }
})universalResolverAddress (optional) 
- Type: 
Address - Default: 
client.chain.contracts.ensUniversalResolver.address 
Address of ENS Universal Resolver Contract.
ts
const ensText = await publicClient.getEnsAvatar({
  name: normalize('wagmi-dev.eth'),
  universalResolverAddress: '0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376', 
})