UNPKG

@broxus/js-core

Version:

MobX-based JavaScript Core library

14 lines (13 loc) 742 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.gasToValue = gasToValue; const bignumber_js_1 = __importDefault(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.default)(fixedValue).plus((0, bignumber_js_1.default)(dynamicGas).times(gasPrice)).plus(safeAmount).toFixed(); }