• Core
  • Actions
  • fetchEnsAvatar

fetchEnsAvatar

Action for fetching avatar for ENS name.

This is a wrapper around viem's getEnsAvatar.

import { fetchEnsAvatar } from '@wagmi/core'

Usage

import { fetchEnsAvatar } from '@wagmi/core'
 
const avatarUrl = await fetchEnsAvatar({
  name: 'jxom.eth',
})

Return Value

string

Configuration

name

ENS name to fetch avatar for.

import { fetchEnsAvatar } from '@wagmi/core'
 
const ensAvatar = await fetchEnsAvatar({
  name: 'jxom.eth',
})

chainId (optional)

Force a specific chain id for the request. The wagmi Client's publicClient must be set up as a chain-aware function for this to work correctly.

import { fetchEnsAvatar } from '@wagmi/core'
 
const ensAvatar = await fetchEnsAvatar({
  name: 'jxom.eth',
  chainId: 1,
})