@injectivelabs/utils
Advanced tools
| //#region rolldown:runtime | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { | ||
| key = keys[i]; | ||
| if (!__hasOwnProp.call(to, key) && key !== except) { | ||
| __defProp(to, key, { | ||
| get: ((k) => from[k]).bind(null, key), | ||
| enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { | ||
| value: mod, | ||
| enumerable: true | ||
| }) : target, mod)); | ||
| //#endregion | ||
| let bignumber_js = require("bignumber.js"); | ||
| bignumber_js = __toESM(bignumber_js); | ||
| //#region src/classes/BigNumber.ts | ||
| var BigNumber_default = bignumber_js.default; | ||
| /** | ||
| * Converts a value to BigNumber if it isn't already | ||
| */ | ||
| const toBigNumber = (value) => { | ||
| if (value instanceof bignumber_js.default) return value; | ||
| return new bignumber_js.default(value); | ||
| }; | ||
| /** | ||
| * Converts a value to Wei (multiplies by 10^decimals) default to 18 decimals | ||
| */ | ||
| const toChainFormat = (value, decimals = 18) => { | ||
| return toBigNumber(value).multipliedBy(new bignumber_js.default(10).pow(decimals)); | ||
| }; | ||
| /** | ||
| * Converts a value from Wei to Base (divides by 10^decimals) default to 18 decimals | ||
| */ | ||
| const toHumanReadable = (value, decimals = 18) => { | ||
| return toBigNumber(value).dividedBy(new bignumber_js.default(10).pow(decimals)); | ||
| }; | ||
| //#endregion | ||
| //#region src/constants.ts | ||
| const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; | ||
| const INJ_DENOM = "inj"; | ||
| const INJECTIVE_DENOM = "inj"; | ||
| const DEFAULT_FEE_DENOM = "inj"; | ||
| const DEFAULT_GAS_LIMIT = 4e5; | ||
| const DEFAULT_IBC_GAS_LIMIT = 3e5; | ||
| const DEFAULT_GAS_PRICE = 16e7; | ||
| const DEFAULT_EXCHANGE_LIMIT = 2e5; | ||
| const DEFAULT_BRIDGE_FEE_DENOM = "inj"; | ||
| const DEFAULT_BRIDGE_FEE_PRICE = "160000000"; | ||
| const DEFAULT_BRIDGE_FEE_AMOUNT = "200000000000000"; | ||
| const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 60; | ||
| const DEFAULT_BLOCK_TIME_IN_SECONDS = .7; | ||
| /** | ||
| * Default timeout for transaction block inclusion polling. | ||
| * | ||
| * Calculation: 120 blocks × 0.7 seconds/block = 84 seconds = 84,000ms | ||
| */ | ||
| const DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS = Math.floor(DEFAULT_BLOCK_TIMEOUT_HEIGHT * DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3); | ||
| const DEFAULT_TX_POLL_INTERVAL_MS = 500; | ||
| const DEFAULT_TX_POLL_CALL_TIMEOUT_MS = 3e3; | ||
| const DEFAULT_TIMESTAMP_TIMEOUT_MS = 60 * 1e3 * 3; | ||
| const getDefaultStdFee = () => ({ | ||
| amount: [{ | ||
| amount: new BigNumber_default(DEFAULT_GAS_LIMIT).times(DEFAULT_GAS_PRICE).toString(), | ||
| denom: "inj" | ||
| }], | ||
| gas: DEFAULT_GAS_LIMIT.toString(), | ||
| payer: "", | ||
| granter: "", | ||
| feePayer: "" | ||
| }); | ||
| const DEFAULT_STD_FEE_BY_DENOM = (denom = "inj") => ({ | ||
| amount: [{ | ||
| denom, | ||
| amount: new BigNumber_default(DEFAULT_GAS_LIMIT).times(DEFAULT_GAS_PRICE).toString() | ||
| }], | ||
| gas: DEFAULT_GAS_LIMIT.toString() | ||
| }); | ||
| //#endregion | ||
| Object.defineProperty(exports, 'BigNumber_default', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return BigNumber_default; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_BLOCK_TIMEOUT_HEIGHT', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_BLOCK_TIMEOUT_HEIGHT; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_BLOCK_TIME_IN_SECONDS', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_BLOCK_TIME_IN_SECONDS; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_BRIDGE_FEE_AMOUNT', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_BRIDGE_FEE_AMOUNT; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_BRIDGE_FEE_DENOM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_BRIDGE_FEE_DENOM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_BRIDGE_FEE_PRICE', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_BRIDGE_FEE_PRICE; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_EXCHANGE_LIMIT', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_EXCHANGE_LIMIT; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_FEE_DENOM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_FEE_DENOM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_GAS_LIMIT', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_GAS_LIMIT; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_GAS_PRICE', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_GAS_PRICE; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_IBC_GAS_LIMIT', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_IBC_GAS_LIMIT; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_STD_FEE_BY_DENOM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_STD_FEE_BY_DENOM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_TIMESTAMP_TIMEOUT_MS', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_TIMESTAMP_TIMEOUT_MS; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_TX_POLL_CALL_TIMEOUT_MS', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_TX_POLL_CALL_TIMEOUT_MS; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_TX_POLL_INTERVAL_MS', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_TX_POLL_INTERVAL_MS; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'INJECTIVE_DENOM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return INJECTIVE_DENOM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'INJ_DENOM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return INJ_DENOM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'ZERO_ADDRESS', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return ZERO_ADDRESS; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, '__toESM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return __toESM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'getDefaultStdFee', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return getDefaultStdFee; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'toBigNumber', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return toBigNumber; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'toChainFormat', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return toChainFormat; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'toHumanReadable', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return toHumanReadable; | ||
| } | ||
| }); |
| import BigNumber from "bignumber.js"; | ||
| //#region src/classes/BigNumber.ts | ||
| var BigNumber_default = BigNumber; | ||
| /** | ||
| * Converts a value to BigNumber if it isn't already | ||
| */ | ||
| const toBigNumber = (value) => { | ||
| if (value instanceof BigNumber) return value; | ||
| return new BigNumber(value); | ||
| }; | ||
| /** | ||
| * Converts a value to Wei (multiplies by 10^decimals) default to 18 decimals | ||
| */ | ||
| const toChainFormat = (value, decimals = 18) => { | ||
| return toBigNumber(value).multipliedBy(new BigNumber(10).pow(decimals)); | ||
| }; | ||
| /** | ||
| * Converts a value from Wei to Base (divides by 10^decimals) default to 18 decimals | ||
| */ | ||
| const toHumanReadable = (value, decimals = 18) => { | ||
| return toBigNumber(value).dividedBy(new BigNumber(10).pow(decimals)); | ||
| }; | ||
| //#endregion | ||
| //#region src/constants.ts | ||
| const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; | ||
| const INJ_DENOM = "inj"; | ||
| const INJECTIVE_DENOM = "inj"; | ||
| const DEFAULT_FEE_DENOM = "inj"; | ||
| const DEFAULT_GAS_LIMIT = 4e5; | ||
| const DEFAULT_IBC_GAS_LIMIT = 3e5; | ||
| const DEFAULT_GAS_PRICE = 16e7; | ||
| const DEFAULT_EXCHANGE_LIMIT = 2e5; | ||
| const DEFAULT_BRIDGE_FEE_DENOM = "inj"; | ||
| const DEFAULT_BRIDGE_FEE_PRICE = "160000000"; | ||
| const DEFAULT_BRIDGE_FEE_AMOUNT = "200000000000000"; | ||
| const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 60; | ||
| const DEFAULT_BLOCK_TIME_IN_SECONDS = .7; | ||
| /** | ||
| * Default timeout for transaction block inclusion polling. | ||
| * | ||
| * Calculation: 120 blocks × 0.7 seconds/block = 84 seconds = 84,000ms | ||
| */ | ||
| const DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS = Math.floor(DEFAULT_BLOCK_TIMEOUT_HEIGHT * DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3); | ||
| const DEFAULT_TX_POLL_INTERVAL_MS = 500; | ||
| const DEFAULT_TX_POLL_CALL_TIMEOUT_MS = 3e3; | ||
| const DEFAULT_TIMESTAMP_TIMEOUT_MS = 60 * 1e3 * 3; | ||
| const getDefaultStdFee = () => ({ | ||
| amount: [{ | ||
| amount: new BigNumber_default(DEFAULT_GAS_LIMIT).times(DEFAULT_GAS_PRICE).toString(), | ||
| denom: "inj" | ||
| }], | ||
| gas: DEFAULT_GAS_LIMIT.toString(), | ||
| payer: "", | ||
| granter: "", | ||
| feePayer: "" | ||
| }); | ||
| const DEFAULT_STD_FEE_BY_DENOM = (denom = "inj") => ({ | ||
| amount: [{ | ||
| denom, | ||
| amount: new BigNumber_default(DEFAULT_GAS_LIMIT).times(DEFAULT_GAS_PRICE).toString() | ||
| }], | ||
| gas: DEFAULT_GAS_LIMIT.toString() | ||
| }); | ||
| //#endregion | ||
| export { toHumanReadable as C, toChainFormat as S, INJ_DENOM as _, DEFAULT_BRIDGE_FEE_PRICE as a, BigNumber_default as b, DEFAULT_GAS_LIMIT as c, DEFAULT_STD_FEE_BY_DENOM as d, DEFAULT_TIMESTAMP_TIMEOUT_MS as f, INJECTIVE_DENOM as g, DEFAULT_TX_POLL_INTERVAL_MS as h, DEFAULT_BRIDGE_FEE_DENOM as i, DEFAULT_GAS_PRICE as l, DEFAULT_TX_POLL_CALL_TIMEOUT_MS as m, DEFAULT_BLOCK_TIME_IN_SECONDS as n, DEFAULT_EXCHANGE_LIMIT as o, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS as p, DEFAULT_BRIDGE_FEE_AMOUNT as r, DEFAULT_FEE_DENOM as s, DEFAULT_BLOCK_TIMEOUT_HEIGHT as t, DEFAULT_IBC_GAS_LIMIT as u, ZERO_ADDRESS as v, toBigNumber as x, getDefaultStdFee as y }; |
@@ -1,2 +0,2 @@ | ||
| const require_constants = require('./constants-_5mj5g2W.cjs'); | ||
| const require_constants = require('./constants-BFjeP4ow.cjs'); | ||
| let axios = require("axios"); | ||
@@ -494,2 +494,4 @@ axios = require_constants.__toESM(axios); | ||
| exports.DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS = require_constants.DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS; | ||
| exports.DEFAULT_TX_POLL_CALL_TIMEOUT_MS = require_constants.DEFAULT_TX_POLL_CALL_TIMEOUT_MS; | ||
| exports.DEFAULT_TX_POLL_INTERVAL_MS = require_constants.DEFAULT_TX_POLL_INTERVAL_MS; | ||
| exports.HttpClient = HttpClient; | ||
@@ -496,0 +498,0 @@ exports.HttpRestClient = HttpRestClient; |
@@ -133,3 +133,3 @@ import BigNumber from "bignumber.js"; | ||
| declare const DEFAULT_BRIDGE_FEE_AMOUNT = "200000000000000"; | ||
| declare const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 120; | ||
| declare const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 60; | ||
| declare const DEFAULT_BLOCK_TIME_IN_SECONDS = 0.7; | ||
@@ -142,2 +142,4 @@ /** | ||
| declare const DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS: number; | ||
| declare const DEFAULT_TX_POLL_INTERVAL_MS = 500; | ||
| declare const DEFAULT_TX_POLL_CALL_TIMEOUT_MS = 3000; | ||
| declare const DEFAULT_TIMESTAMP_TIMEOUT_MS: number; | ||
@@ -270,2 +272,2 @@ declare const getDefaultStdFee: () => { | ||
| //#endregion | ||
| export { BigNumber, BigNumberInBase, BigNumberInWei, DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_BRIDGE_FEE_AMOUNT, DEFAULT_BRIDGE_FEE_DENOM, DEFAULT_BRIDGE_FEE_PRICE, DEFAULT_EXCHANGE_LIMIT, DEFAULT_FEE_DENOM, DEFAULT_GAS_LIMIT, DEFAULT_GAS_PRICE, DEFAULT_IBC_GAS_LIMIT, DEFAULT_STD_FEE_BY_DENOM, DEFAULT_TIMESTAMP_TIMEOUT_MS, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS, HttpClient, HttpRestClient, INJECTIVE_DENOM, INJ_DENOM, LocalStorage, Status, StatusType, ZERO_ADDRESS, awaitAll, awaitForAll, capitalize, convertTimestampToMilliseconds, formatWalletAddress, getBigNumberWithRounding, getDefaultStdFee, getEndDateStringFromTimeInSeconds, getExactDecimalsFromNumber, getSecondsInDay, getSignificantDecimalsFromNumber, getStdFee, getStdFeeForToken, getStdFeeFromObject, getStdFeeFromString, getUTCDateFromTimestamp, past24Hours, pastDays, sleep, snakeToPascal, splitArrayToChunks, splitArrayToChunksThrow, toBigNumber, toChainFormat, toHumanReadable, toPascalCase, todayInSeconds, tomorrow }; | ||
| export { BigNumber, BigNumberInBase, BigNumberInWei, DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_BRIDGE_FEE_AMOUNT, DEFAULT_BRIDGE_FEE_DENOM, DEFAULT_BRIDGE_FEE_PRICE, DEFAULT_EXCHANGE_LIMIT, DEFAULT_FEE_DENOM, DEFAULT_GAS_LIMIT, DEFAULT_GAS_PRICE, DEFAULT_IBC_GAS_LIMIT, DEFAULT_STD_FEE_BY_DENOM, DEFAULT_TIMESTAMP_TIMEOUT_MS, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS, DEFAULT_TX_POLL_CALL_TIMEOUT_MS, DEFAULT_TX_POLL_INTERVAL_MS, HttpClient, HttpRestClient, INJECTIVE_DENOM, INJ_DENOM, LocalStorage, Status, StatusType, ZERO_ADDRESS, awaitAll, awaitForAll, capitalize, convertTimestampToMilliseconds, formatWalletAddress, getBigNumberWithRounding, getDefaultStdFee, getEndDateStringFromTimeInSeconds, getExactDecimalsFromNumber, getSecondsInDay, getSignificantDecimalsFromNumber, getStdFee, getStdFeeForToken, getStdFeeFromObject, getStdFeeFromString, getUTCDateFromTimestamp, past24Hours, pastDays, sleep, snakeToPascal, splitArrayToChunks, splitArrayToChunksThrow, toBigNumber, toChainFormat, toHumanReadable, toPascalCase, todayInSeconds, tomorrow }; |
@@ -1,2 +0,2 @@ | ||
| const require_constants = require('../constants-_5mj5g2W.cjs'); | ||
| const require_constants = require('../constants-BFjeP4ow.cjs'); | ||
| let __injectivelabs_networks = require("@injectivelabs/networks"); | ||
@@ -3,0 +3,0 @@ let __injectivelabs_ts_types = require("@injectivelabs/ts-types"); |
@@ -133,3 +133,3 @@ import BigNumber from "bignumber.js"; | ||
| declare const DEFAULT_BRIDGE_FEE_AMOUNT = "200000000000000"; | ||
| declare const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 120; | ||
| declare const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 60; | ||
| declare const DEFAULT_BLOCK_TIME_IN_SECONDS = 0.7; | ||
@@ -142,2 +142,4 @@ /** | ||
| declare const DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS: number; | ||
| declare const DEFAULT_TX_POLL_INTERVAL_MS = 500; | ||
| declare const DEFAULT_TX_POLL_CALL_TIMEOUT_MS = 3000; | ||
| declare const DEFAULT_TIMESTAMP_TIMEOUT_MS: number; | ||
@@ -270,2 +272,2 @@ declare const getDefaultStdFee: () => { | ||
| //#endregion | ||
| export { BigNumber, BigNumberInBase, BigNumberInWei, DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_BRIDGE_FEE_AMOUNT, DEFAULT_BRIDGE_FEE_DENOM, DEFAULT_BRIDGE_FEE_PRICE, DEFAULT_EXCHANGE_LIMIT, DEFAULT_FEE_DENOM, DEFAULT_GAS_LIMIT, DEFAULT_GAS_PRICE, DEFAULT_IBC_GAS_LIMIT, DEFAULT_STD_FEE_BY_DENOM, DEFAULT_TIMESTAMP_TIMEOUT_MS, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS, HttpClient, HttpRestClient, INJECTIVE_DENOM, INJ_DENOM, LocalStorage, Status, StatusType, ZERO_ADDRESS, awaitAll, awaitForAll, capitalize, convertTimestampToMilliseconds, formatWalletAddress, getBigNumberWithRounding, getDefaultStdFee, getEndDateStringFromTimeInSeconds, getExactDecimalsFromNumber, getSecondsInDay, getSignificantDecimalsFromNumber, getStdFee, getStdFeeForToken, getStdFeeFromObject, getStdFeeFromString, getUTCDateFromTimestamp, past24Hours, pastDays, sleep, snakeToPascal, splitArrayToChunks, splitArrayToChunksThrow, toBigNumber, toChainFormat, toHumanReadable, toPascalCase, todayInSeconds, tomorrow }; | ||
| export { BigNumber, BigNumberInBase, BigNumberInWei, DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_BRIDGE_FEE_AMOUNT, DEFAULT_BRIDGE_FEE_DENOM, DEFAULT_BRIDGE_FEE_PRICE, DEFAULT_EXCHANGE_LIMIT, DEFAULT_FEE_DENOM, DEFAULT_GAS_LIMIT, DEFAULT_GAS_PRICE, DEFAULT_IBC_GAS_LIMIT, DEFAULT_STD_FEE_BY_DENOM, DEFAULT_TIMESTAMP_TIMEOUT_MS, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS, DEFAULT_TX_POLL_CALL_TIMEOUT_MS, DEFAULT_TX_POLL_INTERVAL_MS, HttpClient, HttpRestClient, INJECTIVE_DENOM, INJ_DENOM, LocalStorage, Status, StatusType, ZERO_ADDRESS, awaitAll, awaitForAll, capitalize, convertTimestampToMilliseconds, formatWalletAddress, getBigNumberWithRounding, getDefaultStdFee, getEndDateStringFromTimeInSeconds, getExactDecimalsFromNumber, getSecondsInDay, getSignificantDecimalsFromNumber, getStdFee, getStdFeeForToken, getStdFeeFromObject, getStdFeeFromString, getUTCDateFromTimestamp, past24Hours, pastDays, sleep, snakeToPascal, splitArrayToChunks, splitArrayToChunksThrow, toBigNumber, toChainFormat, toHumanReadable, toPascalCase, todayInSeconds, tomorrow }; |
@@ -1,2 +0,2 @@ | ||
| import { _ as getDefaultStdFee, a as DEFAULT_BRIDGE_FEE_PRICE, b as toChainFormat, c as DEFAULT_GAS_LIMIT, d as DEFAULT_STD_FEE_BY_DENOM, f as DEFAULT_TIMESTAMP_TIMEOUT_MS, g as ZERO_ADDRESS, h as INJ_DENOM, i as DEFAULT_BRIDGE_FEE_DENOM, l as DEFAULT_GAS_PRICE, m as INJECTIVE_DENOM, n as DEFAULT_BLOCK_TIME_IN_SECONDS, o as DEFAULT_EXCHANGE_LIMIT, p as DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS, r as DEFAULT_BRIDGE_FEE_AMOUNT, s as DEFAULT_FEE_DENOM, t as DEFAULT_BLOCK_TIMEOUT_HEIGHT, u as DEFAULT_IBC_GAS_LIMIT, v as BigNumber_default, x as toHumanReadable, y as toBigNumber } from "./constants-i4tKwoig.js"; | ||
| import { C as toHumanReadable, S as toChainFormat, _ as INJ_DENOM, a as DEFAULT_BRIDGE_FEE_PRICE, b as BigNumber_default, c as DEFAULT_GAS_LIMIT, d as DEFAULT_STD_FEE_BY_DENOM, f as DEFAULT_TIMESTAMP_TIMEOUT_MS, g as INJECTIVE_DENOM, h as DEFAULT_TX_POLL_INTERVAL_MS, i as DEFAULT_BRIDGE_FEE_DENOM, l as DEFAULT_GAS_PRICE, m as DEFAULT_TX_POLL_CALL_TIMEOUT_MS, n as DEFAULT_BLOCK_TIME_IN_SECONDS, o as DEFAULT_EXCHANGE_LIMIT, p as DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS, r as DEFAULT_BRIDGE_FEE_AMOUNT, s as DEFAULT_FEE_DENOM, t as DEFAULT_BLOCK_TIMEOUT_HEIGHT, u as DEFAULT_IBC_GAS_LIMIT, v as ZERO_ADDRESS, x as toBigNumber, y as getDefaultStdFee } from "./constants-BY74CT5-.js"; | ||
| import axios from "axios"; | ||
@@ -476,2 +476,2 @@ import store from "store2"; | ||
| //#endregion | ||
| export { BigNumber_default as BigNumber, BigNumberInBase, BigNumberInWei, DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_BRIDGE_FEE_AMOUNT, DEFAULT_BRIDGE_FEE_DENOM, DEFAULT_BRIDGE_FEE_PRICE, DEFAULT_EXCHANGE_LIMIT, DEFAULT_FEE_DENOM, DEFAULT_GAS_LIMIT, DEFAULT_GAS_PRICE, DEFAULT_IBC_GAS_LIMIT, DEFAULT_STD_FEE_BY_DENOM, DEFAULT_TIMESTAMP_TIMEOUT_MS, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS, HttpClient, HttpRestClient, INJECTIVE_DENOM, INJ_DENOM, LocalStorage, Status, StatusType, ZERO_ADDRESS, awaitAll, awaitForAll, capitalize, convertTimestampToMilliseconds, formatWalletAddress, getBigNumberWithRounding, getDefaultStdFee, getEndDateStringFromTimeInSeconds, getExactDecimalsFromNumber, getSecondsInDay, getSignificantDecimalsFromNumber, getStdFee, getStdFeeForToken, getStdFeeFromObject, getStdFeeFromString, getUTCDateFromTimestamp, past24Hours, pastDays, sleep, snakeToPascal, splitArrayToChunks, splitArrayToChunksThrow, toBigNumber, toChainFormat, toHumanReadable, toPascalCase, todayInSeconds, tomorrow }; | ||
| export { BigNumber_default as BigNumber, BigNumberInBase, BigNumberInWei, DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_BRIDGE_FEE_AMOUNT, DEFAULT_BRIDGE_FEE_DENOM, DEFAULT_BRIDGE_FEE_PRICE, DEFAULT_EXCHANGE_LIMIT, DEFAULT_FEE_DENOM, DEFAULT_GAS_LIMIT, DEFAULT_GAS_PRICE, DEFAULT_IBC_GAS_LIMIT, DEFAULT_STD_FEE_BY_DENOM, DEFAULT_TIMESTAMP_TIMEOUT_MS, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS, DEFAULT_TX_POLL_CALL_TIMEOUT_MS, DEFAULT_TX_POLL_INTERVAL_MS, HttpClient, HttpRestClient, INJECTIVE_DENOM, INJ_DENOM, LocalStorage, Status, StatusType, ZERO_ADDRESS, awaitAll, awaitForAll, capitalize, convertTimestampToMilliseconds, formatWalletAddress, getBigNumberWithRounding, getDefaultStdFee, getEndDateStringFromTimeInSeconds, getExactDecimalsFromNumber, getSecondsInDay, getSignificantDecimalsFromNumber, getStdFee, getStdFeeForToken, getStdFeeFromObject, getStdFeeFromString, getUTCDateFromTimestamp, past24Hours, pastDays, sleep, snakeToPascal, splitArrayToChunks, splitArrayToChunksThrow, toBigNumber, toChainFormat, toHumanReadable, toPascalCase, todayInSeconds, tomorrow }; |
@@ -1,2 +0,2 @@ | ||
| import { c as DEFAULT_GAS_LIMIT, l as DEFAULT_GAS_PRICE, v as BigNumber_default } from "../constants-i4tKwoig.js"; | ||
| import { b as BigNumber_default, c as DEFAULT_GAS_LIMIT, l as DEFAULT_GAS_PRICE } from "../constants-BY74CT5-.js"; | ||
| import { Network, getNetworkEndpoints, getNetworkInfo } from "@injectivelabs/networks"; | ||
@@ -3,0 +3,0 @@ import { ChainId, EvmChainId } from "@injectivelabs/ts-types"; |
+4
-4
| { | ||
| "name": "@injectivelabs/utils", | ||
| "version": "1.19.19", | ||
| "version": "1.19.20", | ||
| "description": "List of utils and helper functions that can be reused throughout Injective's projects.", | ||
@@ -69,5 +69,5 @@ "license": "Apache-2.0", | ||
| "store2": "^2.14.4", | ||
| "@injectivelabs/exceptions": "1.19.19", | ||
| "@injectivelabs/ts-types": "1.19.19", | ||
| "@injectivelabs/networks": "1.19.19" | ||
| "@injectivelabs/exceptions": "1.19.20", | ||
| "@injectivelabs/ts-types": "1.19.20", | ||
| "@injectivelabs/networks": "1.19.20" | ||
| }, | ||
@@ -74,0 +74,0 @@ "publishConfig": { |
| //#region rolldown:runtime | ||
| var __create = Object.create; | ||
| var __defProp = Object.defineProperty; | ||
| var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
| var __getOwnPropNames = Object.getOwnPropertyNames; | ||
| var __getProtoOf = Object.getPrototypeOf; | ||
| var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
| var __copyProps = (to, from, except, desc) => { | ||
| if (from && typeof from === "object" || typeof from === "function") { | ||
| for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { | ||
| key = keys[i]; | ||
| if (!__hasOwnProp.call(to, key) && key !== except) { | ||
| __defProp(to, key, { | ||
| get: ((k) => from[k]).bind(null, key), | ||
| enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| return to; | ||
| }; | ||
| var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { | ||
| value: mod, | ||
| enumerable: true | ||
| }) : target, mod)); | ||
| //#endregion | ||
| let bignumber_js = require("bignumber.js"); | ||
| bignumber_js = __toESM(bignumber_js); | ||
| //#region src/classes/BigNumber.ts | ||
| var BigNumber_default = bignumber_js.default; | ||
| /** | ||
| * Converts a value to BigNumber if it isn't already | ||
| */ | ||
| const toBigNumber = (value) => { | ||
| if (value instanceof bignumber_js.default) return value; | ||
| return new bignumber_js.default(value); | ||
| }; | ||
| /** | ||
| * Converts a value to Wei (multiplies by 10^decimals) default to 18 decimals | ||
| */ | ||
| const toChainFormat = (value, decimals = 18) => { | ||
| return toBigNumber(value).multipliedBy(new bignumber_js.default(10).pow(decimals)); | ||
| }; | ||
| /** | ||
| * Converts a value from Wei to Base (divides by 10^decimals) default to 18 decimals | ||
| */ | ||
| const toHumanReadable = (value, decimals = 18) => { | ||
| return toBigNumber(value).dividedBy(new bignumber_js.default(10).pow(decimals)); | ||
| }; | ||
| //#endregion | ||
| //#region src/constants.ts | ||
| const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; | ||
| const INJ_DENOM = "inj"; | ||
| const INJECTIVE_DENOM = "inj"; | ||
| const DEFAULT_FEE_DENOM = "inj"; | ||
| const DEFAULT_GAS_LIMIT = 4e5; | ||
| const DEFAULT_IBC_GAS_LIMIT = 3e5; | ||
| const DEFAULT_GAS_PRICE = 16e7; | ||
| const DEFAULT_EXCHANGE_LIMIT = 2e5; | ||
| const DEFAULT_BRIDGE_FEE_DENOM = "inj"; | ||
| const DEFAULT_BRIDGE_FEE_PRICE = "160000000"; | ||
| const DEFAULT_BRIDGE_FEE_AMOUNT = "200000000000000"; | ||
| const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 120; | ||
| const DEFAULT_BLOCK_TIME_IN_SECONDS = .7; | ||
| /** | ||
| * Default timeout for transaction block inclusion polling. | ||
| * | ||
| * Calculation: 120 blocks × 0.7 seconds/block = 84 seconds = 84,000ms | ||
| */ | ||
| const DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS = Math.floor(DEFAULT_BLOCK_TIMEOUT_HEIGHT * DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3); | ||
| const DEFAULT_TIMESTAMP_TIMEOUT_MS = 60 * 1e3 * 3; | ||
| const getDefaultStdFee = () => ({ | ||
| amount: [{ | ||
| amount: new BigNumber_default(DEFAULT_GAS_LIMIT).times(DEFAULT_GAS_PRICE).toString(), | ||
| denom: "inj" | ||
| }], | ||
| gas: DEFAULT_GAS_LIMIT.toString(), | ||
| payer: "", | ||
| granter: "", | ||
| feePayer: "" | ||
| }); | ||
| const DEFAULT_STD_FEE_BY_DENOM = (denom = "inj") => ({ | ||
| amount: [{ | ||
| denom, | ||
| amount: new BigNumber_default(DEFAULT_GAS_LIMIT).times(DEFAULT_GAS_PRICE).toString() | ||
| }], | ||
| gas: DEFAULT_GAS_LIMIT.toString() | ||
| }); | ||
| //#endregion | ||
| Object.defineProperty(exports, 'BigNumber_default', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return BigNumber_default; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_BLOCK_TIMEOUT_HEIGHT', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_BLOCK_TIMEOUT_HEIGHT; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_BLOCK_TIME_IN_SECONDS', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_BLOCK_TIME_IN_SECONDS; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_BRIDGE_FEE_AMOUNT', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_BRIDGE_FEE_AMOUNT; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_BRIDGE_FEE_DENOM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_BRIDGE_FEE_DENOM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_BRIDGE_FEE_PRICE', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_BRIDGE_FEE_PRICE; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_EXCHANGE_LIMIT', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_EXCHANGE_LIMIT; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_FEE_DENOM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_FEE_DENOM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_GAS_LIMIT', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_GAS_LIMIT; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_GAS_PRICE', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_GAS_PRICE; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_IBC_GAS_LIMIT', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_IBC_GAS_LIMIT; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_STD_FEE_BY_DENOM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_STD_FEE_BY_DENOM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_TIMESTAMP_TIMEOUT_MS', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_TIMESTAMP_TIMEOUT_MS; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'INJECTIVE_DENOM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return INJECTIVE_DENOM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'INJ_DENOM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return INJ_DENOM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'ZERO_ADDRESS', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return ZERO_ADDRESS; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, '__toESM', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return __toESM; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'getDefaultStdFee', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return getDefaultStdFee; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'toBigNumber', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return toBigNumber; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'toChainFormat', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return toChainFormat; | ||
| } | ||
| }); | ||
| Object.defineProperty(exports, 'toHumanReadable', { | ||
| enumerable: true, | ||
| get: function () { | ||
| return toHumanReadable; | ||
| } | ||
| }); |
| import BigNumber from "bignumber.js"; | ||
| //#region src/classes/BigNumber.ts | ||
| var BigNumber_default = BigNumber; | ||
| /** | ||
| * Converts a value to BigNumber if it isn't already | ||
| */ | ||
| const toBigNumber = (value) => { | ||
| if (value instanceof BigNumber) return value; | ||
| return new BigNumber(value); | ||
| }; | ||
| /** | ||
| * Converts a value to Wei (multiplies by 10^decimals) default to 18 decimals | ||
| */ | ||
| const toChainFormat = (value, decimals = 18) => { | ||
| return toBigNumber(value).multipliedBy(new BigNumber(10).pow(decimals)); | ||
| }; | ||
| /** | ||
| * Converts a value from Wei to Base (divides by 10^decimals) default to 18 decimals | ||
| */ | ||
| const toHumanReadable = (value, decimals = 18) => { | ||
| return toBigNumber(value).dividedBy(new BigNumber(10).pow(decimals)); | ||
| }; | ||
| //#endregion | ||
| //#region src/constants.ts | ||
| const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000"; | ||
| const INJ_DENOM = "inj"; | ||
| const INJECTIVE_DENOM = "inj"; | ||
| const DEFAULT_FEE_DENOM = "inj"; | ||
| const DEFAULT_GAS_LIMIT = 4e5; | ||
| const DEFAULT_IBC_GAS_LIMIT = 3e5; | ||
| const DEFAULT_GAS_PRICE = 16e7; | ||
| const DEFAULT_EXCHANGE_LIMIT = 2e5; | ||
| const DEFAULT_BRIDGE_FEE_DENOM = "inj"; | ||
| const DEFAULT_BRIDGE_FEE_PRICE = "160000000"; | ||
| const DEFAULT_BRIDGE_FEE_AMOUNT = "200000000000000"; | ||
| const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 120; | ||
| const DEFAULT_BLOCK_TIME_IN_SECONDS = .7; | ||
| /** | ||
| * Default timeout for transaction block inclusion polling. | ||
| * | ||
| * Calculation: 120 blocks × 0.7 seconds/block = 84 seconds = 84,000ms | ||
| */ | ||
| const DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS = Math.floor(DEFAULT_BLOCK_TIMEOUT_HEIGHT * DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3); | ||
| const DEFAULT_TIMESTAMP_TIMEOUT_MS = 60 * 1e3 * 3; | ||
| const getDefaultStdFee = () => ({ | ||
| amount: [{ | ||
| amount: new BigNumber_default(DEFAULT_GAS_LIMIT).times(DEFAULT_GAS_PRICE).toString(), | ||
| denom: "inj" | ||
| }], | ||
| gas: DEFAULT_GAS_LIMIT.toString(), | ||
| payer: "", | ||
| granter: "", | ||
| feePayer: "" | ||
| }); | ||
| const DEFAULT_STD_FEE_BY_DENOM = (denom = "inj") => ({ | ||
| amount: [{ | ||
| denom, | ||
| amount: new BigNumber_default(DEFAULT_GAS_LIMIT).times(DEFAULT_GAS_PRICE).toString() | ||
| }], | ||
| gas: DEFAULT_GAS_LIMIT.toString() | ||
| }); | ||
| //#endregion | ||
| export { getDefaultStdFee as _, DEFAULT_BRIDGE_FEE_PRICE as a, toChainFormat as b, DEFAULT_GAS_LIMIT as c, DEFAULT_STD_FEE_BY_DENOM as d, DEFAULT_TIMESTAMP_TIMEOUT_MS as f, ZERO_ADDRESS as g, INJ_DENOM as h, DEFAULT_BRIDGE_FEE_DENOM as i, DEFAULT_GAS_PRICE as l, INJECTIVE_DENOM as m, DEFAULT_BLOCK_TIME_IN_SECONDS as n, DEFAULT_EXCHANGE_LIMIT as o, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS as p, DEFAULT_BRIDGE_FEE_AMOUNT as r, DEFAULT_FEE_DENOM as s, DEFAULT_BLOCK_TIMEOUT_HEIGHT as t, DEFAULT_IBC_GAS_LIMIT as u, BigNumber_default as v, toHumanReadable as x, toBigNumber as y }; |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
99121
1.22%2068
0.98%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed