fix critical raw_to_whole bug - v1.0.7

This commit is contained in:
stjet
2025-01-13 02:41:08 +00:00
parent f185cadd21
commit a43bcd3e4e
63 changed files with 145 additions and 143 deletions

View File

@@ -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;