@injectivelabs/utils 1.20.14 → 1.20.16

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.
Files changed (90) hide show
  1. package/dist/cjs/BigNumber-B-r__Egf.d.cts +18 -0
  2. package/dist/cjs/BigNumber-DbDA4_xA.cjs +51 -0
  3. package/dist/cjs/BigNumberInBase-CVKbAXw6.cjs +84 -0
  4. package/dist/cjs/BigNumberInWei-BMQpZg3S.d.cts +36 -0
  5. package/dist/cjs/HttpRestClient-C0p7w6ht.d.cts +29 -0
  6. package/dist/cjs/HttpRestClient-C761J3nA.cjs +138 -0
  7. package/dist/cjs/LocalStorage-DRuofBv_.cjs +35 -0
  8. package/dist/cjs/LocalStorage-Dqm913-z.d.cts +12 -0
  9. package/dist/cjs/Status-C1EkdFOa.cjs +84 -0
  10. package/dist/cjs/Status-lj0Wyw_3.d.cts +34 -0
  11. package/dist/cjs/big-number.cjs +9 -0
  12. package/dist/cjs/big-number.d.cts +3 -0
  13. package/dist/cjs/chunk-CbDLau6x.cjs +34 -0
  14. package/dist/cjs/constants-BRub-WIk.d.cts +42 -0
  15. package/dist/cjs/{constants-BFjeP4ow.cjs → constants-BdaegCnI.cjs} +3 -84
  16. package/dist/cjs/constants.cjs +22 -0
  17. package/dist/cjs/constants.d.cts +2 -0
  18. package/dist/cjs/defineProperty-CImP5zIM.cjs +49 -0
  19. package/dist/cjs/formatters-CBhRviK1.cjs +42 -0
  20. package/dist/cjs/formatters-lY6KvxzC.d.cts +9 -0
  21. package/dist/cjs/formatters.cjs +6 -0
  22. package/dist/cjs/formatters.d.cts +2 -0
  23. package/dist/cjs/helpers-BW4oKV4e.cjs +144 -0
  24. package/dist/cjs/helpers-BmH3TkaY.d.cts +88 -0
  25. package/dist/cjs/helpers.cjs +13 -0
  26. package/dist/cjs/helpers.d.cts +2 -0
  27. package/dist/cjs/http.cjs +5 -0
  28. package/dist/cjs/http.d.cts +2 -0
  29. package/dist/cjs/index.cjs +47 -512
  30. package/dist/cjs/index.d.cts +10 -269
  31. package/dist/cjs/light.cjs +180 -0
  32. package/dist/cjs/light.d.cts +93 -0
  33. package/dist/cjs/numbers-BRXzNJ1I.cjs +39 -0
  34. package/dist/cjs/numbers-CVJM893V.d.cts +8 -0
  35. package/dist/cjs/numbers.cjs +6 -0
  36. package/dist/cjs/numbers.d.cts +3 -0
  37. package/dist/cjs/status.cjs +5 -0
  38. package/dist/cjs/status.d.cts +2 -0
  39. package/dist/cjs/storage.cjs +4 -0
  40. package/dist/cjs/storage.d.cts +2 -0
  41. package/dist/cjs/test-utils/index.cjs +4 -2
  42. package/dist/cjs/time-CPSnQ8xf.cjs +74 -0
  43. package/dist/cjs/time-DQwWSv4e.d.cts +13 -0
  44. package/dist/cjs/time.cjs +11 -0
  45. package/dist/cjs/time.d.cts +3 -0
  46. package/dist/esm/BigNumber-DUr2WQBK.js +26 -0
  47. package/dist/esm/BigNumber-jKUujKpO.d.ts +18 -0
  48. package/dist/esm/BigNumberInBase-Dcx5wyxY.js +73 -0
  49. package/dist/esm/BigNumberInWei-JtQuFET_.d.ts +36 -0
  50. package/dist/esm/HttpRestClient-B-UvB9KB.d.ts +29 -0
  51. package/dist/esm/HttpRestClient-CsKkn8lo.js +125 -0
  52. package/dist/esm/LocalStorage-Cpe5wG8z.js +28 -0
  53. package/dist/esm/LocalStorage-CyTj3H1T.d.ts +12 -0
  54. package/dist/esm/Status-C6A6ZtpL.d.ts +34 -0
  55. package/dist/esm/Status-eHtiFREA.js +73 -0
  56. package/dist/esm/big-number.d.ts +3 -0
  57. package/dist/esm/big-number.js +4 -0
  58. package/dist/esm/{constants-BY74CT5-.js → constants-0w1sGXWU.js} +2 -25
  59. package/dist/esm/constants-BPYHMKzA.d.ts +42 -0
  60. package/dist/esm/constants.d.ts +2 -0
  61. package/dist/esm/constants.js +4 -0
  62. package/dist/esm/defineProperty-Zp25b8Cm.js +43 -0
  63. package/dist/esm/formatters-QUaa2UZY.js +18 -0
  64. package/dist/esm/formatters-v2reo54H.d.ts +9 -0
  65. package/dist/esm/formatters.d.ts +2 -0
  66. package/dist/esm/formatters.js +3 -0
  67. package/dist/esm/helpers-BZ1LFB-6.d.ts +88 -0
  68. package/dist/esm/helpers-BsGkkq54.js +91 -0
  69. package/dist/esm/helpers.d.ts +2 -0
  70. package/dist/esm/helpers.js +5 -0
  71. package/dist/esm/http.d.ts +2 -0
  72. package/dist/esm/http.js +4 -0
  73. package/dist/esm/index.d.ts +10 -269
  74. package/dist/esm/index.js +11 -474
  75. package/dist/esm/light.d.ts +93 -0
  76. package/dist/esm/light.js +151 -0
  77. package/dist/esm/numbers-Bnbd75cb.d.ts +8 -0
  78. package/dist/esm/numbers-Dh5x3_mA.js +22 -0
  79. package/dist/esm/numbers.d.ts +3 -0
  80. package/dist/esm/numbers.js +4 -0
  81. package/dist/esm/status.d.ts +2 -0
  82. package/dist/esm/status.js +4 -0
  83. package/dist/esm/storage.d.ts +2 -0
  84. package/dist/esm/storage.js +4 -0
  85. package/dist/esm/test-utils/index.js +2 -1
  86. package/dist/esm/time-BBEhFnvo.js +27 -0
  87. package/dist/esm/time-DJirA2PE.d.ts +13 -0
  88. package/dist/esm/time.d.ts +3 -0
  89. package/dist/esm/time.js +4 -0
  90. package/package.json +204 -4
