@onekeyfe/blockchain-libs
Version:
OneKey Blockchain Libs
20 lines • 835 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.fromBigIntHex = exports.toBigIntHex = void 0;
const bignumber_js_1 = __importDefault(require("bignumber.js"));
const precondtion_1 = require("./precondtion");
const toBigIntHex = (value) => {
let hexStr = value.integerValue().toString(16);
hexStr = '0x' + hexStr;
return hexStr;
};
exports.toBigIntHex = toBigIntHex;
const fromBigIntHex = (value) => {
(0, precondtion_1.check)(value && value.startsWith('0x'), `Invalid hex string. value: ${value}`);
return new bignumber_js_1.default(value).integerValue();
};
exports.fromBigIntHex = fromBigIntHex;
//# sourceMappingURL=bignumber-plus.js.map