@broxus/js-core
Version:
MobX-based JavaScript Core library
11 lines (10 loc) • 590 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.gasToValue = gasToValue;
const bignumber_js_1 = require("bignumber.js");
const constants_1 = require("../constants");
const to_int_1 = require("../utils/to-int");
// fixedValue + (dynamicGas * gasPrice) + 1 ever
function gasToValue(fixedValue, dynamicGas, gasPrice = 1000, safeAmount = (0, to_int_1.toInt)(1, constants_1.DEFAULT_NATIVE_CURRENCY_DECIMALS)) {
return (0, bignumber_js_1.BigNumber)(fixedValue).plus((0, bignumber_js_1.BigNumber)(dynamicGas).times(gasPrice)).plus(safeAmount).toFixed();
}