@injectivelabs/utils 1.16.24 → 1.16.25-alpha.1
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/constants-DEbTiKzu.cjs +192 -0
- package/dist/cjs/index.cjs +586 -0
- package/dist/cjs/index.d.cts +279 -0
- package/dist/cjs/package.json +2 -2
- package/dist/cjs/test-utils/index.cjs +161 -0
- package/dist/cjs/test-utils/index.d.cts +218 -0
- package/dist/esm/constants-BxcSsKjm.js +66 -0
- package/dist/esm/index.d.ts +279 -6
- package/dist/esm/index.js +509 -6
- package/dist/esm/package.json +2 -2
- package/dist/esm/test-utils/index.d.ts +218 -2
- package/dist/esm/test-utils/index.js +157 -2
- package/package.json +16 -16
- package/dist/cjs/classes/BigNumber.d.ts +0 -14
- package/dist/cjs/classes/BigNumber.js +0 -33
- package/dist/cjs/classes/BigNumberInBase.d.ts +0 -16
- package/dist/cjs/classes/BigNumberInBase.js +0 -39
- package/dist/cjs/classes/BigNumberInWei.d.ts +0 -16
- package/dist/cjs/classes/BigNumberInWei.js +0 -39
- package/dist/cjs/classes/HttpClient.d.ts +0 -11
- package/dist/cjs/classes/HttpClient.js +0 -39
- package/dist/cjs/classes/HttpRestClient.d.ts +0 -14
- package/dist/cjs/classes/HttpRestClient.js +0 -110
- package/dist/cjs/classes/LocalStorage.d.ts +0 -9
- package/dist/cjs/classes/LocalStorage.js +0 -25
- package/dist/cjs/classes/Status.d.ts +0 -22
- package/dist/cjs/classes/Status.js +0 -61
- package/dist/cjs/classes/StreamManager.d.ts +0 -9
- package/dist/cjs/classes/StreamManager.js +0 -41
- package/dist/cjs/classes/index.d.ts +0 -10
- package/dist/cjs/classes/index.js +0 -60
- package/dist/cjs/constants.d.ts +0 -37
- package/dist/cjs/constants.js +0 -54
- package/dist/cjs/enum.d.ts +0 -8
- package/dist/cjs/enum.js +0 -10
- package/dist/cjs/formatters.d.ts +0 -5
- package/dist/cjs/formatters.js +0 -31
- package/dist/cjs/helpers.d.ts +0 -73
- package/dist/cjs/helpers.js +0 -145
- package/dist/cjs/index.d.ts +0 -6
- package/dist/cjs/index.js +0 -22
- package/dist/cjs/numbers.d.ts +0 -4
- package/dist/cjs/numbers.js +0 -37
- package/dist/cjs/test-utils/index.d.ts +0 -2
- package/dist/cjs/test-utils/index.js +0 -18
- package/dist/cjs/test-utils/mocks/index.d.ts +0 -153
- package/dist/cjs/test-utils/mocks/index.js +0 -106
- package/dist/cjs/test-utils/msgs.d.ts +0 -44
- package/dist/cjs/test-utils/msgs.js +0 -54
- package/dist/cjs/time.d.ts +0 -9
- package/dist/cjs/time.js +0 -41
- package/dist/cjs/types.d.ts +0 -3
- package/dist/cjs/types.js +0 -2
- package/dist/esm/classes/BigNumber.d.ts +0 -14
- package/dist/esm/classes/BigNumber.js +0 -27
- package/dist/esm/classes/BigNumberInBase.d.ts +0 -16
- package/dist/esm/classes/BigNumberInBase.js +0 -33
- package/dist/esm/classes/BigNumberInWei.d.ts +0 -16
- package/dist/esm/classes/BigNumberInWei.js +0 -33
- package/dist/esm/classes/HttpClient.d.ts +0 -11
- package/dist/esm/classes/HttpClient.js +0 -33
- package/dist/esm/classes/HttpRestClient.d.ts +0 -14
- package/dist/esm/classes/HttpRestClient.js +0 -104
- package/dist/esm/classes/LocalStorage.d.ts +0 -9
- package/dist/esm/classes/LocalStorage.js +0 -22
- package/dist/esm/classes/Status.d.ts +0 -22
- package/dist/esm/classes/Status.js +0 -58
- package/dist/esm/classes/StreamManager.d.ts +0 -9
- package/dist/esm/classes/StreamManager.js +0 -38
- package/dist/esm/classes/index.d.ts +0 -10
- package/dist/esm/classes/index.js +0 -10
- package/dist/esm/constants.d.ts +0 -37
- package/dist/esm/constants.js +0 -46
- package/dist/esm/enum.d.ts +0 -8
- package/dist/esm/enum.js +0 -7
- package/dist/esm/formatters.d.ts +0 -5
- package/dist/esm/formatters.js +0 -24
- package/dist/esm/helpers.d.ts +0 -73
- package/dist/esm/helpers.js +0 -100
- package/dist/esm/numbers.d.ts +0 -4
- package/dist/esm/numbers.js +0 -28
- package/dist/esm/test-utils/mocks/index.d.ts +0 -153
- package/dist/esm/test-utils/mocks/index.js +0 -103
- package/dist/esm/test-utils/msgs.d.ts +0 -44
- package/dist/esm/test-utils/msgs.js +0 -47
- package/dist/esm/time.d.ts +0 -9
- package/dist/esm/time.js +0 -27
- package/dist/esm/types.d.ts +0 -3
- package/dist/esm/types.js +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
|
|
3
|
+
//#region src/classes/BigNumber.ts
|
|
4
|
+
var BigNumber_default = BigNumber;
|
|
5
|
+
/**
|
|
6
|
+
* Converts a value to BigNumber if it isn't already
|
|
7
|
+
*/
|
|
8
|
+
const toBigNumber = (value) => {
|
|
9
|
+
if (value instanceof BigNumber) return value;
|
|
10
|
+
return new BigNumber(value);
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Converts a value to Wei (multiplies by 10^decimals) default to 18 decimals
|
|
14
|
+
*/
|
|
15
|
+
const toChainFormat = (value, decimals = 18) => {
|
|
16
|
+
return toBigNumber(value).multipliedBy(new BigNumber(10).pow(decimals));
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Converts a value from Wei to Base (divides by 10^decimals) default to 18 decimals
|
|
20
|
+
*/
|
|
21
|
+
const toHumanReadable = (value, decimals = 18) => {
|
|
22
|
+
return toBigNumber(value).dividedBy(new BigNumber(10).pow(decimals));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/constants.ts
|
|
27
|
+
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
28
|
+
const INJ_DENOM = "inj";
|
|
29
|
+
const INJECTIVE_DENOM = "inj";
|
|
30
|
+
const DEFAULT_FEE_DENOM = "inj";
|
|
31
|
+
const DEFAULT_GAS_LIMIT = 4e5;
|
|
32
|
+
const DEFAULT_IBC_GAS_LIMIT = 3e5;
|
|
33
|
+
const DEFAULT_GAS_PRICE = 16e7;
|
|
34
|
+
const DEFAULT_EXCHANGE_LIMIT = 2e5;
|
|
35
|
+
const DEFAULT_BRIDGE_FEE_DENOM = "inj";
|
|
36
|
+
const DEFAULT_BRIDGE_FEE_PRICE = "160000000";
|
|
37
|
+
const DEFAULT_BRIDGE_FEE_AMOUNT = "200000000000000";
|
|
38
|
+
const DEFAULT_BLOCK_TIMEOUT_HEIGHT = 120;
|
|
39
|
+
const DEFAULT_BLOCK_TIME_IN_SECONDS = .7;
|
|
40
|
+
/**
|
|
41
|
+
* Default timeout for transaction block inclusion polling.
|
|
42
|
+
*
|
|
43
|
+
* Calculation: 120 blocks × 0.7 seconds/block = 84 seconds = 84,000ms
|
|
44
|
+
*/
|
|
45
|
+
const DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS = Math.floor(DEFAULT_BLOCK_TIMEOUT_HEIGHT * DEFAULT_BLOCK_TIME_IN_SECONDS * 1e3);
|
|
46
|
+
const DEFAULT_TIMESTAMP_TIMEOUT_MS = 60 * 1e3 * 3;
|
|
47
|
+
const getDefaultStdFee = () => ({
|
|
48
|
+
amount: [{
|
|
49
|
+
amount: new BigNumber_default(DEFAULT_GAS_LIMIT).times(DEFAULT_GAS_PRICE).toString(),
|
|
50
|
+
denom: "inj"
|
|
51
|
+
}],
|
|
52
|
+
gas: DEFAULT_GAS_LIMIT.toString(),
|
|
53
|
+
payer: "",
|
|
54
|
+
granter: "",
|
|
55
|
+
feePayer: ""
|
|
56
|
+
});
|
|
57
|
+
const DEFAULT_STD_FEE_BY_DENOM = (denom = "inj") => ({
|
|
58
|
+
amount: [{
|
|
59
|
+
denom,
|
|
60
|
+
amount: new BigNumber_default(DEFAULT_GAS_LIMIT).times(DEFAULT_GAS_PRICE).toString()
|
|
61
|
+
}],
|
|
62
|
+
gas: DEFAULT_GAS_LIMIT.toString()
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
//#endregion
|
|
66
|
+
export { getDefaultStdFee as _, DEFAULT_BRIDGE_FEE_PRICE as a, toChainFormat as b, DEFAULT_GAS_LIMIT as c, DEFAULT_STD_FEE_BY_DENOM as d, DEFAULT_TIMESTAMP_TIMEOUT_MS as f, ZERO_ADDRESS as g, INJ_DENOM as h, DEFAULT_BRIDGE_FEE_DENOM as i, DEFAULT_GAS_PRICE as l, INJECTIVE_DENOM as m, DEFAULT_BLOCK_TIME_IN_SECONDS as n, DEFAULT_EXCHANGE_LIMIT as o, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS as p, DEFAULT_BRIDGE_FEE_AMOUNT as r, DEFAULT_FEE_DENOM as s, DEFAULT_BLOCK_TIMEOUT_HEIGHT as t, DEFAULT_IBC_GAS_LIMIT as u, BigNumber_default as v, toHumanReadable as x, toBigNumber as y };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,279 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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>) => 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 = 120;
|
|
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_TIMESTAMP_TIMEOUT_MS: number;
|
|
142
|
+
declare const getDefaultStdFee: () => {
|
|
143
|
+
amount: {
|
|
144
|
+
amount: string;
|
|
145
|
+
denom: string;
|
|
146
|
+
}[];
|
|
147
|
+
gas: string;
|
|
148
|
+
payer: string;
|
|
149
|
+
granter: string;
|
|
150
|
+
feePayer: string;
|
|
151
|
+
};
|
|
152
|
+
declare const DEFAULT_STD_FEE_BY_DENOM: (denom?: string) => {
|
|
153
|
+
amount: {
|
|
154
|
+
denom: string;
|
|
155
|
+
amount: string;
|
|
156
|
+
}[];
|
|
157
|
+
gas: string;
|
|
158
|
+
};
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/formatters.d.ts
|
|
161
|
+
declare const formatWalletAddress: (address: AccountAddress, substrLength?: number) => string;
|
|
162
|
+
declare const toPascalCase: (str: string) => string;
|
|
163
|
+
declare const snakeToPascal: (str: string) => string;
|
|
164
|
+
declare const capitalize: (str: string) => string;
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/enum.d.ts
|
|
167
|
+
declare const StatusType: {
|
|
168
|
+
readonly Idle: "idle";
|
|
169
|
+
readonly Loading: "loading";
|
|
170
|
+
readonly Completed: "completed";
|
|
171
|
+
readonly Error: "error";
|
|
172
|
+
readonly Confirmed: "confirmed";
|
|
173
|
+
};
|
|
174
|
+
type StatusType = (typeof StatusType)[keyof typeof StatusType];
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/classes/Status.d.ts
|
|
177
|
+
declare class Status {
|
|
178
|
+
status: string;
|
|
179
|
+
constructor(status?: StatusType);
|
|
180
|
+
get(): string;
|
|
181
|
+
set(status: StatusType): void;
|
|
182
|
+
is(status: StatusType): boolean;
|
|
183
|
+
isLoading(): boolean;
|
|
184
|
+
isNotLoading(): boolean;
|
|
185
|
+
isCompleted(): boolean;
|
|
186
|
+
isConfirmed(): boolean;
|
|
187
|
+
isIdle(): boolean;
|
|
188
|
+
isError(): boolean;
|
|
189
|
+
setLoading(): void;
|
|
190
|
+
setCompleted(): void;
|
|
191
|
+
setConfirmed(): void;
|
|
192
|
+
setError(): void;
|
|
193
|
+
setIdle(): void;
|
|
194
|
+
toggle(): void;
|
|
195
|
+
toString(): string;
|
|
196
|
+
valueOf(): string;
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/classes/HttpClient.d.ts
|
|
200
|
+
declare class HttpClient {
|
|
201
|
+
private readonly client;
|
|
202
|
+
private config;
|
|
203
|
+
constructor(endpoint: string, options?: Record<string, any>);
|
|
204
|
+
setConfig(config: AxiosRequestConfig): HttpClient;
|
|
205
|
+
get<T, P>(endpoint: string, params?: T): Promise<P>;
|
|
206
|
+
post<T, P>(endpoint: string, data?: T): Promise<P>;
|
|
207
|
+
put<T, P>(endpoint: string, data?: T): Promise<P>;
|
|
208
|
+
delete<T, P>(endpoint: string, params?: T): Promise<P>;
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/classes/LocalStorage.d.ts
|
|
212
|
+
declare class LocalStorage {
|
|
213
|
+
private storage;
|
|
214
|
+
constructor(namespace: string);
|
|
215
|
+
get(key: string, defaultValue?: unknown): unknown;
|
|
216
|
+
has(key: string): boolean;
|
|
217
|
+
set(key: string, value: unknown): void;
|
|
218
|
+
remove(key: string): void;
|
|
219
|
+
clear(): void;
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/classes/StreamManager.d.ts
|
|
223
|
+
declare class StreamManager<T> {
|
|
224
|
+
private streams;
|
|
225
|
+
set(stream: any, streamKey: T): void;
|
|
226
|
+
get(streamKey: T): any;
|
|
227
|
+
exists(streamKey: T): boolean;
|
|
228
|
+
cancelAll(): void;
|
|
229
|
+
cancel(streamKey: T): void;
|
|
230
|
+
cancelIfExists(streamKey: T): void;
|
|
231
|
+
}
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region src/classes/BigNumberInBase.d.ts
|
|
234
|
+
/**
|
|
235
|
+
* @deprecated - use toHumanReadable instead
|
|
236
|
+
*/
|
|
237
|
+
declare class BigNumberInBase extends BigNumber {
|
|
238
|
+
static make(number: BigNumber.Value): BigNumberInBase;
|
|
239
|
+
minus(n: BigNumber.Value, base?: number): BigNumberInBase;
|
|
240
|
+
plus(n: BigNumber.Value, base?: number): BigNumberInBase;
|
|
241
|
+
dividedBy(n: BigNumber.Value, base?: number): BigNumberInBase;
|
|
242
|
+
div(n: BigNumber.Value, base?: number): BigNumberInBase;
|
|
243
|
+
multipliedBy(n: BigNumber.Value, base?: number): BigNumberInBase;
|
|
244
|
+
times(n: BigNumber.Value, base?: number): BigNumberInBase;
|
|
245
|
+
pow(n: BigNumber.Value, base?: number): BigNumberInBase;
|
|
246
|
+
toWei(decimals?: number): BigNumberInWei;
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/classes/BigNumberInWei.d.ts
|
|
250
|
+
/**
|
|
251
|
+
* @deprecated - use toChainFormat instead
|
|
252
|
+
*/
|
|
253
|
+
declare class BigNumberInWei extends BigNumber {
|
|
254
|
+
static make(number: BigNumber.Value): BigNumberInWei;
|
|
255
|
+
minus(n: BigNumber.Value, base?: number): BigNumberInWei;
|
|
256
|
+
plus(n: BigNumber.Value, base?: number): BigNumberInWei;
|
|
257
|
+
dividedBy(n: BigNumber.Value, base?: number): BigNumberInWei;
|
|
258
|
+
div(n: BigNumber.Value, base?: number): BigNumberInWei;
|
|
259
|
+
multipliedBy(n: BigNumber.Value, base?: number): BigNumberInWei;
|
|
260
|
+
times(n: BigNumber.Value, base?: number): BigNumberInWei;
|
|
261
|
+
pow(n: BigNumber.Value, base?: number): BigNumberInWei;
|
|
262
|
+
toBase(decimals?: number): BigNumberInBase;
|
|
263
|
+
}
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/classes/HttpRestClient.d.ts
|
|
266
|
+
/**
|
|
267
|
+
* @hidden
|
|
268
|
+
*/
|
|
269
|
+
declare class HttpRestClient {
|
|
270
|
+
protected client: HttpClient;
|
|
271
|
+
protected endpoint: string;
|
|
272
|
+
constructor(endpoint: string, options?: Record<string, any>);
|
|
273
|
+
setConfig(config: AxiosRequestConfig): HttpRestClient;
|
|
274
|
+
get<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
|
|
275
|
+
retry<TResponse>(httpCall: Function, retries?: number, delay?: number): Promise<TResponse>;
|
|
276
|
+
post<T>(endpoint: string, params?: Record<string, any>): Promise<T>;
|
|
277
|
+
}
|
|
278
|
+
//#endregion
|
|
279
|
+
export { BigNumber, BigNumberInBase, BigNumberInWei, DEFAULT_BLOCK_TIMEOUT_HEIGHT, DEFAULT_BLOCK_TIME_IN_SECONDS, DEFAULT_BRIDGE_FEE_AMOUNT, DEFAULT_BRIDGE_FEE_DENOM, DEFAULT_BRIDGE_FEE_PRICE, DEFAULT_EXCHANGE_LIMIT, DEFAULT_FEE_DENOM, DEFAULT_GAS_LIMIT, DEFAULT_GAS_PRICE, DEFAULT_IBC_GAS_LIMIT, DEFAULT_STD_FEE_BY_DENOM, DEFAULT_TIMESTAMP_TIMEOUT_MS, DEFAULT_TX_BLOCK_INCLUSION_TIMEOUT_IN_MS, HttpClient, HttpRestClient, INJECTIVE_DENOM, INJ_DENOM, LocalStorage, Status, StatusType, StreamManager, 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 };
|