From 6c6f649f6cba7dde9ef36e465b66bae0a5d6d65c Mon Sep 17 00:00:00 2001 From: "ildar.timerbaev" Date: Mon, 10 Jun 2024 11:53:41 +0600 Subject: [PATCH] Fixed hive engine estimated value --- .../components/engine-tokens-estimated/index.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/components/engine-tokens-estimated/index.tsx b/src/common/components/engine-tokens-estimated/index.tsx index 5c0c2d8862e..57df247fc0b 100644 --- a/src/common/components/engine-tokens-estimated/index.tsx +++ b/src/common/components/engine-tokens-estimated/index.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useEffect, useState } from "react"; import { _t } from "../../i18n"; import { getMetrics } from "../../api/hive-engine"; @@ -30,13 +30,13 @@ export const EngineTokensEstimated = (props: any) => { ? Number(pricePerHive * w.balance) : w.lastPrice === 0 ? 0 - : Number(w.lastPrice * pricePerHive * w.balance); + : Number((w.lastPrice ?? 0) * pricePerHive * w.balance); }); - const totalWalletUsdValue = tokens_usd_prices.reduce((x: any, y: any) => { - const totalValue = +(x + y).toFixed(3); - return totalValue; - }, 0); + const totalWalletUsdValue = tokens_usd_prices.reduce( + (x: any, y: any) => +(x + y).toFixed(3), + 0 + ); const usd_total_value = totalWalletUsdValue.toLocaleString("en-US", { style: "currency", currency: "USD"