Feat/asset balance decimals fix (#1474)
* feat: positions tab asset balance decimals * feat: positions tab asset balance decimals
This commit is contained in:
parent
195e234f16
commit
3f6bd066f1
@ -17,19 +17,16 @@ export const AssetBalance = ({ partyId, assetSymbol }: AssetBalanceProps) => {
|
||||
variables,
|
||||
});
|
||||
if (data && data.length) {
|
||||
let decimals = 0;
|
||||
const totalBalance = data.reduce((a, c) => {
|
||||
if (c.asset.symbol === assetSymbol) {
|
||||
decimals = c.asset.decimals;
|
||||
return a + BigInt(c.balance);
|
||||
}
|
||||
return a;
|
||||
}, BigInt(0));
|
||||
return (
|
||||
<span>
|
||||
{addDecimalsFormatNumber(
|
||||
totalBalance.toString(),
|
||||
data[0].asset.decimals
|
||||
)}
|
||||
</span>
|
||||
<span>{addDecimalsFormatNumber(totalBalance.toString(), decimals)}</span>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user