@injectivelabs/utils 1.15.35 → 1.15.36

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.
@@ -9,12 +9,12 @@ export declare const awaitAll: <T, S>(array: Array<T>, callback: (item: T) => Pr
9
9
  * and not all in batch as with await Promise.all()
10
10
  */
11
11
  export declare const awaitForAll: <T, S>(array: Array<T>, callback: (item: T) => Promise<S>) => Promise<S[]>;
12
- export declare const splitArrayToChunksThrow: <T>({ array, chunkSize, filter, }: {
12
+ export declare const splitArrayToChunksThrow: <T>({ array, filter, chunkSize, }: {
13
13
  array: Array<T>;
14
14
  chunkSize: number;
15
15
  filter?: (item: T) => boolean;
16
16
  }) => T[][];
17
- export declare const splitArrayToChunks: <T>({ array, chunkSize, filter, }: {
17
+ export declare const splitArrayToChunks: <T>({ array, filter, chunkSize, }: {
18
18
  array: Array<T>;
19
19
  chunkSize: number;
20
20
  filter?: (item: T) => boolean;
@@ -66,11 +66,11 @@ export declare const getStdFeeFromString: (gasPrice: string) => {
66
66
  feePayer: string | undefined;
67
67
  };
68
68
  export declare const getStdFee: (args?: string | {
69
- gas?: string | number;
70
69
  payer?: string;
71
70
  granter?: string;
72
- gasPrice?: string | number;
73
71
  feePayer?: string;
72
+ gas?: string | number;
73
+ gasPrice?: string | number;
74
74
  }) => {
75
75
  amount: {
76
76
  denom: string;
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getStdFee = exports.getStdFeeFromString = exports.getDefaultStdFee = exports.getStdFeeFromObject = exports.getStdFeeForToken = exports.splitArrayToChunks = exports.splitArrayToChunksThrow = exports.awaitForAll = exports.awaitAll = exports.sleep = void 0;
7
7
  const constants_js_1 = require("./constants.js");
8
- const BigNumberInBase_js_1 = __importDefault(require("./classes/BigNumber/BigNumberInBase.js"));
9
8
  const BigNumberInWei_js_1 = __importDefault(require("./classes/BigNumber/BigNumberInWei.js"));
9
+ const BigNumberInBase_js_1 = __importDefault(require("./classes/BigNumber/BigNumberInBase.js"));
10
10
  const sleep = (timeout) => new Promise((resolve) => setTimeout(resolve, timeout));
11
11
  exports.sleep = sleep;
12
12
  /**
@@ -31,7 +31,7 @@ const awaitForAll = async (array, callback) => {
31
31
  return result;
32
32
  };
33
33
  exports.awaitForAll = awaitForAll;
34
- const splitArrayToChunksThrow = ({ array, chunkSize, filter, }) => {
34
+ const splitArrayToChunksThrow = ({ array, filter, chunkSize, }) => {
35
35
  const chunks = [];
36
36
  const chunkSizeInNumber = Number(chunkSize);
37
37
  if (isNaN(chunkSizeInNumber)) {
@@ -49,7 +49,7 @@ const splitArrayToChunksThrow = ({ array, chunkSize, filter, }) => {
49
49
  return chunks;
50
50
  };
51
51
  exports.splitArrayToChunksThrow = splitArrayToChunksThrow;
52
- const splitArrayToChunks = ({ array, chunkSize, filter, }) => {
52
+ const splitArrayToChunks = ({ array, filter, chunkSize, }) => {
53
53
  try {
54
54
  return (0, exports.splitArrayToChunksThrow)({ array, chunkSize, filter });
55
55
  }
@@ -81,7 +81,7 @@ const getStdFeeFromObject = (args) => {
81
81
  if (!args) {
82
82
  return constants_js_1.DEFAULT_STD_FEE;
83
83
  }
84
- const { gas = constants_js_1.DEFAULT_GAS_LIMIT.toString(), gasPrice = constants_js_1.DEFAULT_GAS_PRICE, payer, granter, feePayer, } = args;
84
+ const { payer, granter, feePayer, gasPrice = constants_js_1.DEFAULT_GAS_PRICE, gas = constants_js_1.DEFAULT_GAS_LIMIT.toString(), } = args;
85
85
  const gasNormalized = new BigNumberInBase_js_1.default(gas).toFixed(0);
86
86
  const gasPriceNormalized = new BigNumberInBase_js_1.default(gasPrice).toFixed(0);
87
87
  return {
@@ -9,12 +9,12 @@ export declare const awaitAll: <T, S>(array: Array<T>, callback: (item: T) => Pr
9
9
  * and not all in batch as with await Promise.all()
10
10
  */
11
11
  export declare const awaitForAll: <T, S>(array: Array<T>, callback: (item: T) => Promise<S>) => Promise<S[]>;
12
- export declare const splitArrayToChunksThrow: <T>({ array, chunkSize, filter, }: {
12
+ export declare const splitArrayToChunksThrow: <T>({ array, filter, chunkSize, }: {
13
13
  array: Array<T>;
14
14
  chunkSize: number;
15
15
  filter?: (item: T) => boolean;
16
16
  }) => T[][];
17
- export declare const splitArrayToChunks: <T>({ array, chunkSize, filter, }: {
17
+ export declare const splitArrayToChunks: <T>({ array, filter, chunkSize, }: {
18
18
  array: Array<T>;
19
19
  chunkSize: number;
20
20
  filter?: (item: T) => boolean;
@@ -66,11 +66,11 @@ export declare const getStdFeeFromString: (gasPrice: string) => {
66
66
  feePayer: string | undefined;
67
67
  };
68
68
  export declare const getStdFee: (args?: string | {
69
- gas?: string | number;
70
69
  payer?: string;
71
70
  granter?: string;
72
- gasPrice?: string | number;
73
71
  feePayer?: string;
72
+ gas?: string | number;
73
+ gasPrice?: string | number;
74
74
  }) => {
75
75
  amount: {
76
76
  denom: string;
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_STD_FEE, DEFAULT_GAS_LIMIT, DEFAULT_GAS_PRICE, } from './constants.js';
2
- import BigNumberInBase from './classes/BigNumber/BigNumberInBase.js';
3
2
  import BigNumberInWei from './classes/BigNumber/BigNumberInWei.js';
3
+ import BigNumberInBase from './classes/BigNumber/BigNumberInBase.js';
4
4
  export const sleep = (timeout) => new Promise((resolve) => setTimeout(resolve, timeout));
5
5
  /**
6
6
  * When we want to execute the promises in batch
@@ -22,7 +22,7 @@ export const awaitForAll = async (array, callback) => {
22
22
  }
23
23
  return result;
24
24
  };
25
- export const splitArrayToChunksThrow = ({ array, chunkSize, filter, }) => {
25
+ export const splitArrayToChunksThrow = ({ array, filter, chunkSize, }) => {
26
26
  const chunks = [];
27
27
  const chunkSizeInNumber = Number(chunkSize);
28
28
  if (isNaN(chunkSizeInNumber)) {
@@ -39,7 +39,7 @@ export const splitArrayToChunksThrow = ({ array, chunkSize, filter, }) => {
39
39
  }
40
40
  return chunks;
41
41
  };
42
- export const splitArrayToChunks = ({ array, chunkSize, filter, }) => {
42
+ export const splitArrayToChunks = ({ array, filter, chunkSize, }) => {
43
43
  try {
44
44
  return splitArrayToChunksThrow({ array, chunkSize, filter });
45
45
  }
@@ -69,7 +69,7 @@ export const getStdFeeFromObject = (args) => {
69
69
  if (!args) {
70
70
  return DEFAULT_STD_FEE;
71
71
  }
72
- const { gas = DEFAULT_GAS_LIMIT.toString(), gasPrice = DEFAULT_GAS_PRICE, payer, granter, feePayer, } = args;
72
+ const { payer, granter, feePayer, gasPrice = DEFAULT_GAS_PRICE, gas = DEFAULT_GAS_LIMIT.toString(), } = args;
73
73
  const gasNormalized = new BigNumberInBase(gas).toFixed(0);
74
74
  const gasPriceNormalized = new BigNumberInBase(gasPrice).toFixed(0);
75
75
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@injectivelabs/utils",
3
3
  "description": "List of utils and helper functions that can be reused throughout Injective's projects.",
4
- "version": "1.15.35",
4
+ "version": "1.15.36",
5
5
  "sideEffects": false,
6
6
  "type": "module",
7
7
  "author": {
@@ -77,9 +77,9 @@
77
77
  },
78
78
  "dependencies": {
79
79
  "@bangjelkoski/store2": "^2.14.3",
80
- "@injectivelabs/exceptions": "^1.15.34",
81
- "@injectivelabs/networks": "^1.15.35",
82
- "@injectivelabs/ts-types": "^1.15.35",
80
+ "@injectivelabs/exceptions": "^1.15.35",
81
+ "@injectivelabs/networks": "^1.15.36",
82
+ "@injectivelabs/ts-types": "^1.15.36",
83
83
  "axios": "^1.8.1",
84
84
  "bignumber.js": "^9.1.2",
85
85
  "http-status-codes": "^2.3.0"
@@ -87,5 +87,5 @@
87
87
  "devDependencies": {
88
88
  "shx": "^0.3.4"
89
89
  },
90
- "gitHead": "78251efa42d45cc5ae0ae7205e4035d4cedcd903"
90
+ "gitHead": "2f6b7586dc08c30e83fe780a565571b73af6cacc"
91
91
  }