@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.
- 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
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,270 +1,11 @@
|
|
|
1
|
-
import BigNumber from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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-B-r__Egf.cjs";
|
|
2
|
+
import { n as BigNumberInBase, t as BigNumberInWei } from "./BigNumberInWei-BMQpZg3S.cjs";
|
|
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-BRub-WIk.cjs";
|
|
4
|
+
import { i as toPascalCase, n as formatWalletAddress, r as snakeToPascal, t as capitalize } from "./formatters-lY6KvxzC.cjs";
|
|
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-BmH3TkaY.cjs";
|
|
6
|
+
import { n as HttpClient, t as HttpRestClient } from "./HttpRestClient-C0p7w6ht.cjs";
|
|
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-DQwWSv4e.cjs";
|
|
8
|
+
import { n as getExactDecimalsFromNumber, r as getSignificantDecimalsFromNumber, t as getBigNumberWithRounding } from "./numbers-CVJM893V.cjs";
|
|
9
|
+
import { n as StatusType, t as Status } from "./Status-lj0Wyw_3.cjs";
|
|
10
|
+
import { t as LocalStorage } from "./LocalStorage-Dqm913-z.cjs";
|
|
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 };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
const require_defineProperty = require('./defineProperty-CImP5zIM.cjs');
|
|
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
|
+
require_defineProperty._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
|
+
exports.DEFAULT_BLOCK_TIMEOUT_HEIGHT = DEFAULT_BLOCK_TIMEOUT_HEIGHT;
|
|
152
|
+
exports.DEFAULT_BLOCK_TIME_IN_SECONDS = DEFAULT_BLOCK_TIME_IN_SECONDS;
|
|
153
|
+
exports.DEFAULT_BRIDGE_FEE_AMOUNT = DEFAULT_BRIDGE_FEE_AMOUNT;
|
|
154
|
+
exports.DEFAULT_BRIDGE_FEE_DENOM = DEFAULT_BRIDGE_FEE_DENOM;
|
|
155
|
+
exports.DEFAULT_BRIDGE_FEE_PRICE = DEFAULT_BRIDGE_FEE_PRICE;
|
|
156
|
+
exports.DEFAULT_EXCHANGE_LIMIT = DEFAULT_EXCHANGE_LIMIT;
|
|
157
|
+
exports.DEFAULT_FEE_DENOM = DEFAULT_FEE_DENOM;
|
|
158
|
+
exports.DEFAULT_GAS_LIMIT = DEFAULT_GAS_LIMIT;
|
|
159
|
+
exports.DEFAULT_GAS_PRICE = DEFAULT_GAS_PRICE;
|
|
160
|
+
exports.DEFAULT_IBC_GAS_LIMIT = DEFAULT_IBC_GAS_LIMIT;
|
|
161
|
+
exports.DEFAULT_STD_FEE_BY_DENOM = DEFAULT_STD_FEE_BY_DENOM;
|
|
162
|
+
exports.DEFAULT_TIMESTAMP_TIMEOUT_MS = DEFAULT_TIMESTAMP_TIMEOUT_MS;
|
|
163
|
+
exports.DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS = DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS;
|
|
164
|
+
exports.DEFAULT_TX_POLL_CALL_TIMEOUT_MS = DEFAULT_TX_POLL_CALL_TIMEOUT_MS;
|
|
165
|
+
exports.DEFAULT_TX_POLL_INTERVAL_MS = DEFAULT_TX_POLL_INTERVAL_MS;
|
|
166
|
+
exports.INJECTIVE_DENOM = INJECTIVE_DENOM;
|
|
167
|
+
exports.INJ_DENOM = INJ_DENOM;
|
|
168
|
+
exports.Status = Status;
|
|
169
|
+
exports.StatusType = StatusType;
|
|
170
|
+
exports.ZERO_ADDRESS = ZERO_ADDRESS;
|
|
171
|
+
exports.awaitAll = awaitAll;
|
|
172
|
+
exports.awaitForAll = awaitForAll;
|
|
173
|
+
exports.capitalize = capitalize;
|
|
174
|
+
exports.formatWalletAddress = formatWalletAddress;
|
|
175
|
+
exports.getDefaultStdFee = getDefaultStdFee;
|
|
176
|
+
exports.sleep = sleep;
|
|
177
|
+
exports.snakeToPascal = snakeToPascal;
|
|
178
|
+
exports.splitArrayToChunks = splitArrayToChunks;
|
|
179
|
+
exports.splitArrayToChunksThrow = splitArrayToChunksThrow;
|
|
180
|
+
exports.toPascalCase = toPascalCase;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { AccountAddress } from "@injectivelabs/ts-types";
|
|
2
|
+
|
|
3
|
+
//#region src/light.d.ts
|
|
4
|
+
declare const StatusType: {
|
|
5
|
+
readonly Idle: "idle";
|
|
6
|
+
readonly Loading: "loading";
|
|
7
|
+
readonly Completed: "completed";
|
|
8
|
+
readonly Error: "error";
|
|
9
|
+
readonly Confirmed: "confirmed";
|
|
10
|
+
};
|
|
11
|
+
type StatusType = (typeof StatusType)[keyof typeof StatusType];
|
|
12
|
+
declare class Status {
|
|
13
|
+
status: string;
|
|
14
|
+
constructor(status?: StatusType);
|
|
15
|
+
get(): string;
|
|
16
|
+
set(status: StatusType): void;
|
|
17
|
+
is(status: StatusType): boolean;
|
|
18
|
+
isLoading(): boolean;
|
|
19
|
+
isNotLoading(): boolean;
|
|
20
|
+
isCompleted(): boolean;
|
|
21
|
+
isConfirmed(): boolean;
|
|
22
|
+
isIdle(): boolean;
|
|
23
|
+
isError(): boolean;
|
|
24
|
+
setLoading(): void;
|
|
25
|
+
setCompleted(): void;
|
|
26
|
+
setConfirmed(): void;
|
|
27
|
+
setError(): void;
|
|
28
|
+
setIdle(): void;
|
|
29
|
+
toggle(): void;
|
|
30
|
+
toString(): string;
|
|
31
|
+
valueOf(): string;
|
|
32
|
+
}
|
|
33
|
+
declare const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
34
|
+
declare const INJ_DENOM = "inj";
|
|
35
|
+
declare const INJECTIVE_DENOM = "inj";
|
|
36
|
+
declare const DEFAULT_FEE_DENOM = "inj";
|
|
37
|
+
declare const DEFAULT_GAS_LIMIT = 400000;
|
|
38
|
+
declare const DEFAULT_IBC_GAS_LIMIT = 300000;
|
|
39
|
+
declare const DEFAULT_GAS_PRICE = 160000000;
|
|
40
|
+
declare const DEFAULT_EXCHANGE_LIMIT = 200000;
|
|
41
|
+
declare const DEFAULT_BRIDGE_FEE_DENOM = "inj";
|
|
42
|
+
declare const DEFAULT_BRIDGE_FEE_PRICE = "160000000";
|
|
43
|
+
declare const DEFAULT_BRIDGE_FEE_AMOUNT = "200000000000000";
|
|
44
|
+
declare const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 60;
|
|
45
|
+
declare const DEFAULT_BLOCK_TIME_IN_SECONDS = 0.7;
|
|
46
|
+
declare const DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS: number;
|
|
47
|
+
declare const DEFAULT_TX_POLL_INTERVAL_MS = 500;
|
|
48
|
+
declare const DEFAULT_TX_POLL_CALL_TIMEOUT_MS = 3000;
|
|
49
|
+
declare const DEFAULT_TIMESTAMP_TIMEOUT_MS: number;
|
|
50
|
+
declare const getDefaultStdFee: () => {
|
|
51
|
+
amount: {
|
|
52
|
+
denom: string;
|
|
53
|
+
amount: string;
|
|
54
|
+
}[];
|
|
55
|
+
gas: string;
|
|
56
|
+
payer: string;
|
|
57
|
+
granter: string;
|
|
58
|
+
feePayer: string;
|
|
59
|
+
};
|
|
60
|
+
declare const DEFAULT_STD_FEE_BY_DENOM: (denom?: string) => {
|
|
61
|
+
amount: {
|
|
62
|
+
denom: string;
|
|
63
|
+
amount: string;
|
|
64
|
+
}[];
|
|
65
|
+
gas: string;
|
|
66
|
+
};
|
|
67
|
+
declare const formatWalletAddress: (address: AccountAddress, substrLength?: number) => string;
|
|
68
|
+
declare const toPascalCase: (str: string) => string;
|
|
69
|
+
declare const snakeToPascal: (str: string) => string;
|
|
70
|
+
declare const capitalize: (str: string) => string;
|
|
71
|
+
declare const sleep: (timeout: number) => Promise<void>;
|
|
72
|
+
declare const awaitAll: <T, S>(array: Array<T>, callback: (item: T) => Promise<S>) => Promise<Awaited<S>[]>;
|
|
73
|
+
declare const awaitForAll: <T, S>(array: Array<T>, callback: (item: T) => Promise<S>, onError?: (error: unknown, item: T, index: number) => void) => Promise<S[]>;
|
|
74
|
+
declare const splitArrayToChunksThrow: <T>({
|
|
75
|
+
array,
|
|
76
|
+
filter,
|
|
77
|
+
chunkSize
|
|
78
|
+
}: {
|
|
79
|
+
array: Array<T>;
|
|
80
|
+
chunkSize: number;
|
|
81
|
+
filter?: (item: T) => boolean;
|
|
82
|
+
}) => T[][];
|
|
83
|
+
declare const splitArrayToChunks: <T>({
|
|
84
|
+
array,
|
|
85
|
+
filter,
|
|
86
|
+
chunkSize
|
|
87
|
+
}: {
|
|
88
|
+
array: Array<T>;
|
|
89
|
+
chunkSize: number;
|
|
90
|
+
filter?: (item: T) => boolean;
|
|
91
|
+
}) => T[][];
|
|
92
|
+
//#endregion
|
|
93
|
+
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,39 @@
|
|
|
1
|
+
const require_BigNumber = require('./BigNumber-DbDA4_xA.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/numbers.ts
|
|
4
|
+
const getBigNumberWithRounding = () => require_BigNumber.BigNumber_default.clone({ ROUNDING_MODE: require_BigNumber.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
|
+
Object.defineProperty(exports, 'getBigNumberWithRounding', {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () {
|
|
25
|
+
return getBigNumberWithRounding;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, 'getExactDecimalsFromNumber', {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return getExactDecimalsFromNumber;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, 'getSignificantDecimalsFromNumber', {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () {
|
|
37
|
+
return getSignificantDecimalsFromNumber;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as BigNumber } from "./BigNumber-B-r__Egf.cjs";
|
|
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,6 @@
|
|
|
1
|
+
require('./BigNumber-DbDA4_xA.cjs');
|
|
2
|
+
const require_numbers = require('./numbers-BRXzNJ1I.cjs');
|
|
3
|
+
|
|
4
|
+
exports.getBigNumberWithRounding = require_numbers.getBigNumberWithRounding;
|
|
5
|
+
exports.getExactDecimalsFromNumber = require_numbers.getExactDecimalsFromNumber;
|
|
6
|
+
exports.getSignificantDecimalsFromNumber = require_numbers.getSignificantDecimalsFromNumber;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "./BigNumber-B-r__Egf.cjs";
|
|
2
|
+
import { n as getExactDecimalsFromNumber, r as getSignificantDecimalsFromNumber, t as getBigNumberWithRounding } from "./numbers-CVJM893V.cjs";
|
|
3
|
+
export { getBigNumberWithRounding, getExactDecimalsFromNumber, getSignificantDecimalsFromNumber };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_chunk = require('../chunk-CbDLau6x.cjs');
|
|
2
|
+
const require_BigNumber = require('../BigNumber-DbDA4_xA.cjs');
|
|
3
|
+
const require_constants = require('../constants-BdaegCnI.cjs');
|
|
2
4
|
let __injectivelabs_networks = require("@injectivelabs/networks");
|
|
3
5
|
let __injectivelabs_ts_types = require("@injectivelabs/ts-types");
|
|
4
6
|
|
|
@@ -130,7 +132,7 @@ const prepareEip712 = ({ messages, memo = "", granter = "", payer = "", sequence
|
|
|
130
132
|
fee: {
|
|
131
133
|
amount: [{
|
|
132
134
|
denom: "inj",
|
|
133
|
-
amount: new
|
|
135
|
+
amount: new require_BigNumber.BigNumber_default(gas.toString()).times(require_constants.DEFAULT_GAS_PRICE).toFixed()
|
|
134
136
|
}],
|
|
135
137
|
gas: gas.toString(),
|
|
136
138
|
...granter && { granter },
|