@swapkit/core 0.0.0-nightly-20240208140027

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.
Files changed (39) hide show
  1. package/LICENSE +201 -0
  2. package/dist/index.cjs +3 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.ts +305 -0
  5. package/dist/index.es.js +9109 -0
  6. package/dist/index.es.js.map +1 -0
  7. package/package.json +60 -0
  8. package/src/aggregator/contracts/avaxGeneric.ts +92 -0
  9. package/src/aggregator/contracts/avaxWoofi.ts +145 -0
  10. package/src/aggregator/contracts/bscGeneric.ts +106 -0
  11. package/src/aggregator/contracts/ethGeneric.ts +92 -0
  12. package/src/aggregator/contracts/index.ts +76 -0
  13. package/src/aggregator/contracts/pancakeV2.ts +145 -0
  14. package/src/aggregator/contracts/pangolin.ts +120 -0
  15. package/src/aggregator/contracts/routers/index.ts +58 -0
  16. package/src/aggregator/contracts/routers/kyber.ts +402 -0
  17. package/src/aggregator/contracts/routers/oneinch.ts +2188 -0
  18. package/src/aggregator/contracts/routers/pancakeswap.ts +340 -0
  19. package/src/aggregator/contracts/routers/pangolin.ts +340 -0
  20. package/src/aggregator/contracts/routers/sushiswap.ts +340 -0
  21. package/src/aggregator/contracts/routers/traderJoe.ts +340 -0
  22. package/src/aggregator/contracts/routers/uniswapv2.ts +340 -0
  23. package/src/aggregator/contracts/routers/uniswapv3.ts +254 -0
  24. package/src/aggregator/contracts/routers/woofi.ts +171 -0
  25. package/src/aggregator/contracts/sushiswap.ts +120 -0
  26. package/src/aggregator/contracts/traderJoe.ts +120 -0
  27. package/src/aggregator/contracts/uniswapV2.ts +120 -0
  28. package/src/aggregator/contracts/uniswapV2Leg.ts +128 -0
  29. package/src/aggregator/contracts/uniswapV3_100.ts +128 -0
  30. package/src/aggregator/contracts/uniswapV3_10000.ts +128 -0
  31. package/src/aggregator/contracts/uniswapV3_3000.ts +128 -0
  32. package/src/aggregator/contracts/uniswapV3_500.ts +128 -0
  33. package/src/aggregator/getSwapParams.ts +70 -0
  34. package/src/client/__tests__/helpers.test.ts +77 -0
  35. package/src/client/explorerUrls.ts +61 -0
  36. package/src/client/index.ts +769 -0
  37. package/src/client/thornode.ts +31 -0
  38. package/src/client/types.ts +108 -0
  39. package/src/index.ts +4 -0
