diff --git a/src/APIClient/APIClient10.js b/src/APIClient/APIClient10.js index 49da903..ad96a84 100644 --- a/src/APIClient/APIClient10.js +++ b/src/APIClient/APIClient10.js @@ -1,5 +1,5 @@ import xhr from "axios/index"; -import { PRECISION_RATE } from "utils/constants"; +import { MULTIPLE_CURRENCY_RATE} from "utils/constants"; import Cookies from 'js-cookie'; @@ -97,7 +97,7 @@ class APIClient10 { return this.request('/api/v1/cheque/price-all').then((res) => { Object.keys(res).forEach((key) => { const item = res[key]; - item.rate = +item.rate * PRECISION_RATE; + item.rate = MULTIPLE_CURRENCY_RATE[key] //+item.rate * PRECISION_RATE; }) return res; }).catch(e => { diff --git a/src/components/Modals/WithdrawDepositModal.js b/src/components/Modals/WithdrawDepositModal.js index bede0c0..2e4a1e9 100644 --- a/src/components/Modals/WithdrawDepositModal.js +++ b/src/components/Modals/WithdrawDepositModal.js @@ -35,6 +35,7 @@ export default function WithdrawDepositModal({ color }) { let currentObj = {}; const token = tokenCurrent || 'WBTT'; let maxnum = 0 + setTokenCurrent(token) if (params.type === 'withdraw') { setTitle('chequebook_withdraw'); setDescription('amount_to_withdraw'); diff --git a/src/components/Stats/NodeRevenueStats.js b/src/components/Stats/NodeRevenueStats.js index 18407b8..00b7d6c 100644 --- a/src/components/Stats/NodeRevenueStats.js +++ b/src/components/Stats/NodeRevenueStats.js @@ -232,7 +232,6 @@ export default function NodeRevenueStats({ color }) { dataList: chequeEarningDetailList, }); }; - return (
diff --git a/src/services/dashboardService.js b/src/services/dashboardService.js index fa72285..a134237 100644 --- a/src/services/dashboardService.js +++ b/src/services/dashboardService.js @@ -2,7 +2,7 @@ import Client10 from "APIClient/APIClient10.js"; import BigNumber from 'bignumber.js'; import { switchStorageUnit2, switchBalanceUnit, toThousands, getTimes,formatNumber } from "utils/BTFSUtil.js"; -import { PRECISION, PRECISION_RATE, PRECISION_OLD, FEE, NEW_SCORE_VERSION, INIT_MULTI_CURRENCY_DATA, MULTIPLE_CURRENCY_LIST,MULTIPLE_CURRENCY_RATE } from "utils/constants.js"; +import { PRECISION, PRECISION_RATE, PRECISION_OLD, FEE, NEW_SCORE_VERSION, INIT_MULTI_CURRENCY_DATA, MULTIPLE_CURRENCY_LIST } from "utils/constants.js"; export const getHostInfo = () => { return Client10.getHostInfo(); } @@ -150,13 +150,7 @@ export const getNodeRevenueStats = async () => { : 0; const chequeExpense = +result[0]["totalSent"]; const hasTotalExpense = gasFee || chequeExpense; - const currencyRateList = []; - currencyRateList.push( - 1, - result[5]?.data?.rate, - result[6]?.data?.rate, - result[7]?.data?.rate - ); + const checksExpenseDetailsData = []; const chequeEarningDetailData = []; INIT_MULTI_CURRENCY_DATA.forEach((item, index) => { @@ -177,8 +171,7 @@ export const getNodeRevenueStats = async () => { priceItem?.rate ) expenseItem.bttValue = switchBalanceUnit( - (+totalData.total_issued || 0) * - (currencyRateList[index] ? 1 / currencyRateList[index] : 1), + (+totalData.total_issued || 0) , priceItem?.rate * exchangeRate ) earningItem.value = switchBalanceUnit( @@ -186,8 +179,7 @@ export const getNodeRevenueStats = async () => { priceItem?.rate ) earningItem.bttValue = switchBalanceUnit( - (+totalData.total_received || 0) * - (currencyRateList[index] ? 1 / currencyRateList[index] : 1), + (+totalData.total_received || 0) , priceItem?.rate * exchangeRate ) checksExpenseDetailsData.push(expenseItem) @@ -320,8 +312,8 @@ export const getNodeWalletStats = async () => { newItem.bookBalanceValue = 0 newItem.maxBookBalanceCount = 0 if (allBalanceData?.[item.key]) { - // newItem.addressValue = switchBalanceUnit(allBalanceData?.[item.key], priceList?.[item.key]?.rate) - newItem.addressValue = switchBalanceUnit(allBalanceData?.[item.key], MULTIPLE_CURRENCY_RATE?.[item.key]) + newItem.addressValue = switchBalanceUnit(allBalanceData?.[item.key], priceList?.[item.key]?.rate) + // newItem.addressValue = switchBalanceUnit(allBalanceData?.[item.key], MULTIPLE_CURRENCY_RATE?.[item.key]) newItem.maxAddressCount = new BigNumber(allBalanceData?.[item.key]) .dividedBy(priceList?.[item.key]?.rate) .toNumber() @@ -410,10 +402,10 @@ export const getFilesStorage = async () => { const formAmount = (amount, currencyType = '') => { let precision = PRECISION; - if (!['btt', 'wbtt'].includes(currencyType.toLowerCase())) { + if (!['btt', 'wbtt','usdd'].includes(currencyType.toLowerCase())) { precision = PRECISION_RATE; } - console.log(amount, currencyType, PRECISION_RATE); + console.log(amount, currencyType, precision); let amount_str = new BigNumber(amount).multipliedBy(precision).toFixed(); return amount_str; }; diff --git a/src/utils/constants.js b/src/utils/constants.js index 74f3cf8..b198b1f 100644 --- a/src/utils/constants.js +++ b/src/utils/constants.js @@ -165,6 +165,7 @@ export const SAMPLE_PAGE_MODE = 'SimpleMode'; export const MULTIPLE_CURRENCY_RATE = { WBTT:1000000000000000000 , USDD:1000000000000000000, + TST:1000000, TRX:1000000, USDT:1000000, USDD_t:1000000000000000000,