@sky-mavis/ronin-dex 0.0.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.
@@ -0,0 +1,2091 @@
1
+ import { z } from 'zod';
2
+ import * as _uniswap_sdk_core from '@uniswap/sdk-core';
3
+ import { Percent, CurrencyAmount, Token, NativeCurrency as NativeCurrency$1, Currency, TradeType, Price } from '@uniswap/sdk-core';
4
+ import BigNumber$1 from 'bignumber.js';
5
+ import { BigNumber as BigNumber$2 } from '@ethersproject/bignumber';
6
+ import * as ethers from 'ethers';
7
+ import { ActionRejectedError, BadDataError, BufferOverrunError, CallExceptionError, CancelledError, InsufficientFundsError, InvalidArgumentError, MissingArgumentError, NetworkError, NonceExpiredError, NotImplementedError, NumericFaultError, OffchainFaultError, ReplacementUnderpricedError, ServerError, TimeoutError, TransactionReplacedError, UnconfiguredNameError, UnexpectedArgumentError, UnsupportedOperationError, TransactionRequest, AbstractSigner, Provider, JsonRpcProvider, TransactionResponse, TransactionReceipt, ContractTransactionResponse, TransactionLike } from 'ethers';
8
+ import { Connection, Transaction, VersionedTransaction } from '@solana/web3.js';
9
+ import { PermitSignature, KatanaTrade } from '@sky-mavis/katana-swap';
10
+ import { Trade } from '@uniswap/router-sdk';
11
+
12
+ declare enum Blockchain {
13
+ EVM = "evm",
14
+ SOLANA = "solana"
15
+ }
16
+ declare enum EVMChainId {
17
+ ETHEREUM = 1,
18
+ BSC = 56,
19
+ POLYGON = 137,
20
+ RONIN = 2020,
21
+ ARBITRUM = 42161,
22
+ BASE = 8453,
23
+ GOERLI = 5,
24
+ SEPOLIA = 11155111,
25
+ SAIGON = 2021,
26
+ MUMBAI = 80001,
27
+ BSC_TESTNET = 97,
28
+ BASE_SEPOLIA = 84532
29
+ }
30
+ type ChainId = number;
31
+ declare const NATIVE_ADDRESS = "0x0000000000000000000000000000000000000000";
32
+ declare enum WalletType {
33
+ SEED_PHRASE = "SEED_PHRASE",
34
+ PRIVATE_KEY = "PRIVATE_KEY",
35
+ TREZOR = "TREZOR",
36
+ LEDGER = "LEDGER",
37
+ MPC = "MPC",
38
+ ADDRESS = "ADDRESS",
39
+ OTHER = "OTHER"
40
+ }
41
+ type Account = {
42
+ index: number;
43
+ address: string;
44
+ type: WalletType;
45
+ privateKey?: string;
46
+ walletId: string;
47
+ hdPath?: string;
48
+ blockchain?: Blockchain;
49
+ };
50
+ type ChainConfig = {
51
+ displayName: string;
52
+ chainId: ChainId;
53
+ chainName: string;
54
+ isMainnet?: boolean;
55
+ logoUrl?: string;
56
+ rpcUrl: string;
57
+ freeGasRpcUrl?: string;
58
+ explorerUrl?: string;
59
+ nativeToken: {
60
+ name: string;
61
+ symbol: string;
62
+ decimals?: number;
63
+ logoUrl?: string;
64
+ };
65
+ isCustom?: boolean;
66
+ priority?: number;
67
+ defaultEnabled?: boolean;
68
+ blockchain?: Blockchain;
69
+ nativeTokenAddress?: string;
70
+ simulation?: {
71
+ enabled: boolean;
72
+ methods?: Array<string>;
73
+ };
74
+ };
75
+
76
+ type Listener = (...args: any[]) => Promise<any> | void;
77
+ type DefaultEventMap = {
78
+ [event in string | symbol]: Listener;
79
+ };
80
+ interface IEventEmitter<EventMap extends DefaultEventMap = DefaultEventMap> {
81
+ emit<EventKey extends keyof EventMap>(event: EventKey, ...args: Parameters<EventMap[EventKey]>): boolean;
82
+ on<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
83
+ once<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
84
+ addListener<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
85
+ removeListener<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
86
+ prependListener<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
87
+ prependOnceListener<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
88
+ off<EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]): this;
89
+ removeAllListeners<EventKey extends keyof EventMap = string>(event?: EventKey): this;
90
+ setMaxListeners(n: number): this;
91
+ getMaxListeners(): number;
92
+ listeners<EventKey extends keyof EventMap = string>(event: EventKey): EventMap[EventKey][];
93
+ rawListeners<EventKey extends keyof EventMap = string>(event: EventKey): EventMap[EventKey][];
94
+ eventNames(): Array<string | symbol>;
95
+ listenerCount<EventKey extends keyof EventMap = string>(type: EventKey): number;
96
+ }
97
+
98
+ declare class TypedEventEmitter<EventMap extends DefaultEventMap = DefaultEventMap> implements IEventEmitter<EventMap> {
99
+ events?: {
100
+ [eventName in keyof EventMap]: Function[];
101
+ };
102
+ maxListeners: number;
103
+ emit: <EventKey extends keyof EventMap>(event: EventKey, ...args: Parameters<EventMap[EventKey]>) => boolean;
104
+ on: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
105
+ once: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
106
+ addListener: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
107
+ removeListener: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
108
+ hasListeners: <EventKey extends keyof EventMap = string>(event: EventKey) => boolean;
109
+ prependListener: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
110
+ prependOnceListener: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
111
+ off: <EventKey extends keyof EventMap = string>(event: EventKey, listener: EventMap[EventKey]) => this;
112
+ removeAllListeners: <EventKey extends keyof EventMap = string>(event?: EventKey) => this;
113
+ setMaxListeners: (n: number) => this;
114
+ getMaxListeners: () => number;
115
+ listeners: <EventKey extends keyof EventMap = string>(event: EventKey) => EventMap[EventKey][];
116
+ rawListeners: <EventKey extends keyof EventMap = string>(event: EventKey) => EventMap[EventKey][];
117
+ eventNames: () => Array<string | symbol>;
118
+ listenerCount: <EventKey extends keyof EventMap = string>(type: EventKey) => number;
119
+ }
120
+
121
+ declare const $findRoutesPayload: z.ZodObject<{
122
+ amount: z.ZodString;
123
+ account: z.ZodString;
124
+ currencyIn: z.ZodUnion<[z.ZodType<DexToken, z.ZodTypeDef, DexToken>, z.ZodType<NativeCurrency, z.ZodTypeDef, NativeCurrency>]>;
125
+ currencyOut: z.ZodUnion<[z.ZodType<DexToken, z.ZodTypeDef, DexToken>, z.ZodType<NativeCurrency, z.ZodTypeDef, NativeCurrency>]>;
126
+ direction: z.ZodEnum<["exactIn", "exactOut"]>;
127
+ slippageToleranceBps: z.ZodType<Percent, z.ZodTypeDef, Percent>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ amount?: string;
130
+ account?: string;
131
+ currencyIn?: DexToken | NativeCurrency;
132
+ currencyOut?: DexToken | NativeCurrency;
133
+ direction?: "exactIn" | "exactOut";
134
+ slippageToleranceBps?: Percent;
135
+ }, {
136
+ amount?: string;
137
+ account?: string;
138
+ currencyIn?: DexToken | NativeCurrency;
139
+ currencyOut?: DexToken | NativeCurrency;
140
+ direction?: "exactIn" | "exactOut";
141
+ slippageToleranceBps?: Percent;
142
+ }>;
143
+ declare const $baseQuote: z.ZodObject<{
144
+ provider: z.ZodString;
145
+ address_in: z.ZodString;
146
+ address_out: z.ZodString;
147
+ chain_id: z.ZodNumber;
148
+ chain_id_out: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
149
+ amount_in: z.ZodString;
150
+ amount_out: z.ZodString;
151
+ routes: z.ZodArray<z.ZodUnknown, "many">;
152
+ token_in: z.ZodObject<{
153
+ chain_id: z.ZodEffects<z.ZodNumber, number, number>;
154
+ address: z.ZodString;
155
+ decimal: z.ZodNumber;
156
+ token_standard: z.ZodEnum<["native", "erc20"]>;
157
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
158
+ symbol: z.ZodOptional<z.ZodNullable<z.ZodString>>;
159
+ logo_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
160
+ tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
161
+ }, "strip", z.ZodTypeAny, {
162
+ symbol?: string;
163
+ address?: string;
164
+ name?: string;
165
+ tags?: string[];
166
+ chain_id?: number;
167
+ decimal?: number;
168
+ token_standard?: "erc20" | "native";
169
+ logo_uri?: string;
170
+ }, {
171
+ symbol?: string;
172
+ address?: string;
173
+ name?: string;
174
+ tags?: string[];
175
+ chain_id?: number;
176
+ decimal?: number;
177
+ token_standard?: "erc20" | "native";
178
+ logo_uri?: string;
179
+ }>;
180
+ token_out: z.ZodObject<{
181
+ chain_id: z.ZodEffects<z.ZodNumber, number, number>;
182
+ address: z.ZodString;
183
+ decimal: z.ZodNumber;
184
+ token_standard: z.ZodEnum<["native", "erc20"]>;
185
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
186
+ symbol: z.ZodOptional<z.ZodNullable<z.ZodString>>;
187
+ logo_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
188
+ tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
189
+ }, "strip", z.ZodTypeAny, {
190
+ symbol?: string;
191
+ address?: string;
192
+ name?: string;
193
+ tags?: string[];
194
+ chain_id?: number;
195
+ decimal?: number;
196
+ token_standard?: "erc20" | "native";
197
+ logo_uri?: string;
198
+ }, {
199
+ symbol?: string;
200
+ address?: string;
201
+ name?: string;
202
+ tags?: string[];
203
+ chain_id?: number;
204
+ decimal?: number;
205
+ token_standard?: "erc20" | "native";
206
+ logo_uri?: string;
207
+ }>;
208
+ calldata_builder: z.ZodObject<{
209
+ strategy: z.ZodString;
210
+ request_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
211
+ data: z.ZodString;
212
+ }, "strip", z.ZodTypeAny, {
213
+ data?: string;
214
+ strategy?: string;
215
+ request_id?: string;
216
+ }, {
217
+ data?: string;
218
+ strategy?: string;
219
+ request_id?: string;
220
+ }>;
221
+ gas: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodObject<{
222
+ gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
223
+ gas_price: z.ZodOptional<z.ZodNullable<z.ZodString>>;
224
+ gas_usd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
225
+ }, "strip", z.ZodTypeAny, {
226
+ gas?: string;
227
+ gas_price?: string;
228
+ gas_usd?: string;
229
+ }, {
230
+ gas?: string;
231
+ gas_price?: string;
232
+ gas_usd?: string;
233
+ }>, {
234
+ gasLimit: string;
235
+ gasPrice: string;
236
+ gasUsd: string;
237
+ }, {
238
+ gas?: string;
239
+ gas_price?: string;
240
+ gas_usd?: string;
241
+ }>>>;
242
+ extra_fee: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodObject<{
243
+ token: z.ZodObject<{
244
+ chain_id: z.ZodEffects<z.ZodNumber, number, number>;
245
+ address: z.ZodString;
246
+ decimal: z.ZodNumber;
247
+ token_standard: z.ZodEnum<["native", "erc20"]>;
248
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
249
+ symbol: z.ZodOptional<z.ZodNullable<z.ZodString>>;
250
+ logo_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
251
+ tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
252
+ }, "strip", z.ZodTypeAny, {
253
+ symbol?: string;
254
+ address?: string;
255
+ name?: string;
256
+ tags?: string[];
257
+ chain_id?: number;
258
+ decimal?: number;
259
+ token_standard?: "erc20" | "native";
260
+ logo_uri?: string;
261
+ }, {
262
+ symbol?: string;
263
+ address?: string;
264
+ name?: string;
265
+ tags?: string[];
266
+ chain_id?: number;
267
+ decimal?: number;
268
+ token_standard?: "erc20" | "native";
269
+ logo_uri?: string;
270
+ }>;
271
+ recipient: z.ZodOptional<z.ZodNullable<z.ZodString>>;
272
+ amount: z.ZodOptional<z.ZodNullable<z.ZodString>>;
273
+ amount_usd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
274
+ percentage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
275
+ }, "strip", z.ZodTypeAny, {
276
+ token?: {
277
+ symbol?: string;
278
+ address?: string;
279
+ name?: string;
280
+ tags?: string[];
281
+ chain_id?: number;
282
+ decimal?: number;
283
+ token_standard?: "erc20" | "native";
284
+ logo_uri?: string;
285
+ };
286
+ recipient?: string;
287
+ amount?: string;
288
+ amount_usd?: string;
289
+ percentage?: string;
290
+ }, {
291
+ token?: {
292
+ symbol?: string;
293
+ address?: string;
294
+ name?: string;
295
+ tags?: string[];
296
+ chain_id?: number;
297
+ decimal?: number;
298
+ token_standard?: "erc20" | "native";
299
+ logo_uri?: string;
300
+ };
301
+ recipient?: string;
302
+ amount?: string;
303
+ amount_usd?: string;
304
+ percentage?: string;
305
+ }>, {
306
+ token: {
307
+ symbol?: string;
308
+ address?: string;
309
+ name?: string;
310
+ tags?: string[];
311
+ chain_id?: number;
312
+ decimal?: number;
313
+ token_standard?: "erc20" | "native";
314
+ logo_uri?: string;
315
+ };
316
+ recipient: string;
317
+ amount: string;
318
+ amountUsd: string;
319
+ percentage: Percent;
320
+ }, {
321
+ token?: {
322
+ symbol?: string;
323
+ address?: string;
324
+ name?: string;
325
+ tags?: string[];
326
+ chain_id?: number;
327
+ decimal?: number;
328
+ token_standard?: "erc20" | "native";
329
+ logo_uri?: string;
330
+ };
331
+ recipient?: string;
332
+ amount?: string;
333
+ amount_usd?: string;
334
+ percentage?: string;
335
+ }>>>;
336
+ amount_in_usd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
337
+ amount_out_usd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
338
+ price_impact: z.ZodOptional<z.ZodNullable<z.ZodString>>;
339
+ permit2_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
340
+ universal_router_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
341
+ provider_route_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
342
+ __origin: z.ZodObject<{
343
+ payload: z.ZodObject<{
344
+ amount: z.ZodString;
345
+ account: z.ZodString;
346
+ currencyIn: z.ZodUnion<[z.ZodType<DexToken, z.ZodTypeDef, DexToken>, z.ZodType<NativeCurrency, z.ZodTypeDef, NativeCurrency>]>;
347
+ currencyOut: z.ZodUnion<[z.ZodType<DexToken, z.ZodTypeDef, DexToken>, z.ZodType<NativeCurrency, z.ZodTypeDef, NativeCurrency>]>;
348
+ direction: z.ZodEnum<["exactIn", "exactOut"]>;
349
+ slippageToleranceBps: z.ZodType<Percent, z.ZodTypeDef, Percent>;
350
+ }, "strip", z.ZodTypeAny, {
351
+ amount?: string;
352
+ account?: string;
353
+ currencyIn?: DexToken | NativeCurrency;
354
+ currencyOut?: DexToken | NativeCurrency;
355
+ direction?: "exactIn" | "exactOut";
356
+ slippageToleranceBps?: Percent;
357
+ }, {
358
+ amount?: string;
359
+ account?: string;
360
+ currencyIn?: DexToken | NativeCurrency;
361
+ currencyOut?: DexToken | NativeCurrency;
362
+ direction?: "exactIn" | "exactOut";
363
+ slippageToleranceBps?: Percent;
364
+ }>;
365
+ }, "strip", z.ZodTypeAny, {
366
+ payload?: {
367
+ amount?: string;
368
+ account?: string;
369
+ currencyIn?: DexToken | NativeCurrency;
370
+ currencyOut?: DexToken | NativeCurrency;
371
+ direction?: "exactIn" | "exactOut";
372
+ slippageToleranceBps?: Percent;
373
+ };
374
+ }, {
375
+ payload?: {
376
+ amount?: string;
377
+ account?: string;
378
+ currencyIn?: DexToken | NativeCurrency;
379
+ currencyOut?: DexToken | NativeCurrency;
380
+ direction?: "exactIn" | "exactOut";
381
+ slippageToleranceBps?: Percent;
382
+ };
383
+ }>;
384
+ create_dex_currency: z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodUnion<[z.ZodType<DexToken, z.ZodTypeDef, DexToken>, z.ZodType<NativeCurrency, z.ZodTypeDef, NativeCurrency>]>>;
385
+ }, "strip", z.ZodTypeAny, {
386
+ chain_id?: number;
387
+ provider?: string;
388
+ address_in?: string;
389
+ address_out?: string;
390
+ chain_id_out?: number;
391
+ amount_in?: string;
392
+ amount_out?: string;
393
+ routes?: unknown[];
394
+ token_in?: {
395
+ symbol?: string;
396
+ address?: string;
397
+ name?: string;
398
+ tags?: string[];
399
+ chain_id?: number;
400
+ decimal?: number;
401
+ token_standard?: "erc20" | "native";
402
+ logo_uri?: string;
403
+ };
404
+ token_out?: {
405
+ symbol?: string;
406
+ address?: string;
407
+ name?: string;
408
+ tags?: string[];
409
+ chain_id?: number;
410
+ decimal?: number;
411
+ token_standard?: "erc20" | "native";
412
+ logo_uri?: string;
413
+ };
414
+ calldata_builder?: {
415
+ data?: string;
416
+ strategy?: string;
417
+ request_id?: string;
418
+ };
419
+ gas?: {
420
+ gasLimit: string;
421
+ gasPrice: string;
422
+ gasUsd: string;
423
+ };
424
+ extra_fee?: {
425
+ token: {
426
+ symbol?: string;
427
+ address?: string;
428
+ name?: string;
429
+ tags?: string[];
430
+ chain_id?: number;
431
+ decimal?: number;
432
+ token_standard?: "erc20" | "native";
433
+ logo_uri?: string;
434
+ };
435
+ recipient: string;
436
+ amount: string;
437
+ amountUsd: string;
438
+ percentage: Percent;
439
+ };
440
+ amount_in_usd?: string;
441
+ amount_out_usd?: string;
442
+ price_impact?: string;
443
+ permit2_address?: string;
444
+ universal_router_address?: string;
445
+ provider_route_id?: string;
446
+ __origin?: {
447
+ payload?: {
448
+ amount?: string;
449
+ account?: string;
450
+ currencyIn?: DexToken | NativeCurrency;
451
+ currencyOut?: DexToken | NativeCurrency;
452
+ direction?: "exactIn" | "exactOut";
453
+ slippageToleranceBps?: Percent;
454
+ };
455
+ };
456
+ create_dex_currency?: (args_0: any, ...args: unknown[]) => DexToken | NativeCurrency;
457
+ }, {
458
+ chain_id?: number;
459
+ provider?: string;
460
+ address_in?: string;
461
+ address_out?: string;
462
+ chain_id_out?: number;
463
+ amount_in?: string;
464
+ amount_out?: string;
465
+ routes?: unknown[];
466
+ token_in?: {
467
+ symbol?: string;
468
+ address?: string;
469
+ name?: string;
470
+ tags?: string[];
471
+ chain_id?: number;
472
+ decimal?: number;
473
+ token_standard?: "erc20" | "native";
474
+ logo_uri?: string;
475
+ };
476
+ token_out?: {
477
+ symbol?: string;
478
+ address?: string;
479
+ name?: string;
480
+ tags?: string[];
481
+ chain_id?: number;
482
+ decimal?: number;
483
+ token_standard?: "erc20" | "native";
484
+ logo_uri?: string;
485
+ };
486
+ calldata_builder?: {
487
+ data?: string;
488
+ strategy?: string;
489
+ request_id?: string;
490
+ };
491
+ gas?: {
492
+ gas?: string;
493
+ gas_price?: string;
494
+ gas_usd?: string;
495
+ };
496
+ extra_fee?: {
497
+ token?: {
498
+ symbol?: string;
499
+ address?: string;
500
+ name?: string;
501
+ tags?: string[];
502
+ chain_id?: number;
503
+ decimal?: number;
504
+ token_standard?: "erc20" | "native";
505
+ logo_uri?: string;
506
+ };
507
+ recipient?: string;
508
+ amount?: string;
509
+ amount_usd?: string;
510
+ percentage?: string;
511
+ };
512
+ amount_in_usd?: string;
513
+ amount_out_usd?: string;
514
+ price_impact?: string;
515
+ permit2_address?: string;
516
+ universal_router_address?: string;
517
+ provider_route_id?: string;
518
+ __origin?: {
519
+ payload?: {
520
+ amount?: string;
521
+ account?: string;
522
+ currencyIn?: DexToken | NativeCurrency;
523
+ currencyOut?: DexToken | NativeCurrency;
524
+ direction?: "exactIn" | "exactOut";
525
+ slippageToleranceBps?: Percent;
526
+ };
527
+ };
528
+ create_dex_currency?: (args_0: any, ...args: unknown[]) => DexToken | NativeCurrency;
529
+ }>;
530
+ declare const $quote: z.ZodEffects<z.ZodObject<{
531
+ provider: z.ZodString;
532
+ address_in: z.ZodString;
533
+ address_out: z.ZodString;
534
+ chain_id: z.ZodNumber;
535
+ chain_id_out: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
536
+ amount_in: z.ZodString;
537
+ amount_out: z.ZodString;
538
+ routes: z.ZodArray<z.ZodUnknown, "many">;
539
+ token_in: z.ZodObject<{
540
+ chain_id: z.ZodEffects<z.ZodNumber, number, number>;
541
+ address: z.ZodString;
542
+ decimal: z.ZodNumber;
543
+ token_standard: z.ZodEnum<["native", "erc20"]>;
544
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
545
+ symbol: z.ZodOptional<z.ZodNullable<z.ZodString>>;
546
+ logo_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
547
+ tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
548
+ }, "strip", z.ZodTypeAny, {
549
+ symbol?: string;
550
+ address?: string;
551
+ name?: string;
552
+ tags?: string[];
553
+ chain_id?: number;
554
+ decimal?: number;
555
+ token_standard?: "erc20" | "native";
556
+ logo_uri?: string;
557
+ }, {
558
+ symbol?: string;
559
+ address?: string;
560
+ name?: string;
561
+ tags?: string[];
562
+ chain_id?: number;
563
+ decimal?: number;
564
+ token_standard?: "erc20" | "native";
565
+ logo_uri?: string;
566
+ }>;
567
+ token_out: z.ZodObject<{
568
+ chain_id: z.ZodEffects<z.ZodNumber, number, number>;
569
+ address: z.ZodString;
570
+ decimal: z.ZodNumber;
571
+ token_standard: z.ZodEnum<["native", "erc20"]>;
572
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
573
+ symbol: z.ZodOptional<z.ZodNullable<z.ZodString>>;
574
+ logo_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
575
+ tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
576
+ }, "strip", z.ZodTypeAny, {
577
+ symbol?: string;
578
+ address?: string;
579
+ name?: string;
580
+ tags?: string[];
581
+ chain_id?: number;
582
+ decimal?: number;
583
+ token_standard?: "erc20" | "native";
584
+ logo_uri?: string;
585
+ }, {
586
+ symbol?: string;
587
+ address?: string;
588
+ name?: string;
589
+ tags?: string[];
590
+ chain_id?: number;
591
+ decimal?: number;
592
+ token_standard?: "erc20" | "native";
593
+ logo_uri?: string;
594
+ }>;
595
+ calldata_builder: z.ZodObject<{
596
+ strategy: z.ZodString;
597
+ request_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
598
+ data: z.ZodString;
599
+ }, "strip", z.ZodTypeAny, {
600
+ data?: string;
601
+ strategy?: string;
602
+ request_id?: string;
603
+ }, {
604
+ data?: string;
605
+ strategy?: string;
606
+ request_id?: string;
607
+ }>;
608
+ gas: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodObject<{
609
+ gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
610
+ gas_price: z.ZodOptional<z.ZodNullable<z.ZodString>>;
611
+ gas_usd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
612
+ }, "strip", z.ZodTypeAny, {
613
+ gas?: string;
614
+ gas_price?: string;
615
+ gas_usd?: string;
616
+ }, {
617
+ gas?: string;
618
+ gas_price?: string;
619
+ gas_usd?: string;
620
+ }>, {
621
+ gasLimit: string;
622
+ gasPrice: string;
623
+ gasUsd: string;
624
+ }, {
625
+ gas?: string;
626
+ gas_price?: string;
627
+ gas_usd?: string;
628
+ }>>>;
629
+ extra_fee: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodObject<{
630
+ token: z.ZodObject<{
631
+ chain_id: z.ZodEffects<z.ZodNumber, number, number>;
632
+ address: z.ZodString;
633
+ decimal: z.ZodNumber;
634
+ token_standard: z.ZodEnum<["native", "erc20"]>;
635
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
636
+ symbol: z.ZodOptional<z.ZodNullable<z.ZodString>>;
637
+ logo_uri: z.ZodOptional<z.ZodNullable<z.ZodString>>;
638
+ tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
639
+ }, "strip", z.ZodTypeAny, {
640
+ symbol?: string;
641
+ address?: string;
642
+ name?: string;
643
+ tags?: string[];
644
+ chain_id?: number;
645
+ decimal?: number;
646
+ token_standard?: "erc20" | "native";
647
+ logo_uri?: string;
648
+ }, {
649
+ symbol?: string;
650
+ address?: string;
651
+ name?: string;
652
+ tags?: string[];
653
+ chain_id?: number;
654
+ decimal?: number;
655
+ token_standard?: "erc20" | "native";
656
+ logo_uri?: string;
657
+ }>;
658
+ recipient: z.ZodOptional<z.ZodNullable<z.ZodString>>;
659
+ amount: z.ZodOptional<z.ZodNullable<z.ZodString>>;
660
+ amount_usd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
661
+ percentage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
662
+ }, "strip", z.ZodTypeAny, {
663
+ token?: {
664
+ symbol?: string;
665
+ address?: string;
666
+ name?: string;
667
+ tags?: string[];
668
+ chain_id?: number;
669
+ decimal?: number;
670
+ token_standard?: "erc20" | "native";
671
+ logo_uri?: string;
672
+ };
673
+ recipient?: string;
674
+ amount?: string;
675
+ amount_usd?: string;
676
+ percentage?: string;
677
+ }, {
678
+ token?: {
679
+ symbol?: string;
680
+ address?: string;
681
+ name?: string;
682
+ tags?: string[];
683
+ chain_id?: number;
684
+ decimal?: number;
685
+ token_standard?: "erc20" | "native";
686
+ logo_uri?: string;
687
+ };
688
+ recipient?: string;
689
+ amount?: string;
690
+ amount_usd?: string;
691
+ percentage?: string;
692
+ }>, {
693
+ token: {
694
+ symbol?: string;
695
+ address?: string;
696
+ name?: string;
697
+ tags?: string[];
698
+ chain_id?: number;
699
+ decimal?: number;
700
+ token_standard?: "erc20" | "native";
701
+ logo_uri?: string;
702
+ };
703
+ recipient: string;
704
+ amount: string;
705
+ amountUsd: string;
706
+ percentage: Percent;
707
+ }, {
708
+ token?: {
709
+ symbol?: string;
710
+ address?: string;
711
+ name?: string;
712
+ tags?: string[];
713
+ chain_id?: number;
714
+ decimal?: number;
715
+ token_standard?: "erc20" | "native";
716
+ logo_uri?: string;
717
+ };
718
+ recipient?: string;
719
+ amount?: string;
720
+ amount_usd?: string;
721
+ percentage?: string;
722
+ }>>>;
723
+ amount_in_usd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
724
+ amount_out_usd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
725
+ price_impact: z.ZodOptional<z.ZodNullable<z.ZodString>>;
726
+ permit2_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
727
+ universal_router_address: z.ZodOptional<z.ZodNullable<z.ZodString>>;
728
+ provider_route_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
729
+ __origin: z.ZodObject<{
730
+ payload: z.ZodObject<{
731
+ amount: z.ZodString;
732
+ account: z.ZodString;
733
+ currencyIn: z.ZodUnion<[z.ZodType<DexToken, z.ZodTypeDef, DexToken>, z.ZodType<NativeCurrency, z.ZodTypeDef, NativeCurrency>]>;
734
+ currencyOut: z.ZodUnion<[z.ZodType<DexToken, z.ZodTypeDef, DexToken>, z.ZodType<NativeCurrency, z.ZodTypeDef, NativeCurrency>]>;
735
+ direction: z.ZodEnum<["exactIn", "exactOut"]>;
736
+ slippageToleranceBps: z.ZodType<Percent, z.ZodTypeDef, Percent>;
737
+ }, "strip", z.ZodTypeAny, {
738
+ amount?: string;
739
+ account?: string;
740
+ currencyIn?: DexToken | NativeCurrency;
741
+ currencyOut?: DexToken | NativeCurrency;
742
+ direction?: "exactIn" | "exactOut";
743
+ slippageToleranceBps?: Percent;
744
+ }, {
745
+ amount?: string;
746
+ account?: string;
747
+ currencyIn?: DexToken | NativeCurrency;
748
+ currencyOut?: DexToken | NativeCurrency;
749
+ direction?: "exactIn" | "exactOut";
750
+ slippageToleranceBps?: Percent;
751
+ }>;
752
+ }, "strip", z.ZodTypeAny, {
753
+ payload?: {
754
+ amount?: string;
755
+ account?: string;
756
+ currencyIn?: DexToken | NativeCurrency;
757
+ currencyOut?: DexToken | NativeCurrency;
758
+ direction?: "exactIn" | "exactOut";
759
+ slippageToleranceBps?: Percent;
760
+ };
761
+ }, {
762
+ payload?: {
763
+ amount?: string;
764
+ account?: string;
765
+ currencyIn?: DexToken | NativeCurrency;
766
+ currencyOut?: DexToken | NativeCurrency;
767
+ direction?: "exactIn" | "exactOut";
768
+ slippageToleranceBps?: Percent;
769
+ };
770
+ }>;
771
+ create_dex_currency: z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodUnion<[z.ZodType<DexToken, z.ZodTypeDef, DexToken>, z.ZodType<NativeCurrency, z.ZodTypeDef, NativeCurrency>]>>;
772
+ }, "strip", z.ZodTypeAny, {
773
+ chain_id?: number;
774
+ provider?: string;
775
+ address_in?: string;
776
+ address_out?: string;
777
+ chain_id_out?: number;
778
+ amount_in?: string;
779
+ amount_out?: string;
780
+ routes?: unknown[];
781
+ token_in?: {
782
+ symbol?: string;
783
+ address?: string;
784
+ name?: string;
785
+ tags?: string[];
786
+ chain_id?: number;
787
+ decimal?: number;
788
+ token_standard?: "erc20" | "native";
789
+ logo_uri?: string;
790
+ };
791
+ token_out?: {
792
+ symbol?: string;
793
+ address?: string;
794
+ name?: string;
795
+ tags?: string[];
796
+ chain_id?: number;
797
+ decimal?: number;
798
+ token_standard?: "erc20" | "native";
799
+ logo_uri?: string;
800
+ };
801
+ calldata_builder?: {
802
+ data?: string;
803
+ strategy?: string;
804
+ request_id?: string;
805
+ };
806
+ gas?: {
807
+ gasLimit: string;
808
+ gasPrice: string;
809
+ gasUsd: string;
810
+ };
811
+ extra_fee?: {
812
+ token: {
813
+ symbol?: string;
814
+ address?: string;
815
+ name?: string;
816
+ tags?: string[];
817
+ chain_id?: number;
818
+ decimal?: number;
819
+ token_standard?: "erc20" | "native";
820
+ logo_uri?: string;
821
+ };
822
+ recipient: string;
823
+ amount: string;
824
+ amountUsd: string;
825
+ percentage: Percent;
826
+ };
827
+ amount_in_usd?: string;
828
+ amount_out_usd?: string;
829
+ price_impact?: string;
830
+ permit2_address?: string;
831
+ universal_router_address?: string;
832
+ provider_route_id?: string;
833
+ __origin?: {
834
+ payload?: {
835
+ amount?: string;
836
+ account?: string;
837
+ currencyIn?: DexToken | NativeCurrency;
838
+ currencyOut?: DexToken | NativeCurrency;
839
+ direction?: "exactIn" | "exactOut";
840
+ slippageToleranceBps?: Percent;
841
+ };
842
+ };
843
+ create_dex_currency?: (args_0: any, ...args: unknown[]) => DexToken | NativeCurrency;
844
+ }, {
845
+ chain_id?: number;
846
+ provider?: string;
847
+ address_in?: string;
848
+ address_out?: string;
849
+ chain_id_out?: number;
850
+ amount_in?: string;
851
+ amount_out?: string;
852
+ routes?: unknown[];
853
+ token_in?: {
854
+ symbol?: string;
855
+ address?: string;
856
+ name?: string;
857
+ tags?: string[];
858
+ chain_id?: number;
859
+ decimal?: number;
860
+ token_standard?: "erc20" | "native";
861
+ logo_uri?: string;
862
+ };
863
+ token_out?: {
864
+ symbol?: string;
865
+ address?: string;
866
+ name?: string;
867
+ tags?: string[];
868
+ chain_id?: number;
869
+ decimal?: number;
870
+ token_standard?: "erc20" | "native";
871
+ logo_uri?: string;
872
+ };
873
+ calldata_builder?: {
874
+ data?: string;
875
+ strategy?: string;
876
+ request_id?: string;
877
+ };
878
+ gas?: {
879
+ gas?: string;
880
+ gas_price?: string;
881
+ gas_usd?: string;
882
+ };
883
+ extra_fee?: {
884
+ token?: {
885
+ symbol?: string;
886
+ address?: string;
887
+ name?: string;
888
+ tags?: string[];
889
+ chain_id?: number;
890
+ decimal?: number;
891
+ token_standard?: "erc20" | "native";
892
+ logo_uri?: string;
893
+ };
894
+ recipient?: string;
895
+ amount?: string;
896
+ amount_usd?: string;
897
+ percentage?: string;
898
+ };
899
+ amount_in_usd?: string;
900
+ amount_out_usd?: string;
901
+ price_impact?: string;
902
+ permit2_address?: string;
903
+ universal_router_address?: string;
904
+ provider_route_id?: string;
905
+ __origin?: {
906
+ payload?: {
907
+ amount?: string;
908
+ account?: string;
909
+ currencyIn?: DexToken | NativeCurrency;
910
+ currencyOut?: DexToken | NativeCurrency;
911
+ direction?: "exactIn" | "exactOut";
912
+ slippageToleranceBps?: Percent;
913
+ };
914
+ };
915
+ create_dex_currency?: (args_0: any, ...args: unknown[]) => DexToken | NativeCurrency;
916
+ }>, {
917
+ chainId: number;
918
+ chainIdOut: number;
919
+ amountIn: CurrencyAmount<DexToken | NativeCurrency>;
920
+ amountInUsd: BigNumber$1;
921
+ amountOut: CurrencyAmount<DexToken | NativeCurrency>;
922
+ amountOutUsd: BigNumber$1;
923
+ currencyIn: DexToken | NativeCurrency;
924
+ currencyOut: DexToken | NativeCurrency;
925
+ permit2Address: string;
926
+ universalRouterAddress: string;
927
+ priceImpact: {
928
+ value: Percent;
929
+ severity: WarningSeverity;
930
+ };
931
+ provider: string;
932
+ addressIn: string;
933
+ addressOut: string;
934
+ calldataBuilder: {
935
+ data?: string;
936
+ strategy?: string;
937
+ request_id?: string;
938
+ };
939
+ routes: unknown[];
940
+ routeNotFound: boolean;
941
+ extraFee: {
942
+ token: {
943
+ symbol?: string;
944
+ address?: string;
945
+ name?: string;
946
+ tags?: string[];
947
+ chain_id?: number;
948
+ decimal?: number;
949
+ token_standard?: "erc20" | "native";
950
+ logo_uri?: string;
951
+ };
952
+ recipient: string;
953
+ amount: string;
954
+ amountUsd: string;
955
+ percentage: Percent;
956
+ };
957
+ gas: {
958
+ gasLimit: string;
959
+ gasPrice: string;
960
+ gasUsd: string;
961
+ };
962
+ __origin: {
963
+ payload?: {
964
+ amount?: string;
965
+ account?: string;
966
+ currencyIn?: DexToken | NativeCurrency;
967
+ currencyOut?: DexToken | NativeCurrency;
968
+ direction?: "exactIn" | "exactOut";
969
+ slippageToleranceBps?: Percent;
970
+ };
971
+ };
972
+ }, {
973
+ chain_id?: number;
974
+ provider?: string;
975
+ address_in?: string;
976
+ address_out?: string;
977
+ chain_id_out?: number;
978
+ amount_in?: string;
979
+ amount_out?: string;
980
+ routes?: unknown[];
981
+ token_in?: {
982
+ symbol?: string;
983
+ address?: string;
984
+ name?: string;
985
+ tags?: string[];
986
+ chain_id?: number;
987
+ decimal?: number;
988
+ token_standard?: "erc20" | "native";
989
+ logo_uri?: string;
990
+ };
991
+ token_out?: {
992
+ symbol?: string;
993
+ address?: string;
994
+ name?: string;
995
+ tags?: string[];
996
+ chain_id?: number;
997
+ decimal?: number;
998
+ token_standard?: "erc20" | "native";
999
+ logo_uri?: string;
1000
+ };
1001
+ calldata_builder?: {
1002
+ data?: string;
1003
+ strategy?: string;
1004
+ request_id?: string;
1005
+ };
1006
+ gas?: {
1007
+ gas?: string;
1008
+ gas_price?: string;
1009
+ gas_usd?: string;
1010
+ };
1011
+ extra_fee?: {
1012
+ token?: {
1013
+ symbol?: string;
1014
+ address?: string;
1015
+ name?: string;
1016
+ tags?: string[];
1017
+ chain_id?: number;
1018
+ decimal?: number;
1019
+ token_standard?: "erc20" | "native";
1020
+ logo_uri?: string;
1021
+ };
1022
+ recipient?: string;
1023
+ amount?: string;
1024
+ amount_usd?: string;
1025
+ percentage?: string;
1026
+ };
1027
+ amount_in_usd?: string;
1028
+ amount_out_usd?: string;
1029
+ price_impact?: string;
1030
+ permit2_address?: string;
1031
+ universal_router_address?: string;
1032
+ provider_route_id?: string;
1033
+ __origin?: {
1034
+ payload?: {
1035
+ amount?: string;
1036
+ account?: string;
1037
+ currencyIn?: DexToken | NativeCurrency;
1038
+ currencyOut?: DexToken | NativeCurrency;
1039
+ direction?: "exactIn" | "exactOut";
1040
+ slippageToleranceBps?: Percent;
1041
+ };
1042
+ };
1043
+ create_dex_currency?: (args_0: any, ...args: unknown[]) => DexToken | NativeCurrency;
1044
+ }>;
1045
+ declare const $buildRoutesPayload: z.ZodObject<{
1046
+ chainId: z.ZodEffects<z.ZodNumber, number, number>;
1047
+ chainIdOut: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, number, number>>>;
1048
+ provider: z.ZodString;
1049
+ sender: z.ZodString;
1050
+ recipient: z.ZodString;
1051
+ calldataBuilder: z.ZodObject<{
1052
+ strategy: z.ZodString;
1053
+ request_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1054
+ data: z.ZodString;
1055
+ }, "strip", z.ZodTypeAny, {
1056
+ data?: string;
1057
+ strategy?: string;
1058
+ request_id?: string;
1059
+ }, {
1060
+ data?: string;
1061
+ strategy?: string;
1062
+ request_id?: string;
1063
+ }>;
1064
+ slippageToleranceBps: z.ZodType<Percent, z.ZodTypeDef, Percent>;
1065
+ }, "strip", z.ZodTypeAny, {
1066
+ chainId?: number;
1067
+ provider?: string;
1068
+ recipient?: string;
1069
+ slippageToleranceBps?: Percent;
1070
+ chainIdOut?: number;
1071
+ calldataBuilder?: {
1072
+ data?: string;
1073
+ strategy?: string;
1074
+ request_id?: string;
1075
+ };
1076
+ sender?: string;
1077
+ }, {
1078
+ chainId?: number;
1079
+ provider?: string;
1080
+ recipient?: string;
1081
+ slippageToleranceBps?: Percent;
1082
+ chainIdOut?: number;
1083
+ calldataBuilder?: {
1084
+ data?: string;
1085
+ strategy?: string;
1086
+ request_id?: string;
1087
+ };
1088
+ sender?: string;
1089
+ }>;
1090
+ declare const $originBuiltRoutesCalldata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1091
+
1092
+ type GetTokensOptions = {
1093
+ query?: string;
1094
+ page?: number;
1095
+ pageSize?: number;
1096
+ };
1097
+ type OriginQuote = z.infer<typeof $quote>;
1098
+ type FindRoutesPayload = z.infer<typeof $findRoutesPayload>;
1099
+ type FindRoutesResponse = {
1100
+ data?: Array<z.infer<typeof $baseQuote>>;
1101
+ };
1102
+ type BuildRoutesPayload = z.infer<typeof $buildRoutesPayload>;
1103
+ type BuildRoutesResponse = {
1104
+ data?: {
1105
+ calldata?: Array<z.infer<typeof $originBuiltRoutesCalldata>>;
1106
+ };
1107
+ };
1108
+
1109
+ interface IProviderManager {
1110
+ getProvider<T = any>(chainId: ChainId): T;
1111
+ getChainConfigs(): ChainConfig[];
1112
+ }
1113
+ declare enum TokenStandard {
1114
+ ERC20 = "erc20",
1115
+ NATIVE = "native",
1116
+ ERC721 = "erc721",
1117
+ ERC1155 = "erc1155"
1118
+ }
1119
+
1120
+ interface DexCurrencyConstructorPayload {
1121
+ chainId: ChainId;
1122
+ address?: string;
1123
+ decimals: number;
1124
+ name?: string;
1125
+ tags?: string[];
1126
+ symbol?: string;
1127
+ logoUrl?: string;
1128
+ standard?: `${TokenStandard.NATIVE | TokenStandard.ERC20}`;
1129
+ buyFeeBps?: BigNumber$2;
1130
+ sellFeeBps?: BigNumber$2;
1131
+ bypassChecksum?: boolean;
1132
+ }
1133
+ declare class NativeCurrency extends NativeCurrency$1 {
1134
+ #private;
1135
+ address: string;
1136
+ logoUrl?: string;
1137
+ tags?: string[];
1138
+ protected constructor(payload: DexCurrencyConstructorPayload);
1139
+ get wrapped(): DexToken;
1140
+ equals(other: Currency): boolean;
1141
+ static onChain(payload: DexCurrencyConstructorPayload): NativeCurrency;
1142
+ }
1143
+ declare class DexToken extends Token {
1144
+ logoUrl?: string;
1145
+ tags?: string[];
1146
+ constructor(payload: DexCurrencyConstructorPayload);
1147
+ }
1148
+ declare class SolanaDexToken extends DexToken {
1149
+ constructor(payload: DexCurrencyConstructorPayload);
1150
+ }
1151
+
1152
+ declare const $dexCurrency: z.ZodUnion<[z.ZodType<DexToken, z.ZodTypeDef, DexToken>, z.ZodType<NativeCurrency, z.ZodTypeDef, NativeCurrency>]>;
1153
+
1154
+ declare enum Field {
1155
+ TokenIn = "tokenIn",
1156
+ TokenOut = "tokenOut"
1157
+ }
1158
+ declare enum WrapType {
1159
+ NOT_APPLICABLE = "not-applicable",
1160
+ WRAP = "wrap",
1161
+ UNWRAP = "unwrap"
1162
+ }
1163
+ type WrapInfo = {
1164
+ type: WrapType;
1165
+ method?: 'wrap' | 'unwrap';
1166
+ };
1167
+ declare enum PriceImpactLevel {
1168
+ LOW = 0,
1169
+ MEDIUM = 3,
1170
+ HIGH = 5,
1171
+ BLOCKED = 15
1172
+ }
1173
+ type WarningSeverity = 0 | 1 | 2 | 3 | 4;
1174
+ type DexCurrency$1 = z.infer<typeof $dexCurrency>;
1175
+ type TradeDirection = FindRoutesPayload['direction'];
1176
+
1177
+ declare const $legacyFee: z.ZodEffects<z.ZodObject<{
1178
+ gas_price: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1179
+ }, "strip", z.ZodTypeAny, {
1180
+ gas_price?: string;
1181
+ }, {
1182
+ gas_price?: string;
1183
+ }>, {
1184
+ gasPrice: string;
1185
+ }, {
1186
+ gas_price?: string;
1187
+ }>;
1188
+ declare const $eip1559: z.ZodEffects<z.ZodObject<{
1189
+ base_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1190
+ max_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1191
+ max_priority_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1192
+ }, "strip", z.ZodTypeAny, {
1193
+ base_fee_per_gas?: string;
1194
+ max_fee_per_gas?: string;
1195
+ max_priority_fee_per_gas?: string;
1196
+ }, {
1197
+ base_fee_per_gas?: string;
1198
+ max_fee_per_gas?: string;
1199
+ max_priority_fee_per_gas?: string;
1200
+ }>, {
1201
+ baseFeePerGas: string;
1202
+ maxFeePerGas: string;
1203
+ maxPriorityFeePerGas: string;
1204
+ }, {
1205
+ base_fee_per_gas?: string;
1206
+ max_fee_per_gas?: string;
1207
+ max_priority_fee_per_gas?: string;
1208
+ }>;
1209
+ declare const $networkFeeSuggestion: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1210
+ type: z.ZodLiteral<"legacy">;
1211
+ } & {
1212
+ low: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodObject<{
1213
+ gas_price: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1214
+ }, "strip", z.ZodTypeAny, {
1215
+ gas_price?: string;
1216
+ }, {
1217
+ gas_price?: string;
1218
+ }>, {
1219
+ gasPrice: string;
1220
+ }, {
1221
+ gas_price?: string;
1222
+ }>>>;
1223
+ medium: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodObject<{
1224
+ gas_price: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1225
+ }, "strip", z.ZodTypeAny, {
1226
+ gas_price?: string;
1227
+ }, {
1228
+ gas_price?: string;
1229
+ }>, {
1230
+ gasPrice: string;
1231
+ }, {
1232
+ gas_price?: string;
1233
+ }>>>;
1234
+ high: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodObject<{
1235
+ gas_price: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1236
+ }, "strip", z.ZodTypeAny, {
1237
+ gas_price?: string;
1238
+ }, {
1239
+ gas_price?: string;
1240
+ }>, {
1241
+ gasPrice: string;
1242
+ }, {
1243
+ gas_price?: string;
1244
+ }>>>;
1245
+ } & {
1246
+ chain_name: z.ZodString;
1247
+ exact_base_fee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1248
+ base_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1249
+ }, "strip", z.ZodTypeAny, {
1250
+ type?: "legacy";
1251
+ base_fee_per_gas?: string;
1252
+ chain_name?: string;
1253
+ exact_base_fee?: string;
1254
+ low?: {
1255
+ gasPrice: string;
1256
+ };
1257
+ medium?: {
1258
+ gasPrice: string;
1259
+ };
1260
+ high?: {
1261
+ gasPrice: string;
1262
+ };
1263
+ }, {
1264
+ type?: "legacy";
1265
+ base_fee_per_gas?: string;
1266
+ chain_name?: string;
1267
+ exact_base_fee?: string;
1268
+ low?: {
1269
+ gas_price?: string;
1270
+ };
1271
+ medium?: {
1272
+ gas_price?: string;
1273
+ };
1274
+ high?: {
1275
+ gas_price?: string;
1276
+ };
1277
+ }>, z.ZodObject<{
1278
+ type: z.ZodLiteral<"eip-1559">;
1279
+ } & {
1280
+ low: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodObject<{
1281
+ base_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1282
+ max_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1283
+ max_priority_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1284
+ }, "strip", z.ZodTypeAny, {
1285
+ base_fee_per_gas?: string;
1286
+ max_fee_per_gas?: string;
1287
+ max_priority_fee_per_gas?: string;
1288
+ }, {
1289
+ base_fee_per_gas?: string;
1290
+ max_fee_per_gas?: string;
1291
+ max_priority_fee_per_gas?: string;
1292
+ }>, {
1293
+ baseFeePerGas: string;
1294
+ maxFeePerGas: string;
1295
+ maxPriorityFeePerGas: string;
1296
+ }, {
1297
+ base_fee_per_gas?: string;
1298
+ max_fee_per_gas?: string;
1299
+ max_priority_fee_per_gas?: string;
1300
+ }>>>;
1301
+ medium: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodObject<{
1302
+ base_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1303
+ max_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1304
+ max_priority_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1305
+ }, "strip", z.ZodTypeAny, {
1306
+ base_fee_per_gas?: string;
1307
+ max_fee_per_gas?: string;
1308
+ max_priority_fee_per_gas?: string;
1309
+ }, {
1310
+ base_fee_per_gas?: string;
1311
+ max_fee_per_gas?: string;
1312
+ max_priority_fee_per_gas?: string;
1313
+ }>, {
1314
+ baseFeePerGas: string;
1315
+ maxFeePerGas: string;
1316
+ maxPriorityFeePerGas: string;
1317
+ }, {
1318
+ base_fee_per_gas?: string;
1319
+ max_fee_per_gas?: string;
1320
+ max_priority_fee_per_gas?: string;
1321
+ }>>>;
1322
+ high: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodObject<{
1323
+ base_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1324
+ max_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1325
+ max_priority_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1326
+ }, "strip", z.ZodTypeAny, {
1327
+ base_fee_per_gas?: string;
1328
+ max_fee_per_gas?: string;
1329
+ max_priority_fee_per_gas?: string;
1330
+ }, {
1331
+ base_fee_per_gas?: string;
1332
+ max_fee_per_gas?: string;
1333
+ max_priority_fee_per_gas?: string;
1334
+ }>, {
1335
+ baseFeePerGas: string;
1336
+ maxFeePerGas: string;
1337
+ maxPriorityFeePerGas: string;
1338
+ }, {
1339
+ base_fee_per_gas?: string;
1340
+ max_fee_per_gas?: string;
1341
+ max_priority_fee_per_gas?: string;
1342
+ }>>>;
1343
+ } & {
1344
+ chain_name: z.ZodString;
1345
+ exact_base_fee: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1346
+ base_fee_per_gas: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1347
+ }, "strip", z.ZodTypeAny, {
1348
+ type?: "eip-1559";
1349
+ base_fee_per_gas?: string;
1350
+ chain_name?: string;
1351
+ exact_base_fee?: string;
1352
+ low?: {
1353
+ baseFeePerGas: string;
1354
+ maxFeePerGas: string;
1355
+ maxPriorityFeePerGas: string;
1356
+ };
1357
+ medium?: {
1358
+ baseFeePerGas: string;
1359
+ maxFeePerGas: string;
1360
+ maxPriorityFeePerGas: string;
1361
+ };
1362
+ high?: {
1363
+ baseFeePerGas: string;
1364
+ maxFeePerGas: string;
1365
+ maxPriorityFeePerGas: string;
1366
+ };
1367
+ }, {
1368
+ type?: "eip-1559";
1369
+ base_fee_per_gas?: string;
1370
+ chain_name?: string;
1371
+ exact_base_fee?: string;
1372
+ low?: {
1373
+ base_fee_per_gas?: string;
1374
+ max_fee_per_gas?: string;
1375
+ max_priority_fee_per_gas?: string;
1376
+ };
1377
+ medium?: {
1378
+ base_fee_per_gas?: string;
1379
+ max_fee_per_gas?: string;
1380
+ max_priority_fee_per_gas?: string;
1381
+ };
1382
+ high?: {
1383
+ base_fee_per_gas?: string;
1384
+ max_fee_per_gas?: string;
1385
+ max_priority_fee_per_gas?: string;
1386
+ };
1387
+ }>]>, {
1388
+ type?: "legacy";
1389
+ low?: {
1390
+ gasPrice: string;
1391
+ };
1392
+ medium?: {
1393
+ gasPrice: string;
1394
+ };
1395
+ high?: {
1396
+ gasPrice: string;
1397
+ };
1398
+ chainName: string;
1399
+ exactBaseFee: string;
1400
+ } | {
1401
+ type?: "eip-1559";
1402
+ low?: {
1403
+ baseFeePerGas: string;
1404
+ maxFeePerGas: string;
1405
+ maxPriorityFeePerGas: string;
1406
+ };
1407
+ medium?: {
1408
+ baseFeePerGas: string;
1409
+ maxFeePerGas: string;
1410
+ maxPriorityFeePerGas: string;
1411
+ };
1412
+ high?: {
1413
+ baseFeePerGas: string;
1414
+ maxFeePerGas: string;
1415
+ maxPriorityFeePerGas: string;
1416
+ };
1417
+ chainName: string;
1418
+ exactBaseFee: string;
1419
+ }, {
1420
+ type?: "legacy";
1421
+ base_fee_per_gas?: string;
1422
+ chain_name?: string;
1423
+ exact_base_fee?: string;
1424
+ low?: {
1425
+ gas_price?: string;
1426
+ };
1427
+ medium?: {
1428
+ gas_price?: string;
1429
+ };
1430
+ high?: {
1431
+ gas_price?: string;
1432
+ };
1433
+ } | {
1434
+ type?: "eip-1559";
1435
+ base_fee_per_gas?: string;
1436
+ chain_name?: string;
1437
+ exact_base_fee?: string;
1438
+ low?: {
1439
+ base_fee_per_gas?: string;
1440
+ max_fee_per_gas?: string;
1441
+ max_priority_fee_per_gas?: string;
1442
+ };
1443
+ medium?: {
1444
+ base_fee_per_gas?: string;
1445
+ max_fee_per_gas?: string;
1446
+ max_priority_fee_per_gas?: string;
1447
+ };
1448
+ high?: {
1449
+ base_fee_per_gas?: string;
1450
+ max_fee_per_gas?: string;
1451
+ max_priority_fee_per_gas?: string;
1452
+ };
1453
+ }>;
1454
+
1455
+ declare enum NetworkFeeLevel {
1456
+ Low = "low",
1457
+ Medium = "medium",
1458
+ High = "high",
1459
+ Custom = "custom"
1460
+ }
1461
+ type NetworkSuggestionFee = z.infer<typeof $networkFeeSuggestion> & {
1462
+ type: 'legacy' | 'eip-1559';
1463
+ };
1464
+ type NetworkFeeType = NetworkSuggestionFee['type'];
1465
+ type LegacyFeeData = z.infer<typeof $legacyFee>;
1466
+ type EIP1559FeeData = z.infer<typeof $eip1559>;
1467
+ type NetworkFeeInfo = {
1468
+ level: NetworkFeeLevel;
1469
+ } & ({
1470
+ type: 'legacy';
1471
+ data: LegacyFeeData;
1472
+ } | {
1473
+ type: 'eip-1559';
1474
+ data: EIP1559FeeData;
1475
+ });
1476
+
1477
+ type DexFactoryBuildOptions = {
1478
+ networkFee?: LegacyFeeData | EIP1559FeeData;
1479
+ permitSignature?: PermitSignature | string;
1480
+ };
1481
+
1482
+ type AggregatedQuoteAmounts = {
1483
+ [Field.TokenIn]: CurrencyAmount<Currency | DexCurrency$1> | undefined;
1484
+ [Field.TokenOut]: CurrencyAmount<Currency | DexCurrency$1> | undefined;
1485
+ };
1486
+ declare enum AggregatedQuoteFeeType {
1487
+ DEVELOPMENT = "development",
1488
+ PROTOCOL = "protocol",
1489
+ NETWORK = "network"
1490
+ }
1491
+ type AggregatedQuoteFeeAllocation = {
1492
+ type: `${AggregatedQuoteFeeType}` | AggregatedQuoteFeeType;
1493
+ amount: CurrencyAmount<Currency | DexCurrency$1>;
1494
+ percent?: Percent;
1495
+ amountUsd?: BigNumber$1;
1496
+ };
1497
+ type AggregatedQuoteFee = {
1498
+ totalFeeUsd?: BigNumber$1;
1499
+ allocation: AggregatedQuoteFeeAllocation[];
1500
+ };
1501
+ interface AggregatedQuoteMethods {
1502
+ getAllocatedFee: () => Promise<AggregatedQuoteFee | undefined>;
1503
+ getNetworkFees: () => Promise<PlatformNetworkFee<Blockchain>[] | undefined>;
1504
+ }
1505
+ type DefaultAggregatedQuote = AggregatedQuoteMethods & Pick<OriginQuote, 'routes' | 'chainId' | 'provider' | 'extraFee' | 'addressIn' | 'addressOut' | 'currencyIn' | 'currencyOut' | 'priceImpact' | 'amountIn' | 'amountOut' | 'amountInUsd' | 'amountOutUsd' | 'calldataBuilder' | 'permit2Address' | 'universalRouterAddress' | '__origin'> & {
1506
+ quoteId: string;
1507
+ };
1508
+ interface AggregatedQuote extends DefaultAggregatedQuote {
1509
+ isBestTrade?: boolean;
1510
+ amounts: AggregatedQuoteAmounts;
1511
+ clientTrade?: KatanaTrade | Trade<Currency | DexCurrency$1, Currency | DexCurrency$1, TradeType>;
1512
+ minimumAmountOut?: CurrencyAmount<Currency | DexCurrency$1>;
1513
+ maximumAmountIn?: CurrencyAmount<Currency | DexCurrency$1>;
1514
+ executionPrice?: Price<Currency | DexCurrency$1, Currency | DexCurrency$1>;
1515
+ worstExecutionPrice?: Price<Currency | DexCurrency$1, Currency | DexCurrency$1>;
1516
+ wrapInfo?: WrapInfo;
1517
+ }
1518
+ type AggregatedMethodsExcluded<T> = Omit<T, keyof AggregatedQuoteMethods>;
1519
+ type AggregatedQuoteWithoutMethods = AggregatedMethodsExcluded<AggregatedQuote> | AggregatedMethodsExcluded<DefaultAggregatedQuote>;
1520
+
1521
+ declare enum Code {
1522
+ ACTION_REJECTED = "ACTION_REJECTED",
1523
+ BAD_DATA = "BAD_DATA",
1524
+ BUFFER_OVERRUN = "BUFFER_OVERRUN",
1525
+ CALL_EXCEPTION = "CALL_EXCEPTION",
1526
+ CANCELLED = "CANCELLED",
1527
+ INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
1528
+ INVALID_ARGUMENT = "INVALID_ARGUMENT",
1529
+ MISSING_ARGUMENT = "MISSING_ARGUMENT",
1530
+ NETWORK_ERROR = "NETWORK_ERROR",
1531
+ NONCE_EXPIRED = "NONCE_EXPIRED",
1532
+ NOT_IMPLEMENTED = "NOT_IMPLEMENTED",
1533
+ NUMERIC_FAULT = "NUMERIC_FAULT",
1534
+ OFFCHAIN_FAULT = "OFFCHAIN_FAULT",
1535
+ REPLACEMENT_UNDERPRICED = "REPLACEMENT_UNDERPRICED",
1536
+ SERVER_ERROR = "SERVER_ERROR",
1537
+ TIMEOUT = "TIMEOUT",
1538
+ TRANSACTION_REPLACED = "TRANSACTION_REPLACED",
1539
+ UNCONFIGURED_NAME = "UNCONFIGURED_NAME",
1540
+ UNEXPECTED_ARGUMENT = "UNEXPECTED_ARGUMENT",
1541
+ UNKNOWN_ERROR = "UNKNOWN_ERROR",
1542
+ UNSUPPORTED_OPERATION = "UNSUPPORTED_OPERATION",
1543
+ VALUE_MISMATCH = "VALUE_MISMATCH"
1544
+ }
1545
+ type EtherError = {
1546
+ code: `${Code.ACTION_REJECTED}`;
1547
+ error: ActionRejectedError;
1548
+ } | {
1549
+ code: `${Code.BAD_DATA}`;
1550
+ error: BadDataError;
1551
+ } | {
1552
+ code: `${Code.BUFFER_OVERRUN}`;
1553
+ error: BufferOverrunError;
1554
+ } | {
1555
+ code: `${Code.CALL_EXCEPTION}`;
1556
+ error: CallExceptionError;
1557
+ } | {
1558
+ code: `${Code.CANCELLED}`;
1559
+ error: CancelledError;
1560
+ } | {
1561
+ code: `${Code.INSUFFICIENT_FUNDS}`;
1562
+ error: InsufficientFundsError;
1563
+ } | {
1564
+ code: `${Code.INVALID_ARGUMENT}`;
1565
+ error: InvalidArgumentError;
1566
+ } | {
1567
+ code: `${Code.MISSING_ARGUMENT}`;
1568
+ error: MissingArgumentError;
1569
+ } | {
1570
+ code: `${Code.NETWORK_ERROR}`;
1571
+ error: NetworkError;
1572
+ } | {
1573
+ code: `${Code.NONCE_EXPIRED}`;
1574
+ error: NonceExpiredError;
1575
+ } | {
1576
+ code: `${Code.NOT_IMPLEMENTED}`;
1577
+ error: NotImplementedError;
1578
+ } | {
1579
+ code: `${Code.NUMERIC_FAULT}`;
1580
+ error: NumericFaultError;
1581
+ } | {
1582
+ code: `${Code.OFFCHAIN_FAULT}`;
1583
+ error: OffchainFaultError;
1584
+ } | {
1585
+ code: `${Code.REPLACEMENT_UNDERPRICED}`;
1586
+ error: ReplacementUnderpricedError;
1587
+ } | {
1588
+ code: `${Code.SERVER_ERROR}`;
1589
+ error: ServerError;
1590
+ } | {
1591
+ code: `${Code.TIMEOUT}`;
1592
+ error: TimeoutError;
1593
+ } | {
1594
+ code: `${Code.TRANSACTION_REPLACED}`;
1595
+ error: TransactionReplacedError;
1596
+ } | {
1597
+ code: `${Code.UNCONFIGURED_NAME}`;
1598
+ error: UnconfiguredNameError;
1599
+ } | {
1600
+ code: `${Code.UNEXPECTED_ARGUMENT}`;
1601
+ error: UnexpectedArgumentError;
1602
+ } | {
1603
+ code: `${Code.UNSUPPORTED_OPERATION}`;
1604
+ error: UnsupportedOperationError;
1605
+ } | {
1606
+ code: `${Code.VALUE_MISMATCH}` | `${Code.UNKNOWN_ERROR}`;
1607
+ error?: unknown;
1608
+ };
1609
+ type TypedEtherError = EtherError & {
1610
+ message: string;
1611
+ };
1612
+
1613
+ type DexCurrency = DexCurrency$1 | Currency;
1614
+ declare enum DexHandleQuoteState {
1615
+ Authorizing = "authorizing",
1616
+ Authorized = "authorized",
1617
+ AuthorizeFailed = "authorize-failed",
1618
+ ApprovingToken = "approving-token",
1619
+ ApprovedToken = "approved-token",
1620
+ ApproveTokenFailed = "approve-token-failed",
1621
+ SigningPermit = "signing-permit",
1622
+ SignedPermit = "signed-permit",
1623
+ SignPermitFailed = "sign-permit-failed",
1624
+ Wrapping = "wrapping",
1625
+ Wrapped = "wrapped",
1626
+ Unwrapping = "unwrapping",
1627
+ Unwrapped = "unwrapped",
1628
+ PopulatingTransaction = "populating-transaction",
1629
+ SigningTransaction = "signing-transaction",
1630
+ SignedTransaction = "signed-transaction",
1631
+ TransactionSubmitted = "transaction-submitted",
1632
+ WaitingForNextTransaction = "waiting-for-next-transaction",
1633
+ WaitingForReceipt = "waiting-for-receipt",
1634
+ Computing = "computing",
1635
+ Success = "success",
1636
+ Failed = "failed"
1637
+ }
1638
+ type StateUndefinedData = Exclude<DexHandleQuoteState, DexHandleQuoteState.ApprovingToken | DexHandleQuoteState.SigningPermit | DexHandleQuoteState.Wrapping | DexHandleQuoteState.Unwrapping | DexHandleQuoteState.SigningTransaction | DexHandleQuoteState.WaitingForReceipt | DexHandleQuoteState.Success | DexHandleQuoteState.Failed>;
1639
+ type DexHandleQuoteEvent = {
1640
+ state: DexHandleQuoteState.ApprovingToken | DexHandleQuoteState.Wrapping | DexHandleQuoteState.Unwrapping;
1641
+ data: {
1642
+ amount: CurrencyAmount<DexCurrency>;
1643
+ };
1644
+ } | {
1645
+ state: DexHandleQuoteState.ApproveTokenFailed;
1646
+ data: {
1647
+ error: TypedEtherError | string;
1648
+ };
1649
+ } | {
1650
+ state: DexHandleQuoteState.SigningPermit;
1651
+ data: {
1652
+ message: string;
1653
+ };
1654
+ } | {
1655
+ state: DexHandleQuoteState.SigningTransaction;
1656
+ data: {
1657
+ populatedTransaction: TransactionRequest;
1658
+ };
1659
+ } | {
1660
+ state: DexHandleQuoteState.TransactionSubmitted | DexHandleQuoteState.WaitingForReceipt | DexHandleQuoteState.Success;
1661
+ data: {
1662
+ txHash: string;
1663
+ amountIn: CurrencyAmount<DexCurrency>;
1664
+ amountOut: CurrencyAmount<DexCurrency>;
1665
+ };
1666
+ } | {
1667
+ state: DexHandleQuoteState.Failed;
1668
+ data: {
1669
+ txHash?: string;
1670
+ amountIn: CurrencyAmount<DexCurrency>;
1671
+ amountOut: CurrencyAmount<DexCurrency>;
1672
+ };
1673
+ error: TypedEtherError | string;
1674
+ } | {
1675
+ state: StateUndefinedData;
1676
+ data?: any;
1677
+ error?: any;
1678
+ };
1679
+
1680
+ type GetDexTokensResponse = {
1681
+ ids: string[];
1682
+ data: Record<string, DexCurrency$1>;
1683
+ pagination?: {
1684
+ total?: number;
1685
+ };
1686
+ };
1687
+
1688
+ type FetchMateConfig = {
1689
+ baseUrl?: string;
1690
+ headers?: Record<string, string>;
1691
+ timeout?: number;
1692
+ credentials?: RequestCredentials;
1693
+ };
1694
+ type RequestOptions = {
1695
+ params?: Record<string, string | number | boolean>;
1696
+ headers?: Record<string, string>;
1697
+ timeout?: number;
1698
+ credentials?: RequestCredentials;
1699
+ } & RequestInit;
1700
+ type FetchMateResult<D, E = Error> = {
1701
+ success: true;
1702
+ data: D;
1703
+ } | {
1704
+ success: false;
1705
+ error: E;
1706
+ };
1707
+
1708
+ declare class FetchMateResponse<D, E = Error> {
1709
+ private readonly result;
1710
+ constructor(result: FetchMateResult<D, E>);
1711
+ static success<D>(data: D): FetchMateResponse<D>;
1712
+ static error<T>(error: unknown): FetchMateResponse<T>;
1713
+ get data(): D | undefined;
1714
+ get error(): E | undefined;
1715
+ isSuccess(): this is {
1716
+ result: {
1717
+ success: true;
1718
+ data: D;
1719
+ };
1720
+ };
1721
+ isError(): this is {
1722
+ result: {
1723
+ success: false;
1724
+ error: E;
1725
+ };
1726
+ };
1727
+ unwrap(): D;
1728
+ unwrapOr(defaultValue: D): D;
1729
+ unwrapOrElse(fn: (error: E) => D): D;
1730
+ map<U>(fn: (data: D) => U): FetchMateResponse<U>;
1731
+ flatMap<U>(fn: (data: D) => FetchMateResponse<U>): FetchMateResponse<U>;
1732
+ }
1733
+
1734
+ declare class FetchMate {
1735
+ private config;
1736
+ constructor(config?: FetchMateConfig);
1737
+ static create(config: FetchMateConfig): FetchMate;
1738
+ private buildUrl;
1739
+ private request;
1740
+ private requestJson;
1741
+ get<T = any>(url: string, options?: RequestOptions): Promise<FetchMateResponse<T>>;
1742
+ post<T = any>(url: string, body?: any, options?: RequestOptions): Promise<FetchMateResponse<T>>;
1743
+ put<T = any>(url: string, body?: any, options?: RequestOptions): Promise<FetchMateResponse<T>>;
1744
+ patch<T = any>(url: string, body?: any, options?: RequestOptions): Promise<FetchMateResponse<T>>;
1745
+ delete<T = any>(url: string, options?: RequestOptions): Promise<FetchMateResponse<T>>;
1746
+ head<T = any>(url: string, options?: RequestOptions): Promise<FetchMateResponse<T>>;
1747
+ options<T = any>(url: string, options?: RequestOptions): Promise<FetchMateResponse<T>>;
1748
+ raw(method: string, url: string, body?: any, options?: RequestOptions): Promise<FetchMateResponse<Response>>;
1749
+ baseUrl(url: string): void;
1750
+ header(key: string, value: string): void;
1751
+ headers(headers: Record<string, string>): void;
1752
+ timeout(timeout: number): void;
1753
+ credentials(credentials: RequestCredentials): void;
1754
+ }
1755
+
1756
+ interface IBaseSigner {
1757
+ signMessage: (message: string) => Promise<string>;
1758
+ signTransaction: (txRequest: any) => Promise<string>;
1759
+ sendTransaction: (txRequest: any) => Promise<any>;
1760
+ signTypedDataV4: (message: string) => Promise<string>;
1761
+ getAccount: () => Account | undefined;
1762
+ connect: (providerOrConnection: any) => IBaseSigner;
1763
+ getTag: () => string;
1764
+ }
1765
+ declare abstract class EthereumBaseSigner extends AbstractSigner implements IBaseSigner {
1766
+ protected readonly address: string;
1767
+ protected constructor(address: string, provider?: Provider | null);
1768
+ getAddress(): Promise<string>;
1769
+ abstract getAccount(): Account | undefined;
1770
+ abstract connect(provider: Provider | null): EthereumBaseSigner;
1771
+ abstract signTransaction(txRequest: TransactionRequest): Promise<string>;
1772
+ abstract signMessage(message: string): Promise<string>;
1773
+ abstract signTypedDataV4(message: string): Promise<string>;
1774
+ abstract getTag(): string;
1775
+ }
1776
+ interface SolanaSignerV1 extends IBaseSigner {
1777
+ readonly address: string;
1778
+ readonly connection?: Connection;
1779
+ connect(connection: Connection): SolanaSignerV1;
1780
+ getAccount(): Account | undefined;
1781
+ signMessage(message: string): Promise<string>;
1782
+ sendTransaction(txRequest: Transaction | VersionedTransaction): Promise<string>;
1783
+ signTransaction(txRequest: Transaction | VersionedTransaction): Promise<string>;
1784
+ signTypedDataV4(message: string): Promise<string>;
1785
+ getTag(): string;
1786
+ }
1787
+
1788
+ interface CoreDexDependencies {
1789
+ debug?: boolean;
1790
+ apiUrl: string;
1791
+ providerManager: IProviderManager;
1792
+ getAccounts(baseAddress: string): Promise<Account[] | undefined>;
1793
+ getSignerForAddress(address: string): Promise<IBaseSigner | undefined>;
1794
+ }
1795
+
1796
+ interface Injectable<T> {
1797
+ use(dependency: T): this;
1798
+ }
1799
+ declare class CoreDexShared implements Injectable<CoreDex> {
1800
+ coredex?: CoreDex;
1801
+ use(coredex: CoreDex): this;
1802
+ protected useCoreDex(): CoreDex;
1803
+ }
1804
+
1805
+ declare class Aggregator extends CoreDexShared {
1806
+ api: FetchMate;
1807
+ constructor();
1808
+ use(coredex: CoreDex): this;
1809
+ private getAccount;
1810
+ private createDexCurrency;
1811
+ tokens(chainId: number, options?: GetTokensOptions): Promise<{
1812
+ pagination: {
1813
+ total?: number;
1814
+ };
1815
+ ids: string[];
1816
+ data: Record<string, DexCurrency$1>;
1817
+ }>;
1818
+ private handleAddresses;
1819
+ find(payload: FindRoutesPayload): Promise<{
1820
+ chainId: number;
1821
+ chainIdOut: number;
1822
+ amountIn: _uniswap_sdk_core.CurrencyAmount<DexToken | NativeCurrency>;
1823
+ amountInUsd: BigNumber;
1824
+ amountOut: _uniswap_sdk_core.CurrencyAmount<DexToken | NativeCurrency>;
1825
+ amountOutUsd: BigNumber;
1826
+ currencyIn: DexToken | NativeCurrency;
1827
+ currencyOut: DexToken | NativeCurrency;
1828
+ permit2Address: string;
1829
+ universalRouterAddress: string;
1830
+ priceImpact: {
1831
+ value: _uniswap_sdk_core.Percent;
1832
+ severity: WarningSeverity;
1833
+ };
1834
+ provider: string;
1835
+ addressIn: string;
1836
+ addressOut: string;
1837
+ calldataBuilder: {
1838
+ data?: string;
1839
+ strategy?: string;
1840
+ request_id?: string;
1841
+ };
1842
+ routes: unknown[];
1843
+ routeNotFound: boolean;
1844
+ extraFee: {
1845
+ token: {
1846
+ symbol?: string;
1847
+ address?: string;
1848
+ name?: string;
1849
+ tags?: string[];
1850
+ chain_id?: number;
1851
+ decimal?: number;
1852
+ token_standard?: "erc20" | "native";
1853
+ logo_uri?: string;
1854
+ };
1855
+ recipient: string;
1856
+ amount: string;
1857
+ amountUsd: string;
1858
+ percentage: _uniswap_sdk_core.Percent;
1859
+ };
1860
+ gas: {
1861
+ gasLimit: string;
1862
+ gasPrice: string;
1863
+ gasUsd: string;
1864
+ };
1865
+ __origin: {
1866
+ payload?: {
1867
+ amount?: string;
1868
+ account?: string;
1869
+ currencyIn?: DexToken | NativeCurrency;
1870
+ currencyOut?: DexToken | NativeCurrency;
1871
+ direction?: "exactIn" | "exactOut";
1872
+ slippageToleranceBps?: _uniswap_sdk_core.Percent;
1873
+ };
1874
+ };
1875
+ }[]>;
1876
+ build(payload: BuildRoutesPayload): Promise<{}[]>;
1877
+ getPrice(chain_id: number, address: string): Promise<number>;
1878
+ }
1879
+
1880
+ type PlatformProvider<T extends Blockchain> = T extends Blockchain.EVM ? JsonRpcProvider : T extends Blockchain.SOLANA ? Connection : never;
1881
+ type PlatformSigner<T extends Blockchain> = T extends Blockchain.EVM ? EthereumBaseSigner : T extends Blockchain.SOLANA ? SolanaSignerV1 : never;
1882
+ type PlatformTransaction<T extends Blockchain> = T extends Blockchain.EVM ? TransactionRequest : T extends Blockchain.SOLANA ? Transaction | VersionedTransaction : unknown;
1883
+ type PlatformTransactionResponse<T extends Blockchain> = T extends Blockchain.EVM ? TransactionResponse | ContractTransactionResponse : T extends Blockchain.SOLANA ? string : unknown;
1884
+ type PlatformHandleTransactionOptions = {
1885
+ waitForReceipt?: boolean;
1886
+ networkFee?: LegacyFeeData | EIP1559FeeData;
1887
+ onHandling?: () => void;
1888
+ onWaitingForReceipt?: (response: string | TransactionResponse) => void;
1889
+ onSubmitted?: (response: string | TransactionResponse) => void;
1890
+ onSuccess?: (receipt: string | TransactionReceipt) => void;
1891
+ onFailure?: (error: Error) => void;
1892
+ };
1893
+ type PlatformNetworkFee<T extends Blockchain> = {
1894
+ level: NetworkFeeLevel;
1895
+ amount: BigNumber$1;
1896
+ currency: NativeCurrency;
1897
+ feeData?: T extends Blockchain.EVM ? LegacyFeeData | EIP1559FeeData : never;
1898
+ };
1899
+ type BalanceResult = {
1900
+ address: string;
1901
+ balance: bigint;
1902
+ };
1903
+
1904
+ declare abstract class AbstractedPlatform<T extends Blockchain> extends CoreDexShared {
1905
+ abstract readonly blockchain: T;
1906
+ protected abstract nativeAddress: string;
1907
+ abstract readonly name: string;
1908
+ abstract getProvider(chainId?: ChainId): PlatformProvider<T> | undefined;
1909
+ abstract getSigner(address: string): Promise<PlatformSigner<T>> | undefined;
1910
+ abstract invokeSigner(chainId: ChainId, fromAddress: string): Promise<PlatformSigner<T>> | undefined;
1911
+ abstract balanceOf(chainId: ChainId, account: string, tokenAddress: string): Promise<bigint | undefined>;
1912
+ abstract batchBalanceOf(chainId: ChainId, account: string, tokenAddresses: string[]): Promise<Record<string, bigint> | undefined>;
1913
+ abstract wrap(account: string, amount: CurrencyAmount<DexCurrency$1>, options?: PlatformHandleTransactionOptions): Promise<PlatformTransactionResponse<T>>;
1914
+ abstract unwrap(account: string, amount: CurrencyAmount<DexCurrency$1>, options?: PlatformHandleTransactionOptions): Promise<PlatformTransactionResponse<T>>;
1915
+ abstract sendTransaction(chainId: ChainId, fromAddress: string, txRequest: PlatformTransaction<T>, options?: PlatformHandleTransactionOptions): Promise<PlatformTransactionResponse<T>>;
1916
+ abstract sendBatchTransaction(chainId: ChainId, fromAddress: string, txRequests: PlatformTransaction<T>[], options?: PlatformHandleTransactionOptions): Promise<PlatformTransactionResponse<T>[]>;
1917
+ protected abstract getNetworkFees(quote: AggregatedQuoteWithoutMethods, options?: unknown): Promise<PlatformNetworkFee<T>[] | undefined>;
1918
+ private tokenFactory;
1919
+ isCustom: boolean;
1920
+ constructor();
1921
+ use(coredex: CoreDex): this;
1922
+ createDexCurrency(payload: Omit<DexCurrencyConstructorPayload, 'blockchain'>): DexCurrency$1;
1923
+ isNativeAddress(tokenAddress: string): boolean;
1924
+ getNativeCurrency(chainId: ChainId): NativeCurrency;
1925
+ getAccount(baseAddress: string): Promise<Account>;
1926
+ buildQuote(quote: AggregatedQuoteWithoutMethods, _options?: {
1927
+ permitSignature?: PermitSignature;
1928
+ }): Promise<PlatformTransaction<T>[]>;
1929
+ computeQuote(quote: OriginQuote): Promise<AggregatedQuote>;
1930
+ protected getDefaultQuote(quote: OriginQuote): DefaultAggregatedQuote;
1931
+ protected getAllocatedFee(quote: AggregatedQuoteWithoutMethods): Promise<AggregatedQuoteFee | undefined>;
1932
+ private computeDevelopmentFee;
1933
+ }
1934
+
1935
+ declare class PlatformFactory extends CoreDexShared {
1936
+ private platform;
1937
+ constructor();
1938
+ use(coredex: CoreDex): this;
1939
+ fromChainId(chainId: ChainId): AbstractedPlatform<Blockchain>;
1940
+ fromQuote(quote: OriginQuote | AggregatedQuoteWithoutMethods): AbstractedPlatform<Blockchain>;
1941
+ }
1942
+
1943
+ declare class CoreDex {
1944
+ dependencies: CoreDexDependencies;
1945
+ aggregator: Aggregator;
1946
+ platform: PlatformFactory;
1947
+ updating: boolean;
1948
+ emitter: TypedEventEmitter<Record<string, (event: DexHandleQuoteEvent) => void>>;
1949
+ constructor(dependencies: CoreDexDependencies);
1950
+ private install_dependencies;
1951
+ updateDependencies(dependencies: Partial<CoreDexDependencies>): Promise<boolean>;
1952
+ getNativeAsset(chainId: number): string;
1953
+ getChainConfigId(chainConfig: ChainConfig): string;
1954
+ getAllChainConfigs(): ChainConfig[];
1955
+ getChainConfig(chainId: number): ChainConfig;
1956
+ createSignatureId(chainId: number, tokenAddress: string): string;
1957
+ confirmationBlocks(chainId: number): number;
1958
+ mixedBalanceOf(ownerAddress: string, currencies: DexCurrency$1 | DexCurrency$1[]): Promise<{
1959
+ [x: number]: {
1960
+ [x: string]: bigint;
1961
+ };
1962
+ }>;
1963
+ notify(quoteId: string, event: DexHandleQuoteEvent): void;
1964
+ get console(): {
1965
+ log: (..._args: any[]) => void;
1966
+ warn: (..._args: any[]) => void;
1967
+ info: (..._args: any[]) => void;
1968
+ error: (..._args: any[]) => void;
1969
+ };
1970
+ }
1971
+
1972
+ type GasComputeOptions = Pick<PlatformHandleTransactionOptions, 'networkFee'>;
1973
+ type GasEstimateOptions = {
1974
+ bypassApproval?: boolean;
1975
+ };
1976
+
1977
+ declare class AbstractedEVM extends AbstractedPlatform<Blockchain.EVM> {
1978
+ readonly blockchain = Blockchain.EVM;
1979
+ readonly name: string;
1980
+ nativeAddress: string;
1981
+ private approval;
1982
+ private gas;
1983
+ constructor();
1984
+ use(coredex: CoreDex): this;
1985
+ private _initiated;
1986
+ private initiate;
1987
+ getProvider(chainId: ChainId): JsonRpcProvider;
1988
+ getSigner(address: string): Promise<EthereumBaseSigner>;
1989
+ invokeSigner(chainId: ChainId, fromAddress: string): Promise<EthereumBaseSigner>;
1990
+ authorize(quote: AggregatedQuote | AggregatedQuoteWithoutMethods): Promise<PermitSignature | undefined>;
1991
+ balanceOf(chainId: ChainId, baseAddress: string, tokenAddress: string): Promise<bigint>;
1992
+ batchBalanceOf(chainId: ChainId, account: string, tokenAddresses: string[], callLimit?: number): Promise<Record<string, bigint>>;
1993
+ buildQuote(quote: AggregatedQuote | AggregatedQuoteWithoutMethods): Promise<TransactionRequest[]>;
1994
+ populateTransaction(tx: TransactionRequest): Promise<TransactionRequest>;
1995
+ protected getNetworkFees(quote: AggregatedQuoteWithoutMethods, options?: GasEstimateOptions): Promise<PlatformNetworkFee<Blockchain.EVM>[]>;
1996
+ sendTransaction(chainId: ChainId, from: string, txRequest: TransactionLike, options?: PlatformHandleTransactionOptions): Promise<TransactionResponse>;
1997
+ sendBatchTransaction(chainId: ChainId, from: string, txRequests: TransactionLike[], { onSuccess, onFailure, ...options }?: PlatformHandleTransactionOptions): Promise<TransactionResponse[]>;
1998
+ private multicallErc20Balances;
1999
+ gasSuggestion(chainId: ChainId): Promise<NetworkSuggestionFee>;
2000
+ private estimateGasLimit;
2001
+ private nativeBalanceOf;
2002
+ wrap(baseAddress: string, amount: CurrencyAmount<DexCurrency$1>, options?: PlatformHandleTransactionOptions): Promise<ethers.ContractTransactionResponse>;
2003
+ unwrap(baseAddress: string, amount: CurrencyAmount<DexCurrency$1>, options?: PlatformHandleTransactionOptions): Promise<ethers.ContractTransactionResponse>;
2004
+ }
2005
+
2006
+ declare class GasEstimator {
2007
+ private coredex;
2008
+ constructor(coredex: CoreDex);
2009
+ compute(tx: TransactionRequest, options?: GasComputeOptions): Promise<TransactionRequest>;
2010
+ estimate(tx: TransactionRequest, options?: GasEstimateOptions): Promise<string>;
2011
+ private estimateWithApprovalBypass;
2012
+ getFeeData(chainId: number, feeLevel?: NetworkFeeLevel): Promise<LegacyFeeData | EIP1559FeeData>;
2013
+ suggestion(chainId: number): Promise<NetworkSuggestionFee>;
2014
+ private getProviderFeeData;
2015
+ }
2016
+
2017
+ declare class AbstractedSVM extends AbstractedPlatform<Blockchain.SOLANA> {
2018
+ readonly blockchain = Blockchain.SOLANA;
2019
+ readonly name: string;
2020
+ nativeAddress: string;
2021
+ constructor();
2022
+ use(coredex: CoreDex): this;
2023
+ private _initiated;
2024
+ private initiate;
2025
+ getProvider(chainId?: ChainId): Connection;
2026
+ getSigner(address: string): Promise<SolanaSignerV1>;
2027
+ invokeSigner(chainId: ChainId, fromAddress: string): Promise<SolanaSignerV1>;
2028
+ buildQuote(quote: AggregatedQuoteWithoutMethods): Promise<(Transaction | VersionedTransaction)[]>;
2029
+ wrap(baseAccount: string, amount: CurrencyAmount<DexCurrency$1>, options?: PlatformHandleTransactionOptions): Promise<string>;
2030
+ unwrap(baseAccount: string, amount: CurrencyAmount<DexCurrency$1>, options?: PlatformHandleTransactionOptions): Promise<string>;
2031
+ sendTransaction(chainId: ChainId, from: string, txRequest: Transaction | VersionedTransaction, options?: PlatformHandleTransactionOptions): Promise<string>;
2032
+ sendBatchTransaction(chainId: ChainId, from: string, txRequests: Array<Transaction | VersionedTransaction>, { onSuccess, onFailure, ...options }?: PlatformHandleTransactionOptions): Promise<string[]>;
2033
+ nativeBalanceOf(chainId: ChainId, account: string): Promise<bigint>;
2034
+ balanceOf(chainId: ChainId, account: string, tokenAddress: string): Promise<bigint>;
2035
+ batchBalanceOf(chainId: ChainId, account: string, tokenAddresses: string[]): Promise<Record<string, bigint>>;
2036
+ protected getNetworkFees(quote: AggregatedQuoteWithoutMethods): Promise<PlatformNetworkFee<Blockchain.SOLANA>[] | undefined>;
2037
+ getTransactionFeeFromTxHash(txHash: string): Promise<number | undefined>;
2038
+ verifyNetworkFee(quote: AggregatedQuoteWithoutMethods, txHash: string): Promise<{
2039
+ estimated: BigNumber$1;
2040
+ actual: BigNumber$1 | undefined;
2041
+ actualLamports: number | undefined;
2042
+ difference: BigNumber$1 | undefined;
2043
+ match: boolean;
2044
+ }>;
2045
+ private getAccountInfo;
2046
+ private wSolAccount;
2047
+ private getWSolBalance;
2048
+ private handlePartialUnwrap;
2049
+ private getLatestBlockhash;
2050
+ private getTokenProgramId;
2051
+ private populateTransaction;
2052
+ private waitForReceipt;
2053
+ private computeTxFee;
2054
+ private batchSplTokenBalances;
2055
+ }
2056
+
2057
+ declare const DEFAULT_SLIPPAGE: Percent;
2058
+ declare const BIPS_BASE = 10000;
2059
+ declare const DEFAULT_DEADLINE_FROM_NOW: number;
2060
+
2061
+ declare function maxAmountSpend(currencyAmount?: CurrencyAmount<DexCurrency$1>): CurrencyAmount<DexCurrency$1> | undefined;
2062
+ declare function tradeMeaningfullyDiffers(quote: AggregatedQuote, nextQuote: AggregatedQuote): boolean;
2063
+
2064
+ declare function computeNetworkCost(feeData: LegacyFeeData | EIP1559FeeData, gasLimit: string): BigNumber$2;
2065
+
2066
+ declare function createSignatureId(rpcUrl: string, tokenAddress: string): string;
2067
+ declare function parseSignatureId(sigil: string): [string, string];
2068
+
2069
+ declare class DexFactory {
2070
+ private coredex;
2071
+ private racer;
2072
+ constructor(coredex: CoreDex);
2073
+ setLocation(location: string): void;
2074
+ updateDeps(dependencies: Partial<CoreDexDependencies>): Promise<void>;
2075
+ getCurrencySigil(currency: DexCurrency$1): string;
2076
+ getNativeCurrency(chainId: number): NativeCurrency;
2077
+ balanceOf(account: string, currency: DexCurrency$1 | DexCurrency$1[]): Promise<{
2078
+ ids: string[];
2079
+ data: Record<string, string>;
2080
+ }>;
2081
+ getDexTokens(chainId: number, options?: GetTokensOptions): Promise<GetDexTokensResponse>;
2082
+ getQuotes(payload: FindRoutesPayload): Promise<AggregatedQuote[]>;
2083
+ build(quote: AggregatedQuote, options?: {
2084
+ permitSignature?: PermitSignature;
2085
+ }): Promise<PlatformTransaction<Blockchain>[]>;
2086
+ handle(quote: AggregatedQuote, { waitForReceipt, ...options }?: Pick<PlatformHandleTransactionOptions, 'networkFee' | 'waitForReceipt'>): Promise<unknown>;
2087
+ createDexCurrency(payload: DexCurrencyConstructorPayload): DexToken | NativeCurrency;
2088
+ subscribe(quoteId: string, callback: (event: DexHandleQuoteEvent) => void): () => TypedEventEmitter<Record<string, (event: DexHandleQuoteEvent) => void>>;
2089
+ }
2090
+
2091
+ export { AbstractedEVM, AbstractedPlatform, AbstractedSVM, type Account, type AggregatedQuote, type AggregatedQuoteAmounts, type AggregatedQuoteFee, type AggregatedQuoteFeeAllocation, AggregatedQuoteFeeType, BIPS_BASE, type BalanceResult, Blockchain, Blockchain as BlockchainEnum, type BuildRoutesPayload, type BuildRoutesResponse, type ChainConfig, type ChainId, CoreDex, type CoreDexDependencies, DEFAULT_DEADLINE_FROM_NOW, DEFAULT_SLIPPAGE, type DexCurrency$1 as DexCurrency, type DexCurrencyConstructorPayload, type DexFactoryBuildOptions, type DexHandleQuoteEvent, DexHandleQuoteState, DexToken, type EIP1559FeeData, EVMChainId, EVMChainId as EVMChainIdEnum, EthereumBaseSigner, Field, type FindRoutesPayload, type FindRoutesResponse, GasEstimator, type GetTokensOptions as GetDexTokensOptions, type GetDexTokensResponse, type IBaseSigner, type IProviderManager, type LegacyFeeData, NATIVE_ADDRESS, NativeCurrency, type NetworkFeeInfo, NetworkFeeLevel, type NetworkFeeType, type NetworkSuggestionFee, PlatformFactory, type PlatformHandleTransactionOptions, type PlatformNetworkFee, type PlatformProvider, type PlatformSigner, type PlatformTransaction, type PlatformTransactionResponse, PriceImpactLevel, SolanaDexToken, type SolanaSignerV1, TokenStandard, TokenStandard as TokenStandardEnum, type TradeDirection, WalletType, WalletType as WalletTypeEnum, type WarningSeverity, type WrapInfo, WrapType, computeNetworkCost, createSignatureId, DexFactory as default, maxAmountSpend, parseSignatureId, tradeMeaningfullyDiffers };