@swapkit/helpers 2.5.0 → 3.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/api/index.cjs +3 -0
  2. package/dist/api/index.cjs.map +16 -0
  3. package/dist/api/index.js +3 -0
  4. package/dist/api/index.js.map +16 -0
  5. package/dist/chunk-fazw0jvt.js +3 -0
  6. package/dist/chunk-fazw0jvt.js.map +9 -0
  7. package/dist/chunk-nm00d52v.js +4 -0
  8. package/dist/chunk-nm00d52v.js.map +9 -0
  9. package/dist/contracts/index.cjs +3 -0
  10. package/dist/contracts/index.cjs.map +38 -0
  11. package/dist/contracts/index.js +3 -0
  12. package/dist/contracts/index.js.map +38 -0
  13. package/dist/index.cjs +6 -0
  14. package/dist/index.cjs.map +29 -0
  15. package/dist/index.js +3 -3
  16. package/dist/index.js.map +19 -20
  17. package/dist/tokens/index.cjs +3 -0
  18. package/dist/tokens/index.cjs.map +23 -0
  19. package/dist/tokens/index.js +3 -0
  20. package/dist/tokens/index.js.map +23 -0
  21. package/package.json +31 -15
  22. package/src/api/index.ts +19 -0
  23. package/src/api/microgard/endpoints.ts +83 -0
  24. package/src/api/microgard/types.ts +60 -0
  25. package/src/api/midgard/endpoints.ts +166 -0
  26. package/src/api/midgard/types.ts +155 -0
  27. package/src/api/swapkitApi/endpoints.ts +266 -0
  28. package/src/api/swapkitApi/types.ts +772 -0
  29. package/src/api/thornode/endpoints.ts +78 -0
  30. package/src/api/thornode/types.ts +241 -0
  31. package/src/api/thorswapStatic/endpoints.ts +30 -0
  32. package/src/api/thorswapStatic/types.ts +18 -0
  33. package/src/contracts/abis/avaxGeneric.ts +92 -0
  34. package/src/contracts/abis/avaxWoofi.ts +145 -0
  35. package/src/contracts/abis/bscGeneric.ts +106 -0
  36. package/src/contracts/abis/chainflipGateway.ts +330 -0
  37. package/src/contracts/abis/erc20.ts +99 -0
  38. package/src/contracts/abis/ethGeneric.ts +92 -0
  39. package/src/contracts/abis/mayaEvmVaults.ts +331 -0
  40. package/src/contracts/abis/pancakeV2.ts +145 -0
  41. package/src/contracts/abis/pangolin.ts +120 -0
  42. package/src/contracts/abis/sushiswap.ts +120 -0
  43. package/src/contracts/abis/tcEthVault.ts +650 -0
  44. package/src/contracts/abis/traderJoe.ts +120 -0
  45. package/src/contracts/abis/uniswapV2.ts +120 -0
  46. package/src/contracts/abis/uniswapV2Leg.ts +128 -0
  47. package/src/contracts/abis/uniswapV3_100.ts +128 -0
  48. package/src/contracts/abis/uniswapV3_10000.ts +128 -0
  49. package/src/contracts/abis/uniswapV3_3000.ts +128 -0
  50. package/src/contracts/abis/uniswapV3_500.ts +128 -0
  51. package/src/contracts/index.ts +95 -0
  52. package/src/contracts/routers/index.ts +58 -0
  53. package/src/contracts/routers/kyber.ts +402 -0
  54. package/src/contracts/routers/oneinch.ts +2188 -0
  55. package/src/contracts/routers/pancakeswap.ts +340 -0
  56. package/src/contracts/routers/pangolin.ts +340 -0
  57. package/src/contracts/routers/sushiswap.ts +340 -0
  58. package/src/contracts/routers/traderJoe.ts +340 -0
  59. package/src/contracts/routers/uniswapv2.ts +340 -0
  60. package/src/contracts/routers/uniswapv3.ts +254 -0
  61. package/src/contracts/routers/woofi.ts +171 -0
  62. package/src/index.ts +11 -12
  63. package/src/modules/__tests__/assetValue.test.ts +0 -2
  64. package/src/modules/__tests__/swapKitConfig.test.ts +37 -0
  65. package/src/modules/assetValue.ts +26 -92
  66. package/src/modules/bigIntArithmetics.ts +6 -2
  67. package/src/modules/requestClient.ts +26 -35
  68. package/src/modules/swapKitConfig.ts +131 -0
  69. package/src/modules/swapKitError.ts +6 -6
  70. package/src/tokens/index.ts +15 -0
  71. package/src/tokens/lists/camelot_v3.ts +15920 -0
  72. package/src/tokens/lists/caviar_v1.ts +1694 -0
  73. package/src/tokens/lists/chainflip.ts +104 -0
  74. package/src/tokens/lists/index.ts +13 -0
  75. package/src/tokens/lists/jupiter.ts +29606 -0
  76. package/src/tokens/lists/mayachain.ts +513 -0
  77. package/src/tokens/lists/oneinch.ts +14238 -0
  78. package/src/tokens/lists/openocean_v2.ts +11514 -0
  79. package/src/tokens/lists/pancakeswap.ts +4296 -0
  80. package/src/tokens/lists/pangolin_v1.ts +175 -0
  81. package/src/tokens/lists/sushiswap_v2.ts +965 -0
  82. package/src/tokens/lists/thorchain.ts +669 -0
  83. package/src/tokens/lists/traderjoe_v2.ts +1384 -0
  84. package/src/tokens/lists/uniswap_v2.ts +5596 -0
  85. package/src/tokens/lists/uniswap_v3.ts +5946 -0
  86. package/src/types/chains.ts +26 -46
  87. package/src/types/commonTypes.ts +3 -90
  88. package/src/types/index.ts +3 -4
  89. package/src/types/sdk.ts +0 -30
  90. package/src/types/tokens.ts +2 -2
  91. package/src/types/wallet.ts +37 -21
  92. package/src/{helpers → utils}/asset.ts +49 -19
  93. package/src/{helpers → utils}/derivationPath.ts +7 -2
  94. package/src/{helpers → utils}/memo.ts +0 -65
  95. package/src/{helpers → utils}/others.ts +12 -5
  96. package/src/utils/plugin.ts +13 -0
  97. package/src/{helpers/web3wallets.ts → utils/wallets.ts} +175 -139
  98. package/src/modules/walletUtils.ts +0 -30
  99. package/src/types/network.ts +0 -49
  100. /package/src/{helpers → utils}/__tests__/asset.test.ts +0 -0
  101. /package/src/{helpers/__tests__/derivationPath.ts → utils/__tests__/derivationPath.test.ts} +0 -0
  102. /package/src/{helpers → utils}/__tests__/memo.test.ts +0 -0
  103. /package/src/{helpers → utils}/__tests__/others.test.ts +0 -0
  104. /package/src/{helpers → utils}/__tests__/validators.test.ts +0 -0
  105. /package/src/{helpers → utils}/liquidity.ts +0 -0
  106. /package/src/{helpers → utils}/validators.ts +0 -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
+ ];