fetchEthPrice

Fetches the current ETH price in USD from the CoinGecko API.

Usage

import { fetchEthPrice } from 'ethereum-identity-kit'
// For server-side usage
import { fetchEthPrice } from 'ethereum-identity-kit/utils'
 
const ethPrice = await fetchEthPrice()

Return Value

Returns the current ETH price in USD as a number, or null if the request fails.

Example Response

2500.42 // Current ETH price in USD