Skip to content

Commit

Permalink
fix: parse udt value negative issue (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyouxin authored and Keith-CY committed Nov 15, 2023
1 parent ed8fd09 commit 993e330
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const parseUDTAmount = (amount: string, decimal: string | number) => {
if (decimalInt > 20) {
return `${result.toFixed(20)}...`
}
if (result.toString().length >= 16 || result.lt(new BigNumber(0.000001))) {
if (result.toString().length >= 16 || result.abs().lt(new BigNumber(0.000001))) {
return localeNumberString(result.toFixed(decimalInt))
}
return localeNumberString(result.toNumber())
Expand Down

0 comments on commit 993e330

Please sign in to comment.