@injectivelabs/utils 1.20.15 → 1.20.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BigNumber-B-r__Egf.d.cts +18 -0
- package/dist/cjs/BigNumber-DbDA4_xA.cjs +51 -0
- package/dist/cjs/BigNumberInBase-CVKbAXw6.cjs +84 -0
- package/dist/cjs/BigNumberInWei-BMQpZg3S.d.cts +36 -0
- package/dist/cjs/HttpRestClient-C0p7w6ht.d.cts +29 -0
- package/dist/cjs/HttpRestClient-C761J3nA.cjs +138 -0
- package/dist/cjs/LocalStorage-DRuofBv_.cjs +35 -0
- package/dist/cjs/LocalStorage-Dqm913-z.d.cts +12 -0
- package/dist/cjs/Status-C1EkdFOa.cjs +84 -0
- package/dist/cjs/Status-lj0Wyw_3.d.cts +34 -0
- package/dist/cjs/big-number.cjs +9 -0
- package/dist/cjs/big-number.d.cts +3 -0
- package/dist/cjs/chunk-CbDLau6x.cjs +34 -0
- package/dist/cjs/constants-BRub-WIk.d.cts +42 -0
- package/dist/cjs/{constants-BFjeP4ow.cjs → constants-BdaegCnI.cjs} +3 -84
- package/dist/cjs/constants.cjs +22 -0
- package/dist/cjs/constants.d.cts +2 -0
- package/dist/cjs/defineProperty-CImP5zIM.cjs +49 -0
- package/dist/cjs/formatters-CBhRviK1.cjs +42 -0
- package/dist/cjs/formatters-lY6KvxzC.d.cts +9 -0
- package/dist/cjs/formatters.cjs +6 -0
- package/dist/cjs/formatters.d.cts +2 -0
- package/dist/cjs/helpers-BW4oKV4e.cjs +144 -0
- package/dist/cjs/helpers-BmH3TkaY.d.cts +88 -0
- package/dist/cjs/helpers.cjs +13 -0
- package/dist/cjs/helpers.d.cts +2 -0
- package/dist/cjs/http.cjs +5 -0
- package/dist/cjs/http.d.cts +2 -0
- package/dist/cjs/index.cjs +47 -512
- package/dist/cjs/index.d.cts +10 -269
- package/dist/cjs/light.cjs +180 -0
- package/dist/cjs/light.d.cts +93 -0
- package/dist/cjs/numbers-BRXzNJ1I.cjs +39 -0
- package/dist/cjs/numbers-CVJM893V.d.cts +8 -0
- package/dist/cjs/numbers.cjs +6 -0
- package/dist/cjs/numbers.d.cts +3 -0
- package/dist/cjs/status.cjs +5 -0
- package/dist/cjs/status.d.cts +2 -0
- package/dist/cjs/storage.cjs +4 -0
- package/dist/cjs/storage.d.cts +2 -0
- package/dist/cjs/test-utils/index.cjs +4 -2
- package/dist/cjs/time-CPSnQ8xf.cjs +74 -0
- package/dist/cjs/time-DQwWSv4e.d.cts +13 -0
- package/dist/cjs/time.cjs +11 -0
- package/dist/cjs/time.d.cts +3 -0
- package/dist/esm/BigNumber-DUr2WQBK.js +26 -0
- package/dist/esm/BigNumber-jKUujKpO.d.ts +18 -0
- package/dist/esm/BigNumberInBase-Dcx5wyxY.js +73 -0
- package/dist/esm/BigNumberInWei-JtQuFET_.d.ts +36 -0
- package/dist/esm/HttpRestClient-B-UvB9KB.d.ts +29 -0
- package/dist/esm/HttpRestClient-CsKkn8lo.js +125 -0
- package/dist/esm/LocalStorage-Cpe5wG8z.js +28 -0
- package/dist/esm/LocalStorage-CyTj3H1T.d.ts +12 -0
- package/dist/esm/Status-C6A6ZtpL.d.ts +34 -0
- package/dist/esm/Status-eHtiFREA.js +73 -0
- package/dist/esm/big-number.d.ts +3 -0
- package/dist/esm/big-number.js +4 -0
- package/dist/esm/{constants-BY74CT5-.js → constants-0w1sGXWU.js} +2 -25
- package/dist/esm/constants-BPYHMKzA.d.ts +42 -0
- package/dist/esm/constants.d.ts +2 -0
- package/dist/esm/constants.js +4 -0
- package/dist/esm/defineProperty-Zp25b8Cm.js +43 -0
- package/dist/esm/formatters-QUaa2UZY.js +18 -0
- package/dist/esm/formatters-v2reo54H.d.ts +9 -0
- package/dist/esm/formatters.d.ts +2 -0
- package/dist/esm/formatters.js +3 -0
- package/dist/esm/helpers-BZ1LFB-6.d.ts +88 -0
- package/dist/esm/helpers-BsGkkq54.js +91 -0
- package/dist/esm/helpers.d.ts +2 -0
- package/dist/esm/helpers.js +5 -0
- package/dist/esm/http.d.ts +2 -0
- package/dist/esm/http.js +4 -0
- package/dist/esm/index.d.ts +10 -269
- package/dist/esm/index.js +11 -474
- package/dist/esm/light.d.ts +93 -0
- package/dist/esm/light.js +151 -0
- package/dist/esm/numbers-Bnbd75cb.d.ts +8 -0
- package/dist/esm/numbers-Dh5x3_mA.js +22 -0
- package/dist/esm/numbers.d.ts +3 -0
- package/dist/esm/numbers.js +4 -0
- package/dist/esm/status.d.ts +2 -0
- package/dist/esm/status.js +4 -0
- package/dist/esm/storage.d.ts +2 -0
- package/dist/esm/storage.js +4 -0
- package/dist/esm/test-utils/index.js +2 -1
- package/dist/esm/time-BBEhFnvo.js +27 -0
- package/dist/esm/time-DJirA2PE.d.ts +13 -0
- package/dist/esm/time.d.ts +3 -0
- package/dist/esm/time.js +4 -0
- package/package.json +204 -4
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { t as _defineProperty } from "./defineProperty-Zp25b8Cm.js";
|
|
2
|
+
|
|
3
|
+
//#region src/light.ts
|
|
4
|
+
const StatusType = {
|
|
5
|
+
Idle: "idle",
|
|
6
|
+
Loading: "loading",
|
|
7
|
+
Completed: "completed",
|
|
8
|
+
Error: "error",
|
|
9
|
+
Confirmed: "confirmed"
|
|
10
|
+
};
|
|
11
|
+
var Status = class {
|
|
12
|
+
constructor(status = StatusType.Idle) {
|
|
13
|
+
_defineProperty(this, "status", void 0);
|
|
14
|
+
this.status = status;
|
|
15
|
+
}
|
|
16
|
+
get() {
|
|
17
|
+
return this.status;
|
|
18
|
+
}
|
|
19
|
+
set(status) {
|
|
20
|
+
this.status = status;
|
|
21
|
+
}
|
|
22
|
+
is(status) {
|
|
23
|
+
return this.status === status;
|
|
24
|
+
}
|
|
25
|
+
isLoading() {
|
|
26
|
+
return this.is(StatusType.Loading);
|
|
27
|
+
}
|
|
28
|
+
isNotLoading() {
|
|
29
|
+
return !this.is(StatusType.Loading);
|
|
30
|
+
}
|
|
31
|
+
isCompleted() {
|
|
32
|
+
return this.is(StatusType.Completed);
|
|
33
|
+
}
|
|
34
|
+
isConfirmed() {
|
|
35
|
+
return this.is(StatusType.Confirmed);
|
|
36
|
+
}
|
|
37
|
+
isIdle() {
|
|
38
|
+
return this.is(StatusType.Idle);
|
|
39
|
+
}
|
|
40
|
+
isError() {
|
|
41
|
+
return this.is(StatusType.Error);
|
|
42
|
+
}
|
|
43
|
+
setLoading() {
|
|
44
|
+
this.set(StatusType.Loading);
|
|
45
|
+
}
|
|
46
|
+
setCompleted() {
|
|
47
|
+
this.set(StatusType.Completed);
|
|
48
|
+
}
|
|
49
|
+
setConfirmed() {
|
|
50
|
+
this.set(StatusType.Confirmed);
|
|
51
|
+
}
|
|
52
|
+
setError() {
|
|
53
|
+
this.set(StatusType.Error);
|
|
54
|
+
}
|
|
55
|
+
setIdle() {
|
|
56
|
+
this.set(StatusType.Idle);
|
|
57
|
+
}
|
|
58
|
+
toggle() {
|
|
59
|
+
this.set(this.status === StatusType.Idle ? StatusType.Loading : StatusType.Idle);
|
|
60
|
+
}
|
|
61
|
+
toString() {
|
|
62
|
+
return this.get();
|
|
63
|
+
}
|
|
64
|
+
valueOf() {
|
|
65
|
+
return this.get();
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
69
|
+
const INJ_DENOM = "inj";
|
|
70
|
+
const INJECTIVE_DENOM = "inj";
|
|
71
|
+
const DEFAULT_FEE_DENOM = "inj";
|
|
72
|
+
const DEFAULT_GAS_LIMIT = 4e5;
|
|
73
|
+
const DEFAULT_IBC_GAS_LIMIT = 3e5;
|
|
74
|
+
const DEFAULT_GAS_PRICE = 16e7;
|
|
75
|
+
const DEFAULT_EXCHANGE_LIMIT = 2e5;
|
|
76
|
+
const DEFAULT_BRIDGE_FEE_DENOM = "inj";
|
|
77
|
+
const DEFAULT_BRIDGE_FEE_PRICE = "160000000";
|
|
78
|
+
const DEFAULT_BRIDGE_FEE_AMOUNT = "200000000000000";
|
|
79
|
+
const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 60;
|
|
80
|
+
const DEFAULT_BLOCK_TIME_IN_SECONDS = .7;
|
|
81
|
+
const DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS = Math.floor(DEFAULT_BLOCK_TIMEOUT_HEIGHT * DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3);
|
|
82
|
+
const DEFAULT_TX_POLL_INTERVAL_MS = 500;
|
|
83
|
+
const DEFAULT_TX_POLL_CALL_TIMEOUT_MS = 3e3;
|
|
84
|
+
const DEFAULT_TIMESTAMP_TIMEOUT_MS = 60 * 1e3 * 3;
|
|
85
|
+
const getDefaultStdFee = () => ({
|
|
86
|
+
amount: [{
|
|
87
|
+
denom: "inj",
|
|
88
|
+
amount: String(DEFAULT_GAS_LIMIT * DEFAULT_GAS_PRICE)
|
|
89
|
+
}],
|
|
90
|
+
gas: DEFAULT_GAS_LIMIT.toString(),
|
|
91
|
+
payer: "",
|
|
92
|
+
granter: "",
|
|
93
|
+
feePayer: ""
|
|
94
|
+
});
|
|
95
|
+
const DEFAULT_STD_FEE_BY_DENOM = (denom = "inj") => ({
|
|
96
|
+
amount: [{
|
|
97
|
+
denom,
|
|
98
|
+
amount: String(DEFAULT_GAS_LIMIT * DEFAULT_GAS_PRICE)
|
|
99
|
+
}],
|
|
100
|
+
gas: DEFAULT_GAS_LIMIT.toString()
|
|
101
|
+
});
|
|
102
|
+
const formatWalletAddress = (address, substrLength = 6) => {
|
|
103
|
+
if (address.length <= 10) return address;
|
|
104
|
+
return `${address.slice(0, substrLength)}...${address.slice(address.length - substrLength, address.length)}`;
|
|
105
|
+
};
|
|
106
|
+
const toPascalCase = (str) => {
|
|
107
|
+
return `${str}`.toLowerCase().replace(new RegExp(/[-_]+/, "g"), " ").replace(new RegExp(/[^\w\s]/, "g"), "").replace(new RegExp(/\s+(.)(\w*)/, "g"), (_$1, $2, $3) => `${$2.toUpperCase() + $3}`).replace(/* @__PURE__ */ new RegExp(/\w/), (s) => s.toUpperCase());
|
|
108
|
+
};
|
|
109
|
+
const snakeToPascal = (str) => {
|
|
110
|
+
return str.split("/").map((snake) => snake.split("_").map((substr) => substr.charAt(0).toUpperCase() + substr.slice(1)).join("")).join("/");
|
|
111
|
+
};
|
|
112
|
+
const capitalize = (str) => {
|
|
113
|
+
if (!str) return str;
|
|
114
|
+
return str[0].toUpperCase() + str.slice(1);
|
|
115
|
+
};
|
|
116
|
+
const sleep = (timeout) => new Promise((resolve) => setTimeout(resolve, timeout));
|
|
117
|
+
const awaitAll = async (array, callback) => await Promise.all(array.map(async (item) => await callback(item)));
|
|
118
|
+
const awaitForAll = async (array, callback, onError) => {
|
|
119
|
+
const result = [];
|
|
120
|
+
for (let index = 0; index < array.length; index += 1) try {
|
|
121
|
+
result.push(await callback(array[index]));
|
|
122
|
+
} catch (error) {
|
|
123
|
+
if (onError) onError(error, array[index], index);
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
};
|
|
127
|
+
const splitArrayToChunksThrow = ({ array, filter, chunkSize }) => {
|
|
128
|
+
const chunks = [];
|
|
129
|
+
const chunkSizeInNumber = Number(chunkSize);
|
|
130
|
+
if (!Number.isFinite(chunkSizeInNumber) || !Number.isInteger(chunkSizeInNumber) || chunkSizeInNumber <= 0) throw new Error("Invalid chunk size, must be a positive integer");
|
|
131
|
+
for (let index = 0; index < array.length; index += chunkSizeInNumber) {
|
|
132
|
+
const chunk = array.slice(index, index + chunkSizeInNumber);
|
|
133
|
+
if (filter) chunks.push(chunk.filter(filter));
|
|
134
|
+
else chunks.push(chunk);
|
|
135
|
+
}
|
|
136
|
+
return chunks;
|
|
137
|
+
};
|
|
138
|
+
const splitArrayToChunks = ({ array, filter, chunkSize }) => {
|
|
139
|
+
try {
|
|
140
|
+
return splitArrayToChunksThrow({
|
|
141
|
+
array,
|
|
142
|
+
chunkSize,
|
|
143
|
+
filter
|
|
144
|
+
});
|
|
145
|
+
} catch (_unused) {
|
|
146
|
+
return [array];
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
//#endregion
|
|
151
|
+
export { 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, INJECTIVE_DENOM, INJ_DENOM, Status, StatusType, ZERO_ADDRESS, awaitAll, awaitForAll, capitalize, formatWalletAddress, getDefaultStdFee, sleep, snakeToPascal, splitArrayToChunks, splitArrayToChunksThrow, toPascalCase };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as BigNumber } from "./BigNumber-jKUujKpO.js";
|
|
2
|
+
|
|
3
|
+
//#region src/numbers.d.ts
|
|
4
|
+
declare const getBigNumberWithRounding: () => typeof BigNumber;
|
|
5
|
+
declare const getSignificantDecimalsFromNumber: (number: BigNumber | number | string) => number;
|
|
6
|
+
declare const getExactDecimalsFromNumber: (number: number | string) => number;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { getExactDecimalsFromNumber as n, getSignificantDecimalsFromNumber as r, getBigNumberWithRounding as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { t as BigNumber_default } from "./BigNumber-DUr2WQBK.js";
|
|
2
|
+
|
|
3
|
+
//#region src/numbers.ts
|
|
4
|
+
const getBigNumberWithRounding = () => BigNumber_default.clone({ ROUNDING_MODE: BigNumber_default.ROUND_DOWN });
|
|
5
|
+
const getSignificantDecimalsFromNumber = (number) => {
|
|
6
|
+
const $BigNumber = getBigNumberWithRounding();
|
|
7
|
+
if (Math.floor(new $BigNumber(number).toNumber()) === number) return 0;
|
|
8
|
+
const [, decimals] = new $BigNumber(number).toFixed().split(".");
|
|
9
|
+
/** Number doesn't have decimals */
|
|
10
|
+
if (!decimals) return 0;
|
|
11
|
+
return decimals.length;
|
|
12
|
+
};
|
|
13
|
+
const getExactDecimalsFromNumber = (number) => {
|
|
14
|
+
if (!number.toString().includes(".")) return 0;
|
|
15
|
+
if (Number(number) % 1 === 0) return 0;
|
|
16
|
+
const [, decimals] = number.toString().split(".");
|
|
17
|
+
if (!decimals) return 0;
|
|
18
|
+
return decimals.length;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { getExactDecimalsFromNumber as n, getSignificantDecimalsFromNumber as r, getBigNumberWithRounding as t };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "./BigNumber-jKUujKpO.js";
|
|
2
|
+
import { n as getExactDecimalsFromNumber, r as getSignificantDecimalsFromNumber, t as getBigNumberWithRounding } from "./numbers-Bnbd75cb.js";
|
|
3
|
+
export { getBigNumberWithRounding, getExactDecimalsFromNumber, getSignificantDecimalsFromNumber };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "./BigNumber-DUr2WQBK.js";
|
|
2
|
+
import { n as getExactDecimalsFromNumber, r as getSignificantDecimalsFromNumber, t as getBigNumberWithRounding } from "./numbers-Dh5x3_mA.js";
|
|
3
|
+
|
|
4
|
+
export { getBigNumberWithRounding, getExactDecimalsFromNumber, getSignificantDecimalsFromNumber };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as BigNumber_default } from "../BigNumber-DUr2WQBK.js";
|
|
2
|
+
import { c as DEFAULT_GAS_LIMIT, l as DEFAULT_GAS_PRICE } from "../constants-0w1sGXWU.js";
|
|
2
3
|
import { Network, getNetworkEndpoints, getNetworkInfo } from "@injectivelabs/networks";
|
|
3
4
|
import { ChainId, EvmChainId } from "@injectivelabs/ts-types";
|
|
4
5
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { t as BigNumber_default } from "./BigNumber-DUr2WQBK.js";
|
|
2
|
+
|
|
3
|
+
//#region src/time.ts
|
|
4
|
+
const getSecondsInDay = () => new BigNumber_default(3600 * 24);
|
|
5
|
+
const convertTimestampToMilliseconds = (timestamp) => {
|
|
6
|
+
const timestampInBigNumber = new BigNumber_default(timestamp);
|
|
7
|
+
if (timestamp.toString().length > 13) return timestampInBigNumber.precision(13, BigNumber_default.ROUND_HALF_UP).toNumber();
|
|
8
|
+
if (timestamp.toString().length < 13) {
|
|
9
|
+
const trailingZeros = 13 - timestamp.toString().length;
|
|
10
|
+
return timestampInBigNumber.times(10 ** trailingZeros).toNumber();
|
|
11
|
+
}
|
|
12
|
+
return timestampInBigNumber.toNumber();
|
|
13
|
+
};
|
|
14
|
+
const getUTCDateFromTimestamp = (timestamp) => {
|
|
15
|
+
const date = new Date(convertTimestampToMilliseconds(timestamp));
|
|
16
|
+
return `${date.getUTCDate()}-${date.getUTCMonth() + 1}-${date.getUTCFullYear()}`;
|
|
17
|
+
};
|
|
18
|
+
const tomorrow = () => new BigNumber_default(Math.floor((/* @__PURE__ */ new Date()).valueOf() / 1e3) + 3600 * 24);
|
|
19
|
+
const todayInSeconds = () => Math.floor(Date.now() / 1e3);
|
|
20
|
+
const past24Hours = () => new BigNumber_default(todayInSeconds()).minus(getSecondsInDay()).toNumber();
|
|
21
|
+
const pastDays = (day = 1) => new BigNumber_default(todayInSeconds()).minus(getSecondsInDay().times(day)).toNumber();
|
|
22
|
+
const getEndDateStringFromTimeInSeconds = (timeInSeconds) => {
|
|
23
|
+
return (/* @__PURE__ */ new Date(timeInSeconds.toNumber() * 1e3)).toLocaleString("en-us");
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export { past24Hours as a, tomorrow as c, getUTCDateFromTimestamp as i, getEndDateStringFromTimeInSeconds as n, pastDays as o, getSecondsInDay as r, todayInSeconds as s, convertTimestampToMilliseconds as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as BigNumber } from "./BigNumber-jKUujKpO.js";
|
|
2
|
+
|
|
3
|
+
//#region src/time.d.ts
|
|
4
|
+
declare const getSecondsInDay: () => BigNumber;
|
|
5
|
+
declare const convertTimestampToMilliseconds: (timestamp: number | string) => number;
|
|
6
|
+
declare const getUTCDateFromTimestamp: (timestamp: number) => string;
|
|
7
|
+
declare const tomorrow: () => BigNumber;
|
|
8
|
+
declare const todayInSeconds: () => number;
|
|
9
|
+
declare const past24Hours: () => number;
|
|
10
|
+
declare const pastDays: (day?: number) => number;
|
|
11
|
+
declare const getEndDateStringFromTimeInSeconds: (timeInSeconds: BigNumber) => string;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { past24Hours as a, tomorrow as c, getUTCDateFromTimestamp as i, getEndDateStringFromTimeInSeconds as n, pastDays as o, getSecondsInDay as r, todayInSeconds as s, convertTimestampToMilliseconds as t };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "./BigNumber-jKUujKpO.js";
|
|
2
|
+
import { a as past24Hours, c as tomorrow, i as getUTCDateFromTimestamp, n as getEndDateStringFromTimeInSeconds, o as pastDays, r as getSecondsInDay, s as todayInSeconds, t as convertTimestampToMilliseconds } from "./time-DJirA2PE.js";
|
|
3
|
+
export { convertTimestampToMilliseconds, getEndDateStringFromTimeInSeconds, getSecondsInDay, getUTCDateFromTimestamp, past24Hours, pastDays, todayInSeconds, tomorrow };
|
package/dist/esm/time.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "./BigNumber-DUr2WQBK.js";
|
|
2
|
+
import { a as past24Hours, c as tomorrow, i as getUTCDateFromTimestamp, n as getEndDateStringFromTimeInSeconds, o as pastDays, r as getSecondsInDay, s as todayInSeconds, t as convertTimestampToMilliseconds } from "./time-BBEhFnvo.js";
|
|
3
|
+
|
|
4
|
+
export { convertTimestampToMilliseconds, getEndDateStringFromTimeInSeconds, getSecondsInDay, getUTCDateFromTimestamp, past24Hours, pastDays, todayInSeconds, tomorrow };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/utils",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.17",
|
|
4
4
|
"description": "List of utils and helper functions that can be reused throughout Injective's projects.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -34,6 +34,186 @@
|
|
|
34
34
|
"default": "./dist/cjs/index.cjs"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
+
"./big-number": {
|
|
38
|
+
"react-native": {
|
|
39
|
+
"import": "./dist/esm/big-number.js",
|
|
40
|
+
"require": "./dist/cjs/big-number.cjs",
|
|
41
|
+
"types": "./dist/cjs/big-number.d.cts",
|
|
42
|
+
"default": "./dist/cjs/big-number.cjs"
|
|
43
|
+
},
|
|
44
|
+
"require": {
|
|
45
|
+
"types": "./dist/cjs/big-number.d.cts",
|
|
46
|
+
"default": "./dist/cjs/big-number.cjs"
|
|
47
|
+
},
|
|
48
|
+
"import": {
|
|
49
|
+
"types": "./dist/esm/big-number.d.ts",
|
|
50
|
+
"default": "./dist/esm/big-number.js"
|
|
51
|
+
},
|
|
52
|
+
"default": {
|
|
53
|
+
"types": "./dist/cjs/big-number.d.cts",
|
|
54
|
+
"default": "./dist/cjs/big-number.cjs"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"./constants": {
|
|
58
|
+
"react-native": {
|
|
59
|
+
"import": "./dist/esm/constants.js",
|
|
60
|
+
"require": "./dist/cjs/constants.cjs",
|
|
61
|
+
"types": "./dist/cjs/constants.d.cts",
|
|
62
|
+
"default": "./dist/cjs/constants.cjs"
|
|
63
|
+
},
|
|
64
|
+
"require": {
|
|
65
|
+
"types": "./dist/cjs/constants.d.cts",
|
|
66
|
+
"default": "./dist/cjs/constants.cjs"
|
|
67
|
+
},
|
|
68
|
+
"import": {
|
|
69
|
+
"types": "./dist/esm/constants.d.ts",
|
|
70
|
+
"default": "./dist/esm/constants.js"
|
|
71
|
+
},
|
|
72
|
+
"default": {
|
|
73
|
+
"types": "./dist/cjs/constants.d.cts",
|
|
74
|
+
"default": "./dist/cjs/constants.cjs"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"./formatters": {
|
|
78
|
+
"react-native": {
|
|
79
|
+
"import": "./dist/esm/formatters.js",
|
|
80
|
+
"require": "./dist/cjs/formatters.cjs",
|
|
81
|
+
"types": "./dist/cjs/formatters.d.cts",
|
|
82
|
+
"default": "./dist/cjs/formatters.cjs"
|
|
83
|
+
},
|
|
84
|
+
"require": {
|
|
85
|
+
"types": "./dist/cjs/formatters.d.cts",
|
|
86
|
+
"default": "./dist/cjs/formatters.cjs"
|
|
87
|
+
},
|
|
88
|
+
"import": {
|
|
89
|
+
"types": "./dist/esm/formatters.d.ts",
|
|
90
|
+
"default": "./dist/esm/formatters.js"
|
|
91
|
+
},
|
|
92
|
+
"default": {
|
|
93
|
+
"types": "./dist/cjs/formatters.d.cts",
|
|
94
|
+
"default": "./dist/cjs/formatters.cjs"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"./helpers": {
|
|
98
|
+
"react-native": {
|
|
99
|
+
"import": "./dist/esm/helpers.js",
|
|
100
|
+
"require": "./dist/cjs/helpers.cjs",
|
|
101
|
+
"types": "./dist/cjs/helpers.d.cts",
|
|
102
|
+
"default": "./dist/cjs/helpers.cjs"
|
|
103
|
+
},
|
|
104
|
+
"require": {
|
|
105
|
+
"types": "./dist/cjs/helpers.d.cts",
|
|
106
|
+
"default": "./dist/cjs/helpers.cjs"
|
|
107
|
+
},
|
|
108
|
+
"import": {
|
|
109
|
+
"types": "./dist/esm/helpers.d.ts",
|
|
110
|
+
"default": "./dist/esm/helpers.js"
|
|
111
|
+
},
|
|
112
|
+
"default": {
|
|
113
|
+
"types": "./dist/cjs/helpers.d.cts",
|
|
114
|
+
"default": "./dist/cjs/helpers.cjs"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"./http": {
|
|
118
|
+
"react-native": {
|
|
119
|
+
"import": "./dist/esm/http.js",
|
|
120
|
+
"require": "./dist/cjs/http.cjs",
|
|
121
|
+
"types": "./dist/cjs/http.d.cts",
|
|
122
|
+
"default": "./dist/cjs/http.cjs"
|
|
123
|
+
},
|
|
124
|
+
"require": {
|
|
125
|
+
"types": "./dist/cjs/http.d.cts",
|
|
126
|
+
"default": "./dist/cjs/http.cjs"
|
|
127
|
+
},
|
|
128
|
+
"import": {
|
|
129
|
+
"types": "./dist/esm/http.d.ts",
|
|
130
|
+
"default": "./dist/esm/http.js"
|
|
131
|
+
},
|
|
132
|
+
"default": {
|
|
133
|
+
"types": "./dist/cjs/http.d.cts",
|
|
134
|
+
"default": "./dist/cjs/http.cjs"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"./light": {
|
|
138
|
+
"react-native": {
|
|
139
|
+
"import": "./dist/esm/light.js",
|
|
140
|
+
"require": "./dist/cjs/light.cjs",
|
|
141
|
+
"types": "./dist/cjs/light.d.cts",
|
|
142
|
+
"default": "./dist/cjs/light.cjs"
|
|
143
|
+
},
|
|
144
|
+
"require": {
|
|
145
|
+
"types": "./dist/cjs/light.d.cts",
|
|
146
|
+
"default": "./dist/cjs/light.cjs"
|
|
147
|
+
},
|
|
148
|
+
"import": {
|
|
149
|
+
"types": "./dist/esm/light.d.ts",
|
|
150
|
+
"default": "./dist/esm/light.js"
|
|
151
|
+
},
|
|
152
|
+
"default": {
|
|
153
|
+
"types": "./dist/cjs/light.d.cts",
|
|
154
|
+
"default": "./dist/cjs/light.cjs"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"./numbers": {
|
|
158
|
+
"react-native": {
|
|
159
|
+
"import": "./dist/esm/numbers.js",
|
|
160
|
+
"require": "./dist/cjs/numbers.cjs",
|
|
161
|
+
"types": "./dist/cjs/numbers.d.cts",
|
|
162
|
+
"default": "./dist/cjs/numbers.cjs"
|
|
163
|
+
},
|
|
164
|
+
"require": {
|
|
165
|
+
"types": "./dist/cjs/numbers.d.cts",
|
|
166
|
+
"default": "./dist/cjs/numbers.cjs"
|
|
167
|
+
},
|
|
168
|
+
"import": {
|
|
169
|
+
"types": "./dist/esm/numbers.d.ts",
|
|
170
|
+
"default": "./dist/esm/numbers.js"
|
|
171
|
+
},
|
|
172
|
+
"default": {
|
|
173
|
+
"types": "./dist/cjs/numbers.d.cts",
|
|
174
|
+
"default": "./dist/cjs/numbers.cjs"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"./status": {
|
|
178
|
+
"react-native": {
|
|
179
|
+
"import": "./dist/esm/status.js",
|
|
180
|
+
"require": "./dist/cjs/status.cjs",
|
|
181
|
+
"types": "./dist/cjs/status.d.cts",
|
|
182
|
+
"default": "./dist/cjs/status.cjs"
|
|
183
|
+
},
|
|
184
|
+
"require": {
|
|
185
|
+
"types": "./dist/cjs/status.d.cts",
|
|
186
|
+
"default": "./dist/cjs/status.cjs"
|
|
187
|
+
},
|
|
188
|
+
"import": {
|
|
189
|
+
"types": "./dist/esm/status.d.ts",
|
|
190
|
+
"default": "./dist/esm/status.js"
|
|
191
|
+
},
|
|
192
|
+
"default": {
|
|
193
|
+
"types": "./dist/cjs/status.d.cts",
|
|
194
|
+
"default": "./dist/cjs/status.cjs"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"./storage": {
|
|
198
|
+
"react-native": {
|
|
199
|
+
"import": "./dist/esm/storage.js",
|
|
200
|
+
"require": "./dist/cjs/storage.cjs",
|
|
201
|
+
"types": "./dist/cjs/storage.d.cts",
|
|
202
|
+
"default": "./dist/cjs/storage.cjs"
|
|
203
|
+
},
|
|
204
|
+
"require": {
|
|
205
|
+
"types": "./dist/cjs/storage.d.cts",
|
|
206
|
+
"default": "./dist/cjs/storage.cjs"
|
|
207
|
+
},
|
|
208
|
+
"import": {
|
|
209
|
+
"types": "./dist/esm/storage.d.ts",
|
|
210
|
+
"default": "./dist/esm/storage.js"
|
|
211
|
+
},
|
|
212
|
+
"default": {
|
|
213
|
+
"types": "./dist/cjs/storage.d.cts",
|
|
214
|
+
"default": "./dist/cjs/storage.cjs"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
37
217
|
"./test-utils": {
|
|
38
218
|
"react-native": {
|
|
39
219
|
"import": "./dist/esm/test-utils/index.js",
|
|
@@ -53,6 +233,26 @@
|
|
|
53
233
|
"types": "./dist/cjs/test-utils/index.d.cts",
|
|
54
234
|
"default": "./dist/cjs/test-utils/index.cjs"
|
|
55
235
|
}
|
|
236
|
+
},
|
|
237
|
+
"./time": {
|
|
238
|
+
"react-native": {
|
|
239
|
+
"import": "./dist/esm/time.js",
|
|
240
|
+
"require": "./dist/cjs/time.cjs",
|
|
241
|
+
"types": "./dist/cjs/time.d.cts",
|
|
242
|
+
"default": "./dist/cjs/time.cjs"
|
|
243
|
+
},
|
|
244
|
+
"require": {
|
|
245
|
+
"types": "./dist/cjs/time.d.cts",
|
|
246
|
+
"default": "./dist/cjs/time.cjs"
|
|
247
|
+
},
|
|
248
|
+
"import": {
|
|
249
|
+
"types": "./dist/esm/time.d.ts",
|
|
250
|
+
"default": "./dist/esm/time.js"
|
|
251
|
+
},
|
|
252
|
+
"default": {
|
|
253
|
+
"types": "./dist/cjs/time.d.cts",
|
|
254
|
+
"default": "./dist/cjs/time.cjs"
|
|
255
|
+
}
|
|
56
256
|
}
|
|
57
257
|
},
|
|
58
258
|
"main": "dist/cjs/index.cjs",
|
|
@@ -66,9 +266,9 @@
|
|
|
66
266
|
"bignumber.js": "^9.3.1",
|
|
67
267
|
"http-status-codes": "^2.3.0",
|
|
68
268
|
"store2": "^2.14.4",
|
|
69
|
-
"@injectivelabs/exceptions": "1.20.
|
|
70
|
-
"@injectivelabs/
|
|
71
|
-
"@injectivelabs/
|
|
269
|
+
"@injectivelabs/exceptions": "1.20.17",
|
|
270
|
+
"@injectivelabs/networks": "1.20.17",
|
|
271
|
+
"@injectivelabs/ts-types": "1.20.17"
|
|
72
272
|
},
|
|
73
273
|
"publishConfig": {
|
|
74
274
|
"access": "public"
|