diff --git a/src/components/modular/StakingPool/index.tsx b/src/components/modular/StakingPool/index.tsx
index 82a568458..33dcfcf28 100644
--- a/src/components/modular/StakingPool/index.tsx
+++ b/src/components/modular/StakingPool/index.tsx
@@ -1,15 +1,15 @@
import React from 'react';
import { View } from 'react-native';
import { useTranslation } from 'react-i18next';
-import { BigNumber } from 'ethers';
+import { ethers } from 'ethers';
import { StakingPool } from '@models';
import { Row, Spacer, Text } from '@components/base';
import { useStakingPoolDetails } from '@entities/staking';
import { TokenLogo } from '../TokenLogo';
-import { NumberUtils } from '@utils/number';
import { TokenUtils } from '@utils/token';
import { scale, verticalScale } from '@utils/scaling';
import { COLORS } from '@constants/colors';
+import { NumberUtils } from '@utils/number';
interface StakingPoolItemProps {
stakingPool: StakingPool;
@@ -44,9 +44,10 @@ export const StakingPoolItem = (props: StakingPoolItemProps) => {
fontWeight="500"
>
{t('staking.current.stake', {
- amount: NumberUtils.formatAmount(
- poolStakingDetails?.user.raw ?? BigNumber.from(0),
- 0
+ amount: NumberUtils.formatDecimal(
+ ethers.utils.formatEther(
+ poolStakingDetails?.user.raw ?? ethers.BigNumber.from(0)
+ )
),
symbol: 'AMB'
})}
diff --git a/src/screens/StakingPool/components/StakingInfo.tsx b/src/screens/StakingPool/components/StakingInfo.tsx
index f6b1cda75..ea838a9d0 100644
--- a/src/screens/StakingPool/components/StakingInfo.tsx
+++ b/src/screens/StakingPool/components/StakingInfo.tsx
@@ -7,7 +7,7 @@ import { moderateScale, scale, verticalScale } from '@utils/scaling';
import React, { PropsWithChildren, ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import { StyleSheet, View } from 'react-native';
-import { BigNumber } from 'ethers';
+import { BigNumber, ethers } from 'ethers';
interface StakingInfoProps {
totalStake: number;
@@ -97,7 +97,8 @@ export const StakingInfo = (props: StakingInfoProps) => {
fontSize={14}
fontWeight="600"
>
- {NumberUtils.formatAmount(userStaking)} AMB
+ {NumberUtils.formatDecimal(ethers.utils.formatEther(userStaking))}{' '}
+ AMB
{
return `${formattedIntPart}.${formattedFloatPart}`;
};
+const formatDecimal = (value: string, decimals = 2): string => {
+ const fixed = Number(value).toFixed(decimals);
+ return fixed.replace(/\.?0+$/, '');
+};
+
export const NumberUtils = {
formatNumber,
addSignToNumber,
@@ -140,5 +145,6 @@ export const NumberUtils = {
limitDecimalCount,
formatAmount,
minimiseAmount,
- numberToTransformedLocale
+ numberToTransformedLocale,
+ formatDecimal
};