Skip to content

Commit 6dbf748

Browse files
committed
fix: toHumanFormat
1 parent 828b8d7 commit 6dbf748

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/sdk/utils/formatter.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ const limitNum = (n: bigint, d = 18): bigint => {
6868
}
6969
};
7070

71-
export function toHumanFormat(num: bigint, precision = 2): string {
71+
function toHumanFormat(num: bigint, precision = 2): string {
72+
if (num >= BigInt(1e18)) {
73+
return `${formatBn4dig(num / BigInt(1e12), precision)}T`;
74+
}
75+
7276
if (num >= BigInt(1e15)) {
7377
return `${formatBn4dig(num / BigInt(1e9), precision)}Bn`;
7478
}
@@ -84,7 +88,7 @@ export function toHumanFormat(num: bigint, precision = 2): string {
8488
return formatBn4dig(num, precision);
8589
}
8690

87-
export function formatBn4dig(num: bigint, precision = 2): string {
91+
function formatBn4dig(num: bigint, precision = 2): string {
8892
if (precision > 6) {
8993
throw new Error("Precision is too high, try <= 6");
9094
}

0 commit comments

Comments
 (0)