Getting 400 error while using fetchTokenPrice function of useTokenPrice hook React Moralis

{
    "code": 141,
    "error": "No pools found with enough liquidity, to calculate the price"
}

I got this error when I am trying to fetch the USD price for AVAX. I am using the Avalanche C-Chain main-net and I have enough AVAX on my account. but I keep getting this error.

Here is my input

import { useTokenPrice } from "react-moralis";

const TokenPrice = () => {
  const { fetchTokenPrice, data: formattedData, error, isLoading, isFetching } = useTokenPrice({ address: "0x05e332209afcc94ec6ecaa0f19ca721cf5b67f69", chain: "0xa86a" });

  return (
    <div>
        {error && <>{JSON.stringify(error)}</>}
        <button onClick={() => fetchTokenPrice({ params: { address: "0x05e332209afcc94ec6ecaa0f19ca721cf5b67f69", chain: "0xa86a" } })}>Refetch</button>
        <pre>{JSON.stringify(formattedData, null, 2)}</pre>
    </div>
  );
}

Hey @sachcha99 just checked your address and looks like it is your wallet address and not the contract address, if you want to get the price of AVAX I think you need to put lik 0xeeeeee...eee as the address since it’s a native token. Cheers :raised_hands:

Hey Thank you @YosephKS for the reply. Actually this is my problem, My wallet balance is in AVAX, I just need to convert it to USD. Is there any way to do this thing using useTokenPrice hook?

You need to to know the address for wrapped avax and to use that address. You can use it in different chains too.

yeah do as @cryptokid says, just keep in mind the hook is not to get the USD price of the asset in your wallet, rather to get the price of a certain token :raised_hands: