"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.maxBN = exports.minBN = exports.bnToNumber = exports.safeParseUnits = exports.toBN = exports.formatUnits = exports.BigNumber = void 0;
var ethers_1 = require("ethers");
var format_1 = require("./format");
var ethers_2 = require("ethers");
Object.defineProperty(exports, "BigNumber", { enumerable: true, get: function () { return ethers_2.BigNumber; } });
exports.formatUnits = ethers_1.utils.formatUnits;
exports.toBN = ethers_1.BigNumber.from;
var safeParseUnits = function (value, dec) {
    // using maxDecimals prevents parseUnits throwing an error when asked to
    // parse a value with more decimals than its second prop allows
    return ethers_1.utils.parseUnits((0, format_1.maxDecimals)(value, dec), dec);
};
exports.safeParseUnits = safeParseUnits;
var bnToNumber = function (n, d) {
    return parseFloat((0, exports.formatUnits)(n, d));
};
exports.bnToNumber = bnToNumber;
var minBN = function (a, b) {
    return ethers_1.BigNumber.from(a).lt(ethers_1.BigNumber.from(b))
        ? ethers_1.BigNumber.from(a)
        : ethers_1.BigNumber.from(b);
};
exports.minBN = minBN;
var maxBN = function (a, b) {
    return ethers_1.BigNumber.from(a).gt(ethers_1.BigNumber.from(b))
        ? ethers_1.BigNumber.from(a)
        : ethers_1.BigNumber.from(b);
};
exports.maxBN = maxBN;
//# sourceMappingURL=bn.js.map