• Core
  • Actions
  • fetchEnsAddress

fetchEnsAddress

Action for fetching address for ENS name.

This is a wrapper around viem's getEnsAddress.

import { fetchEnsAddress } from '@wagmi/core'

Usage

import { fetchEnsAddress } from '@wagmi/core'
 
const address = await fetchEnsAddress({
  name: 'awkweb.eth',
})

Return Value

string

Configuration

name

ENS name to fetch address for.

import { fetchEnsAddress } from '@wagmi/core'
 
const address = await fetchEnsAddress({
  name: 'moxey.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 { fetchEnsAddress } from '@wagmi/core'
 
const address = await fetchEnsAddress({
  name: 'awkweb.eth',
  chainId: 1,
})