@provable-games/ekubo-sdk 0.1.0
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/README.md +336 -0
- package/dist/index.cjs +1592 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +927 -0
- package/dist/index.d.ts +927 -0
- package/dist/index.js +1533 -0
- package/dist/index.js.map +1 -0
- package/package.json +76 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,927 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ekubo pool key identifying a unique liquidity pool
|
|
3
|
+
*/
|
|
4
|
+
interface PoolKey {
|
|
5
|
+
token0: string;
|
|
6
|
+
token1: string;
|
|
7
|
+
fee: string;
|
|
8
|
+
tick_spacing: number;
|
|
9
|
+
extension: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A single hop in a swap route through one pool
|
|
13
|
+
*/
|
|
14
|
+
interface RouteNode {
|
|
15
|
+
pool_key: PoolKey;
|
|
16
|
+
sqrt_ratio_limit: string;
|
|
17
|
+
skip_ahead: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A split in a multi-route swap, representing one path through liquidity pools
|
|
21
|
+
*/
|
|
22
|
+
interface SwapSplit {
|
|
23
|
+
amount_specified: string;
|
|
24
|
+
route: RouteNode[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A complete swap quote from the Ekubo API
|
|
28
|
+
*/
|
|
29
|
+
interface SwapQuote {
|
|
30
|
+
/** Price impact as a decimal (e.g., 0.01 = 1%) */
|
|
31
|
+
impact: number;
|
|
32
|
+
/** Total amount to send or receive (always positive) */
|
|
33
|
+
total: bigint;
|
|
34
|
+
/** Individual route splits for multi-path swaps */
|
|
35
|
+
splits: SwapSplit[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Raw API response format (before transformation)
|
|
39
|
+
*/
|
|
40
|
+
interface SwapQuoteApiResponse {
|
|
41
|
+
price_impact: number;
|
|
42
|
+
total_calculated: string | number;
|
|
43
|
+
splits: SwapSplit[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Error response from the Ekubo API
|
|
47
|
+
*/
|
|
48
|
+
interface SwapQuoteErrorResponse {
|
|
49
|
+
error: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Token information for registry and resolution
|
|
54
|
+
*/
|
|
55
|
+
interface TokenInfo {
|
|
56
|
+
/** Token symbol (e.g., "ETH", "STRK") */
|
|
57
|
+
symbol: string;
|
|
58
|
+
/** Contract address (hex string) */
|
|
59
|
+
address: string;
|
|
60
|
+
/** Token decimals (default: 18) */
|
|
61
|
+
decimals?: number;
|
|
62
|
+
/** Human-readable name */
|
|
63
|
+
name?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Configuration for fetch operations with retry logic
|
|
68
|
+
*/
|
|
69
|
+
interface FetchConfig {
|
|
70
|
+
/** Request timeout in milliseconds (default: 10000) */
|
|
71
|
+
timeout?: number;
|
|
72
|
+
/** Maximum number of retry attempts (default: 3) */
|
|
73
|
+
maxRetries?: number;
|
|
74
|
+
/** Base backoff delay in milliseconds (default: 1000) */
|
|
75
|
+
baseBackoff?: number;
|
|
76
|
+
/** Maximum backoff delay in milliseconds (default: 5000) */
|
|
77
|
+
maxBackoff?: number;
|
|
78
|
+
/** Custom fetch function (for SSR or custom implementations) */
|
|
79
|
+
fetch?: typeof globalThis.fetch;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Configuration for quote polling
|
|
83
|
+
*/
|
|
84
|
+
interface PollingConfig {
|
|
85
|
+
/** Polling interval in milliseconds (default: 5000) */
|
|
86
|
+
interval?: number;
|
|
87
|
+
/** Maximum consecutive errors before auto-stopping (default: 3) */
|
|
88
|
+
maxConsecutiveErrors?: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Main configuration for EkuboClient
|
|
92
|
+
*/
|
|
93
|
+
interface EkuboClientConfig {
|
|
94
|
+
/** Chain shorthand: 'mainnet' or 'sepolia' */
|
|
95
|
+
chain?: "mainnet" | "sepolia";
|
|
96
|
+
/** Custom chain ID (overrides chain setting) */
|
|
97
|
+
chainId?: string;
|
|
98
|
+
/** Custom quoter API URL (for swap quotes) */
|
|
99
|
+
quoterApiUrl?: string;
|
|
100
|
+
/** Custom API URL (for tokens, prices, stats, etc.) */
|
|
101
|
+
apiUrl?: string;
|
|
102
|
+
/** Custom router contract address */
|
|
103
|
+
routerAddress?: string;
|
|
104
|
+
/** Default slippage percentage as bigint (default: 5n = 5%) */
|
|
105
|
+
defaultSlippagePercent?: bigint;
|
|
106
|
+
/** Fetch configuration */
|
|
107
|
+
fetch?: FetchConfig;
|
|
108
|
+
/** Polling configuration */
|
|
109
|
+
polling?: PollingConfig;
|
|
110
|
+
/** Additional custom tokens to register */
|
|
111
|
+
customTokens?: TokenInfo[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Resolved configuration with all defaults applied
|
|
115
|
+
*/
|
|
116
|
+
interface ResolvedConfig {
|
|
117
|
+
chainId: string;
|
|
118
|
+
quoterApiUrl: string;
|
|
119
|
+
apiUrl: string;
|
|
120
|
+
routerAddress: string;
|
|
121
|
+
defaultSlippagePercent: bigint;
|
|
122
|
+
fetch: Required<FetchConfig>;
|
|
123
|
+
polling: Required<PollingConfig>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A single Starknet call (compatible with starknet.js Call type)
|
|
128
|
+
*/
|
|
129
|
+
interface SwapCall {
|
|
130
|
+
contractAddress: string;
|
|
131
|
+
entrypoint: string;
|
|
132
|
+
calldata: string[];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Result of swap call generation
|
|
136
|
+
*/
|
|
137
|
+
interface SwapCallsResult {
|
|
138
|
+
/** Transfer call to send tokens to router */
|
|
139
|
+
transferCall: SwapCall;
|
|
140
|
+
/** Swap execution calls */
|
|
141
|
+
swapCalls: SwapCall[];
|
|
142
|
+
/** Clear remaining tokens call */
|
|
143
|
+
clearCall: SwapCall;
|
|
144
|
+
/** All calls in execution order */
|
|
145
|
+
allCalls: SwapCall[];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Parameters for fetching a swap quote
|
|
149
|
+
*/
|
|
150
|
+
interface FetchQuoteParams {
|
|
151
|
+
/** Amount to swap (in smallest unit) */
|
|
152
|
+
amount: bigint;
|
|
153
|
+
/** Token to sell (address or symbol) */
|
|
154
|
+
tokenFrom: string;
|
|
155
|
+
/** Token to buy (address or symbol) */
|
|
156
|
+
tokenTo: string;
|
|
157
|
+
/** Optional abort signal for cancellation */
|
|
158
|
+
signal?: AbortSignal;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Price history data point
|
|
163
|
+
*/
|
|
164
|
+
interface PriceDataPoint {
|
|
165
|
+
timestamp: number;
|
|
166
|
+
price: number;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Price history response
|
|
170
|
+
*/
|
|
171
|
+
interface PriceHistoryResponse {
|
|
172
|
+
data: PriceDataPoint[];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Parameters for getPriceHistory
|
|
176
|
+
*/
|
|
177
|
+
interface GetPriceHistoryParams {
|
|
178
|
+
/** Token to get price for */
|
|
179
|
+
token: string;
|
|
180
|
+
/** Quote token (e.g., USDC) */
|
|
181
|
+
otherToken: string;
|
|
182
|
+
/** Chain ID (Ekubo format) */
|
|
183
|
+
chainId?: string;
|
|
184
|
+
/** Time interval in seconds */
|
|
185
|
+
interval?: number;
|
|
186
|
+
/** API base URL */
|
|
187
|
+
apiUrl?: string;
|
|
188
|
+
/** Fetch configuration */
|
|
189
|
+
fetchConfig?: FetchConfig;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Fetch price history from Ekubo API
|
|
193
|
+
*/
|
|
194
|
+
declare function getPriceHistory(params: GetPriceHistoryParams): Promise<PriceHistoryResponse>;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Token metadata from Ekubo API
|
|
198
|
+
*/
|
|
199
|
+
interface ApiTokenInfo {
|
|
200
|
+
/** Token contract address */
|
|
201
|
+
address: string;
|
|
202
|
+
/** Token name */
|
|
203
|
+
name: string;
|
|
204
|
+
/** Token symbol */
|
|
205
|
+
symbol: string;
|
|
206
|
+
/** Token decimals */
|
|
207
|
+
decimals: number;
|
|
208
|
+
/** Logo URI (optional) */
|
|
209
|
+
logo_uri?: string;
|
|
210
|
+
/** Whether token is verified/trusted */
|
|
211
|
+
verified?: boolean;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Parameters for fetching tokens
|
|
215
|
+
*/
|
|
216
|
+
interface FetchTokensParams {
|
|
217
|
+
/** Chain ID (Ekubo format) */
|
|
218
|
+
chainId?: string;
|
|
219
|
+
/** API base URL */
|
|
220
|
+
apiUrl?: string;
|
|
221
|
+
/** Fetch configuration */
|
|
222
|
+
fetchConfig?: FetchConfig;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Parameters for fetching a single token
|
|
226
|
+
*/
|
|
227
|
+
interface FetchTokenParams extends FetchTokensParams {
|
|
228
|
+
/** Token contract address */
|
|
229
|
+
tokenAddress: string;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Parameters for batch fetching tokens
|
|
233
|
+
*/
|
|
234
|
+
interface FetchTokensBatchParams extends FetchTokensParams {
|
|
235
|
+
/** Token contract addresses */
|
|
236
|
+
tokenAddresses: string[];
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Fetch list of all tokens for a chain
|
|
240
|
+
*/
|
|
241
|
+
declare function fetchTokens(params?: FetchTokensParams): Promise<ApiTokenInfo[]>;
|
|
242
|
+
/**
|
|
243
|
+
* Fetch metadata for a single token
|
|
244
|
+
*/
|
|
245
|
+
declare function fetchToken(params: FetchTokenParams): Promise<ApiTokenInfo | null>;
|
|
246
|
+
/**
|
|
247
|
+
* Fetch metadata for multiple tokens at once
|
|
248
|
+
*/
|
|
249
|
+
declare function fetchTokensBatch(params: FetchTokensBatchParams): Promise<ApiTokenInfo[]>;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Trading pair statistics
|
|
253
|
+
*/
|
|
254
|
+
interface PairStats {
|
|
255
|
+
token0: string;
|
|
256
|
+
token1: string;
|
|
257
|
+
tvl_usd: number;
|
|
258
|
+
volume_24h_usd: number;
|
|
259
|
+
fees_24h_usd: number;
|
|
260
|
+
price: number;
|
|
261
|
+
price_change_24h: number;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Overview statistics response
|
|
265
|
+
*/
|
|
266
|
+
interface OverviewStats {
|
|
267
|
+
tvl_usd: number;
|
|
268
|
+
volume_24h_usd: number;
|
|
269
|
+
fees_24h_usd: number;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Pool information
|
|
273
|
+
*/
|
|
274
|
+
interface PoolInfo {
|
|
275
|
+
key_hash: string;
|
|
276
|
+
token0: string;
|
|
277
|
+
token1: string;
|
|
278
|
+
fee: string;
|
|
279
|
+
tick_spacing: number;
|
|
280
|
+
extension: string;
|
|
281
|
+
tvl_usd: number;
|
|
282
|
+
volume_24h_usd: number;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* TVL data point
|
|
286
|
+
*/
|
|
287
|
+
interface TvlDataPoint {
|
|
288
|
+
timestamp: number;
|
|
289
|
+
tvl_usd: number;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Volume data point
|
|
293
|
+
*/
|
|
294
|
+
interface VolumeDataPoint {
|
|
295
|
+
timestamp: number;
|
|
296
|
+
volume_usd: number;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Base parameters for stats API calls
|
|
300
|
+
*/
|
|
301
|
+
interface StatsBaseParams {
|
|
302
|
+
/** Chain ID (Ekubo format) */
|
|
303
|
+
chainId?: string;
|
|
304
|
+
/** API base URL */
|
|
305
|
+
apiUrl?: string;
|
|
306
|
+
/** Fetch configuration */
|
|
307
|
+
fetchConfig?: FetchConfig;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Parameters for pair-specific queries
|
|
311
|
+
*/
|
|
312
|
+
interface PairStatsParams extends StatsBaseParams {
|
|
313
|
+
/** First token address */
|
|
314
|
+
tokenA: string;
|
|
315
|
+
/** Second token address */
|
|
316
|
+
tokenB: string;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Fetch overview of top trading pairs
|
|
320
|
+
*/
|
|
321
|
+
declare function fetchTopPairs(params?: StatsBaseParams): Promise<PairStats[]>;
|
|
322
|
+
/**
|
|
323
|
+
* Fetch protocol TVL overview
|
|
324
|
+
*/
|
|
325
|
+
declare function fetchTvl(params?: StatsBaseParams): Promise<OverviewStats>;
|
|
326
|
+
/**
|
|
327
|
+
* Fetch protocol volume overview
|
|
328
|
+
*/
|
|
329
|
+
declare function fetchVolume(params?: StatsBaseParams): Promise<OverviewStats>;
|
|
330
|
+
/**
|
|
331
|
+
* Fetch TVL for a specific trading pair
|
|
332
|
+
*/
|
|
333
|
+
declare function fetchPairTvl(params: PairStatsParams): Promise<TvlDataPoint[]>;
|
|
334
|
+
/**
|
|
335
|
+
* Fetch volume for a specific trading pair
|
|
336
|
+
*/
|
|
337
|
+
declare function fetchPairVolume(params: PairStatsParams): Promise<VolumeDataPoint[]>;
|
|
338
|
+
/**
|
|
339
|
+
* Fetch pools for a specific trading pair
|
|
340
|
+
*/
|
|
341
|
+
declare function fetchPairPools(params: PairStatsParams): Promise<PoolInfo[]>;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Parameters for generating swap calls
|
|
345
|
+
*/
|
|
346
|
+
interface GenerateSwapCallsParams {
|
|
347
|
+
/** Token being sold (address) */
|
|
348
|
+
sellToken: string;
|
|
349
|
+
/** Token being bought (address) */
|
|
350
|
+
buyToken: string;
|
|
351
|
+
/** Minimum amount of buyToken to receive */
|
|
352
|
+
minimumReceived: bigint;
|
|
353
|
+
/** Quote from Ekubo API */
|
|
354
|
+
quote: SwapQuote;
|
|
355
|
+
/** Chain ID (Ekubo format) */
|
|
356
|
+
chainId?: string;
|
|
357
|
+
/** Router contract address (overrides chainId lookup) */
|
|
358
|
+
routerAddress?: string;
|
|
359
|
+
/** Slippage percentage for transfer amount (default: 5n = 5%) */
|
|
360
|
+
slippagePercent?: bigint;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Generate swap calls for Ekubo router
|
|
364
|
+
*
|
|
365
|
+
* This generates the calls needed to execute a swap:
|
|
366
|
+
* 1. Transfer tokens to router
|
|
367
|
+
* 2. Execute multihop_swap or multi_multihop_swap
|
|
368
|
+
* 3. Clear minimum profits
|
|
369
|
+
* 4. Clear remaining tokens
|
|
370
|
+
*/
|
|
371
|
+
declare function generateSwapCalls(params: GenerateSwapCallsParams): SwapCallsResult;
|
|
372
|
+
/**
|
|
373
|
+
* Prepare swap calls with approval included
|
|
374
|
+
* This is a convenience wrapper that adds the ERC20 approve call
|
|
375
|
+
*/
|
|
376
|
+
declare function prepareSwapCalls(params: GenerateSwapCallsParams): SwapCallsResult & {
|
|
377
|
+
approveCall: SwapCall;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Token registry for managing token information and symbol-to-address resolution
|
|
382
|
+
*/
|
|
383
|
+
declare class TokenRegistry {
|
|
384
|
+
private symbolMap;
|
|
385
|
+
private addressMap;
|
|
386
|
+
constructor(tokens?: TokenInfo[]);
|
|
387
|
+
/**
|
|
388
|
+
* Register a token
|
|
389
|
+
*/
|
|
390
|
+
register(token: TokenInfo): void;
|
|
391
|
+
/**
|
|
392
|
+
* Get token by symbol (case-insensitive)
|
|
393
|
+
*/
|
|
394
|
+
getBySymbol(symbol: string): TokenInfo | undefined;
|
|
395
|
+
/**
|
|
396
|
+
* Get token by address (normalized)
|
|
397
|
+
*/
|
|
398
|
+
getByAddress(address: string): TokenInfo | undefined;
|
|
399
|
+
/**
|
|
400
|
+
* Check if a token exists by symbol
|
|
401
|
+
*/
|
|
402
|
+
hasSymbol(symbol: string): boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Check if a token exists by address
|
|
405
|
+
*/
|
|
406
|
+
hasAddress(address: string): boolean;
|
|
407
|
+
/**
|
|
408
|
+
* Get all registered tokens
|
|
409
|
+
*/
|
|
410
|
+
getAll(): TokenInfo[];
|
|
411
|
+
/**
|
|
412
|
+
* Get all registered symbols
|
|
413
|
+
*/
|
|
414
|
+
getSymbols(): string[];
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Get the default token registry (singleton)
|
|
418
|
+
*/
|
|
419
|
+
declare function getDefaultRegistry(): TokenRegistry;
|
|
420
|
+
/**
|
|
421
|
+
* Create a new token registry with custom tokens
|
|
422
|
+
*/
|
|
423
|
+
declare function createTokenRegistry(customTokens?: TokenInfo[]): TokenRegistry;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* Resolve a token identifier (symbol or address) to a normalized address
|
|
427
|
+
*
|
|
428
|
+
* @param tokenIdentifier - Token symbol (e.g., "ETH") or address
|
|
429
|
+
* @param registry - Optional token registry (defaults to mainnet tokens)
|
|
430
|
+
* @returns Normalized address
|
|
431
|
+
* @throws TokenNotFoundError if symbol is not found in registry
|
|
432
|
+
*/
|
|
433
|
+
declare function resolveToken(tokenIdentifier: string, registry?: TokenRegistry): string;
|
|
434
|
+
/**
|
|
435
|
+
* Resolve a token identifier to full token info
|
|
436
|
+
*
|
|
437
|
+
* @param tokenIdentifier - Token symbol or address
|
|
438
|
+
* @param registry - Optional token registry
|
|
439
|
+
* @returns TokenInfo or undefined if not found
|
|
440
|
+
*/
|
|
441
|
+
declare function resolveTokenInfo(tokenIdentifier: string, registry?: TokenRegistry): TokenInfo | undefined;
|
|
442
|
+
/**
|
|
443
|
+
* Check if a token identifier can be resolved
|
|
444
|
+
*/
|
|
445
|
+
declare function canResolveToken(tokenIdentifier: string, registry?: TokenRegistry): boolean;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Well-known mainnet tokens
|
|
449
|
+
*/
|
|
450
|
+
declare const MAINNET_TOKENS: TokenInfo[];
|
|
451
|
+
/**
|
|
452
|
+
* Get mainnet tokens as a map by symbol (uppercase)
|
|
453
|
+
*/
|
|
454
|
+
declare function getMainnetTokensMap(): Map<string, TokenInfo>;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Default polling configuration
|
|
458
|
+
*/
|
|
459
|
+
declare const DEFAULT_POLLING_CONFIG: Required<PollingConfig>;
|
|
460
|
+
/**
|
|
461
|
+
* Quote poller callbacks
|
|
462
|
+
*/
|
|
463
|
+
interface QuotePollerCallbacks {
|
|
464
|
+
/** Called when a new quote is received */
|
|
465
|
+
onQuote: (quote: SwapQuote) => void;
|
|
466
|
+
/** Called when an error occurs */
|
|
467
|
+
onError?: (error: Error) => void;
|
|
468
|
+
/** Called when polling stops (due to errors or manually) */
|
|
469
|
+
onStop?: (reason: "manual" | "errors") => void;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Parameters for quote polling
|
|
473
|
+
*/
|
|
474
|
+
interface QuotePollerParams {
|
|
475
|
+
/** Amount to swap */
|
|
476
|
+
amount: bigint;
|
|
477
|
+
/** Token to sell (address) */
|
|
478
|
+
tokenFrom: string;
|
|
479
|
+
/** Token to buy (address) */
|
|
480
|
+
tokenTo: string;
|
|
481
|
+
/** Chain ID (Ekubo format) */
|
|
482
|
+
chainId?: string;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* QuotePoller class for real-time quote updates
|
|
486
|
+
*/
|
|
487
|
+
declare class QuotePoller {
|
|
488
|
+
private intervalId;
|
|
489
|
+
private abortController;
|
|
490
|
+
private consecutiveErrors;
|
|
491
|
+
private isRunning;
|
|
492
|
+
private readonly params;
|
|
493
|
+
private readonly callbacks;
|
|
494
|
+
private readonly config;
|
|
495
|
+
private readonly fetchConfig?;
|
|
496
|
+
constructor(params: QuotePollerParams, callbacks: QuotePollerCallbacks, config?: PollingConfig, fetchConfig?: FetchConfig);
|
|
497
|
+
/**
|
|
498
|
+
* Start polling for quotes
|
|
499
|
+
*/
|
|
500
|
+
start(): void;
|
|
501
|
+
/**
|
|
502
|
+
* Stop polling
|
|
503
|
+
*/
|
|
504
|
+
stop(): void;
|
|
505
|
+
/**
|
|
506
|
+
* Check if currently polling
|
|
507
|
+
*/
|
|
508
|
+
get running(): boolean;
|
|
509
|
+
/**
|
|
510
|
+
* Update polling parameters (requires restart)
|
|
511
|
+
*/
|
|
512
|
+
updateParams(params: Partial<QuotePollerParams>): void;
|
|
513
|
+
/**
|
|
514
|
+
* Fetch a quote
|
|
515
|
+
*/
|
|
516
|
+
private fetchQuote;
|
|
517
|
+
/**
|
|
518
|
+
* Stop due to consecutive errors
|
|
519
|
+
*/
|
|
520
|
+
private stopDueToErrors;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Create a quote poller instance
|
|
524
|
+
*/
|
|
525
|
+
declare function createQuotePoller(params: QuotePollerParams, callbacks: QuotePollerCallbacks, config?: PollingConfig, fetchConfig?: FetchConfig): QuotePoller;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Main Ekubo SDK client
|
|
529
|
+
*
|
|
530
|
+
* Provides a high-level interface for:
|
|
531
|
+
* - Fetching swap quotes
|
|
532
|
+
* - Generating swap calls
|
|
533
|
+
* - Token symbol resolution
|
|
534
|
+
* - Quote polling
|
|
535
|
+
* - Protocol statistics (TVL, volume, pairs)
|
|
536
|
+
* - Dynamic token list fetching
|
|
537
|
+
*/
|
|
538
|
+
declare class EkuboClient {
|
|
539
|
+
private readonly config;
|
|
540
|
+
private readonly tokenRegistry;
|
|
541
|
+
constructor(config?: EkuboClientConfig);
|
|
542
|
+
/**
|
|
543
|
+
* Resolve configuration with defaults
|
|
544
|
+
*/
|
|
545
|
+
private resolveConfig;
|
|
546
|
+
/**
|
|
547
|
+
* Get the current chain ID
|
|
548
|
+
*/
|
|
549
|
+
get chainId(): string;
|
|
550
|
+
/**
|
|
551
|
+
* Get the router contract address
|
|
552
|
+
*/
|
|
553
|
+
get routerAddress(): string;
|
|
554
|
+
/**
|
|
555
|
+
* Get the token registry
|
|
556
|
+
*/
|
|
557
|
+
get tokens(): TokenRegistry;
|
|
558
|
+
/**
|
|
559
|
+
* Resolve a token identifier (symbol or address) to an address
|
|
560
|
+
*/
|
|
561
|
+
resolveToken(tokenIdentifier: string): string;
|
|
562
|
+
/**
|
|
563
|
+
* Fetch a swap quote
|
|
564
|
+
*
|
|
565
|
+
* @param params - Quote parameters (supports symbols or addresses)
|
|
566
|
+
* @returns Swap quote
|
|
567
|
+
*/
|
|
568
|
+
getQuote(params: FetchQuoteParams): Promise<SwapQuote>;
|
|
569
|
+
/**
|
|
570
|
+
* Fetch a token price in USDC
|
|
571
|
+
*
|
|
572
|
+
* @param tokenIdentifier - Token symbol or address
|
|
573
|
+
* @param amount - Amount of token
|
|
574
|
+
* @param signal - Optional abort signal
|
|
575
|
+
* @returns Price in USDC (as bigint)
|
|
576
|
+
*/
|
|
577
|
+
getUsdcPrice(tokenIdentifier: string, amount: bigint, signal?: AbortSignal): Promise<bigint>;
|
|
578
|
+
/**
|
|
579
|
+
* Fetch price history
|
|
580
|
+
*
|
|
581
|
+
* @param token - Token symbol or address
|
|
582
|
+
* @param otherToken - Quote token symbol or address
|
|
583
|
+
* @param interval - Time interval in seconds (default: 7000)
|
|
584
|
+
* @returns Price history data
|
|
585
|
+
*/
|
|
586
|
+
getPriceHistory(token: string, otherToken: string, interval?: number): Promise<PriceHistoryResponse>;
|
|
587
|
+
/**
|
|
588
|
+
* Generate swap calls from a quote
|
|
589
|
+
*
|
|
590
|
+
* @param params - Call generation parameters (supports symbols or addresses)
|
|
591
|
+
* @returns Swap calls result
|
|
592
|
+
*/
|
|
593
|
+
generateSwapCalls(params: Omit<GenerateSwapCallsParams, "chainId" | "routerAddress">): SwapCallsResult;
|
|
594
|
+
/**
|
|
595
|
+
* Prepare swap calls with approval included
|
|
596
|
+
*
|
|
597
|
+
* @param params - Call generation parameters (supports symbols or addresses)
|
|
598
|
+
* @returns Swap calls result with approve call
|
|
599
|
+
*/
|
|
600
|
+
prepareSwapCalls(params: Omit<GenerateSwapCallsParams, "chainId" | "routerAddress">): SwapCallsResult & {
|
|
601
|
+
approveCall: SwapCall;
|
|
602
|
+
};
|
|
603
|
+
/**
|
|
604
|
+
* Create a quote poller for real-time updates
|
|
605
|
+
*
|
|
606
|
+
* @param params - Quote parameters (supports symbols or addresses)
|
|
607
|
+
* @param callbacks - Poller callbacks
|
|
608
|
+
* @param config - Optional polling configuration
|
|
609
|
+
* @returns QuotePoller instance
|
|
610
|
+
*/
|
|
611
|
+
createQuotePoller(params: Omit<FetchQuoteParams, "signal">, callbacks: QuotePollerCallbacks, config?: PollingConfig): QuotePoller;
|
|
612
|
+
/**
|
|
613
|
+
* Register a custom token in the local registry
|
|
614
|
+
*/
|
|
615
|
+
registerToken(token: TokenInfo): void;
|
|
616
|
+
/**
|
|
617
|
+
* Fetch all tokens from the Ekubo API
|
|
618
|
+
*
|
|
619
|
+
* @returns Array of token metadata from the API
|
|
620
|
+
*/
|
|
621
|
+
fetchTokens(): Promise<ApiTokenInfo[]>;
|
|
622
|
+
/**
|
|
623
|
+
* Fetch metadata for a single token from the API
|
|
624
|
+
*
|
|
625
|
+
* @param tokenAddress - Token contract address
|
|
626
|
+
* @returns Token metadata or null if not found
|
|
627
|
+
*/
|
|
628
|
+
fetchToken(tokenAddress: string): Promise<ApiTokenInfo | null>;
|
|
629
|
+
/**
|
|
630
|
+
* Fetch metadata for multiple tokens at once
|
|
631
|
+
*
|
|
632
|
+
* @param tokenAddresses - Array of token addresses
|
|
633
|
+
* @returns Array of token metadata
|
|
634
|
+
*/
|
|
635
|
+
fetchTokensBatch(tokenAddresses: string[]): Promise<ApiTokenInfo[]>;
|
|
636
|
+
/**
|
|
637
|
+
* Fetch tokens from API and register them in the local registry
|
|
638
|
+
*
|
|
639
|
+
* @returns Number of tokens registered
|
|
640
|
+
*/
|
|
641
|
+
syncTokensFromApi(): Promise<number>;
|
|
642
|
+
/**
|
|
643
|
+
* Fetch top trading pairs by volume
|
|
644
|
+
*
|
|
645
|
+
* @returns Array of pair statistics
|
|
646
|
+
*/
|
|
647
|
+
getTopPairs(): Promise<PairStats[]>;
|
|
648
|
+
/**
|
|
649
|
+
* Fetch protocol TVL overview
|
|
650
|
+
*
|
|
651
|
+
* @returns TVL statistics
|
|
652
|
+
*/
|
|
653
|
+
getTvl(): Promise<OverviewStats>;
|
|
654
|
+
/**
|
|
655
|
+
* Fetch protocol volume overview
|
|
656
|
+
*
|
|
657
|
+
* @returns Volume statistics
|
|
658
|
+
*/
|
|
659
|
+
getVolume(): Promise<OverviewStats>;
|
|
660
|
+
/**
|
|
661
|
+
* Fetch TVL history for a trading pair
|
|
662
|
+
*
|
|
663
|
+
* @param tokenA - First token (symbol or address)
|
|
664
|
+
* @param tokenB - Second token (symbol or address)
|
|
665
|
+
* @returns TVL data points
|
|
666
|
+
*/
|
|
667
|
+
getPairTvl(tokenA: string, tokenB: string): Promise<TvlDataPoint[]>;
|
|
668
|
+
/**
|
|
669
|
+
* Fetch volume history for a trading pair
|
|
670
|
+
*
|
|
671
|
+
* @param tokenA - First token (symbol or address)
|
|
672
|
+
* @param tokenB - Second token (symbol or address)
|
|
673
|
+
* @returns Volume data points
|
|
674
|
+
*/
|
|
675
|
+
getPairVolume(tokenA: string, tokenB: string): Promise<VolumeDataPoint[]>;
|
|
676
|
+
/**
|
|
677
|
+
* Fetch pools for a trading pair
|
|
678
|
+
*
|
|
679
|
+
* @param tokenA - First token (symbol or address)
|
|
680
|
+
* @param tokenB - Second token (symbol or address)
|
|
681
|
+
* @returns Pool information
|
|
682
|
+
*/
|
|
683
|
+
getPairPools(tokenA: string, tokenB: string): Promise<PoolInfo[]>;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* Create an EkuboClient instance
|
|
687
|
+
*/
|
|
688
|
+
declare function createEkuboClient(config?: EkuboClientConfig): EkuboClient;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Parameters for fetchSwapQuote
|
|
692
|
+
*/
|
|
693
|
+
interface FetchSwapQuoteParams {
|
|
694
|
+
/** Amount to receive (will be negated internally) */
|
|
695
|
+
amount: bigint;
|
|
696
|
+
/** Token to sell (address) */
|
|
697
|
+
tokenFrom: string;
|
|
698
|
+
/** Token to buy (address) */
|
|
699
|
+
tokenTo: string;
|
|
700
|
+
/** Chain ID (Ekubo format) */
|
|
701
|
+
chainId?: string;
|
|
702
|
+
/** Abort signal for cancellation */
|
|
703
|
+
signal?: AbortSignal;
|
|
704
|
+
/** Fetch configuration */
|
|
705
|
+
fetchConfig?: FetchConfig;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Fetch a swap quote from Ekubo API with retry logic
|
|
709
|
+
*/
|
|
710
|
+
declare function fetchSwapQuote(params: FetchSwapQuoteParams): Promise<SwapQuote>;
|
|
711
|
+
/**
|
|
712
|
+
* Fetch token price in USDC
|
|
713
|
+
*/
|
|
714
|
+
declare function fetchSwapQuoteInUsdc(params: Omit<FetchSwapQuoteParams, "tokenTo">): Promise<bigint>;
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
|
+
* Result of encoding a route
|
|
718
|
+
*/
|
|
719
|
+
interface EncodedRoute {
|
|
720
|
+
token: string;
|
|
721
|
+
encoded: string[];
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Encode a single route node into calldata format
|
|
725
|
+
*/
|
|
726
|
+
declare function encodeRouteNode(routeNode: RouteNode, currentToken: string): {
|
|
727
|
+
nextToken: string;
|
|
728
|
+
calldata: string[];
|
|
729
|
+
};
|
|
730
|
+
/**
|
|
731
|
+
* Encode a full route (array of route nodes) into calldata format
|
|
732
|
+
*/
|
|
733
|
+
declare function encodeRoute(route: RouteNode[], targetToken: string): EncodedRoute;
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Ekubo chain IDs (decimal string format used by API)
|
|
737
|
+
*/
|
|
738
|
+
declare const CHAIN_IDS: {
|
|
739
|
+
readonly MAINNET: "23448594291968334";
|
|
740
|
+
readonly SEPOLIA: "393402133025997798000961";
|
|
741
|
+
};
|
|
742
|
+
/**
|
|
743
|
+
* Starknet.js chain ID constants (hex format)
|
|
744
|
+
*/
|
|
745
|
+
declare const STARKNET_CHAIN_IDS: {
|
|
746
|
+
readonly SN_MAIN: "0x534e5f4d41494e";
|
|
747
|
+
readonly SN_SEPOLIA: "0x534e5f5345504f4c4941";
|
|
748
|
+
};
|
|
749
|
+
/**
|
|
750
|
+
* Ekubo Router contract addresses by chain
|
|
751
|
+
*/
|
|
752
|
+
declare const ROUTER_ADDRESSES: {
|
|
753
|
+
readonly "23448594291968334": "0x0199741822c2dc722f6f605204f35e56dbc23bceed54818168c4c49e4fb8737e";
|
|
754
|
+
readonly "393402133025997798000961": "0x0045f933adf0607292468ad1c1dedaa74d5ad166392590e72676a34d01d7b763";
|
|
755
|
+
};
|
|
756
|
+
/**
|
|
757
|
+
* USDC contract addresses by chain (for price quotes)
|
|
758
|
+
*/
|
|
759
|
+
declare const USDC_ADDRESSES: {
|
|
760
|
+
readonly "23448594291968334": "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb";
|
|
761
|
+
readonly "393402133025997798000961": "0x053b40a647cedfca6ca84f542a0fe36736031905a9639a7f19a3c1e66bfd5080";
|
|
762
|
+
};
|
|
763
|
+
/**
|
|
764
|
+
* API base URLs
|
|
765
|
+
*/
|
|
766
|
+
declare const API_URLS: {
|
|
767
|
+
/** Quoter API for swap quotes */
|
|
768
|
+
readonly QUOTER: "https://prod-api-quoter.ekubo.org";
|
|
769
|
+
/** Main API for tokens, prices, stats, etc. */
|
|
770
|
+
readonly API: "https://prod-api.ekubo.org";
|
|
771
|
+
};
|
|
772
|
+
/**
|
|
773
|
+
* Chain configuration preset
|
|
774
|
+
*/
|
|
775
|
+
interface ChainConfig {
|
|
776
|
+
chainId: string;
|
|
777
|
+
quoterApiUrl: string;
|
|
778
|
+
apiUrl: string;
|
|
779
|
+
routerAddress: string;
|
|
780
|
+
usdcAddress: string;
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Pre-configured chain configurations
|
|
784
|
+
*/
|
|
785
|
+
declare const CHAIN_CONFIGS: Record<"mainnet" | "sepolia", ChainConfig>;
|
|
786
|
+
/**
|
|
787
|
+
* Map starknet.js chain IDs to Ekubo chain IDs
|
|
788
|
+
*/
|
|
789
|
+
declare const STARKNET_TO_EKUBO_CHAIN: Record<string, string>;
|
|
790
|
+
/**
|
|
791
|
+
* Get Ekubo chain ID from starknet.js chain ID
|
|
792
|
+
*/
|
|
793
|
+
declare function getEkuboChainId(starknetChainId: string): string | undefined;
|
|
794
|
+
/**
|
|
795
|
+
* Get chain config by chain name or ID
|
|
796
|
+
*/
|
|
797
|
+
declare function getChainConfig(chainOrId: "mainnet" | "sepolia" | string): ChainConfig | undefined;
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Calculate exponential backoff delay with jitter
|
|
801
|
+
*/
|
|
802
|
+
declare function calculateBackoff(attempt: number, baseBackoff: number, maxBackoff: number, retryAfter?: string | null): number;
|
|
803
|
+
/**
|
|
804
|
+
* Sleep for a specified duration
|
|
805
|
+
*/
|
|
806
|
+
declare function sleep(ms: number): Promise<void>;
|
|
807
|
+
/**
|
|
808
|
+
* Options for withRetry function
|
|
809
|
+
*/
|
|
810
|
+
interface RetryOptions {
|
|
811
|
+
maxRetries: number;
|
|
812
|
+
baseBackoff: number;
|
|
813
|
+
maxBackoff: number;
|
|
814
|
+
signal?: AbortSignal;
|
|
815
|
+
onRetry?: (attempt: number, error: Error, delay: number) => void;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Execute a function with retry logic
|
|
819
|
+
*/
|
|
820
|
+
declare function withRetry<T>(fn: () => Promise<T>, options: RetryOptions): Promise<T>;
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Parse total_calculated from API response (handles string or number)
|
|
824
|
+
* Returns absolute value since negative is just API convention for swap direction
|
|
825
|
+
*/
|
|
826
|
+
declare function parseTotalCalculated(totalCalculated: string | number): bigint;
|
|
827
|
+
/**
|
|
828
|
+
* Return absolute value of a bigint
|
|
829
|
+
*/
|
|
830
|
+
declare function abs(value: bigint): bigint;
|
|
831
|
+
/**
|
|
832
|
+
* Apply slippage to an amount
|
|
833
|
+
* @param amount - Base amount
|
|
834
|
+
* @param slippagePercent - Slippage as percentage (e.g., 5n = 5%)
|
|
835
|
+
* @returns Amount with slippage buffer added
|
|
836
|
+
*/
|
|
837
|
+
declare function addSlippage(amount: bigint, slippagePercent: bigint): bigint;
|
|
838
|
+
/**
|
|
839
|
+
* Calculate minimum received after slippage
|
|
840
|
+
* @param amount - Expected amount
|
|
841
|
+
* @param slippagePercent - Slippage as percentage (e.g., 5n = 5%)
|
|
842
|
+
* @returns Minimum acceptable amount
|
|
843
|
+
*/
|
|
844
|
+
declare function subtractSlippage(amount: bigint, slippagePercent: bigint): bigint;
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* Convert a value to hex string (without leading zeros normalization)
|
|
848
|
+
*/
|
|
849
|
+
declare function toHex(value: bigint | number | string): string;
|
|
850
|
+
/**
|
|
851
|
+
* Normalize an address to lowercase hex format
|
|
852
|
+
*/
|
|
853
|
+
declare function normalizeAddress(address: string): string;
|
|
854
|
+
/**
|
|
855
|
+
* Check if a string looks like an address (hex format)
|
|
856
|
+
*/
|
|
857
|
+
declare function isAddress(value: string): boolean;
|
|
858
|
+
/**
|
|
859
|
+
* Split a u256 value into low and high parts for calldata
|
|
860
|
+
*/
|
|
861
|
+
declare function splitU256(value: bigint): {
|
|
862
|
+
low: string;
|
|
863
|
+
high: string;
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Base error class for all Ekubo SDK errors
|
|
868
|
+
*/
|
|
869
|
+
declare class EkuboError extends Error {
|
|
870
|
+
readonly code: string;
|
|
871
|
+
readonly cause?: unknown | undefined;
|
|
872
|
+
constructor(message: string, code: string, cause?: unknown | undefined);
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Error thrown when there is insufficient liquidity for a swap
|
|
876
|
+
* This error should NOT be retried
|
|
877
|
+
*/
|
|
878
|
+
declare class InsufficientLiquidityError extends EkuboError {
|
|
879
|
+
constructor(message?: string);
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Error thrown when an API request fails after all retries
|
|
883
|
+
*/
|
|
884
|
+
declare class ApiError extends EkuboError {
|
|
885
|
+
readonly statusCode?: number | undefined;
|
|
886
|
+
constructor(message: string, statusCode?: number | undefined, cause?: unknown);
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Error thrown when rate limited by the API
|
|
890
|
+
*/
|
|
891
|
+
declare class RateLimitError extends EkuboError {
|
|
892
|
+
readonly retryAfter?: number | undefined;
|
|
893
|
+
constructor(message?: string, retryAfter?: number | undefined);
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Error thrown when a request times out
|
|
897
|
+
*/
|
|
898
|
+
declare class TimeoutError extends EkuboError {
|
|
899
|
+
readonly timeout: number;
|
|
900
|
+
constructor(message: string | undefined, timeout: number);
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Error thrown when a request is aborted
|
|
904
|
+
*/
|
|
905
|
+
declare class AbortError extends EkuboError {
|
|
906
|
+
constructor(message?: string);
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Error thrown when token resolution fails
|
|
910
|
+
*/
|
|
911
|
+
declare class TokenNotFoundError extends EkuboError {
|
|
912
|
+
readonly tokenIdentifier: string;
|
|
913
|
+
constructor(tokenIdentifier: string, message?: string);
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Error thrown when chain configuration is invalid or missing
|
|
917
|
+
*/
|
|
918
|
+
declare class InvalidChainError extends EkuboError {
|
|
919
|
+
readonly chainId: string;
|
|
920
|
+
constructor(chainId: string, message?: string);
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Check if an error should not be retried
|
|
924
|
+
*/
|
|
925
|
+
declare function isNonRetryableError(error: unknown): boolean;
|
|
926
|
+
|
|
927
|
+
export { API_URLS, AbortError, ApiError, type ApiTokenInfo, CHAIN_CONFIGS, CHAIN_IDS, type ChainConfig, DEFAULT_POLLING_CONFIG, EkuboClient, type EkuboClientConfig, EkuboError, type EncodedRoute, type FetchConfig, type FetchQuoteParams, type FetchSwapQuoteParams, type FetchTokenParams, type FetchTokensBatchParams, type FetchTokensParams, type GenerateSwapCallsParams, type GetPriceHistoryParams, InsufficientLiquidityError, InvalidChainError, MAINNET_TOKENS, type OverviewStats, type PairStats, type PairStatsParams, type PollingConfig, type PoolInfo, type PoolKey, type PriceDataPoint, type PriceHistoryResponse, QuotePoller, type QuotePollerCallbacks, type QuotePollerParams, ROUTER_ADDRESSES, RateLimitError, type ResolvedConfig, type RetryOptions, type RouteNode, STARKNET_CHAIN_IDS, STARKNET_TO_EKUBO_CHAIN, type StatsBaseParams, type SwapCall, type SwapCallsResult, type SwapQuote, type SwapQuoteApiResponse, type SwapQuoteErrorResponse, type SwapSplit, TimeoutError, type TokenInfo, TokenNotFoundError, TokenRegistry, type TvlDataPoint, USDC_ADDRESSES, type VolumeDataPoint, abs, addSlippage, calculateBackoff, canResolveToken, createEkuboClient, createQuotePoller, createTokenRegistry, encodeRoute, encodeRouteNode, fetchPairPools, fetchPairTvl, fetchPairVolume, fetchSwapQuote, fetchSwapQuoteInUsdc, fetchToken, fetchTokens, fetchTokensBatch, fetchTopPairs, fetchTvl, fetchVolume, generateSwapCalls, getChainConfig, getDefaultRegistry, getEkuboChainId, getMainnetTokensMap, getPriceHistory, isAddress, isNonRetryableError, normalizeAddress, parseTotalCalculated, prepareSwapCalls, resolveToken, resolveTokenInfo, sleep, splitU256, subtractSlippage, toHex, withRetry };
|