@@ -0,0 +1,402 @@
1
+ export const kyberRouter = [
2
+ {
3
+ inputs: [{ internalType: 'address', name: '_WETH', type: 'address' }],
4
+ stateMutability: 'nonpayable',
5
+ type: 'constructor',
6
+ },
7
+ {
8
+ anonymous: false,
9
+ inputs: [
10
+ {
11
+ indexed: false,
12
+ internalType: 'bytes',
13
+ name: 'clientData',
14
+ type: 'bytes',
15
+ },
16
+ ],
17
+ name: 'ClientData',
18
+ type: 'event',
19
+ },
20
+ {
21
+ anonymous: false,
22
+ inputs: [
23
+ {
24
+ indexed: false,
25
+ internalType: 'string',
26
+ name: 'reason',
27
+ type: 'string',
28
+ },
29
+ ],
30
+ name: 'Error',
31
+ type: 'event',
32
+ },
33
+ {
34
+ anonymous: false,
35
+ inputs: [
36
+ {
37
+ indexed: false,
38
+ internalType: 'address',
39
+ name: 'pair',
40
+ type: 'address',
41
+ },
42
+ {
43
+ indexed: false,
44
+ internalType: 'uint256',
45
+ name: 'amountOut',
46
+ type: 'uint256',
47
+ },
48
+ {
49
+ indexed: false,
50
+ internalType: 'address',
51
+ name: 'output',
52
+ type: 'address',
53
+ },
54
+ ],
55
+ name: 'Exchange',
56
+ type: 'event',
57
+ },
58
+ {
59
+ anonymous: false,
60
+ inputs: [
61
+ {
62
+ indexed: false,
63
+ internalType: 'address',
64
+ name: 'token',
65
+ type: 'address',
66
+ },
67
+ {
68
+ indexed: false,
69
+ internalType: 'uint256',
70
+ name: 'totalAmount',
71
+ type: 'uint256',
72
+ },
73
+ {
74
+ indexed: false,
75
+ internalType: 'uint256',
76
+ name: 'totalFee',
77
+ type: 'uint256',
78
+ },
79
+ {
80
+ indexed: false,
81
+ internalType: 'address[]',
82
+ name: 'recipients',
83
+ type: 'address[]',
84
+ },
85
+ {
86
+ indexed: false,
87
+ internalType: 'uint256[]',
88
+ name: 'amounts',
89
+ type: 'uint256[]',
90
+ },
91
+ { indexed: false, internalType: 'bool', name: 'isBps', type: 'bool' },
92
+ ],
93
+ name: 'Fee',
94
+ type: 'event',
95
+ },
96
+ {
97
+ anonymous: false,
98
+ inputs: [
99
+ {
100
+ indexed: true,
101
+ internalType: 'address',
102
+ name: 'previousOwner',
103
+ type: 'address',
104
+ },
105
+ {
106
+ indexed: true,
107
+ internalType: 'address',
108
+ name: 'newOwner',
109
+ type: 'address',
110
+ },
111
+ ],
112
+ name: 'OwnershipTransferred',
113
+ type: 'event',
114
+ },
115
+ {
116
+ anonymous: false,
117
+ inputs: [
118
+ {
119
+ indexed: false,
120
+ internalType: 'address',
121
+ name: 'sender',
122
+ type: 'address',
123
+ },
124
+ {
125
+ indexed: false,
126
+ internalType: 'contract IERC20',
127
+ name: 'srcToken',
128
+ type: 'address',
129
+ },
130
+ {
131
+ indexed: false,
132
+ internalType: 'contract IERC20',
133
+ name: 'dstToken',
134
+ type: 'address',
135
+ },
136
+ {
137
+ indexed: false,
138
+ internalType: 'address',
139
+ name: 'dstReceiver',
140
+ type: 'address',
141
+ },
142
+ {
143
+ indexed: false,
144
+ internalType: 'uint256',
145
+ name: 'spentAmount',
146
+ type: 'uint256',
147
+ },
148
+ {
149
+ indexed: false,
150
+ internalType: 'uint256',
151
+ name: 'returnAmount',
152
+ type: 'uint256',
153
+ },
154
+ ],
155
+ name: 'Swapped',
156
+ type: 'event',
157
+ },
158
+ {
159
+ inputs: [],
160
+ name: 'WETH',
161
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
162
+ stateMutability: 'view',
163
+ type: 'function',
164
+ },
165
+ {
166
+ inputs: [{ internalType: 'address', name: '', type: 'address' }],
167
+ name: 'isWhitelist',
168
+ outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
169
+ stateMutability: 'view',
170
+ type: 'function',
171
+ },
172
+ {
173
+ inputs: [],
174
+ name: 'owner',
175
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
176
+ stateMutability: 'view',
177
+ type: 'function',
178
+ },
179
+ {
180
+ inputs: [],
181
+ name: 'renounceOwnership',
182
+ outputs: [],
183
+ stateMutability: 'nonpayable',
184
+ type: 'function',
185
+ },
186
+ {
187
+ inputs: [
188
+ { internalType: 'address', name: 'token', type: 'address' },
189
+ { internalType: 'uint256', name: 'amount', type: 'uint256' },
190
+ ],
191
+ name: 'rescueFunds',
192
+ outputs: [],
193
+ stateMutability: 'nonpayable',
194
+ type: 'function',
195
+ },
196
+ {
197
+ inputs: [
198
+ {
199
+ components: [
200
+ { internalType: 'address', name: 'callTarget', type: 'address' },
201
+ { internalType: 'address', name: 'approveTarget', type: 'address' },
202
+ { internalType: 'bytes', name: 'targetData', type: 'bytes' },
203
+ {
204
+ components: [
205
+ {
206
+ internalType: 'contract IERC20',
207
+ name: 'srcToken',
208
+ type: 'address',
209
+ },
210
+ {
211
+ internalType: 'contract IERC20',
212
+ name: 'dstToken',
213
+ type: 'address',
214
+ },
215
+ {
216
+ internalType: 'address[]',
217
+ name: 'srcReceivers',
218
+ type: 'address[]',
219
+ },
220
+ {
221
+ internalType: 'uint256[]',
222
+ name: 'srcAmounts',
223
+ type: 'uint256[]',
224
+ },
225
+ {
226
+ internalType: 'address[]',
227
+ name: 'feeReceivers',
228
+ type: 'address[]',
229
+ },
230
+ {
231
+ internalType: 'uint256[]',
232
+ name: 'feeAmounts',
233
+ type: 'uint256[]',
234
+ },
235
+ { internalType: 'address', name: 'dstReceiver', type: 'address' },
236
+ { internalType: 'uint256', name: 'amount', type: 'uint256' },
237
+ {
238
+ internalType: 'uint256',
239
+ name: 'minReturnAmount',
240
+ type: 'uint256',
241
+ },
242
+ { internalType: 'uint256', name: 'flags', type: 'uint256' },
243
+ { internalType: 'bytes', name: 'permit', type: 'bytes' },
244
+ ],
245
+ internalType: 'struct MetaAggregationRouterV2.SwapDescriptionV2',
246
+ name: 'desc',
247
+ type: 'tuple',
248
+ },
249
+ { internalType: 'bytes', name: 'clientData', type: 'bytes' },
250
+ ],
251
+ internalType: 'struct MetaAggregationRouterV2.SwapExecutionParams',
252
+ name: 'execution',
253
+ type: 'tuple',
254
+ },
255
+ ],
256
+ name: 'swap',
257
+ outputs: [
258
+ { internalType: 'uint256', name: 'returnAmount', type: 'uint256' },
259
+ { internalType: 'uint256', name: 'gasUsed', type: 'uint256' },
260
+ ],
261
+ stateMutability: 'payable',
262
+ type: 'function',
263
+ },
264
+ {
265
+ inputs: [
266
+ {
267
+ components: [
268
+ { internalType: 'address', name: 'callTarget', type: 'address' },
269
+ { internalType: 'address', name: 'approveTarget', type: 'address' },
270
+ { internalType: 'bytes', name: 'targetData', type: 'bytes' },
271
+ {
272
+ components: [
273
+ {
274
+ internalType: 'contract IERC20',
275
+ name: 'srcToken',
276
+ type: 'address',
277
+ },
278
+ {
279
+ internalType: 'contract IERC20',
280
+ name: 'dstToken',
281
+ type: 'address',
282
+ },
283
+ {
284
+ internalType: 'address[]',
285
+ name: 'srcReceivers',
286
+ type: 'address[]',
287
+ },
288
+ {
289
+ internalType: 'uint256[]',
290
+ name: 'srcAmounts',
291
+ type: 'uint256[]',
292
+ },
293
+ {
294
+ internalType: 'address[]',
295
+ name: 'feeReceivers',
296
+ type: 'address[]',
297
+ },
298
+ {
299
+ internalType: 'uint256[]',
300
+ name: 'feeAmounts',
301
+ type: 'uint256[]',
302
+ },
303
+ { internalType: 'address', name: 'dstReceiver', type: 'address' },
304
+ { internalType: 'uint256', name: 'amount', type: 'uint256' },
305
+ {
306
+ internalType: 'uint256',
307
+ name: 'minReturnAmount',
308
+ type: 'uint256',
309
+ },
310
+ { internalType: 'uint256', name: 'flags', type: 'uint256' },
311
+ { internalType: 'bytes', name: 'permit', type: 'bytes' },
312
+ ],
313
+ internalType: 'struct MetaAggregationRouterV2.SwapDescriptionV2',
314
+ name: 'desc',
315
+ type: 'tuple',
316
+ },
317
+ { internalType: 'bytes', name: 'clientData', type: 'bytes' },
318
+ ],
319
+ internalType: 'struct MetaAggregationRouterV2.SwapExecutionParams',
320
+ name: 'execution',
321
+ type: 'tuple',
322
+ },
323
+ ],
324
+ name: 'swapGeneric',
325
+ outputs: [
326
+ { internalType: 'uint256', name: 'returnAmount', type: 'uint256' },
327
+ { internalType: 'uint256', name: 'gasUsed', type: 'uint256' },
328
+ ],
329
+ stateMutability: 'payable',
330
+ type: 'function',
331
+ },
332
+ {
333
+ inputs: [
334
+ {
335
+ internalType: 'contract IAggregationExecutor',
336
+ name: 'caller',
337
+ type: 'address',
338
+ },
339
+ {
340
+ components: [
341
+ {
342
+ internalType: 'contract IERC20',
343
+ name: 'srcToken',
344
+ type: 'address',
345
+ },
346
+ {
347
+ internalType: 'contract IERC20',
348
+ name: 'dstToken',
349
+ type: 'address',
350
+ },
351
+ {
352
+ internalType: 'address[]',
353
+ name: 'srcReceivers',
354
+ type: 'address[]',
355
+ },
356
+ { internalType: 'uint256[]', name: 'srcAmounts', type: 'uint256[]' },
357
+ {
358
+ internalType: 'address[]',
359
+ name: 'feeReceivers',
360
+ type: 'address[]',
361
+ },
362
+ { internalType: 'uint256[]', name: 'feeAmounts', type: 'uint256[]' },
363
+ { internalType: 'address', name: 'dstReceiver', type: 'address' },
364
+ { internalType: 'uint256', name: 'amount', type: 'uint256' },
365
+ { internalType: 'uint256', name: 'minReturnAmount', type: 'uint256' },
366
+ { internalType: 'uint256', name: 'flags', type: 'uint256' },
367
+ { internalType: 'bytes', name: 'permit', type: 'bytes' },
368
+ ],
369
+ internalType: 'struct MetaAggregationRouterV2.SwapDescriptionV2',
370
+ name: 'desc',
371
+ type: 'tuple',
372
+ },
373
+ { internalType: 'bytes', name: 'executorData', type: 'bytes' },
374
+ { internalType: 'bytes', name: 'clientData', type: 'bytes' },
375
+ ],
376
+ name: 'swapSimpleMode',
377
+ outputs: [
378
+ { internalType: 'uint256', name: 'returnAmount', type: 'uint256' },
379
+ { internalType: 'uint256', name: 'gasUsed', type: 'uint256' },
380
+ ],
381
+ stateMutability: 'nonpayable',
382
+ type: 'function',
383
+ },
384
+ {
385
+ inputs: [{ internalType: 'address', name: 'newOwner', type: 'address' }],
386
+ name: 'transferOwnership',
387
+ outputs: [],
388
+ stateMutability: 'nonpayable',
389
+ type: 'function',
390
+ },
391
+ {
392
+ inputs: [
393
+ { internalType: 'address[]', name: 'addr', type: 'address[]' },
394
+ { internalType: 'bool[]', name: 'value', type: 'bool[]' },
395
+ ],
396
+ name: 'updateWhitelist',
397
+ outputs: [],
398
+ stateMutability: 'nonpayable',
399
+ type: 'function',
400
+ },
401
+ { stateMutability: 'payable', type: 'receive' },
402
+ ];