mirror of
https://github.com/stjet/banani.git
synced 2025-12-29 09:39:23 +00:00
fix critical raw_to_whole bug - v1.0.7
This commit is contained in:
4
util.ts
4
util.ts
@@ -154,8 +154,10 @@ export function raw_to_whole(raw: bigint, decimals = BANANO_DECIMALS): Whole {
|
||||
//truncate any extra zeroes
|
||||
const cl: number = whole_string.length;
|
||||
for (let c = 0; c < cl; c++) {
|
||||
if (whole_string.slice(-1) === "0" || whole_string.slice(-1) === ".") {
|
||||
let dot = whole_string.slice(-1) === ".";
|
||||
if (whole_string.slice(-1) === "0" || dot) {
|
||||
whole_string = whole_string.slice(0, -1);
|
||||
if (dot) break;
|
||||
}
|
||||
}
|
||||
return whole_string as Whole;
|
||||
|
||||
Reference in New Issue
Block a user