fetchEnsName
Action for fetching ENS name for address.
This is a wrapper around viem's getEnsName
.
import { fetchEnsName } from '@wagmi/core'
Usage
import { fetchEnsName } from '@wagmi/core'
const ensName = await fetchEnsName({
address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
})
Return Value
string
Configuration
address
Address to fetch ENS name for.
import { fetchEnsName } from '@wagmi/core'
function App() {
const ensName = await fetchEnsName({
address: '0xa5cc3c03994db5b0d9a5eedd10cabab0813678ac',
})
}
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 { fetchEnsName } from '@wagmi/core'
function App() {
const ensName = await fetchEnsName({
address: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
chainId: 1,
})
}