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,
|
variables,
|
||||||
});
|
});
|
||||||
if (data && data.length) {
|
if (data && data.length) {
|
||||||
|
let decimals = 0;
|
||||||
const totalBalance = data.reduce((a, c) => {
|
const totalBalance = data.reduce((a, c) => {
|
||||||
if (c.asset.symbol === assetSymbol) {
|
if (c.asset.symbol === assetSymbol) {
|
||||||
|
decimals = c.asset.decimals;
|
||||||
return a + BigInt(c.balance);
|
return a + BigInt(c.balance);
|
||||||
}
|
}
|
||||||
return a;
|
return a;
|
||||||
}, BigInt(0));
|
}, BigInt(0));
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>{addDecimalsFormatNumber(totalBalance.toString(), decimals)}</span>
|
||||||
{addDecimalsFormatNumber(
|
|
||||||
totalBalance.toString(),
|
|
||||||
data[0].asset.decimals
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user