koilib 5.5.4 → 5.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/koinos.js +8 -0
- package/dist/koinos.min.js +1 -1
- package/lib/Contract.d.ts +1 -1
- package/lib/browser/Contract.d.ts +1 -1
- package/lib/browser/utils.js +8 -0
- package/lib/browser/utils.js.map +1 -1
- package/lib/utils.js +8 -0
- package/lib/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/Contract.ts +2 -2
- package/src/utils.ts +8 -0
package/dist/koinos.js
CHANGED
|
@@ -25028,6 +25028,14 @@ function parseUnits(value, decimals) {
|
|
|
25028
25028
|
if (!decimalPart)
|
|
25029
25029
|
decimalPart = "";
|
|
25030
25030
|
decimalPart = decimalPart.padEnd(decimals, "0");
|
|
25031
|
+
if (decimalPart.length > decimals) {
|
|
25032
|
+
// approximate
|
|
25033
|
+
const miniDecimals = decimalPart.substring(decimals);
|
|
25034
|
+
decimalPart = decimalPart.substring(0, decimals);
|
|
25035
|
+
if (miniDecimals.startsWith("5")) {
|
|
25036
|
+
decimalPart = (BigInt(decimalPart) + BigInt(1)).toString();
|
|
25037
|
+
}
|
|
25038
|
+
}
|
|
25031
25039
|
return `${sign}${`${integerPart}${decimalPart}`.replace(/^0+(?=\d)/, "")}`;
|
|
25032
25040
|
}
|
|
25033
25041
|
exports.parseUnits = parseUnits;
|