@rabby-wallet/rabby-swap 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/abi.js ADDED
@@ -0,0 +1,545 @@
1
+ export const OneInchABI = [
2
+ {
3
+ inputs: [
4
+ {
5
+ internalType: "contract IAggregationExecutor",
6
+ name: "executor",
7
+ type: "address",
8
+ },
9
+ {
10
+ components: [
11
+ {
12
+ internalType: "contract IERC20",
13
+ name: "srcToken",
14
+ type: "address",
15
+ },
16
+ {
17
+ internalType: "contract IERC20",
18
+ name: "dstToken",
19
+ type: "address",
20
+ },
21
+ {
22
+ internalType: "address payable",
23
+ name: "srcReceiver",
24
+ type: "address",
25
+ },
26
+ {
27
+ internalType: "address payable",
28
+ name: "dstReceiver",
29
+ type: "address",
30
+ },
31
+ { internalType: "uint256", name: "amount", type: "uint256" },
32
+ { internalType: "uint256", name: "minReturnAmount", type: "uint256" },
33
+ { internalType: "uint256", name: "flags", type: "uint256" },
34
+ ],
35
+ internalType: "struct GenericRouter.SwapDescription",
36
+ name: "desc",
37
+ type: "tuple",
38
+ },
39
+ { internalType: "bytes", name: "permit", type: "bytes" },
40
+ { internalType: "bytes", name: "data", type: "bytes" },
41
+ ],
42
+ name: "swap",
43
+ outputs: [
44
+ { internalType: "uint256", name: "returnAmount", type: "uint256" },
45
+ { internalType: "uint256", name: "spentAmount", type: "uint256" },
46
+ ],
47
+ stateMutability: "payable",
48
+ type: "function",
49
+ },
50
+ {
51
+ inputs: [
52
+ { internalType: "uint256", name: "amount", type: "uint256" },
53
+ { internalType: "uint256", name: "minReturn", type: "uint256" },
54
+ { internalType: "uint256[]", name: "pools", type: "uint256[]" },
55
+ ],
56
+ name: "uniswapV3Swap",
57
+ outputs: [
58
+ { internalType: "uint256", name: "returnAmount", type: "uint256" },
59
+ ],
60
+ stateMutability: "payable",
61
+ type: "function",
62
+ },
63
+ {
64
+ inputs: [
65
+ { internalType: "address payable", name: "recipient", type: "address" },
66
+ { internalType: "uint256", name: "amount", type: "uint256" },
67
+ { internalType: "uint256", name: "minReturn", type: "uint256" },
68
+ { internalType: "uint256[]", name: "pools", type: "uint256[]" },
69
+ ],
70
+ name: "uniswapV3SwapTo",
71
+ outputs: [
72
+ { internalType: "uint256", name: "returnAmount", type: "uint256" },
73
+ ],
74
+ stateMutability: "payable",
75
+ type: "function",
76
+ },
77
+ {
78
+ inputs: [
79
+ { internalType: "contract IERC20", name: "srcToken", type: "address" },
80
+ { internalType: "uint256", name: "amount", type: "uint256" },
81
+ { internalType: "uint256", name: "minReturn", type: "uint256" },
82
+ { internalType: "uint256[]", name: "pools", type: "uint256[]" },
83
+ ],
84
+ name: "unoswap",
85
+ outputs: [
86
+ { internalType: "uint256", name: "returnAmount", type: "uint256" },
87
+ ],
88
+ stateMutability: "payable",
89
+ type: "function",
90
+ },
91
+ {
92
+ inputs: [
93
+ { internalType: "address payable", name: "recipient", type: "address" },
94
+ { internalType: "contract IERC20", name: "srcToken", type: "address" },
95
+ { internalType: "uint256", name: "amount", type: "uint256" },
96
+ { internalType: "uint256", name: "minReturn", type: "uint256" },
97
+ { internalType: "uint256[]", name: "pools", type: "uint256[]" },
98
+ ],
99
+ name: "unoswapTo",
100
+ outputs: [
101
+ { internalType: "uint256", name: "returnAmount", type: "uint256" },
102
+ ],
103
+ stateMutability: "payable",
104
+ type: "function",
105
+ },
106
+ ];
107
+ export const ZeroXABI = [
108
+ {
109
+ inputs: [
110
+ {
111
+ name: "inputToken",
112
+ type: "address",
113
+ },
114
+ {
115
+ name: "outputToken",
116
+ type: "address",
117
+ },
118
+ {
119
+ name: "inputTokenAmount",
120
+ type: "uint256",
121
+ },
122
+ {
123
+ name: "minOutputTokenAmount",
124
+ type: "uint256",
125
+ },
126
+ {
127
+ name: "transformations",
128
+ type: "(uint32,bytes)[]",
129
+ components: [
130
+ {
131
+ name: "deploymentNonce",
132
+ type: "uint32",
133
+ },
134
+ {
135
+ name: "data",
136
+ type: "bytes",
137
+ },
138
+ ],
139
+ },
140
+ ],
141
+ name: "transformERC20",
142
+ outputs: [
143
+ {
144
+ name: "outputTokenAmount",
145
+ type: "uint256",
146
+ },
147
+ ],
148
+ stateMutability: "payable",
149
+ type: "function",
150
+ },
151
+ ];
152
+ export const ParaSwapABI = [
153
+ {
154
+ inputs: [
155
+ {
156
+ components: [
157
+ {
158
+ internalType: "address",
159
+ name: "fromToken",
160
+ type: "address",
161
+ },
162
+ {
163
+ internalType: "uint256",
164
+ name: "fromAmount",
165
+ type: "uint256",
166
+ },
167
+ {
168
+ internalType: "uint256",
169
+ name: "toAmount",
170
+ type: "uint256",
171
+ },
172
+ {
173
+ internalType: "uint256",
174
+ name: "expectedAmount",
175
+ type: "uint256",
176
+ },
177
+ {
178
+ internalType: "address payable",
179
+ name: "beneficiary",
180
+ type: "address",
181
+ },
182
+ {
183
+ components: [
184
+ {
185
+ internalType: "uint256",
186
+ name: "fromAmountPercent",
187
+ type: "uint256",
188
+ },
189
+ {
190
+ components: [
191
+ {
192
+ internalType: "address",
193
+ name: "to",
194
+ type: "address",
195
+ },
196
+ {
197
+ internalType: "uint256",
198
+ name: "totalNetworkFee",
199
+ type: "uint256",
200
+ },
201
+ {
202
+ components: [
203
+ {
204
+ internalType: "address payable",
205
+ name: "adapter",
206
+ type: "address",
207
+ },
208
+ {
209
+ internalType: "uint256",
210
+ name: "percent",
211
+ type: "uint256",
212
+ },
213
+ {
214
+ internalType: "uint256",
215
+ name: "networkFee",
216
+ type: "uint256",
217
+ },
218
+ {
219
+ components: [
220
+ {
221
+ internalType: "uint256",
222
+ name: "index",
223
+ type: "uint256",
224
+ },
225
+ {
226
+ internalType: "address",
227
+ name: "targetExchange",
228
+ type: "address",
229
+ },
230
+ {
231
+ internalType: "uint256",
232
+ name: "percent",
233
+ type: "uint256",
234
+ },
235
+ {
236
+ internalType: "bytes",
237
+ name: "payload",
238
+ type: "bytes",
239
+ },
240
+ {
241
+ internalType: "uint256",
242
+ name: "networkFee",
243
+ type: "uint256",
244
+ },
245
+ ],
246
+ internalType: "struct Utils.Route[]",
247
+ name: "route",
248
+ type: "tuple[]",
249
+ },
250
+ ],
251
+ internalType: "struct Utils.Adapter[]",
252
+ name: "adapters",
253
+ type: "tuple[]",
254
+ },
255
+ ],
256
+ internalType: "struct Utils.Path[]",
257
+ name: "path",
258
+ type: "tuple[]",
259
+ },
260
+ ],
261
+ internalType: "struct Utils.MegaSwapPath[]",
262
+ name: "path",
263
+ type: "tuple[]",
264
+ },
265
+ {
266
+ internalType: "address payable",
267
+ name: "partner",
268
+ type: "address",
269
+ },
270
+ {
271
+ internalType: "uint256",
272
+ name: "feePercent",
273
+ type: "uint256",
274
+ },
275
+ {
276
+ internalType: "bytes",
277
+ name: "permit",
278
+ type: "bytes",
279
+ },
280
+ {
281
+ internalType: "uint256",
282
+ name: "deadline",
283
+ type: "uint256",
284
+ },
285
+ {
286
+ internalType: "bytes16",
287
+ name: "uuid",
288
+ type: "bytes16",
289
+ },
290
+ ],
291
+ internalType: "struct Utils.MegaSwapSellData",
292
+ name: "data",
293
+ type: "tuple",
294
+ },
295
+ ],
296
+ name: "megaSwap",
297
+ outputs: [
298
+ {
299
+ internalType: "uint256",
300
+ name: "",
301
+ type: "uint256",
302
+ },
303
+ ],
304
+ stateMutability: "payable",
305
+ type: "function",
306
+ },
307
+ {
308
+ inputs: [
309
+ {
310
+ components: [
311
+ {
312
+ internalType: "address",
313
+ name: "fromToken",
314
+ type: "address",
315
+ },
316
+ {
317
+ internalType: "uint256",
318
+ name: "fromAmount",
319
+ type: "uint256",
320
+ },
321
+ {
322
+ internalType: "uint256",
323
+ name: "toAmount",
324
+ type: "uint256",
325
+ },
326
+ {
327
+ internalType: "uint256",
328
+ name: "expectedAmount",
329
+ type: "uint256",
330
+ },
331
+ {
332
+ internalType: "address payable",
333
+ name: "beneficiary",
334
+ type: "address",
335
+ },
336
+ {
337
+ components: [
338
+ {
339
+ internalType: "address",
340
+ name: "to",
341
+ type: "address",
342
+ },
343
+ {
344
+ internalType: "uint256",
345
+ name: "totalNetworkFee",
346
+ type: "uint256",
347
+ },
348
+ {
349
+ components: [
350
+ {
351
+ internalType: "address payable",
352
+ name: "adapter",
353
+ type: "address",
354
+ },
355
+ {
356
+ internalType: "uint256",
357
+ name: "percent",
358
+ type: "uint256",
359
+ },
360
+ {
361
+ internalType: "uint256",
362
+ name: "networkFee",
363
+ type: "uint256",
364
+ },
365
+ {
366
+ components: [
367
+ {
368
+ internalType: "uint256",
369
+ name: "index",
370
+ type: "uint256",
371
+ },
372
+ {
373
+ internalType: "address",
374
+ name: "targetExchange",
375
+ type: "address",
376
+ },
377
+ {
378
+ internalType: "uint256",
379
+ name: "percent",
380
+ type: "uint256",
381
+ },
382
+ {
383
+ internalType: "bytes",
384
+ name: "payload",
385
+ type: "bytes",
386
+ },
387
+ {
388
+ internalType: "uint256",
389
+ name: "networkFee",
390
+ type: "uint256",
391
+ },
392
+ ],
393
+ internalType: "struct Utils.Route[]",
394
+ name: "route",
395
+ type: "tuple[]",
396
+ },
397
+ ],
398
+ internalType: "struct Utils.Adapter[]",
399
+ name: "adapters",
400
+ type: "tuple[]",
401
+ },
402
+ ],
403
+ internalType: "struct Utils.Path[]",
404
+ name: "path",
405
+ type: "tuple[]",
406
+ },
407
+ {
408
+ internalType: "address payable",
409
+ name: "partner",
410
+ type: "address",
411
+ },
412
+ {
413
+ internalType: "uint256",
414
+ name: "feePercent",
415
+ type: "uint256",
416
+ },
417
+ {
418
+ internalType: "bytes",
419
+ name: "permit",
420
+ type: "bytes",
421
+ },
422
+ {
423
+ internalType: "uint256",
424
+ name: "deadline",
425
+ type: "uint256",
426
+ },
427
+ {
428
+ internalType: "bytes16",
429
+ name: "uuid",
430
+ type: "bytes16",
431
+ },
432
+ ],
433
+ internalType: "struct Utils.SellData",
434
+ name: "data",
435
+ type: "tuple",
436
+ },
437
+ ],
438
+ name: "multiSwap",
439
+ outputs: [
440
+ {
441
+ internalType: "uint256",
442
+ name: "",
443
+ type: "uint256",
444
+ },
445
+ ],
446
+ stateMutability: "payable",
447
+ type: "function",
448
+ },
449
+ {
450
+ inputs: [
451
+ {
452
+ components: [
453
+ {
454
+ internalType: "address",
455
+ name: "fromToken",
456
+ type: "address",
457
+ },
458
+ {
459
+ internalType: "address",
460
+ name: "toToken",
461
+ type: "address",
462
+ },
463
+ {
464
+ internalType: "uint256",
465
+ name: "fromAmount",
466
+ type: "uint256",
467
+ },
468
+ {
469
+ internalType: "uint256",
470
+ name: "toAmount",
471
+ type: "uint256",
472
+ },
473
+ {
474
+ internalType: "uint256",
475
+ name: "expectedAmount",
476
+ type: "uint256",
477
+ },
478
+ {
479
+ internalType: "address[]",
480
+ name: "callees",
481
+ type: "address[]",
482
+ },
483
+ {
484
+ internalType: "bytes",
485
+ name: "exchangeData",
486
+ type: "bytes",
487
+ },
488
+ {
489
+ internalType: "uint256[]",
490
+ name: "startIndexes",
491
+ type: "uint256[]",
492
+ },
493
+ {
494
+ internalType: "uint256[]",
495
+ name: "values",
496
+ type: "uint256[]",
497
+ },
498
+ {
499
+ internalType: "address payable",
500
+ name: "beneficiary",
501
+ type: "address",
502
+ },
503
+ {
504
+ internalType: "address payable",
505
+ name: "partner",
506
+ type: "address",
507
+ },
508
+ {
509
+ internalType: "uint256",
510
+ name: "feePercent",
511
+ type: "uint256",
512
+ },
513
+ {
514
+ internalType: "bytes",
515
+ name: "permit",
516
+ type: "bytes",
517
+ },
518
+ {
519
+ internalType: "uint256",
520
+ name: "deadline",
521
+ type: "uint256",
522
+ },
523
+ {
524
+ internalType: "bytes16",
525
+ name: "uuid",
526
+ type: "bytes16",
527
+ },
528
+ ],
529
+ internalType: "struct Utils.SimpleData",
530
+ name: "data",
531
+ type: "tuple",
532
+ },
533
+ ],
534
+ name: "simpleSwap",
535
+ outputs: [
536
+ {
537
+ internalType: "uint256",
538
+ name: "receivedAmount",
539
+ type: "uint256",
540
+ },
541
+ ],
542
+ stateMutability: "payable",
543
+ type: "function",
544
+ },
545
+ ];
package/dist/consts.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CHAINS_ENUM } from '@debank/common';
1
+ import { CHAINS_ENUM } from "@debank/common";
2
2
  export declare enum DEX_ENUM {
3
3
  ONEINCH = "1inch",
4
4
  PARASWAP = "ParaSwap",
@@ -22,3 +22,63 @@ export declare const DEX_SUPPORT_CHAINS: {
22
22
  ParaSwap: CHAINS_ENUM[];
23
23
  "0xAPI": CHAINS_ENUM[];
24
24
  };
25
+ export declare const DEX_ROUTER_WHITELIST: {
26
+ "1inch": {
27
+ ETH: string;
28
+ POLYGON: string;
29
+ BSC: string;
30
+ OP: string;
31
+ FTM: string;
32
+ AVAX: string;
33
+ ARBITRUM: string;
34
+ KLAY: string;
35
+ GNOSIS: string;
36
+ CELO: string;
37
+ };
38
+ ParaSwap: {
39
+ ETH: string;
40
+ POLYGON: string;
41
+ BSC: string;
42
+ AVAX: string;
43
+ };
44
+ "0xAPI": {
45
+ ETH: string;
46
+ POLYGON: string;
47
+ BSC: string;
48
+ OP: string;
49
+ FTM: string;
50
+ CELO: string;
51
+ AVAX: string;
52
+ ARBITRUM: string;
53
+ };
54
+ };
55
+ export declare const DEX_SPENDER_WHITELIST: {
56
+ "1inch": {
57
+ ETH: string;
58
+ POLYGON: string;
59
+ BSC: string;
60
+ OP: string;
61
+ FTM: string;
62
+ AVAX: string;
63
+ ARBITRUM: string;
64
+ KLAY: string;
65
+ GNOSIS: string;
66
+ CELO: string;
67
+ };
68
+ ParaSwap: {
69
+ ETH: string;
70
+ POLYGON: string;
71
+ BSC: string;
72
+ AVAX: string;
73
+ };
74
+ "0xAPI": {
75
+ ETH: string;
76
+ POLYGON: string;
77
+ BSC: string;
78
+ OP: string;
79
+ FTM: string;
80
+ CELO: string;
81
+ AVAX: string;
82
+ ARBITRUM: string;
83
+ };
84
+ };