mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-20 20:25:48 +00:00
Refactored UInt and Derived Classes (#83)
Refactored UInt and Derived classes to be constructed from Buffers, and swapped out BN.js in favor of BigInt to reduce dependencies.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
const Decimal = require("decimal.js");
|
||||
import { bytesToHex, slice, parseBytes } from "./utils/bytes-utils";
|
||||
import { coreTypes } from "./types";
|
||||
import { BN } from "bn.js";
|
||||
|
||||
module.exports = {
|
||||
encode(arg) {
|
||||
@@ -11,7 +10,7 @@ module.exports = {
|
||||
.times("1e" + -exponent)
|
||||
.abs()
|
||||
.toString();
|
||||
const bytes = new coreTypes.UInt64(new BN(qualityString)).toBytes();
|
||||
const bytes = coreTypes.UInt64.from(BigInt(qualityString)).toBytes();
|
||||
bytes[0] = exponent + 100;
|
||||
return bytes;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user