@injectivelabs/utils
Advanced tools
Comparing version
@@ -11,2 +11,12 @@ import { ComposerResponse } from '@injectivelabs/ts-types'; | ||
}; | ||
export declare const getStdFeeForToken: (token?: { | ||
denom: string; | ||
decimals: number; | ||
}) => { | ||
amount: { | ||
denom: string; | ||
amount: string; | ||
}[]; | ||
gas: string; | ||
}; | ||
//# sourceMappingURL=helpers.d.ts.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mapMultipleComposerResponseMessages = exports.isServerSide = exports.sleep = void 0; | ||
exports.getStdFeeForToken = exports.mapMultipleComposerResponseMessages = exports.isServerSide = exports.sleep = void 0; | ||
const BigNumberInBase_1 = __importDefault(require("./classes/BigNumber/BigNumberInBase")); | ||
const BigNumberInWei_1 = __importDefault(require("./classes/BigNumber/BigNumberInWei")); | ||
const constants_1 = require("./constants"); | ||
const sleep = (timeout) => new Promise((resolve) => setTimeout(resolve, timeout)); | ||
@@ -30,2 +36,18 @@ exports.sleep = sleep; | ||
exports.mapMultipleComposerResponseMessages = mapMultipleComposerResponseMessages; | ||
const getStdFeeForToken = (token = { denom: 'inj', decimals: 18 }) => { | ||
const gasPrice = new BigNumberInWei_1.default(constants_1.DEFAULT_GAS_PRICE).toBase(); | ||
const gasPriceScaled = gasPrice.toWei(token.decimals); | ||
return { | ||
amount: [ | ||
{ | ||
denom: token.denom, | ||
amount: new BigNumberInBase_1.default(constants_1.DEFAULT_GAS_LIMIT) | ||
.times(gasPriceScaled) | ||
.toString(), | ||
}, | ||
], | ||
gas: constants_1.DEFAULT_GAS_LIMIT.toString(), | ||
}; | ||
}; | ||
exports.getStdFeeForToken = getStdFeeForToken; | ||
//# sourceMappingURL=helpers.js.map |
{ | ||
"name": "@injectivelabs/utils", | ||
"description": "List of utils and helper functions that can be reused throughout Injective's projects.", | ||
"version": "1.0.38", | ||
"version": "1.0.39", | ||
"author": { | ||
@@ -43,3 +43,3 @@ "name": "Bojan Angjelkoski", | ||
}, | ||
"gitHead": "ae63d770ca55242b7b884aafe2dd2a81369439f4" | ||
"gitHead": "cb4c096488c1078c98906943faef9eadd1871700" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
95167
1.93%1113
2.96%