Revert "fix too aggressively flooring BN math (#276)"
This reverts commit 28c542be3f
.
This commit is contained in:
parent
28c542be3f
commit
cc220f56e3
|
@ -34,14 +34,13 @@ export function toUiDecimals(
|
|||
nativeAmount: BN | I80F48 | number,
|
||||
decimals: number,
|
||||
): number {
|
||||
if (nativeAmount instanceof I80F48) {
|
||||
if (nativeAmount instanceof BN) {
|
||||
return nativeAmount.div(new BN(Math.pow(10, decimals))).toNumber();
|
||||
} else if (nativeAmount instanceof I80F48) {
|
||||
return nativeAmount
|
||||
.div(I80F48.fromNumber(Math.pow(10, decimals)))
|
||||
.toNumber();
|
||||
}
|
||||
if (nativeAmount instanceof BN) {
|
||||
nativeAmount = nativeAmount.toNumber();
|
||||
}
|
||||
return nativeAmount / Math.pow(10, decimals);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue