0

I'm pulling prices from an api, and I have a function where I pull the prices, and return a formatted version of them.

          const res = await CoinGeckoClient.coins.fetch(farm.quoteToken.name)
          // console.log(res)
          const data = await res.data
          const unformatted_price = new BigNumber(data.market_data.current_price.usd).toString()
          // console.log(earn_price)
          const formatted_price = parseFloat(unformatted_price).toLocaleString(undefined, {
            minimumSignificantDigits: 3,
          })

          return formatted_price
        }

Inside of the function, if I console.log(formatted_price) it gives me the result I'm looking for. However when I return it to use when calling the function, I get a pending fulfilled promise. I'm trying to get the promise result as shown.

Sort of confused on how it's pending, but it's fulfilled with a result? I've tried .then() and everything but I continue to get Promise {}. Any help would be appreciated!

enter image description here

Mari
  • 31
  • 1
  • 2
  • 6

0 Answers0