diff --git a/src/app/pages/RewardPage/components/FeesEarnedTab/index.tsx b/src/app/pages/RewardPage/components/FeesEarnedTab/index.tsx index fdff2b085..9d307b38c 100644 --- a/src/app/pages/RewardPage/components/FeesEarnedTab/index.tsx +++ b/src/app/pages/RewardPage/components/FeesEarnedTab/index.tsx @@ -44,6 +44,29 @@ export const FeesEarnedTab: React.FC = ({ const isClaimDisabled = useMemo(() => tx.loading, [tx.loading]); + const fees = useMemo( + () => + earnedFees.reduce((p, c) => { + const asset = c.asset; + const index = p.findIndex(i => i.asset === asset); + if (index === -1) { + p.push({ + asset, + value: c.value, + rbtcValue: c.rbtcValue, + contractAddress: c.contractAddress, + }); + } else { + p[index].value = bignumber(p[index].value).add(c.value).toString(); + p[index].rbtcValue = bignumber(p[index].rbtcValue) + .add(c.rbtcValue) + .toNumber(); + } + return p; + }, [] as IEarnedFee[]), + [earnedFees], + ); + return (
@@ -100,7 +123,7 @@ export const FeesEarnedTab: React.FC = ({ - {earnedFees.map(earnedFee => ( + {fees.map(earnedFee => ( ({ - asset: assetByTokenAddress(token) || assetByLoanTokenAddress(token), + asset: + assetByTokenAddress(token) || + assetByLoanTokenAddress(token) || + Asset.RBTC, contractAddress: token, value: amounts.returnData[token].toString(), rbtcValue: 0,