@@ -0,0 +1,43 @@
1
+ //#region \0@oxc-project+runtime@0.99.0/helpers/typeof.js
2
+ function _typeof(o) {
3
+ "@babel/helpers - typeof";
4
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
5
+ return typeof o$1;
6
+ } : function(o$1) {
7
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
8
+ }, _typeof(o);
9
+ }
10
+
11
+ //#endregion
12
+ //#region \0@oxc-project+runtime@0.99.0/helpers/toPrimitive.js
13
+ function toPrimitive(t, r) {
14
+ if ("object" != _typeof(t) || !t) return t;
15
+ var e = t[Symbol.toPrimitive];
16
+ if (void 0 !== e) {
17
+ var i = e.call(t, r || "default");
18
+ if ("object" != _typeof(i)) return i;
19
+ throw new TypeError("@@toPrimitive must return a primitive value.");
20
+ }
21
+ return ("string" === r ? String : Number)(t);
22
+ }
23
+
24
+ //#endregion
25
+ //#region \0@oxc-project+runtime@0.99.0/helpers/toPropertyKey.js
26
+ function toPropertyKey(t) {
27
+ var i = toPrimitive(t, "string");
28
+ return "symbol" == _typeof(i) ? i : i + "";
29
+ }
30
+
31
+ //#endregion
32
+ //#region \0@oxc-project+runtime@0.99.0/helpers/defineProperty.js
33
+ function _defineProperty(e, r, t) {
34
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
35
+ value: t,
36
+ enumerable: !0,
37
+ configurable: !0,
38
+ writable: !0
39
+ }) : e[r] = t, e;
40
+ }
41
+
42
+ //#endregion
43
+ export { _defineProperty as t };
@@ -0,0 +1,18 @@
1
+ //#region src/formatters.ts
2
+ const formatWalletAddress = (address, substrLength = 6) => {
3
+ if (address.length <= 10) return address;
4
+ return `${address.slice(0, substrLength)}...${address.slice(address.length - substrLength, address.length)}`;
5
+ };
6
+ const toPascalCase = (str) => {
7
+ 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());
8
+ };
9
+ const snakeToPascal = (str) => {
10
+ return str.split("/").map((snake) => snake.split("_").map((substr) => substr.charAt(0).toUpperCase() + substr.slice(1)).join("")).join("/");
11
+ };
12
+ const capitalize = (str) => {
13
+ if (!str) return str;
14
+ return str[0].toUpperCase() + str.slice(1);
15
+ };
16
+
17
+ //#endregion
18
+ export { toPascalCase as i, formatWalletAddress as n, snakeToPascal as r, capitalize as t };
@@ -0,0 +1,9 @@
1
+ import { AccountAddress } from "@injectivelabs/ts-types";
2
+
3
+ //#region src/formatters.d.ts
4
+ declare const formatWalletAddress: (address: AccountAddress, substrLength?: number) => string;
5
+ declare const toPascalCase: (str: string) => string;
6
+ declare const snakeToPascal: (str: string) => string;
7
+ declare const capitalize: (str: string) => string;
8
+ //#endregion
9
+ export { toPascalCase as i, formatWalletAddress as n, snakeToPascal as r, capitalize as t };
@@ -0,0 +1,2 @@
1
+ import { i as toPascalCase, n as formatWalletAddress, r as snakeToPascal, t as capitalize } from "./formatters-v2reo54H.js";
2
+ export { capitalize, formatWalletAddress, snakeToPascal, toPascalCase };
@@ -0,0 +1,3 @@
1
+ import { i as toPascalCase, n as formatWalletAddress, r as snakeToPascal, t as capitalize } from "./formatters-QUaa2UZY.js";
2
+
3
+ export { capitalize, formatWalletAddress, snakeToPascal, toPascalCase };
@@ -0,0 +1,88 @@
1
+ //#region src/types.d.ts
2
+ type Awaited<T> = T extends null | undefined ? T : T extends object & {
3
+ then(onfulfilled: infer F, ...args: infer _): any;
4
+ } ? F extends ((value: infer V, ...args: infer _) => any) ? Awaited<V> : never : T;
5
+ //#endregion
6
+ //#region src/helpers.d.ts
7
+ declare const sleep: (timeout: number) => Promise<void>;
8
+ /**
9
+ * When we want to execute the promises in batch
10
+ */
11
+ declare const awaitAll: <T, S>(array: Array<T>, callback: (item: T) => Promise<S>) => Promise<Awaited<S>[]>;
12
+ /**
13
+ * When we want to execute the promises one by one
14
+ * and not all in batch as with await Promise.all()
15
+ */
16
+ declare const awaitForAll: <T, S>(array: Array<T>, callback: (item: T) => Promise<S>, onError?: (error: unknown, item: T, index: number) => void) => Promise<S[]>;
17
+ declare const splitArrayToChunksThrow: <T>({
18
+ array,
19
+ filter,
20
+ chunkSize
21
+ }: {
22
+ array: Array<T>;
23
+ chunkSize: number;
24
+ filter?: (item: T) => boolean;
25
+ }) => T[][];
26
+ declare const splitArrayToChunks: <T>({
27
+ array,
28
+ filter,
29
+ chunkSize
30
+ }: {
31
+ array: Array<T>;
32
+ chunkSize: number;
33
+ filter?: (item: T) => boolean;
34
+ }) => T[][];
35
+ declare const getStdFeeForToken: (token?: {
36
+ denom: string;
37
+ decimals: number;
38
+ }, gasPrice?: string, gasLimit?: string) => {
39
+ amount: {
40
+ denom: string;
41
+ amount: string;
42
+ }[];
43
+ gas: string;
44
+ };
45
+ declare const getStdFeeFromObject: (args?: {
46
+ gas?: string | number;
47
+ payer?: string;
48
+ granter?: string;
49
+ gasPrice?: string | number;
50
+ feePayer?: string;
51
+ }) => {
52
+ amount: {
53
+ denom: string;
54
+ amount: string;
55
+ }[];
56
+ gas: string;
57
+ payer: string | undefined; /** for Web3Gateway fee delegation */
58
+ granter: string | undefined;
59
+ feePayer: string | undefined;
60
+ };
61
+ declare const getStdFeeFromString: (gasPrice: string) => {
62
+ amount: {
63
+ denom: string;
64
+ amount: string;
65
+ }[];
66
+ gas: string;
67
+ payer: string | undefined; /** for Web3Gateway fee delegation */
68
+ granter: string | undefined;
69
+ feePayer: string | undefined;
70
+ };
71
+ declare const getStdFee: (args?: string | {
72
+ payer?: string;
73
+ granter?: string;
74
+ feePayer?: string;
75
+ gas?: string | number;
76
+ gasPrice?: string | number;
77
+ }) => {
78
+ amount: {
79
+ denom: string;
80
+ amount: string;
81
+ }[];
82
+ gas: string;
83
+ payer: string | undefined; /** for Web3Gateway fee delegation */
84
+ granter: string | undefined;
85
+ feePayer: string | undefined;
86
+ };
87
+ //#endregion
88
+ export { getStdFeeFromObject as a, splitArrayToChunks as c, getStdFeeForToken as i, splitArrayToChunksThrow as l, awaitForAll as n, getStdFeeFromString as o, getStdFee as r, sleep as s, awaitAll as t };
@@ -0,0 +1,91 @@
1
+ import { i as toHumanReadable, n as toBigNumber, r as toChainFormat, t as BigNumber_default } from "./BigNumber-DUr2WQBK.js";
2
+ import { c as DEFAULT_GAS_LIMIT, l as DEFAULT_GAS_PRICE, y as getDefaultStdFee } from "./constants-0w1sGXWU.js";
3
+
4
+ //#region src/helpers.ts
5
+ const sleep = (timeout) => new Promise((resolve) => setTimeout(resolve, timeout));
6
+ /**
7
+ * When we want to execute the promises in batch
8
+ */
9
+ const awaitAll = async (array, callback) => await Promise.all(array.map(async (item) => await callback(item)));
10
+ /**
11
+ * When we want to execute the promises one by one
12
+ * and not all in batch as with await Promise.all()
13
+ */
14
+ const awaitForAll = async (array, callback, onError) => {
15
+ const result = [];
16
+ for (let i = 0; i < array.length; i += 1) try {
17
+ result.push(await callback(array[i]));
18
+ } catch (e) {
19
+ if (onError) onError(e, array[i], i);
20
+ }
21
+ return result;
22
+ };
23
+ const splitArrayToChunksThrow = ({ array, filter, chunkSize }) => {
24
+ const chunks = [];
25
+ const chunkSizeInNumber = Number(chunkSize);
26
+ if (!Number.isFinite(chunkSizeInNumber) || !Number.isInteger(chunkSizeInNumber) || chunkSizeInNumber <= 0) throw new Error("Invalid chunk size, must be a positive integer");
27
+ for (let i = 0; i < array.length; i += chunkSizeInNumber) {
28
+ const chunk = array.slice(i, i + chunkSizeInNumber);
29
+ if (filter) chunks.push(chunk.filter(filter));
30
+ else chunks.push(chunk);
31
+ }
32
+ return chunks;
33
+ };
34
+ const splitArrayToChunks = ({ array, filter, chunkSize }) => {
35
+ try {
36
+ return splitArrayToChunksThrow({
37
+ array,
38
+ chunkSize,
39
+ filter
40
+ });
41
+ } catch (_unused) {
42
+ return [array];
43
+ }
44
+ };
45
+ const getStdFeeForToken = (token = {
46
+ denom: "inj",
47
+ decimals: 18
48
+ }, gasPrice, gasLimit) => {
49
+ const gasPriceScaled = toChainFormat(gasPrice || toHumanReadable(DEFAULT_GAS_PRICE, 18), token.decimals).toFixed(0);
50
+ const gasNormalized = new BigNumber_default(gasLimit || DEFAULT_GAS_LIMIT).toFixed(0);
51
+ return {
52
+ amount: [{
53
+ denom: token.denom,
54
+ amount: new BigNumber_default(gasPriceScaled).times(gasNormalized).toFixed()
55
+ }],
56
+ gas: (gasLimit || DEFAULT_GAS_LIMIT).toString()
57
+ };
58
+ };
59
+ const getStdFeeFromObject = (args) => {
60
+ if (!args) return getDefaultStdFee();
61
+ const { payer, granter, feePayer, gasPrice = DEFAULT_GAS_PRICE, gas = DEFAULT_GAS_LIMIT.toString() } = args;
62
+ const gasNormalized = toBigNumber(gas).toFixed(0);
63
+ const gasPriceNormalized = toBigNumber(gasPrice).toFixed(0);
64
+ return {
65
+ amount: [{
66
+ denom: "inj",
67
+ amount: toBigNumber(gasNormalized).times(gasPriceNormalized).toFixed()
68
+ }],
69
+ gas: toBigNumber(gasNormalized).toFixed(),
70
+ payer,
71
+ granter,
72
+ feePayer
73
+ };
74
+ };
75
+ const getStdFeeFromString = (gasPrice) => {
76
+ const matchResult = gasPrice.match(/^([0-9.]+)([a-zA-Z][a-zA-Z0-9/:._-]*)$/);
77
+ if (!matchResult) throw new Error("Invalid gas price string");
78
+ const [_, amount] = matchResult;
79
+ return getStdFeeFromObject({
80
+ gas: toChainFormat(amount, 18).dividedBy(DEFAULT_GAS_PRICE).toFixed(0),
81
+ gasPrice: DEFAULT_GAS_PRICE
82
+ });
83
+ };
84
+ const getStdFee = (args) => {
85
+ if (!args) return getDefaultStdFee();
86
+ if (typeof args === "string") return getStdFeeFromString(args);
87
+ return getStdFeeFromObject({ ...args });
88
+ };
89
+
90
+ //#endregion
91
+ export { getStdFeeFromObject as a, splitArrayToChunks as c, getStdFeeForToken as i, splitArrayToChunksThrow as l, awaitForAll as n, getStdFeeFromString as o, getStdFee as r, sleep as s, awaitAll as t };
@@ -0,0 +1,2 @@
1
+ import { a as getStdFeeFromObject, c as splitArrayToChunks, i as getStdFeeForToken, l as splitArrayToChunksThrow, n as awaitForAll, o as getStdFeeFromString, r as getStdFee, s as sleep, t as awaitAll } from "./helpers-BZ1LFB-6.js";
2
+ export { awaitAll, awaitForAll, getStdFee, getStdFeeForToken, getStdFeeFromObject, getStdFeeFromString, sleep, splitArrayToChunks, splitArrayToChunksThrow };
@@ -0,0 +1,5 @@
1
+ import "./BigNumber-DUr2WQBK.js";
2
+ import "./constants-0w1sGXWU.js";
3
+ import { a as getStdFeeFromObject, c as splitArrayToChunks, i as getStdFeeForToken, l as splitArrayToChunksThrow, n as awaitForAll, o as getStdFeeFromString, r as getStdFee, s as sleep, t as awaitAll } from "./helpers-BsGkkq54.js";
4
+
5
+ export { awaitAll, awaitForAll, getStdFee, getStdFeeForToken, getStdFeeFromObject, getStdFeeFromString, sleep, splitArrayToChunks, splitArrayToChunksThrow };
@@ -0,0 +1,2 @@
1
+ import { n as HttpClient, t as HttpRestClient } from "./HttpRestClient-B-UvB9KB.js";
2
+ export { HttpClient, HttpRestClient };
@@ -0,0 +1,4 @@
1
+ import "./defineProperty-Zp25b8Cm.js";
2
+ import { n as HttpClient, t as HttpRestClient } from "./HttpRestClient-CsKkn8lo.js";
3
+
4
+ export { HttpClient, HttpRestClient };
@@ -1,270 +1,11 @@
1
- import BigNumber from "bignumber.js";
2
- import { AxiosRequestConfig } from "axios";
3
- import { AccountAddress } from "@injectivelabs/ts-types";
4
-
5
- //#region src/classes/BigNumber.d.ts
6
- /**
7
- * Converts a value to BigNumber if it isn't already
8
- */
9
- declare const toBigNumber: (value: BigNumber | string | number) => BigNumber;
10
- /**
11
- * Converts a value to Wei (multiplies by 10^decimals) default to 18 decimals
12
- */
13
- declare const toChainFormat: (value: BigNumber | string | number, decimals?: number) => BigNumber;
14
- /**
15
- * Converts a value from Wei to Base (divides by 10^decimals) default to 18 decimals
16
- */
17
- declare const toHumanReadable: (value: BigNumber | string | number, decimals?: number) => BigNumber;
18
- //#endregion
19
- //#region src/time.d.ts
20
- declare const getSecondsInDay: () => BigNumber;
21
- declare const convertTimestampToMilliseconds: (timestamp: number | string) => number;
22
- declare const getUTCDateFromTimestamp: (timestamp: number) => string;
23
- declare const tomorrow: () => BigNumber;
24
- declare const todayInSeconds: () => number;
25
- declare const past24Hours: () => number;
26
- declare const pastDays: (day?: number) => number;
27
- declare const getEndDateStringFromTimeInSeconds: (timeInSeconds: BigNumber) => string;
28
- //#endregion
29
- //#region src/types.d.ts
30
- type Awaited<T> = T extends null | undefined ? T : T extends object & {
31
- then(onfulfilled: infer F, ...args: infer _): any;
32
- } ? F extends ((value: infer V, ...args: infer _) => any) ? Awaited<V> : never : T;
33
- //#endregion
34
- //#region src/helpers.d.ts
35
- declare const sleep: (timeout: number) => Promise<void>;
36
- /**
37
- * When we want to execute the promises in batch
38
- */
39
- declare const awaitAll: <T, S>(array: Array<T>, callback: (item: T) => Promise<S>) => Promise<Awaited<S>[]>;
40
- /**
41
- * When we want to execute the promises one by one
42
- * and not all in batch as with await Promise.all()
43
- */
44
- declare const awaitForAll: <T, S>(array: Array<T>, callback: (item: T) => Promise<S>, onError?: (error: unknown, item: T, index: number) => void) => Promise<S[]>;
45
- declare const splitArrayToChunksThrow: <T>({
46
- array,
47
- filter,
48
- chunkSize
49
- }: {
50
- array: Array<T>;
51
- chunkSize: number;
52
- filter?: (item: T) => boolean;
53
- }) => T[][];
54
- declare const splitArrayToChunks: <T>({
55
- array,
56
- filter,
57
- chunkSize
58
- }: {
59
- array: Array<T>;
60
- chunkSize: number;
61
- filter?: (item: T) => boolean;
62
- }) => T[][];
63
- declare const getStdFeeForToken: (token?: {
64
- denom: string;
65
- decimals: number;
66
- }, gasPrice?: string, gasLimit?: string) => {
67
- amount: {
68
- denom: string;
69
- amount: string;
70
- }[];
71
- gas: string;
72
- };
73
- declare const getStdFeeFromObject: (args?: {
74
- gas?: string | number;
75
- payer?: string;
76
- granter?: string;
77
- gasPrice?: string | number;
78
- feePayer?: string;
79
- }) => {
80
- amount: {
81
- denom: string;
82
- amount: string;
83
- }[];
84
- gas: string;
85
- payer: string | undefined; /** for Web3Gateway fee delegation */
86
- granter: string | undefined;
87
- feePayer: string | undefined;
88
- };
89
- declare const getStdFeeFromString: (gasPrice: string) => {
90
- amount: {
91
- denom: string;
92
- amount: string;
93
- }[];
94
- gas: string;
95
- payer: string | undefined; /** for Web3Gateway fee delegation */
96
- granter: string | undefined;
97
- feePayer: string | undefined;
98
- };
99
- declare const getStdFee: (args?: string | {
100
- payer?: string;
101
- granter?: string;
102
- feePayer?: string;
103
- gas?: string | number;
104
- gasPrice?: string | number;
105
- }) => {
106
- amount: {
107
- denom: string;
108
- amount: string;
109
- }[];
110
- gas: string;
111
- payer: string | undefined; /** for Web3Gateway fee delegation */
112
- granter: string | undefined;
113
- feePayer: string | undefined;
114
- };
115
- //#endregion
116
- //#region src/numbers.d.ts
117
- declare const getBigNumberWithRounding: () => typeof BigNumber;
118
- declare const getSignificantDecimalsFromNumber: (number: BigNumber | number | string) => number;
119
- declare const getExactDecimalsFromNumber: (number: number | string) => number;
120
- //#endregion
121
- //#region src/constants.d.ts
122
- declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
123
- declare const INJ_DENOM = "inj";
124
- declare const INJECTIVE_DENOM = "inj";
125
- declare const DEFAULT_FEE_DENOM = "inj";
126
- declare const DEFAULT_GAS_LIMIT = 400000;
127
- declare const DEFAULT_IBC_GAS_LIMIT = 300000;
128
- declare const DEFAULT_GAS_PRICE = 160000000;
129
- declare const DEFAULT_EXCHANGE_LIMIT = 200000;
130
- declare const DEFAULT_BRIDGE_FEE_DENOM = "inj";
131
- declare const DEFAULT_BRIDGE_FEE_PRICE = "160000000";
132
- declare const DEFAULT_BRIDGE_FEE_AMOUNT = "200000000000000";
133
- declare const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 60;
134
- declare const DEFAULT_BLOCK_TIME_IN_SECONDS = 0.7;
135
- /**
136
- * Default timeout for transaction block inclusion polling.
137
- *
138
- * Calculation: 120 blocks × 0.7 seconds/block = 84 seconds = 84,000ms
139
- */
140
- declare const DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS: number;
141
- declare const DEFAULT_TX_POLL_INTERVAL_MS = 500;
142
- declare const DEFAULT_TX_POLL_CALL_TIMEOUT_MS = 3000;
143
- declare const DEFAULT_TIMESTAMP_TIMEOUT_MS: number;
144
- declare const getDefaultStdFee: () => {
145
- amount: {
146
- amount: string;
147
- denom: string;
148
- }[];
149
- gas: string;
150
- payer: string;
151
- granter: string;
152
- feePayer: string;
153
- };
154
- declare const DEFAULT_STD_FEE_BY_DENOM: (denom?: string) => {
155
- amount: {
156
- denom: string;
157
- amount: string;
158
- }[];
159
- gas: string;
160
- };
161
- //#endregion
162
- //#region src/formatters.d.ts
163
- declare const formatWalletAddress: (address: AccountAddress, substrLength?: number) => string;
164
- declare const toPascalCase: (str: string) => string;
165
- declare const snakeToPascal: (str: string) => string;
166
- declare const capitalize: (str: string) => string;
167
- //#endregion
168
- //#region src/enum.d.ts
169
- declare const StatusType: {
170
- readonly Idle: "idle";
171
- readonly Loading: "loading";
172
- readonly Completed: "completed";
173
- readonly Error: "error";
174
- readonly Confirmed: "confirmed";
175
- };
176
- type StatusType = (typeof StatusType)[keyof typeof StatusType];
177
- //#endregion
178
- //#region src/classes/Status.d.ts
179
- declare class Status {
180
- status: string;
181
- constructor(status?: StatusType);
182
- get(): string;
183
- set(status: StatusType): void;
184
- is(status: StatusType): boolean;
185
- isLoading(): boolean;
186
- isNotLoading(): boolean;
187
- isCompleted(): boolean;
188
- isConfirmed(): boolean;
189
- isIdle(): boolean;
190
- isError(): boolean;
191
- setLoading(): void;
192
- setCompleted(): void;
193
- setConfirmed(): void;
194
- setError(): void;
195
- setIdle(): void;
196
- toggle(): void;
197
- toString(): string;
198
- valueOf(): string;
199
- }
200
- //#endregion
201
- //#region src/classes/HttpClient.d.ts
202
- declare class HttpClient {
203
- private readonly client;
204
- private config;
205
- constructor(endpoint: string, options?: Record<string, any>);
206
- setConfig(config: AxiosRequestConfig): HttpClient;
207
- get<T, P>(endpoint: string, params?: T): Promise<P>;
208
- post<T, P>(endpoint: string, data?: T): Promise<P>;
209
- put<T, P>(endpoint: string, data?: T): Promise<P>;
210
- delete<T, P>(endpoint: string, params?: T): Promise<P>;
211
- }
212
- //#endregion
213
- //#region src/classes/LocalStorage.d.ts
214
- declare class LocalStorage {
215
- private storage;
216
- constructor(namespace: string);
217
- get(key: string, defaultValue?: unknown): unknown;
218
- has(key: string): boolean;
219
- set(key: string, value: unknown): void;
220
- remove(key: string): void;
221
- clear(): void;
222
- }
223
- //#endregion
224
- //#region src/classes/BigNumberInBase.d.ts
225
- /**
226
- * @deprecated - use toHumanReadable instead
227
- */
228
- declare class BigNumberInBase extends BigNumber {
229
- static make(number: BigNumber.Value): BigNumberInBase;
230
- minus(n: BigNumber.Value, base?: number): BigNumberInBase;
231
- plus(n: BigNumber.Value, base?: number): BigNumberInBase;
232
- dividedBy(n: BigNumber.Value, base?: number): BigNumberInBase;
233
- div(n: BigNumber.Value, base?: number): BigNumberInBase;
234
- multipliedBy(n: BigNumber.Value, base?: number): BigNumberInBase;
235
- times(n: BigNumber.Value, base?: number): BigNumberInBase;
236
- pow(n: BigNumber.Value, base?: number): BigNumberInBase;
237
- toWei(decimals?: number): BigNumberInWei;
238
- }
239
- //#endregion
240
- //#region src/classes/BigNumberInWei.d.ts
241
- /**
242
- * @deprecated - use toChainFormat instead
243
- */
244
- declare class BigNumberInWei extends BigNumber {
245
- static make(number: BigNumber.Value): BigNumberInWei;
246
- minus(n: BigNumber.Value, base?: number): BigNumberInWei;
247
- plus(n: BigNumber.Value, base?: number): BigNumberInWei;
248
- dividedBy(n: BigNumber.Value, base?: number): BigNumberInWei;
249
- div(n: BigNumber.Value, base?: number): BigNumberInWei;
250
- multipliedBy(n: BigNumber.Value, base?: number): BigNumberInWei;
251
- times(n: BigNumber.Value, base?: number): BigNumberInWei;
252
- pow(n: BigNumber.Value, base?: number): BigNumberInWei;
253
- toBase(decimals?: number): BigNumberInBase;
254
- }
255
- //#endregion
256
- //#region src/classes/HttpRestClient.d.ts
257
- /**
258
- * @hidden
259
- */
260
- declare class HttpRestClient {
261
- protected client: HttpClient;
262
- protected endpoint: string;
263
- constructor(endpoint: string, options?: Record<string, any>);
264
- setConfig(config: AxiosRequestConfig): HttpRestClient;
265
- get<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
266
- retry<TResponse>(httpCall: Function, retries?: number, delay?: number): Promise<TResponse>;
267
- post<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
268
- }
269
- //#endregion
1
+ import { i as toHumanReadable, n as toBigNumber, r as toChainFormat, t as BigNumber } from "./BigNumber-jKUujKpO.js";
2
+ import { n as BigNumberInBase, t as BigNumberInWei } from "./BigNumberInWei-JtQuFET_.js";
3
+ import { _ as INJ_DENOM, a as DEFAULT_BRIDGE_FEE_PRICE, 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, y as getDefaultStdFee } from "./constants-BPYHMKzA.js";
4
+ import { i as toPascalCase, n as formatWalletAddress, r as snakeToPascal, t as capitalize } from "./formatters-v2reo54H.js";
5
+ import { a as getStdFeeFromObject, c as splitArrayToChunks, i as getStdFeeForToken, l as splitArrayToChunksThrow, n as awaitForAll, o as getStdFeeFromString, r as getStdFee, s as sleep, t as awaitAll } from "./helpers-BZ1LFB-6.js";
6
+ import { n as HttpClient, t as HttpRestClient } from "./HttpRestClient-B-UvB9KB.js";
7
+ 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";
8
+ import { n as getExactDecimalsFromNumber, r as getSignificantDecimalsFromNumber, t as getBigNumberWithRounding } from "./numbers-Bnbd75cb.js";
9
+ import { n as StatusType, t as Status } from "./Status-C6A6ZtpL.js";
10
+ import { t as LocalStorage } from "./LocalStorage-CyTj3H1T.js";
270
11
  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 };