@swapkit/core 1.0.0-rc.13 → 1.0.0-rc.130

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 (45) hide show
  1. package/dist/index.js +171 -0
  2. package/dist/index.js.map +13 -0
  3. package/package.json +33 -47
  4. package/src/__tests__/helpers.test.ts +53 -0
  5. package/src/aggregator/contracts/avaxGeneric.ts +50 -50
  6. package/src/aggregator/contracts/avaxWoofi.ts +80 -80
  7. package/src/aggregator/contracts/bscGeneric.ts +59 -59
  8. package/src/aggregator/contracts/ethGeneric.ts +50 -50
  9. package/src/aggregator/contracts/index.ts +30 -28
  10. package/src/aggregator/contracts/pancakeV2.ts +80 -80
  11. package/src/aggregator/contracts/pangolin.ts +65 -65
  12. package/src/aggregator/contracts/routers/index.ts +58 -0
  13. package/src/aggregator/contracts/routers/kyber.ts +402 -0
  14. package/src/aggregator/contracts/routers/oneinch.ts +2188 -0
  15. package/src/aggregator/contracts/routers/pancakeswap.ts +340 -0
  16. package/src/aggregator/contracts/routers/pangolin.ts +340 -0
  17. package/src/aggregator/contracts/routers/sushiswap.ts +340 -0
  18. package/src/aggregator/contracts/routers/traderJoe.ts +340 -0
  19. package/src/aggregator/contracts/routers/uniswapv2.ts +340 -0
  20. package/src/aggregator/contracts/routers/uniswapv3.ts +254 -0
  21. package/src/aggregator/contracts/routers/woofi.ts +171 -0
  22. package/src/aggregator/contracts/sushiswap.ts +65 -65
  23. package/src/aggregator/contracts/traderJoe.ts +65 -65
  24. package/src/aggregator/contracts/uniswapV2.ts +65 -65
  25. package/src/aggregator/contracts/uniswapV2Leg.ts +70 -70
  26. package/src/aggregator/contracts/uniswapV3_100.ts +70 -70
  27. package/src/aggregator/contracts/uniswapV3_10000.ts +70 -70
  28. package/src/aggregator/contracts/uniswapV3_3000.ts +70 -70
  29. package/src/aggregator/contracts/uniswapV3_500.ts +70 -70
  30. package/src/aggregator/getSwapParams.ts +12 -12
  31. package/src/client.ts +209 -0
  32. package/src/helpers/explorerUrls.ts +38 -0
  33. package/src/index.ts +4 -4
  34. package/src/types.ts +29 -0
  35. package/LICENSE +0 -201
  36. package/dist/index-9e36735e.cjs +0 -1
  37. package/dist/index-cf1865cd.js +0 -649
  38. package/dist/index.cjs +0 -2
  39. package/dist/index.d.ts +0 -216
  40. package/dist/index.es.js +0 -3827
  41. package/src/client/__tests__/helpers.test.ts +0 -69
  42. package/src/client/explorerUrls.ts +0 -62
  43. package/src/client/index.ts +0 -699
  44. package/src/client/thornode.ts +0 -31
  45. package/src/client/types.ts +0 -103
package/dist/index.es.js DELETED
@@ -1,3827 +0,0 @@
1
- var Me = Object.defineProperty;
2
- var Ce = (e, t, n) => t in e ? Me(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var T = (e, t, n) => (Ce(e, typeof t != "symbol" ? t + "" : t, n), n), Ne = (e, t, n) => {
4
- if (!t.has(e))
5
- throw TypeError("Cannot " + n);
6
- };
7
- var f = (e, t, n) => (Ne(e, t, "read from private field"), n ? n.call(e) : t.get(e)), B = (e, t, n) => {
8
- if (t.has(e))
9
- throw TypeError("Cannot add the same private member more than once");
10
- t instanceof WeakSet ? t.add(e) : t.set(e, n);
11
- };
12
- var xe = Object.defineProperty, De = (e, t, n) => t in e ? xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, M = (e, t, n) => (De(e, typeof t != "symbol" ? t + "" : t, n), n);
13
- const Lt = [
14
- { inputs: [], stateMutability: "nonpayable", type: "constructor" },
15
- {
16
- anonymous: !1,
17
- inputs: [
18
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
19
- { indexed: !0, internalType: "address", name: "spender", type: "address" },
20
- { indexed: !1, internalType: "uint256", name: "value", type: "uint256" }
21
- ],
22
- name: "Approval",
23
- type: "event"
24
- },
25
- {
26
- anonymous: !1,
27
- inputs: [
28
- { indexed: !0, internalType: "address", name: "from", type: "address" },
29
- { indexed: !0, internalType: "address", name: "to", type: "address" },
30
- { indexed: !1, internalType: "uint256", name: "value", type: "uint256" }
31
- ],
32
- name: "Transfer",
33
- type: "event"
34
- },
35
- {
36
- inputs: [
37
- { internalType: "address", name: "", type: "address" },
38
- { internalType: "address", name: "", type: "address" }
39
- ],
40
- name: "allowance",
41
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
42
- stateMutability: "view",
43
- type: "function"
44
- },
45
- {
46
- inputs: [
47
- { internalType: "address", name: "spender", type: "address" },
48
- { internalType: "uint256", name: "value", type: "uint256" }
49
- ],
50
- name: "approve",
51
- outputs: [{ internalType: "bool", name: "success", type: "bool" }],
52
- stateMutability: "nonpayable",
53
- type: "function"
54
- },
55
- {
56
- inputs: [{ internalType: "address", name: "", type: "address" }],
57
- name: "balanceOf",
58
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
59
- stateMutability: "view",
60
- type: "function"
61
- },
62
- {
63
- inputs: [],
64
- name: "decimals",
65
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
66
- stateMutability: "view",
67
- type: "function"
68
- },
69
- {
70
- inputs: [],
71
- name: "name",
72
- outputs: [{ internalType: "string", name: "", type: "string" }],
73
- stateMutability: "view",
74
- type: "function"
75
- },
76
- {
77
- inputs: [],
78
- name: "symbol",
79
- outputs: [{ internalType: "string", name: "", type: "string" }],
80
- stateMutability: "view",
81
- type: "function"
82
- },
83
- {
84
- inputs: [],
85
- name: "totalSupply",
86
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
87
- stateMutability: "view",
88
- type: "function"
89
- },
90
- {
91
- inputs: [
92
- { internalType: "address", name: "to", type: "address" },
93
- { internalType: "uint256", name: "value", type: "uint256" }
94
- ],
95
- name: "transfer",
96
- outputs: [{ internalType: "bool", name: "success", type: "bool" }],
97
- stateMutability: "nonpayable",
98
- type: "function"
99
- },
100
- {
101
- inputs: [
102
- { internalType: "address", name: "from", type: "address" },
103
- { internalType: "address", name: "to", type: "address" },
104
- { internalType: "uint256", name: "value", type: "uint256" }
105
- ],
106
- name: "transferFrom",
107
- outputs: [{ internalType: "bool", name: "success", type: "bool" }],
108
- stateMutability: "nonpayable",
109
- type: "function"
110
- }
111
- ], Be = [
112
- {
113
- inputs: [{ internalType: "address", name: "rune", type: "address" }],
114
- stateMutability: "nonpayable",
115
- type: "constructor"
116
- },
117
- {
118
- anonymous: !1,
119
- inputs: [
120
- { indexed: !0, internalType: "address", name: "to", type: "address" },
121
- { indexed: !0, internalType: "address", name: "asset", type: "address" },
122
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
123
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
124
- ],
125
- name: "Deposit",
126
- type: "event"
127
- },
128
- {
129
- anonymous: !1,
130
- inputs: [
131
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
132
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
133
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
134
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
135
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
136
- ],
137
- name: "TransferAllowance",
138
- type: "event"
139
- },
140
- {
141
- anonymous: !1,
142
- inputs: [
143
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
144
- { indexed: !0, internalType: "address", name: "to", type: "address" },
145
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
146
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
147
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
148
- ],
149
- name: "TransferOut",
150
- type: "event"
151
- },
152
- {
153
- anonymous: !1,
154
- inputs: [
155
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
156
- { indexed: !1, internalType: "address", name: "target", type: "address" },
157
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
158
- { indexed: !1, internalType: "address", name: "finalAsset", type: "address" },
159
- { indexed: !1, internalType: "address", name: "to", type: "address" },
160
- { indexed: !1, internalType: "uint256", name: "amountOutMin", type: "uint256" },
161
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
162
- ],
163
- name: "TransferOutAndCall",
164
- type: "event"
165
- },
166
- {
167
- anonymous: !1,
168
- inputs: [
169
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
170
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
171
- {
172
- components: [
173
- { internalType: "address", name: "asset", type: "address" },
174
- { internalType: "uint256", name: "amount", type: "uint256" }
175
- ],
176
- indexed: !1,
177
- internalType: "struct THORChain_Router.Coin[]",
178
- name: "coins",
179
- type: "tuple[]"
180
- },
181
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
182
- ],
183
- name: "VaultTransfer",
184
- type: "event"
185
- },
186
- {
187
- inputs: [],
188
- name: "RUNE",
189
- outputs: [{ internalType: "address", name: "", type: "address" }],
190
- stateMutability: "view",
191
- type: "function"
192
- },
193
- {
194
- inputs: [
195
- { internalType: "address payable", name: "vault", type: "address" },
196
- { internalType: "address", name: "asset", type: "address" },
197
- { internalType: "uint256", name: "amount", type: "uint256" },
198
- { internalType: "string", name: "memo", type: "string" }
199
- ],
200
- name: "deposit",
201
- outputs: [],
202
- stateMutability: "payable",
203
- type: "function"
204
- },
205
- {
206
- inputs: [
207
- { internalType: "address payable", name: "vault", type: "address" },
208
- { internalType: "address", name: "asset", type: "address" },
209
- { internalType: "uint256", name: "amount", type: "uint256" },
210
- { internalType: "string", name: "memo", type: "string" },
211
- { internalType: "uint256", name: "expiration", type: "uint256" }
212
- ],
213
- name: "depositWithExpiry",
214
- outputs: [],
215
- stateMutability: "payable",
216
- type: "function"
217
- },
218
- {
219
- inputs: [
220
- { internalType: "address", name: "router", type: "address" },
221
- { internalType: "address payable", name: "asgard", type: "address" },
222
- {
223
- components: [
224
- { internalType: "address", name: "asset", type: "address" },
225
- { internalType: "uint256", name: "amount", type: "uint256" }
226
- ],
227
- internalType: "struct THORChain_Router.Coin[]",
228
- name: "coins",
229
- type: "tuple[]"
230
- },
231
- { internalType: "string", name: "memo", type: "string" }
232
- ],
233
- name: "returnVaultAssets",
234
- outputs: [],
235
- stateMutability: "payable",
236
- type: "function"
237
- },
238
- {
239
- inputs: [
240
- { internalType: "address", name: "router", type: "address" },
241
- { internalType: "address", name: "newVault", type: "address" },
242
- { internalType: "address", name: "asset", type: "address" },
243
- { internalType: "uint256", name: "amount", type: "uint256" },
244
- { internalType: "string", name: "memo", type: "string" }
245
- ],
246
- name: "transferAllowance",
247
- outputs: [],
248
- stateMutability: "nonpayable",
249
- type: "function"
250
- },
251
- {
252
- inputs: [
253
- { internalType: "address payable", name: "to", type: "address" },
254
- { internalType: "address", name: "asset", type: "address" },
255
- { internalType: "uint256", name: "amount", type: "uint256" },
256
- { internalType: "string", name: "memo", type: "string" }
257
- ],
258
- name: "transferOut",
259
- outputs: [],
260
- stateMutability: "payable",
261
- type: "function"
262
- },
263
- {
264
- inputs: [
265
- { internalType: "address payable", name: "aggregator", type: "address" },
266
- { internalType: "address", name: "finalToken", type: "address" },
267
- { internalType: "address", name: "to", type: "address" },
268
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
269
- { internalType: "string", name: "memo", type: "string" }
270
- ],
271
- name: "transferOutAndCall",
272
- outputs: [],
273
- stateMutability: "payable",
274
- type: "function"
275
- },
276
- {
277
- inputs: [
278
- { internalType: "address", name: "vault", type: "address" },
279
- { internalType: "address", name: "token", type: "address" }
280
- ],
281
- name: "vaultAllowance",
282
- outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
283
- stateMutability: "view",
284
- type: "function"
285
- }
286
- ], Pe = [
287
- { inputs: [], stateMutability: "nonpayable", type: "constructor" },
288
- {
289
- anonymous: !1,
290
- inputs: [
291
- { indexed: !0, internalType: "address", name: "to", type: "address" },
292
- { indexed: !0, internalType: "address", name: "asset", type: "address" },
293
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
294
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
295
- ],
296
- name: "Deposit",
297
- type: "event"
298
- },
299
- {
300
- anonymous: !1,
301
- inputs: [
302
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
303
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
304
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
305
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
306
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
307
- ],
308
- name: "TransferAllowance",
309
- type: "event"
310
- },
311
- {
312
- anonymous: !1,
313
- inputs: [
314
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
315
- { indexed: !0, internalType: "address", name: "to", type: "address" },
316
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
317
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
318
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
319
- ],
320
- name: "TransferOut",
321
- type: "event"
322
- },
323
- {
324
- anonymous: !1,
325
- inputs: [
326
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
327
- { indexed: !1, internalType: "address", name: "target", type: "address" },
328
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
329
- { indexed: !1, internalType: "address", name: "finalAsset", type: "address" },
330
- { indexed: !1, internalType: "address", name: "to", type: "address" },
331
- { indexed: !1, internalType: "uint256", name: "amountOutMin", type: "uint256" },
332
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
333
- ],
334
- name: "TransferOutAndCall",
335
- type: "event"
336
- },
337
- {
338
- anonymous: !1,
339
- inputs: [
340
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
341
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
342
- {
343
- components: [
344
- { internalType: "address", name: "asset", type: "address" },
345
- { internalType: "uint256", name: "amount", type: "uint256" }
346
- ],
347
- indexed: !1,
348
- internalType: "struct AvaxRouter.Coin[]",
349
- name: "coins",
350
- type: "tuple[]"
351
- },
352
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
353
- ],
354
- name: "VaultTransfer",
355
- type: "event"
356
- },
357
- {
358
- inputs: [
359
- { internalType: "address payable", name: "vault", type: "address" },
360
- { internalType: "address", name: "asset", type: "address" },
361
- { internalType: "uint256", name: "amount", type: "uint256" },
362
- { internalType: "string", name: "memo", type: "string" }
363
- ],
364
- name: "deposit",
365
- outputs: [],
366
- stateMutability: "payable",
367
- type: "function"
368
- },
369
- {
370
- inputs: [
371
- { internalType: "address payable", name: "vault", type: "address" },
372
- { internalType: "address", name: "asset", type: "address" },
373
- { internalType: "uint256", name: "amount", type: "uint256" },
374
- { internalType: "string", name: "memo", type: "string" },
375
- { internalType: "uint256", name: "expiration", type: "uint256" }
376
- ],
377
- name: "depositWithExpiry",
378
- outputs: [],
379
- stateMutability: "payable",
380
- type: "function"
381
- },
382
- {
383
- inputs: [
384
- { internalType: "address", name: "router", type: "address" },
385
- { internalType: "address payable", name: "asgard", type: "address" },
386
- {
387
- components: [
388
- { internalType: "address", name: "asset", type: "address" },
389
- { internalType: "uint256", name: "amount", type: "uint256" }
390
- ],
391
- internalType: "struct AvaxRouter.Coin[]",
392
- name: "coins",
393
- type: "tuple[]"
394
- },
395
- { internalType: "string", name: "memo", type: "string" }
396
- ],
397
- name: "returnVaultAssets",
398
- outputs: [],
399
- stateMutability: "payable",
400
- type: "function"
401
- },
402
- {
403
- inputs: [
404
- { internalType: "address", name: "router", type: "address" },
405
- { internalType: "address", name: "newVault", type: "address" },
406
- { internalType: "address", name: "asset", type: "address" },
407
- { internalType: "uint256", name: "amount", type: "uint256" },
408
- { internalType: "string", name: "memo", type: "string" }
409
- ],
410
- name: "transferAllowance",
411
- outputs: [],
412
- stateMutability: "nonpayable",
413
- type: "function"
414
- },
415
- {
416
- inputs: [
417
- { internalType: "address payable", name: "to", type: "address" },
418
- { internalType: "address", name: "asset", type: "address" },
419
- { internalType: "uint256", name: "amount", type: "uint256" },
420
- { internalType: "string", name: "memo", type: "string" }
421
- ],
422
- name: "transferOut",
423
- outputs: [],
424
- stateMutability: "payable",
425
- type: "function"
426
- },
427
- {
428
- inputs: [
429
- { internalType: "address payable", name: "target", type: "address" },
430
- { internalType: "address", name: "finalToken", type: "address" },
431
- { internalType: "address", name: "to", type: "address" },
432
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
433
- { internalType: "string", name: "memo", type: "string" }
434
- ],
435
- name: "transferOutAndCall",
436
- outputs: [],
437
- stateMutability: "payable",
438
- type: "function"
439
- },
440
- {
441
- inputs: [
442
- { internalType: "address", name: "vault", type: "address" },
443
- { internalType: "address", name: "token", type: "address" }
444
- ],
445
- name: "vaultAllowance",
446
- outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
447
- stateMutability: "view",
448
- type: "function"
449
- }
450
- ], Ve = [
451
- { inputs: [], stateMutability: "nonpayable", type: "constructor" },
452
- {
453
- anonymous: !1,
454
- inputs: [
455
- { indexed: !0, internalType: "address", name: "to", type: "address" },
456
- { indexed: !0, internalType: "address", name: "asset", type: "address" },
457
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
458
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
459
- ],
460
- name: "Deposit",
461
- type: "event"
462
- },
463
- {
464
- anonymous: !1,
465
- inputs: [
466
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
467
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
468
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
469
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
470
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
471
- ],
472
- name: "TransferAllowance",
473
- type: "event"
474
- },
475
- {
476
- anonymous: !1,
477
- inputs: [
478
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
479
- { indexed: !0, internalType: "address", name: "to", type: "address" },
480
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
481
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
482
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
483
- ],
484
- name: "TransferOut",
485
- type: "event"
486
- },
487
- {
488
- anonymous: !1,
489
- inputs: [
490
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
491
- { indexed: !1, internalType: "address", name: "target", type: "address" },
492
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
493
- { indexed: !1, internalType: "address", name: "finalAsset", type: "address" },
494
- { indexed: !1, internalType: "address", name: "to", type: "address" },
495
- { indexed: !1, internalType: "uint256", name: "amountOutMin", type: "uint256" },
496
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
497
- ],
498
- name: "TransferOutAndCall",
499
- type: "event"
500
- },
501
- {
502
- anonymous: !1,
503
- inputs: [
504
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
505
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
506
- {
507
- components: [
508
- { internalType: "address", name: "asset", type: "address" },
509
- { internalType: "uint256", name: "amount", type: "uint256" }
510
- ],
511
- indexed: !1,
512
- internalType: "struct THORChain_Router.Coin[]",
513
- name: "coins",
514
- type: "tuple[]"
515
- },
516
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
517
- ],
518
- name: "VaultTransfer",
519
- type: "event"
520
- },
521
- {
522
- inputs: [
523
- { internalType: "address payable", name: "vault", type: "address" },
524
- { internalType: "address", name: "asset", type: "address" },
525
- { internalType: "uint256", name: "amount", type: "uint256" },
526
- { internalType: "string", name: "memo", type: "string" },
527
- { internalType: "uint256", name: "expiration", type: "uint256" }
528
- ],
529
- name: "depositWithExpiry",
530
- outputs: [],
531
- stateMutability: "payable",
532
- type: "function"
533
- },
534
- {
535
- inputs: [
536
- { internalType: "address", name: "router", type: "address" },
537
- { internalType: "address payable", name: "asgard", type: "address" },
538
- {
539
- components: [
540
- { internalType: "address", name: "asset", type: "address" },
541
- { internalType: "uint256", name: "amount", type: "uint256" }
542
- ],
543
- internalType: "struct THORChain_Router.Coin[]",
544
- name: "coins",
545
- type: "tuple[]"
546
- },
547
- { internalType: "string", name: "memo", type: "string" }
548
- ],
549
- name: "returnVaultAssets",
550
- outputs: [],
551
- stateMutability: "payable",
552
- type: "function"
553
- },
554
- {
555
- inputs: [
556
- { internalType: "address", name: "router", type: "address" },
557
- { internalType: "address", name: "newVault", type: "address" },
558
- { internalType: "address", name: "asset", type: "address" },
559
- { internalType: "uint256", name: "amount", type: "uint256" },
560
- { internalType: "string", name: "memo", type: "string" }
561
- ],
562
- name: "transferAllowance",
563
- outputs: [],
564
- stateMutability: "nonpayable",
565
- type: "function"
566
- },
567
- {
568
- inputs: [
569
- { internalType: "address payable", name: "to", type: "address" },
570
- { internalType: "address", name: "asset", type: "address" },
571
- { internalType: "uint256", name: "amount", type: "uint256" },
572
- { internalType: "string", name: "memo", type: "string" }
573
- ],
574
- name: "transferOut",
575
- outputs: [],
576
- stateMutability: "payable",
577
- type: "function"
578
- },
579
- {
580
- inputs: [
581
- { internalType: "address payable", name: "target", type: "address" },
582
- { internalType: "address", name: "finalToken", type: "address" },
583
- { internalType: "address", name: "to", type: "address" },
584
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
585
- { internalType: "string", name: "memo", type: "string" }
586
- ],
587
- name: "transferOutAndCall",
588
- outputs: [],
589
- stateMutability: "payable",
590
- type: "function"
591
- },
592
- {
593
- inputs: [
594
- { internalType: "address", name: "vault", type: "address" },
595
- { internalType: "address", name: "token", type: "address" }
596
- ],
597
- name: "vaultAllowance",
598
- outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
599
- stateMutability: "view",
600
- type: "function"
601
- }
602
- ];
603
- var Le = /* @__PURE__ */ ((e) => (e.TC_SUPPORTED_TO_TC_SUPPORTED = "TC-TC", e.TC_SUPPORTED_TO_ETH = "TC-ERC20", e.TC_SUPPORTED_TO_AVAX = "TC-ARC20", e.TC_SUPPORTED_TO_BSC = "TC-BEP20", e.ETH_TO_TC_SUPPORTED = "ERC20-TC", e.ETH_TO_ETH = "ERC20-ERC20", e.ETH_TO_AVAX = "ERC20-ARC20", e.ETH_TO_BSC = "ERC20-BEP20", e.AVAX_TO_TC_SUPPORTED = "ARC20-TC", e.AVAX_TO_ETH = "ARC20-ERC20", e.AVAX_TO_AVAX = "ARC20-ARC20", e.AVAX_TO_BSC = "ARC20-BEP20", e.BSC_TO_TC_SUPPORTED = "BEP20-TC", e.BSC_TO_ETH = "BEP20-ERC20", e.BSC_TO_AVAX = "BEP20-ARC20", e.BSC_TO_BSC = "BEP20-BEP20", e))(Le || {});
604
- const Ue = [
605
- "ERC20-ERC20",
606
- "ARC20-ARC20",
607
- "BEP20-BEP20"
608
- /* BSC_TO_BSC */
609
- ], He = [
610
- "ERC20-TC",
611
- "ERC20-ARC20",
612
- "ERC20-BEP20",
613
- "ARC20-TC",
614
- "ARC20-ERC20",
615
- "ARC20-BEP20",
616
- "BEP20-TC",
617
- "BEP20-ERC20",
618
- "BEP20-ARC20"
619
- /* BSC_TO_AVAX */
620
- ], $e = [
621
- "TC-TC",
622
- "TC-ERC20",
623
- "TC-ARC20",
624
- "TC-BEP20"
625
- /* TC_SUPPORTED_TO_BSC */
626
- ];
627
- var fe = /* @__PURE__ */ ((e) => (e.VALIDATION_ERROR = "VALIDATION_ERROR", e.REQUEST_PARAMETER_ERROR = "REQUEST_PARAMETER_ERROR", e.RESPONSE_PARSING_ERROR = "RESPONSE_PARSING_ERROR", e.UNSUPPORTED = "UNSUPPORTED", e.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", e.INCOMPATIBLE_ASSETS_OPERATIONS = "INCOMPATIBLE_ASSETS_OPERATIONS", e.SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", e.DOWN_FOR_MAINTENANCE = "DOWN_FOR_MAINTENANCE", e.MISSING_INBOUND_INFO = "MISSING_INBOUND_INFO", e.QUOTE_FETCHING_ERROR = "QUOTE_FETCHING_ERROR", e.AIRDROP_ERROR = "AIRDROP_ERROR", e.UNHANDLED_ERROR = "UNHANDLED_ERROR", e))(fe || {}), ke = /* @__PURE__ */ ((e) => (e.HEALTH_CONTROLLER = "1000", e.LIQUIDITY_CONTROLLER = "1001", e.PROVIDER_CONTROLLER = "1002", e.QUOTE_CONTROLLER = "1003", e.SWAP_CONTROLLER = "1004", e.UTIL_CONTROLLER = "1005", e.AIRDROP_CONTROLLER = "1006", e.PROVIDER = "2000", e.ASSET = "2001", e.TOKEN_LIST = "2002", e.QUOTE = "2100", e.QUOTE_TXN_DETAILS = "2101", e.THORCHAIN_PROVIDER = "3000", e.UNISWAPV2_ETH_PROVIDER = "3001", e.UNISWAPV3_ETH_PROVIDER = "3002", e.SUSHISWAP_ETH_PROVIDER = "3003", e.PANCAKESWAP_BSC_PROVIDER = "3004", e.PANCAKESWAP_ETH_PROVIDER = "3005", e.ONEINCH_ETH_PROVIDER = "3006", e.ONEINCH_BSC_PROVIDER = "3007", e.ONEINCH_AVAX_PROVIDER = "3008", e.ZEROX_ETH_PROVIDER = "3009", e.WOOFI_AVAX_PROVIDER = "3010", e.PANGOLIN_AVAX_PROVIDER = "3011", e.TRADERJOE_AVAX_PROVIDER = "3012", e.KYBER_ETH_PROVIDER = "3013", e.KYBER_AVAX_PROVIDER = "3014", e.WOOFI_BSC_PROVIDER = "3015", e.STARGATE_PROVIDER = "3016", e.PROVIDER_UTIL = "4000", e.TXN_DETAILS = "5000", e.AIRDROP_UTIL = "6000", e))(ke || {}), u = /* @__PURE__ */ ((e) => (e.INVALID_INPUT_PARAMETERS = "1000", e.UNKNOWN_PROVIDERS = "1001", e.CANNOT_FIND_INBOUND_ADDRESS = "1002", e.NO_INBOUND_ADDRESSES = "1003", e.CHAIN_HALTED_OR_UNSUPPORTED = "1004", e.MISSING_INPUT_PARAMETER = "1005", e.INVALID_TYPE_GENERIC = "1100", e.INVALID_NUMBER_STRING = "1101", e.INVALID_NUMBER = "1102", e.INVALID_BOOLEAN = "1103", e.INVALID_OBJECT = "1104", e.INVALID_ARRAY = "1105", e.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2000", e.SELL_BUY_ASSETS_ARE_THE_SAME = "2001", e.MISSING_SOURCE_ADDRESS_FOR_SYNTH = "2002", e.AFF_ADDRESS_AND_BPS_OR_NEITHER = "2003", e.AFF_ADDRESS_TOO_LONG = "2004", e.AFF_BPS_INTEGER_0_100 = "2005", e.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN = "2006", e.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN = "2007", e.PREFERRED_PROFVIDER_NOT_SUPPORTED = "2008", e.DESTINATION_ADDRESS_SMART_CONTRACT = "2009", e.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER = "2010", e.SOURCE_ADDRESS_SMART_CONTRACT = "2011", e.INVALID_PROVIDER = "2100", e.MISSING_CROSS_CHAIN_PROVIDER = "2101", e.MISSING_AVAX_PROVIDER = "2102", e.MISSING_BSC_PROVIDER = "2103", e.MISSING_ETH_PROVIDER = "2104", e.INVALID_PROVIDER_FOR_SWAP_OUT = "2105", e.MISSING_ARB_PROVIDER = "2106", e.INVALID_CHAIN = "2200", e.INVALID_ASSET = "2201", e.INVALID_ASSET_IDENTIFIER = "2202", e.UNSUPPORTED_CHAIN = "2204", e.UNSUPPORTED_ASSET = "2203", e.UNSUPPORTED_ASSET_FOR_SWAPOUT = "2205", e.INVALID_SOURCE_ADDRESS = "2300", e.INVALID_DESTINATION_ADDRESS = "2301", e.THORNODE_QUOTE_GENERIC_ERROR = "3000", e.NOT_ENOUGH_SYNTH_BALANCE = "3001", e.SYNTH_MINTING_CAP_REACHED = "3002", e.INVALID_QUOTE_MODE = "4000", e.NO_QUOTES = "4001", e.SERVICE_UNAVAILABLE_GENERIC = "5000", e.MISSING_GAS_DATA_GENERIC = "5100", e.MISSING_TOKEN_INFO_GENERIC = "5200", e.CANT_FIND_TOKEN_LIST = "5201", e.NO_PRICE = "5202", e.PRICE_IS_STALE = "5203", e.ADDRESS_NOT_WHITELISTED = "6000", e.ADDRESS_ALREADY_CLAIMED = "6001", e.TEMPORARY_ERROR = "9999", e))(u || {});
628
- const Fe = {
629
- [u.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
630
- [u.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
631
- [u.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
632
- [u.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
633
- [u.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
634
- [u.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
635
- [u.INVALID_TYPE_GENERIC]: "Invalid type",
636
- [u.INVALID_NUMBER_STRING]: "Invalid number string.",
637
- [u.INVALID_NUMBER]: "Invalid number.",
638
- [u.INVALID_BOOLEAN]: "Invalid boolean.",
639
- [u.INVALID_OBJECT]: "Invalid object.",
640
- [u.INVALID_ARRAY]: "Invalid array.",
641
- [u.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
642
- [u.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
643
- [u.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
644
- [u.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
645
- [u.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 3 characters max.",
646
- [u.AFF_BPS_INTEGER_0_100]: "affiliateBasisPoints must be an integer between 0 and 100.",
647
- [u.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
648
- [u.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
649
- [u.PREFERRED_PROFVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
650
- [u.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
651
- [u.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
652
- [u.INVALID_PROVIDER]: "Invalid provider {0}.",
653
- [u.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
654
- [u.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
655
- [u.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
656
- [u.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
657
- [u.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
658
- [u.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
659
- [u.INVALID_CHAIN]: "Invalid chain {0}.",
660
- [u.INVALID_ASSET]: "Invalid asset {0}.",
661
- [u.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
662
- [u.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
663
- [u.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
664
- [u.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
665
- [u.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
666
- [u.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
667
- [u.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
668
- [u.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
669
- [u.INVALID_QUOTE_MODE]: "Invalid quote mode.",
670
- [u.NO_QUOTES]: "No quotes to service this request.",
671
- [u.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
672
- [u.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
673
- [u.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
674
- [u.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
675
- [u.NO_PRICE]: "No price for asset {0}.",
676
- [u.PRICE_IS_STALE]: "Price is stale for asset {0}.",
677
- [u.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
678
- [u.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
679
- }, ee = (e, t) => {
680
- let n = Fe[e];
681
- for (let a = 0; a < t.length; a++)
682
- n = n.replace(`{${a}}`, t[a]);
683
- return t.length === 0 ? n.replace("{0}", "") : n;
684
- };
685
- class be extends Error {
686
- constructor({
687
- status: t,
688
- revision: n,
689
- module: a,
690
- code: i,
691
- message: r,
692
- type: p,
693
- options: { shouldLog: d, shouldThrow: y, shouldTrace: l } = {
694
- shouldLog: !0,
695
- shouldThrow: !0,
696
- shouldTrace: !0
697
- },
698
- displayMessageParams: o
699
- }) {
700
- const c = r || ee(i, o || []) || "";
701
- super(c), M(this, "status"), M(this, "revision"), M(this, "type"), M(this, "module"), M(this, "code"), M(this, "message"), M(this, "display"), M(this, "stack"), M(this, "options"), M(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = c, this.display = ee(i, o || []), this.code = i, this.type = p || fe.UNHANDLED_ERROR, this.options = {
702
- shouldLog: d || !0,
703
- shouldTrace: l || !0,
704
- shouldThrow: y || !1
705
- }, this.displayMessageParams = o || [], this.options.shouldTrace && Error.captureStackTrace(this);
706
- }
707
- static fromErrorInfo(t) {
708
- return new be(t);
709
- }
710
- toErrorInfo() {
711
- return { ...this, identifier: this.identifier };
712
- }
713
- get identifier() {
714
- return `${this.revision}-${this.type || "NO_TYPE"}-${this.module}-${this.code}`;
715
- }
716
- get displayMessage() {
717
- return ee(this.code, this.displayMessageParams || []);
718
- }
719
- handle() {
720
- const t = `[${this.identifier}]: ${this.message}`;
721
- if (this.options.shouldLog && console.error(t, `
722
- `, this.stack || ""), this.options.shouldThrow)
723
- throw Error(t, { cause: this.stack });
724
- return this.toErrorInfo();
725
- }
726
- }
727
- var s = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(s || {}), Ge = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(Ge || {}), We = /* @__PURE__ */ ((e) => (e.ARB = "m/44'/60'/0'/0", e.AVAX = "m/44'/60'/0'/0", e.BCH = "m/44'/145'/0'/0", e.BNB = "m/44'/714'/0'/0", e.BSC = "m/44'/60'/0'/0", e.BTC = "m/84'/0'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.ETH = "m/44'/60'/0'/0", e.GAIA = "m/44'/118'/0'/0", e.KUJI = "m/44'/118'/0'/0", e.LTC = "m/84'/2'/0'/0", e.MATIC = "m/44'/60'/0'/0", e.MAYA = "m/44'/931'/0'/0", e.OP = "m/44'/60'/0'/0", e.THOR = "m/44'/931'/0'/0", e))(We || {});
728
- const Ut = {
729
- ARB: [44, 60, 0, 0, 0],
730
- AVAX: [44, 60, 0, 0, 0],
731
- BCH: [44, 145, 0, 0, 0],
732
- BNB: [44, 714, 0, 0, 0],
733
- BSC: [44, 60, 0, 0, 0],
734
- BTC: [84, 0, 0, 0, 0],
735
- DOGE: [44, 3, 0, 0, 0],
736
- ETH: [44, 60, 0, 0, 0],
737
- GAIA: [44, 118, 0, 0, 0],
738
- KUJI: [44, 118, 0, 0, 0],
739
- LTC: [84, 2, 0, 0, 0],
740
- MATIC: [44, 60, 0, 0, 0],
741
- MAYA: [44, 931, 0, 0, 0],
742
- OP: [44, 60, 0, 0, 0],
743
- THOR: [44, 931, 0, 0, 0]
744
- };
745
- var b = /* @__PURE__ */ ((e) => (e[e.ARB = 18] = "ARB", e[e.AVAX = 18] = "AVAX", e[e.BCH = 8] = "BCH", e[e.BNB = 8] = "BNB", e[e.BSC = 18] = "BSC", e[e.BTC = 8] = "BTC", e[e.DASH = 8] = "DASH", e[e.DOGE = 8] = "DOGE", e[e.ETH = 18] = "ETH", e[e.GAIA = 6] = "GAIA", e[e.KUJI = 6] = "KUJI", e[e.LTC = 8] = "LTC", e[e.MATIC = 18] = "MATIC", e[e.MAYA = 10] = "MAYA", e[e.OP = 18] = "OP", e[e.THOR = 8] = "THOR", e))(b || {});
746
- const Ht = [
747
- "ETH",
748
- "AVAX",
749
- "BSC",
750
- "ARB",
751
- "OP",
752
- "MATIC"
753
- /* Polygon */
754
- ], $t = [
755
- "BTC",
756
- "BCH",
757
- "DOGE",
758
- "LTC"
759
- /* Litecoin */
760
- ], kt = [
761
- "GAIA",
762
- "THOR",
763
- "BNB"
764
- /* Binance */
765
- ];
766
- var ye = /* @__PURE__ */ ((e) => (e.Arbitrum = "42161", e.ArbitrumHex = "0xa4b1", e.Avalanche = "43114", e.AvalancheHex = "0xa86a", e.Binance = "Binance-Chain-Tigris", e.BinanceSmartChain = "56", e.BinanceSmartChainHex = "0x38", e.Bitcoin = "bitcoin", e.BitcoinCash = "bitcoincash", e.Cosmos = "cosmoshub-4", e.Dogecoin = "dogecoin", e.Kujira = "kaiyo-1", e.Ethereum = "1", e.EthereumHex = "0x1", e.Litecoin = "litecoin", e.Maya = "mayachain-mainnet-v1", e.MayaStagenet = "mayachain-stagenet-v1", e.Optimism = "10", e.OptimismHex = "0xa", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(ye || {}), Ae = /* @__PURE__ */ ((e) => (e.Arbitrum = "https://arb1.arbitrum.io/rpc", e.Avalanche = "https://node-router.thorswap.net/avalanche-c", e.Binance = "", e.BinanceSmartChain = "https://bsc-dataseed.binance.org", e.Bitcoin = "https://node-router.thorswap.net/bitcoin", e.BitcoinCash = "https://node-router.thorswap.net/bitcoin-cash", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Kujira = "https://rpc-kujira.synergynodes.com/", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Litecoin = "https://node-router.thorswap.net/litecoin", e.Maya = "https://tendermint.mayachain.info", e.MayaStagenet = "https://stagenet.tendermint.mayachain.info", e.Optimism = "https://mainnet.optimism.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(Ae || {}), W = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(W || {});
767
- const Z = Object.values(s), qe = Object.keys(s), le = Z.reduce(
768
- (e, t) => {
769
- const n = qe.find((a) => s[a] === t);
770
- return n && (e[t] = n), e;
771
- },
772
- {}
773
- ), Ke = Z.reduce(
774
- (e, t) => (e[t] = ye[le[t]], e),
775
- {}
776
- ), Ye = Z.reduce(
777
- (e, t) => (e[t] = Ae[le[t]], e),
778
- {}
779
- ), Ft = Z.reduce(
780
- (e, t) => {
781
- const n = `${le[t]}Hex`;
782
- return e[t] = ye[n], e;
783
- },
784
- {}
785
- ), Gt = {
786
- "0xa4b1": "ARB",
787
- 42161: "ARB",
788
- "0xa86a": "AVAX",
789
- 43114: "AVAX",
790
- "0x38": "BSC",
791
- 56: "BSC",
792
- "Binance-Chain-Tigris": "BNB",
793
- bitcoincash: "BCH",
794
- bitcoin: "BTC",
795
- "cosmoshub-4": "GAIA",
796
- dogecoin: "DOGE",
797
- "0x1": "ETH",
798
- "kaiyo-1": "KUJI",
799
- 1: "ETH",
800
- litecoin: "LTC",
801
- "mayachain-stagenet-v1": "MAYA",
802
- "mayachain-mainnet-v1": "MAYA",
803
- "0xa": "OP",
804
- 10: "OP",
805
- "0x89": "MATIC",
806
- 137: "MATIC",
807
- "thorchain-stagenet-v2": "THOR",
808
- "thorchain-mainnet-v1": "THOR"
809
- /* THORChain */
810
- }, we = {
811
- ARB: "https://arbiscan.io",
812
- AVAX: "https://snowtrace.io",
813
- BSC: "https://bscscan.com",
814
- BNB: "https://explorer.binance.org",
815
- BCH: "https://www.blockchain.com/bch",
816
- BTC: "https://blockstream.info",
817
- GAIA: "https://cosmos.bigdipper.live",
818
- DOGE: "https://blockchair.com/dogecoin",
819
- KUJI: "https://finder.kujira.network/kaiyo-1",
820
- ETH: "https://etherscan.io",
821
- LTC: "https://ltc.bitaps.com",
822
- MAYA: "https://www.mayascan.org",
823
- OP: "https://optimistic.etherscan.io",
824
- MATIC: "https://polygonscan.com",
825
- THOR: "https://viewblock.io/thorchain"
826
- };
827
- var Xe = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(Xe || {}), _ = /* @__PURE__ */ ((e) => (e.BOND = "BOND", e.DEPOSIT = "+", e.LEAVE = "LEAVE", e.THORNAME_REGISTER = "~", e.UNBOND = "UNBOND", e.WITHDRAW = "-", e.OPEN_LOAN = "$+", e.CLOSE_LOAN = "$-", e))(_ || {}), k = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(k || {}), je = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.XDEFI = "XDEFI", e.METAMASK = "METAMASK", e.COINBASE_WEB = "COINBASE_WEB", e.TREZOR = "TREZOR", e.TRUSTWALLET_WEB = "TRUSTWALLET_WEB", e.LEDGER = "LEDGER", e.KEPLR = "KEPLR", e.OKX = "OKX", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(je || {}), Qe = Object.defineProperty, Je = (e, t, n) => t in e ? Qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Je(e, typeof t != "symbol" ? t + "" : t, n), n), ze = (e, t, n) => {
828
- if (!t.has(e))
829
- throw TypeError("Cannot " + n);
830
- }, V = (e, t, n) => {
831
- if (t.has(e))
832
- throw TypeError("Cannot add the same private member more than once");
833
- t instanceof WeakSet ? t.add(e) : t.set(e, n);
834
- }, g = (e, t, n) => (ze(e, t, "access private method"), n);
835
- const Wt = (e) => {
836
- if (e < 0)
837
- throw new Error("Invalid number of year");
838
- return 10 + e;
839
- }, qt = (e) => {
840
- if (e.length > 30)
841
- return !1;
842
- const t = /^[a-zA-Z0-9+_-]+$/g;
843
- return !!e.match(t);
844
- }, Kt = ([e, t, n, a, i]) => `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`, Ee = async (e, t) => {
845
- try {
846
- const n = Object.entries(t || {}).reduce(
847
- (a, [i, r]) => (r && (a[i] = r), a),
848
- {}
849
- );
850
- return (await fetch(
851
- `${e}${t ? `?${new URLSearchParams(n).toString()}` : ""}`,
852
- { method: "GET", mode: "cors", credentials: "omit", referrer: "https://sk.thorswap.net" }
853
- )).json();
854
- } catch (n) {
855
- return console.error(n), {};
856
- }
857
- }, Ze = async (e, t, n, a = !1) => {
858
- try {
859
- const i = await fetch(`${e}`, {
860
- body: t,
861
- headers: n,
862
- method: "POST",
863
- referrer: "https://sk.thorswap.net"
864
- });
865
- return a ? i.text() : i.json();
866
- } catch {
867
- return {};
868
- }
869
- }, et = "0x313ce567", Re = async ({ chain: e, to: t }) => {
870
- try {
871
- const n = await Ze(
872
- Ye[e],
873
- JSON.stringify({
874
- method: "eth_call",
875
- params: [{ to: t.toLowerCase(), data: et }, "latest"],
876
- id: 44,
877
- jsonrpc: "2.0"
878
- }),
879
- { accept: "*/*", "cache-control": "no-cache", "content-type": "application/json" },
880
- !0
881
- ), { result: a } = JSON.parse(n);
882
- return parseInt(BigInt(a).toString());
883
- } catch (n) {
884
- return console.error(n), b[e];
885
- }
886
- }, tt = async (e) => {
887
- if (e === s.Ethereum)
888
- return b.ETH;
889
- const [, t] = e.split("-");
890
- return t != null && t.startsWith("0x") ? Re({ chain: s.Ethereum, to: t }) : b.ETH;
891
- }, nt = async (e) => {
892
- const [, t] = e.split("-");
893
- return t != null && t.startsWith("0x") ? Re({ chain: s.Avalanche, to: t.toLowerCase() }) : b.AVAX;
894
- }, at = async (e) => (e === s.BinanceSmartChain, b.BSC), Oe = async ({ chain: e, symbol: t }) => {
895
- switch (e) {
896
- case s.Ethereum:
897
- return tt(t);
898
- case s.Avalanche:
899
- return nt(t);
900
- case s.BinanceSmartChain:
901
- return at(t);
902
- default:
903
- return b[e];
904
- }
905
- }, st = {
906
- [k.Average]: 1.2,
907
- [k.Fast]: 1.5,
908
- [k.Fastest]: 2
909
- }, it = ({ chain: e, symbol: t }) => {
910
- switch (e) {
911
- case s.Bitcoin:
912
- case s.BitcoinCash:
913
- case s.Litecoin:
914
- case s.Dogecoin:
915
- case s.Binance:
916
- case s.Ethereum:
917
- case s.Avalanche:
918
- return t === e;
919
- case s.Arbitrum:
920
- case s.Optimism:
921
- return t === "ETH";
922
- case s.Maya:
923
- return t === "CACAO";
924
- case s.Kujira:
925
- return t === "KUJI";
926
- case s.Cosmos:
927
- return t === "ATOM";
928
- case s.Polygon:
929
- return t === "MATIC";
930
- case s.BinanceSmartChain:
931
- return t === "BNB";
932
- case s.THORChain:
933
- return t === "RUNE";
934
- }
935
- }, rt = (e) => {
936
- switch (e) {
937
- case "ETH.THOR":
938
- return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
939
- case "ETH.vTHOR":
940
- return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
941
- case s.Cosmos:
942
- return { identifier: "GAIA.ATOM", decimal: b[e] };
943
- case s.THORChain:
944
- return { identifier: "THOR.RUNE", decimal: b[e] };
945
- case s.BinanceSmartChain:
946
- return { identifier: "BSC.BNB", decimal: b[e] };
947
- case s.Maya:
948
- return { identifier: "MAYA.CACAO", decimal: b.MAYA };
949
- case "MAYA.MAYA":
950
- return { identifier: "MAYA.MAYA", decimal: 4 };
951
- case s.Kujira:
952
- case s.Arbitrum:
953
- case s.Optimism:
954
- case s.BitcoinCash:
955
- case s.Litecoin:
956
- case s.Dogecoin:
957
- case s.Binance:
958
- case s.Avalanche:
959
- case s.Polygon:
960
- case s.Bitcoin:
961
- case s.Ethereum:
962
- return { identifier: `${e}.${e}`, decimal: b[e] };
963
- }
964
- }, pt = ({ chain: e, symbol: t }) => {
965
- if (t.includes("/"))
966
- return "Synth";
967
- switch (e) {
968
- case s.Bitcoin:
969
- case s.BitcoinCash:
970
- case s.Dogecoin:
971
- case s.Litecoin:
972
- case s.Maya:
973
- case s.THORChain:
974
- return "Native";
975
- case s.Cosmos:
976
- return t === "ATOM" ? "Native" : s.Cosmos;
977
- case s.Kujira:
978
- return t === s.Kujira ? "Native" : s.Kujira;
979
- case s.Binance:
980
- return t === s.Binance ? "Native" : "BEP2";
981
- case s.BinanceSmartChain:
982
- return t === s.Binance ? "Native" : "BEP20";
983
- case s.Ethereum:
984
- return t === s.Ethereum ? "Native" : "ERC20";
985
- case s.Avalanche:
986
- return t === s.Avalanche ? "Native" : s.Avalanche;
987
- case s.Polygon:
988
- return t === s.Polygon ? "Native" : "POLYGON";
989
- case s.Arbitrum:
990
- return [s.Ethereum, s.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
991
- case s.Optimism:
992
- return [s.Ethereum, s.Optimism].includes(t) ? "Native" : "OPTIMISM";
993
- }
994
- }, Yt = (e) => {
995
- var t;
996
- const [n, ...a] = e.split("."), i = e.includes("/"), r = a.join("."), p = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
997
- return { chain: n, symbol: r, ticker: p, synth: i };
998
- }, ot = new RegExp(
999
- /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
1000
- "gmi"
1001
- ), Xt = (e) => e.filter(
1002
- (t) => !ot.test(t.toString()) && !t.toString().includes("undefined")
1003
- ), dt = ({
1004
- liquidityUnits: e,
1005
- poolUnits: t,
1006
- runeDepth: n
1007
- }) => {
1008
- const a = A(e), i = A(t), r = A(n), p = a.mul(r), d = i.mul(i).mul(2), y = i.mul(a).mul(2), l = a.mul(a), o = i.mul(i).mul(i);
1009
- return p.mul(d.sub(y).add(l)).div(o);
1010
- }, ut = ({
1011
- liquidityUnits: e,
1012
- poolUnits: t,
1013
- assetDepth: n
1014
- }) => {
1015
- const a = A(e), i = A(t), r = A(n), p = a.mul(r), d = i.mul(i).mul(2), y = i.mul(a).mul(2), l = a.mul(a), o = p.mul(d.sub(y).add(l)), c = i.mul(i).mul(i);
1016
- return o.div(c);
1017
- }, jt = ({
1018
- percent: e,
1019
- runeDepth: t,
1020
- liquidityUnits: n,
1021
- poolUnits: a
1022
- }) => dt({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), Qt = ({
1023
- percent: e,
1024
- assetDepth: t,
1025
- liquidityUnits: n,
1026
- poolUnits: a
1027
- }) => ut({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), A = (e) => new ue({ value: e, decimal: b.THOR }), yt = ({
1028
- liquidityUnits: e,
1029
- poolUnits: t,
1030
- runeDepth: n,
1031
- assetDepth: a
1032
- }) => ({
1033
- assetAmount: A(a).mul(e).div(t),
1034
- runeAmount: A(n).mul(e).div(t)
1035
- }), Jt = ({
1036
- liquidityUnits: e,
1037
- poolUnits: t,
1038
- runeDepth: n,
1039
- assetDepth: a,
1040
- percent: i
1041
- }) => Object.fromEntries(
1042
- Object.entries(yt({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
1043
- ([r, p]) => [r, p.mul(i)]
1044
- )
1045
- ), zt = ({
1046
- runeDepth: e,
1047
- poolUnits: t,
1048
- assetDepth: n,
1049
- liquidityUnits: a,
1050
- runeAmount: i,
1051
- assetAmount: r
1052
- }) => {
1053
- const p = A(e), d = A(n), y = A(t), l = A(i), o = A(r), c = l.mul(d), h = o.mul(p), w = l.mul(o), R = p.mul(d), O = y.mul(c.add(h.add(w.mul(2)))), E = c.add(h.add(R.mul(2))), I = O.div(E), S = A(a).add(I);
1054
- if (I.baseValueNumber === 0)
1055
- return S.div(y).baseValueNumber;
1056
- const D = y.add(S);
1057
- return S.div(D).baseValueNumber;
1058
- }, Zt = ({
1059
- runeAmount: e,
1060
- assetAmount: t,
1061
- runeDepth: n,
1062
- assetDepth: a
1063
- }) => {
1064
- const i = A(n), r = A(a), p = A(t), d = A(e), y = p.mul(i).sub(r.mul(d)), l = r.mul(d).add(i.mul(r));
1065
- return Math.abs(y.div(l).baseValueNumber);
1066
- }, lt = ({
1067
- symbol: e,
1068
- ticker: t,
1069
- chain: n
1070
- }) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, x = (e, t) => {
1071
- switch (e) {
1072
- case _.LEAVE:
1073
- case _.BOND: {
1074
- const { address: n } = t;
1075
- return `${e}:${n}`;
1076
- }
1077
- case _.UNBOND: {
1078
- const { address: n, unbondAmount: a } = t;
1079
- return `${e}:${n}:${a * 10 ** 8}`;
1080
- }
1081
- case _.THORNAME_REGISTER: {
1082
- const { name: n, chain: a, address: i, owner: r } = t;
1083
- return `${e}:${n}:${a}:${i}${r ? `:${r}` : ""}`;
1084
- }
1085
- case _.DEPOSIT: {
1086
- const { chain: n, symbol: a, address: i, singleSide: r } = t;
1087
- return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${i || ""}:t:0`;
1088
- }
1089
- case _.WITHDRAW: {
1090
- const { chain: n, ticker: a, symbol: i, basisPoints: r, targetAssetString: p, singleSide: d } = t, y = !d && p ? `:${p}` : "", l = lt({ chain: n, symbol: i, ticker: a });
1091
- return `${e}:${n}${d ? "/" : "."}${l}:${r}${y}`;
1092
- }
1093
- case _.OPEN_LOAN:
1094
- case _.CLOSE_LOAN: {
1095
- const { asset: n, address: a } = t;
1096
- return `${e}:${n}:${a}`;
1097
- }
1098
- default:
1099
- return "";
1100
- }
1101
- }, ce = Object.values(s), ct = (e = "") => {
1102
- const t = e.toUpperCase(), [n] = t.split(".");
1103
- if (ce.includes(n))
1104
- return !0;
1105
- const [a] = t.split("/");
1106
- if (ce.includes(a))
1107
- return !0;
1108
- throw new Error(
1109
- `Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
1110
- );
1111
- }, q = 8, U = (e) => 10n ** BigInt(e), F = (e) => Math.log10(parseFloat(e.toString()));
1112
- function ge({
1113
- value: e,
1114
- bigIntDecimal: t = q,
1115
- decimal: n = q
1116
- }) {
1117
- const a = e < 0n;
1118
- let i = e.toString().substring(a ? 1 : 0);
1119
- const r = n - (i.length - 1);
1120
- r > 0 && (i = "0".repeat(r) + i);
1121
- const p = i.length - n;
1122
- let d = i.slice(-n);
1123
- return parseInt(d[t]) >= 5 ? d = `${d.substring(0, t - 1)}${(parseInt(d[t - 1]) + 1).toString()}` : d = d.substring(0, t), `${a ? "-" : ""}${i.slice(0, p)}.${d}`.replace(
1124
- /\.?0*$/,
1125
- ""
1126
- );
1127
- }
1128
- var L, $, ne, Ie, ae, me, Q, se, H, G, J, ie;
1129
- const mt = class j {
1130
- constructor(t) {
1131
- V(this, L), V(this, ne), V(this, ae), V(this, Q), V(this, H), V(this, J), C(this, "decimalMultiplier", 10n ** 8n), C(this, "bigIntValue", 0n), C(this, "decimal");
1132
- const n = pe(t);
1133
- this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = U(
1134
- Math.max(g(this, J, ie).call(this, g(this, H, G).call(this, n)), this.decimal || 0)
1135
- ), g(this, ne, Ie).call(this, n);
1136
- }
1137
- static fromBigInt(t, n) {
1138
- return new j({
1139
- decimal: n,
1140
- value: ge({ value: t, bigIntDecimal: n, decimal: n })
1141
- });
1142
- }
1143
- static shiftDecimals({
1144
- value: t,
1145
- from: n,
1146
- to: a
1147
- }) {
1148
- return j.fromBigInt(
1149
- new j(t).bigIntValue * U(a) / U(n),
1150
- a
1151
- );
1152
- }
1153
- /**
1154
- * @deprecated Use `getBaseValue('string')` instead
1155
- */
1156
- get baseValue() {
1157
- return this.getBaseValue("string");
1158
- }
1159
- /**
1160
- * @deprecated Use `getBaseValue('number')` instead
1161
- */
1162
- get baseValueNumber() {
1163
- return this.getBaseValue("number");
1164
- }
1165
- /**
1166
- * @deprecated Use `getBaseValue('bigint')` instead
1167
- */
1168
- get baseValueBigInt() {
1169
- return this.getBaseValue("bigint");
1170
- }
1171
- set(t) {
1172
- return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
1173
- }
1174
- add(...t) {
1175
- return g(this, L, $).call(this, "add", ...t);
1176
- }
1177
- sub(...t) {
1178
- return g(this, L, $).call(this, "sub", ...t);
1179
- }
1180
- mul(...t) {
1181
- return g(this, L, $).call(this, "mul", ...t);
1182
- }
1183
- div(...t) {
1184
- return g(this, L, $).call(this, "div", ...t);
1185
- }
1186
- gt(t) {
1187
- return this.bigIntValue > this.getBigIntValue(t);
1188
- }
1189
- gte(t) {
1190
- return this.bigIntValue >= this.getBigIntValue(t);
1191
- }
1192
- lt(t) {
1193
- return this.bigIntValue < this.getBigIntValue(t);
1194
- }
1195
- lte(t) {
1196
- return this.bigIntValue <= this.getBigIntValue(t);
1197
- }
1198
- eqValue(t) {
1199
- return this.bigIntValue === this.getBigIntValue(t);
1200
- }
1201
- getValue(t) {
1202
- const n = this.formatBigIntToSafeValue(
1203
- this.bigIntValue,
1204
- this.decimal || F(this.decimalMultiplier)
1205
- );
1206
- switch (t) {
1207
- case "number":
1208
- return Number(n);
1209
- case "string":
1210
- return n;
1211
- default:
1212
- return this.bigIntValue * BigInt(this.decimal || 8n) / this.decimalMultiplier;
1213
- }
1214
- }
1215
- getBaseValue(t) {
1216
- const n = this.decimalMultiplier / U(this.decimal || b.THOR), a = this.bigIntValue / n;
1217
- switch (t) {
1218
- case "number":
1219
- return Number(a);
1220
- case "string":
1221
- return a.toString();
1222
- default:
1223
- return a;
1224
- }
1225
- }
1226
- getBigIntValue(t, n) {
1227
- if (!n && typeof t == "object")
1228
- return t.bigIntValue;
1229
- const a = pe(t), i = g(this, H, G).call(this, a);
1230
- return i === "0" || i === "undefined" ? 0n : g(this, Q, se).call(this, i, n);
1231
- }
1232
- formatBigIntToSafeValue(t, n) {
1233
- const a = n || this.decimal || q, i = Math.max(
1234
- a,
1235
- F(this.decimalMultiplier)
1236
- ), r = t < 0n, p = t.toString().substring(r ? 1 : 0), d = i - (p.length - 1), y = d > 0 ? "0".repeat(d) + p : p, l = y.length - i;
1237
- let o = y.slice(-i);
1238
- return parseInt(o[a]) >= 5 ? o = `${o.substring(0, a - 1)}${(parseInt(o[a - 1]) + 1).toString()}` : o = o.substring(0, a), `${r ? "-" : ""}${y.slice(
1239
- 0,
1240
- l
1241
- )}.${o}`.replace(/\.?0*$/, "");
1242
- }
1243
- toSignificant(t = 6) {
1244
- const [n, a] = this.getValue("string").split("."), i = n || "", r = a || "", p = parseInt(i) ? i.length + r.length : r.length;
1245
- if (p <= t)
1246
- return this.getValue("string");
1247
- if (i.length >= t)
1248
- return i.slice(0, t).padEnd(i.length, "0");
1249
- if (parseInt(i))
1250
- return `${i}.${r.slice(0, t - i.length)}`.padEnd(
1251
- p - t,
1252
- "0"
1253
- );
1254
- const d = parseInt(r), y = `${d}`.slice(0, t);
1255
- return `0.${y.padStart(
1256
- r.length - `${d}`.length + y.length,
1257
- "0"
1258
- )}`;
1259
- }
1260
- };
1261
- L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
1262
- const n = g(this, ae, me).call(this, this, ...t), a = U(n), i = t.reduce(
1263
- (p, d) => {
1264
- const y = this.getBigIntValue(d, n);
1265
- switch (e) {
1266
- case "add":
1267
- return p + y;
1268
- case "sub":
1269
- return p - y;
1270
- case "mul":
1271
- return p * y / a;
1272
- case "div": {
1273
- if (y === 0n)
1274
- throw new RangeError("Division by zero");
1275
- return p * a / y;
1276
- }
1277
- default:
1278
- return p;
1279
- }
1280
- },
1281
- //normalize is to precision multiplier base
1282
- this.bigIntValue * a / this.decimalMultiplier
1283
- ), r = ge({
1284
- bigIntDecimal: n,
1285
- decimal: Math.max(n, F(this.decimalMultiplier)),
1286
- value: i
1287
- });
1288
- return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
1289
- }, ne = /* @__PURE__ */ new WeakSet(), Ie = function(e) {
1290
- const t = g(this, H, G).call(this, e) || "0";
1291
- this.bigIntValue = g(this, Q, se).call(this, t);
1292
- }, ae = /* @__PURE__ */ new WeakSet(), me = function(...e) {
1293
- const t = e.map(
1294
- (n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : g(this, J, ie).call(this, g(this, H, G).call(this, n))
1295
- ).filter(Boolean);
1296
- return Math.max(...t, q);
1297
- }, Q = /* @__PURE__ */ new WeakSet(), se = function(e, t) {
1298
- const n = t ? U(t) : this.decimalMultiplier, a = F(n), [i = "", r = ""] = e.split(".");
1299
- return BigInt(`${i}${r.padEnd(a, "0")}`);
1300
- }, H = /* @__PURE__ */ new WeakSet(), G = function(e) {
1301
- const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
1302
- useGrouping: !1,
1303
- maximumFractionDigits: 20
1304
- }) : pe(e)}`.replaceAll(",", ".").split(".");
1305
- return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
1306
- }, J = /* @__PURE__ */ new WeakSet(), ie = function(e) {
1307
- var t;
1308
- const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
1309
- return Math.max(n, q);
1310
- };
1311
- let re = mt;
1312
- function pe(e) {
1313
- return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
1314
- }
1315
- let oe;
1316
- const te = (e) => {
1317
- if (!oe)
1318
- throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
1319
- return oe.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
1320
- }, Te = async (e, t = 0) => {
1321
- ct(e);
1322
- const n = await Oe(de(e));
1323
- return new v({ decimal: n, value: t, identifier: e });
1324
- };
1325
- class v extends re {
1326
- constructor(t) {
1327
- super(
1328
- t.value instanceof re ? t.value : { decimal: t.decimal, value: t.value }
1329
- ), C(this, "address"), C(this, "chain"), C(this, "isSynthetic", !1), C(this, "isGasAsset", !1), C(this, "symbol"), C(this, "ticker"), C(this, "type");
1330
- const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = de(n);
1331
- this.type = pt(a), this.chain = a.chain, this.ticker = a.ticker, this.symbol = a.symbol, this.address = a.address, this.isSynthetic = a.isSynthetic, this.isGasAsset = a.isGasAsset;
1332
- }
1333
- get assetValue() {
1334
- return `${this.getValue("string")} ${this.ticker}`;
1335
- }
1336
- toString(t = !1) {
1337
- const n = this.isSynthetic ? this.ticker : `${this.chain}.${this.ticker}`;
1338
- return t ? n : (
1339
- // THOR.ETH/ETH | ETH.USDT-0x1234567890
1340
- `${this.chain}.${this.symbol}`
1341
- );
1342
- }
1343
- eq({ chain: t, symbol: n }) {
1344
- return this.chain === t && this.symbol === n;
1345
- }
1346
- static async fromString(t, n = 0) {
1347
- return Te(t, n);
1348
- }
1349
- static fromStringSync(t, n = 0) {
1350
- const { decimal: a, identifier: i } = te(
1351
- t
1352
- );
1353
- return i ? new v({ decimal: a, identifier: i, value: n }) : void 0;
1354
- }
1355
- static async fromIdentifier(t, n = 0) {
1356
- return Te(t, n);
1357
- }
1358
- static fromIdentifierSync(t, n = 0) {
1359
- const { decimal: a, identifier: i } = te(t);
1360
- return new v({ decimal: a, identifier: i, value: n });
1361
- }
1362
- static fromChainOrSignature(t, n = 0) {
1363
- const { decimal: a, identifier: i } = rt(t);
1364
- return new v({ value: n, decimal: a, identifier: i });
1365
- }
1366
- static async fromTCQuote(t, n = 0) {
1367
- const a = await Oe(de(t)), i = this.shiftDecimals({ value: n, from: b.THOR, to: a });
1368
- return new v({ value: i, identifier: t, decimal: a });
1369
- }
1370
- static fromTCQuoteStatic(t, n = 0) {
1371
- const a = te(t), i = this.shiftDecimals({
1372
- value: n,
1373
- from: b.THOR,
1374
- to: a.decimal
1375
- });
1376
- return new v({ ...a, value: i });
1377
- }
1378
- static async loadStaticAssets() {
1379
- return new Promise(
1380
- async (t, n) => {
1381
- try {
1382
- const {
1383
- // Omit ThorchainList from import to avoid decimals conflict (TC uses 8 for all)
1384
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1385
- ThorchainList: a,
1386
- NativeList: i,
1387
- ...r
1388
- } = await import("@swapkit/tokens");
1389
- oe = [i, ...Object.values(r)].reduce(
1390
- (p, { tokens: d }) => (d.forEach(({ identifier: y, chain: l, ...o }) => {
1391
- const c = "decimals" in o ? o.decimals : b[l];
1392
- p.set(y, { identifier: y, decimal: c });
1393
- }), p),
1394
- /* @__PURE__ */ new Map()
1395
- ), t({ ok: !0 });
1396
- } catch (a) {
1397
- console.error(a), n({
1398
- ok: !1,
1399
- error: a,
1400
- message: "Couldn't load static assets. Ensure you have installed @swapkit/tokens package"
1401
- });
1402
- }
1403
- }
1404
- );
1405
- }
1406
- }
1407
- const _e = (e) => {
1408
- const t = v.fromChainOrSignature(e);
1409
- switch (e) {
1410
- case s.Bitcoin:
1411
- case s.Litecoin:
1412
- case s.BitcoinCash:
1413
- return t.add(10001);
1414
- case s.Dogecoin:
1415
- return t.add(100000001);
1416
- case s.Avalanche:
1417
- case s.Ethereum:
1418
- return t.add(10 * 10 ** 9);
1419
- case s.THORChain:
1420
- case s.Maya:
1421
- return t.add(0);
1422
- default:
1423
- return t.add(1);
1424
- }
1425
- }, de = (e) => {
1426
- const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${s.THORChain}.${e}`, [a, i] = n.split("."), [r, p] = i.split("-");
1427
- return {
1428
- address: p == null ? void 0 : p.toLowerCase(),
1429
- chain: a,
1430
- isGasAsset: it({ chain: a, symbol: i }),
1431
- isSynthetic: t,
1432
- symbol: p ? `${r}-${(p == null ? void 0 : p.toLowerCase()) ?? ""}` : i,
1433
- ticker: t ? i : r
1434
- };
1435
- }, Tt = {
1436
- /**
1437
- * Core
1438
- */
1439
- core_wallet_connection_not_found: 10001,
1440
- core_estimated_max_spendable_chain_not_supported: 10002,
1441
- core_extend_error: 10003,
1442
- core_inbound_data_not_found: 10004,
1443
- core_approve_asset_address_or_from_not_found: 10005,
1444
- core_chain_halted: 10099,
1445
- /**
1446
- * Core - Wallet Connection
1447
- */
1448
- core_wallet_xdefi_not_installed: 10101,
1449
- core_wallet_evmwallet_not_installed: 10102,
1450
- core_wallet_walletconnect_not_installed: 10103,
1451
- core_wallet_keystore_not_installed: 10104,
1452
- core_wallet_ledger_not_installed: 10105,
1453
- core_wallet_trezor_not_installed: 10106,
1454
- core_wallet_keplr_not_installed: 10107,
1455
- core_wallet_okx_not_installed: 10108,
1456
- /**
1457
- * Core - Swap
1458
- */
1459
- core_swap_invalid_params: 10200,
1460
- core_swap_route_not_complete: 10201,
1461
- core_swap_asset_not_recognized: 10202,
1462
- core_swap_contract_not_found: 10203,
1463
- core_swap_route_transaction_not_found: 10204,
1464
- core_swap_contract_not_supported: 10205,
1465
- core_swap_transaction_error: 10206,
1466
- core_swap_quote_mode_not_supported: 10207,
1467
- /**
1468
- * Core - Transaction
1469
- */
1470
- core_transaction_deposit_error: 10301,
1471
- core_transaction_create_liquidity_rune_error: 10302,
1472
- core_transaction_create_liquidity_asset_error: 10303,
1473
- core_transaction_create_liquidity_invalid_params: 10304,
1474
- core_transaction_add_liquidity_invalid_params: 10305,
1475
- core_transaction_add_liquidity_no_rune_address: 10306,
1476
- core_transaction_add_liquidity_rune_error: 10307,
1477
- core_transaction_add_liquidity_asset_error: 10308,
1478
- core_transaction_withdraw_error: 10309,
1479
- core_transaction_deposit_to_pool_error: 10310,
1480
- core_transaction_deposit_insufficient_funds_error: 10311,
1481
- core_transaction_deposit_gas_error: 10312,
1482
- core_transaction_deposit_server_error: 10313,
1483
- /**
1484
- * Wallets
1485
- */
1486
- wallet_ledger_connection_error: 20001,
1487
- /**
1488
- * Helpers
1489
- */
1490
- helpers_number_different_decimals: 99101
1491
- };
1492
- class m extends Error {
1493
- constructor(t, n) {
1494
- console.error(n), super(t, { cause: { code: Tt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
1495
- }
1496
- }
1497
- class ue extends re {
1498
- eq(t) {
1499
- return this.eqValue(t);
1500
- }
1501
- }
1502
- const _t = [
1503
- {
1504
- inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1505
- stateMutability: "nonpayable",
1506
- type: "constructor"
1507
- },
1508
- {
1509
- anonymous: !1,
1510
- inputs: [
1511
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1512
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
1513
- ],
1514
- name: "FeeSet",
1515
- type: "event"
1516
- },
1517
- {
1518
- anonymous: !1,
1519
- inputs: [
1520
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
1521
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
1522
- ],
1523
- name: "OwnerSet",
1524
- type: "event"
1525
- },
1526
- {
1527
- inputs: [],
1528
- name: "fee",
1529
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1530
- stateMutability: "view",
1531
- type: "function"
1532
- },
1533
- {
1534
- inputs: [],
1535
- name: "feeRecipient",
1536
- outputs: [{ internalType: "address", name: "", type: "address" }],
1537
- stateMutability: "view",
1538
- type: "function"
1539
- },
1540
- {
1541
- inputs: [{ internalType: "address", name: "", type: "address" }],
1542
- name: "owners",
1543
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1544
- stateMutability: "view",
1545
- type: "function"
1546
- },
1547
- {
1548
- inputs: [
1549
- { internalType: "uint256", name: "_fee", type: "uint256" },
1550
- { internalType: "address", name: "_feeRecipient", type: "address" }
1551
- ],
1552
- name: "setFee",
1553
- outputs: [],
1554
- stateMutability: "nonpayable",
1555
- type: "function"
1556
- },
1557
- {
1558
- inputs: [
1559
- { internalType: "address", name: "owner", type: "address" },
1560
- { internalType: "bool", name: "active", type: "bool" }
1561
- ],
1562
- name: "setOwner",
1563
- outputs: [],
1564
- stateMutability: "nonpayable",
1565
- type: "function"
1566
- },
1567
- {
1568
- inputs: [
1569
- { internalType: "address", name: "tcRouter", type: "address" },
1570
- { internalType: "address", name: "tcVault", type: "address" },
1571
- { internalType: "string", name: "tcMemo", type: "string" },
1572
- { internalType: "address", name: "token", type: "address" },
1573
- { internalType: "uint256", name: "amount", type: "uint256" },
1574
- { internalType: "address", name: "router", type: "address" },
1575
- { internalType: "bytes", name: "data", type: "bytes" },
1576
- { internalType: "uint256", name: "deadline", type: "uint256" }
1577
- ],
1578
- name: "swapIn",
1579
- outputs: [],
1580
- stateMutability: "nonpayable",
1581
- type: "function"
1582
- },
1583
- {
1584
- inputs: [],
1585
- name: "tokenTransferProxy",
1586
- outputs: [
1587
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
1588
- ],
1589
- stateMutability: "view",
1590
- type: "function"
1591
- },
1592
- { stateMutability: "payable", type: "receive" }
1593
- ], ht = [
1594
- {
1595
- inputs: [
1596
- { internalType: "address", name: "_ttp", type: "address" },
1597
- { internalType: "address", name: "_weth", type: "address" },
1598
- { internalType: "address", name: "_swapRouter", type: "address" }
1599
- ],
1600
- stateMutability: "nonpayable",
1601
- type: "constructor"
1602
- },
1603
- {
1604
- anonymous: !1,
1605
- inputs: [
1606
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1607
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
1608
- ],
1609
- name: "FeeSet",
1610
- type: "event"
1611
- },
1612
- {
1613
- anonymous: !1,
1614
- inputs: [
1615
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
1616
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
1617
- ],
1618
- name: "OwnerSet",
1619
- type: "event"
1620
- },
1621
- {
1622
- anonymous: !1,
1623
- inputs: [
1624
- { indexed: !1, internalType: "address", name: "from", type: "address" },
1625
- { indexed: !1, internalType: "address", name: "token", type: "address" },
1626
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
1627
- { indexed: !1, internalType: "uint256", name: "out", type: "uint256" },
1628
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1629
- { indexed: !1, internalType: "address", name: "vault", type: "address" },
1630
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
1631
- ],
1632
- name: "SwapIn",
1633
- type: "event"
1634
- },
1635
- {
1636
- anonymous: !1,
1637
- inputs: [
1638
- { indexed: !1, internalType: "address", name: "to", type: "address" },
1639
- { indexed: !1, internalType: "address", name: "token", type: "address" },
1640
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
1641
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" }
1642
- ],
1643
- name: "SwapOut",
1644
- type: "event"
1645
- },
1646
- {
1647
- inputs: [],
1648
- name: "fee",
1649
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1650
- stateMutability: "view",
1651
- type: "function"
1652
- },
1653
- {
1654
- inputs: [],
1655
- name: "feeRecipient",
1656
- outputs: [{ internalType: "address", name: "", type: "address" }],
1657
- stateMutability: "view",
1658
- type: "function"
1659
- },
1660
- {
1661
- inputs: [{ internalType: "address", name: "", type: "address" }],
1662
- name: "owners",
1663
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1664
- stateMutability: "view",
1665
- type: "function"
1666
- },
1667
- {
1668
- inputs: [
1669
- { internalType: "uint256", name: "_fee", type: "uint256" },
1670
- { internalType: "address", name: "_feeRecipient", type: "address" }
1671
- ],
1672
- name: "setFee",
1673
- outputs: [],
1674
- stateMutability: "nonpayable",
1675
- type: "function"
1676
- },
1677
- {
1678
- inputs: [
1679
- { internalType: "address", name: "owner", type: "address" },
1680
- { internalType: "bool", name: "active", type: "bool" }
1681
- ],
1682
- name: "setOwner",
1683
- outputs: [],
1684
- stateMutability: "nonpayable",
1685
- type: "function"
1686
- },
1687
- {
1688
- inputs: [
1689
- { internalType: "address", name: "router", type: "address" },
1690
- { internalType: "address", name: "vault", type: "address" },
1691
- { internalType: "string", name: "memo", type: "string" },
1692
- { internalType: "address", name: "token", type: "address" },
1693
- { internalType: "uint256", name: "amount", type: "uint256" },
1694
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
1695
- { internalType: "uint256", name: "deadline", type: "uint256" }
1696
- ],
1697
- name: "swapIn",
1698
- outputs: [],
1699
- stateMutability: "nonpayable",
1700
- type: "function"
1701
- },
1702
- {
1703
- inputs: [
1704
- { internalType: "address", name: "token", type: "address" },
1705
- { internalType: "address", name: "to", type: "address" },
1706
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
1707
- ],
1708
- name: "swapOut",
1709
- outputs: [],
1710
- stateMutability: "payable",
1711
- type: "function"
1712
- },
1713
- {
1714
- inputs: [],
1715
- name: "swapRouter",
1716
- outputs: [{ internalType: "contract IWoofi", name: "", type: "address" }],
1717
- stateMutability: "view",
1718
- type: "function"
1719
- },
1720
- {
1721
- inputs: [],
1722
- name: "tokenTransferProxy",
1723
- outputs: [
1724
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
1725
- ],
1726
- stateMutability: "view",
1727
- type: "function"
1728
- },
1729
- {
1730
- inputs: [],
1731
- name: "weth",
1732
- outputs: [{ internalType: "address", name: "", type: "address" }],
1733
- stateMutability: "view",
1734
- type: "function"
1735
- },
1736
- { stateMutability: "payable", type: "receive" }
1737
- ], ft = [
1738
- {
1739
- inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1740
- stateMutability: "nonpayable",
1741
- type: "constructor"
1742
- },
1743
- {
1744
- anonymous: !1,
1745
- inputs: [
1746
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1747
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
1748
- ],
1749
- name: "FeeSet",
1750
- type: "event"
1751
- },
1752
- {
1753
- anonymous: !1,
1754
- inputs: [
1755
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
1756
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
1757
- ],
1758
- name: "OwnerSet",
1759
- type: "event"
1760
- },
1761
- {
1762
- anonymous: !1,
1763
- inputs: [
1764
- { indexed: !1, internalType: "address", name: "from", type: "address" },
1765
- { indexed: !1, internalType: "address", name: "token", type: "address" },
1766
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
1767
- { indexed: !1, internalType: "uint256", name: "out", type: "uint256" },
1768
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1769
- { indexed: !1, internalType: "address", name: "vault", type: "address" },
1770
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
1771
- ],
1772
- name: "SwapIn",
1773
- type: "event"
1774
- },
1775
- {
1776
- inputs: [],
1777
- name: "fee",
1778
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1779
- stateMutability: "view",
1780
- type: "function"
1781
- },
1782
- {
1783
- inputs: [],
1784
- name: "feeRecipient",
1785
- outputs: [{ internalType: "address", name: "", type: "address" }],
1786
- stateMutability: "view",
1787
- type: "function"
1788
- },
1789
- {
1790
- inputs: [{ internalType: "address", name: "", type: "address" }],
1791
- name: "owners",
1792
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1793
- stateMutability: "view",
1794
- type: "function"
1795
- },
1796
- {
1797
- inputs: [
1798
- { internalType: "uint256", name: "_fee", type: "uint256" },
1799
- { internalType: "address", name: "_feeRecipient", type: "address" }
1800
- ],
1801
- name: "setFee",
1802
- outputs: [],
1803
- stateMutability: "nonpayable",
1804
- type: "function"
1805
- },
1806
- {
1807
- inputs: [
1808
- { internalType: "address", name: "owner", type: "address" },
1809
- { internalType: "bool", name: "active", type: "bool" }
1810
- ],
1811
- name: "setOwner",
1812
- outputs: [],
1813
- stateMutability: "nonpayable",
1814
- type: "function"
1815
- },
1816
- {
1817
- inputs: [
1818
- { internalType: "address", name: "router", type: "address" },
1819
- { internalType: "address", name: "vault", type: "address" },
1820
- { internalType: "string", name: "memo", type: "string" },
1821
- { internalType: "address", name: "token", type: "address" },
1822
- { internalType: "uint256", name: "amount", type: "uint256" },
1823
- { internalType: "address", name: "swapRouter", type: "address" },
1824
- { internalType: "bytes", name: "data", type: "bytes" },
1825
- { internalType: "uint256", name: "deadline", type: "uint256" }
1826
- ],
1827
- name: "swapIn",
1828
- outputs: [],
1829
- stateMutability: "nonpayable",
1830
- type: "function"
1831
- },
1832
- {
1833
- inputs: [],
1834
- name: "tokenTransferProxy",
1835
- outputs: [
1836
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
1837
- ],
1838
- stateMutability: "view",
1839
- type: "function"
1840
- },
1841
- { stateMutability: "payable", type: "receive" }
1842
- ], bt = [
1843
- {
1844
- inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1845
- stateMutability: "nonpayable",
1846
- type: "constructor"
1847
- },
1848
- {
1849
- anonymous: !1,
1850
- inputs: [
1851
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1852
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
1853
- ],
1854
- name: "FeeSet",
1855
- type: "event"
1856
- },
1857
- {
1858
- anonymous: !1,
1859
- inputs: [
1860
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
1861
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
1862
- ],
1863
- name: "OwnerSet",
1864
- type: "event"
1865
- },
1866
- {
1867
- inputs: [],
1868
- name: "fee",
1869
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1870
- stateMutability: "view",
1871
- type: "function"
1872
- },
1873
- {
1874
- inputs: [],
1875
- name: "feeRecipient",
1876
- outputs: [{ internalType: "address", name: "", type: "address" }],
1877
- stateMutability: "view",
1878
- type: "function"
1879
- },
1880
- {
1881
- inputs: [{ internalType: "address", name: "", type: "address" }],
1882
- name: "owners",
1883
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1884
- stateMutability: "view",
1885
- type: "function"
1886
- },
1887
- {
1888
- inputs: [
1889
- { internalType: "uint256", name: "_fee", type: "uint256" },
1890
- { internalType: "address", name: "_feeRecipient", type: "address" }
1891
- ],
1892
- name: "setFee",
1893
- outputs: [],
1894
- stateMutability: "nonpayable",
1895
- type: "function"
1896
- },
1897
- {
1898
- inputs: [
1899
- { internalType: "address", name: "owner", type: "address" },
1900
- { internalType: "bool", name: "active", type: "bool" }
1901
- ],
1902
- name: "setOwner",
1903
- outputs: [],
1904
- stateMutability: "nonpayable",
1905
- type: "function"
1906
- },
1907
- {
1908
- inputs: [
1909
- { internalType: "address", name: "tcRouter", type: "address" },
1910
- { internalType: "address", name: "tcVault", type: "address" },
1911
- { internalType: "string", name: "tcMemo", type: "string" },
1912
- { internalType: "address", name: "token", type: "address" },
1913
- { internalType: "uint256", name: "amount", type: "uint256" },
1914
- { internalType: "address", name: "router", type: "address" },
1915
- { internalType: "bytes", name: "data", type: "bytes" },
1916
- { internalType: "uint256", name: "deadline", type: "uint256" }
1917
- ],
1918
- name: "swapIn",
1919
- outputs: [],
1920
- stateMutability: "nonpayable",
1921
- type: "function"
1922
- },
1923
- {
1924
- inputs: [],
1925
- name: "tokenTransferProxy",
1926
- outputs: [
1927
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
1928
- ],
1929
- stateMutability: "view",
1930
- type: "function"
1931
- },
1932
- { stateMutability: "payable", type: "receive" }
1933
- ], At = [
1934
- {
1935
- inputs: [
1936
- { internalType: "address", name: "_ttp", type: "address" },
1937
- { internalType: "address", name: "_wbnb", type: "address" },
1938
- { internalType: "address", name: "_swapRouter", type: "address" }
1939
- ],
1940
- stateMutability: "nonpayable",
1941
- type: "constructor"
1942
- },
1943
- {
1944
- anonymous: !1,
1945
- inputs: [
1946
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1947
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
1948
- ],
1949
- name: "FeeSet",
1950
- type: "event"
1951
- },
1952
- {
1953
- anonymous: !1,
1954
- inputs: [
1955
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
1956
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
1957
- ],
1958
- name: "OwnerSet",
1959
- type: "event"
1960
- },
1961
- {
1962
- anonymous: !1,
1963
- inputs: [
1964
- { indexed: !1, internalType: "address", name: "from", type: "address" },
1965
- { indexed: !1, internalType: "address", name: "token", type: "address" },
1966
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
1967
- { indexed: !1, internalType: "uint256", name: "out", type: "uint256" },
1968
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1969
- { indexed: !1, internalType: "address", name: "vault", type: "address" },
1970
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
1971
- ],
1972
- name: "SwapIn",
1973
- type: "event"
1974
- },
1975
- {
1976
- anonymous: !1,
1977
- inputs: [
1978
- { indexed: !1, internalType: "address", name: "to", type: "address" },
1979
- { indexed: !1, internalType: "address", name: "token", type: "address" },
1980
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
1981
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" }
1982
- ],
1983
- name: "SwapOut",
1984
- type: "event"
1985
- },
1986
- {
1987
- inputs: [],
1988
- name: "fee",
1989
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1990
- stateMutability: "view",
1991
- type: "function"
1992
- },
1993
- {
1994
- inputs: [],
1995
- name: "feeRecipient",
1996
- outputs: [{ internalType: "address", name: "", type: "address" }],
1997
- stateMutability: "view",
1998
- type: "function"
1999
- },
2000
- {
2001
- inputs: [{ internalType: "address", name: "", type: "address" }],
2002
- name: "owners",
2003
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2004
- stateMutability: "view",
2005
- type: "function"
2006
- },
2007
- {
2008
- inputs: [
2009
- { internalType: "uint256", name: "_fee", type: "uint256" },
2010
- { internalType: "address", name: "_feeRecipient", type: "address" }
2011
- ],
2012
- name: "setFee",
2013
- outputs: [],
2014
- stateMutability: "nonpayable",
2015
- type: "function"
2016
- },
2017
- {
2018
- inputs: [
2019
- { internalType: "address", name: "owner", type: "address" },
2020
- { internalType: "bool", name: "active", type: "bool" }
2021
- ],
2022
- name: "setOwner",
2023
- outputs: [],
2024
- stateMutability: "nonpayable",
2025
- type: "function"
2026
- },
2027
- {
2028
- inputs: [
2029
- { internalType: "address", name: "router", type: "address" },
2030
- { internalType: "address", name: "vault", type: "address" },
2031
- { internalType: "string", name: "memo", type: "string" },
2032
- { internalType: "address", name: "token", type: "address" },
2033
- { internalType: "uint256", name: "amount", type: "uint256" },
2034
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2035
- { internalType: "uint256", name: "deadline", type: "uint256" }
2036
- ],
2037
- name: "swapIn",
2038
- outputs: [],
2039
- stateMutability: "nonpayable",
2040
- type: "function"
2041
- },
2042
- {
2043
- inputs: [
2044
- { internalType: "address", name: "token", type: "address" },
2045
- { internalType: "address", name: "to", type: "address" },
2046
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2047
- ],
2048
- name: "swapOut",
2049
- outputs: [],
2050
- stateMutability: "payable",
2051
- type: "function"
2052
- },
2053
- {
2054
- inputs: [],
2055
- name: "swapRouter",
2056
- outputs: [{ internalType: "contract IPancakeRouterV2", name: "", type: "address" }],
2057
- stateMutability: "view",
2058
- type: "function"
2059
- },
2060
- {
2061
- inputs: [],
2062
- name: "tokenTransferProxy",
2063
- outputs: [
2064
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2065
- ],
2066
- stateMutability: "view",
2067
- type: "function"
2068
- },
2069
- {
2070
- inputs: [],
2071
- name: "wbnb",
2072
- outputs: [{ internalType: "address", name: "", type: "address" }],
2073
- stateMutability: "view",
2074
- type: "function"
2075
- },
2076
- { stateMutability: "payable", type: "receive" }
2077
- ], wt = [
2078
- {
2079
- inputs: [
2080
- { internalType: "address", name: "_ttp", type: "address" },
2081
- { internalType: "address", name: "_weth", type: "address" },
2082
- { internalType: "address", name: "_swapRouter", type: "address" }
2083
- ],
2084
- stateMutability: "nonpayable",
2085
- type: "constructor"
2086
- },
2087
- {
2088
- anonymous: !1,
2089
- inputs: [
2090
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2091
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2092
- ],
2093
- name: "FeeSet",
2094
- type: "event"
2095
- },
2096
- {
2097
- anonymous: !1,
2098
- inputs: [
2099
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2100
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2101
- ],
2102
- name: "OwnerSet",
2103
- type: "event"
2104
- },
2105
- {
2106
- inputs: [],
2107
- name: "fee",
2108
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2109
- stateMutability: "view",
2110
- type: "function"
2111
- },
2112
- {
2113
- inputs: [],
2114
- name: "feeRecipient",
2115
- outputs: [{ internalType: "address", name: "", type: "address" }],
2116
- stateMutability: "view",
2117
- type: "function"
2118
- },
2119
- {
2120
- inputs: [{ internalType: "address", name: "", type: "address" }],
2121
- name: "owners",
2122
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2123
- stateMutability: "view",
2124
- type: "function"
2125
- },
2126
- {
2127
- inputs: [
2128
- { internalType: "uint256", name: "_fee", type: "uint256" },
2129
- { internalType: "address", name: "_feeRecipient", type: "address" }
2130
- ],
2131
- name: "setFee",
2132
- outputs: [],
2133
- stateMutability: "nonpayable",
2134
- type: "function"
2135
- },
2136
- {
2137
- inputs: [
2138
- { internalType: "address", name: "owner", type: "address" },
2139
- { internalType: "bool", name: "active", type: "bool" }
2140
- ],
2141
- name: "setOwner",
2142
- outputs: [],
2143
- stateMutability: "nonpayable",
2144
- type: "function"
2145
- },
2146
- {
2147
- inputs: [
2148
- { internalType: "address", name: "tcRouter", type: "address" },
2149
- { internalType: "address", name: "tcVault", type: "address" },
2150
- { internalType: "string", name: "tcMemo", type: "string" },
2151
- { internalType: "address", name: "token", type: "address" },
2152
- { internalType: "uint256", name: "amount", type: "uint256" },
2153
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2154
- { internalType: "uint256", name: "deadline", type: "uint256" }
2155
- ],
2156
- name: "swapIn",
2157
- outputs: [],
2158
- stateMutability: "nonpayable",
2159
- type: "function"
2160
- },
2161
- {
2162
- inputs: [
2163
- { internalType: "address", name: "token", type: "address" },
2164
- { internalType: "address", name: "to", type: "address" },
2165
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2166
- ],
2167
- name: "swapOut",
2168
- outputs: [],
2169
- stateMutability: "payable",
2170
- type: "function"
2171
- },
2172
- {
2173
- inputs: [],
2174
- name: "swapRouter",
2175
- outputs: [{ internalType: "contract IUniswapRouterV2AVAX", name: "", type: "address" }],
2176
- stateMutability: "view",
2177
- type: "function"
2178
- },
2179
- {
2180
- inputs: [],
2181
- name: "tokenTransferProxy",
2182
- outputs: [
2183
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2184
- ],
2185
- stateMutability: "view",
2186
- type: "function"
2187
- },
2188
- {
2189
- inputs: [],
2190
- name: "weth",
2191
- outputs: [{ internalType: "address", name: "", type: "address" }],
2192
- stateMutability: "view",
2193
- type: "function"
2194
- },
2195
- { stateMutability: "payable", type: "receive" }
2196
- ], Et = [
2197
- {
2198
- inputs: [
2199
- { internalType: "address", name: "_ttp", type: "address" },
2200
- { internalType: "address", name: "_weth", type: "address" },
2201
- { internalType: "address", name: "_swapRouter", type: "address" }
2202
- ],
2203
- stateMutability: "nonpayable",
2204
- type: "constructor"
2205
- },
2206
- {
2207
- anonymous: !1,
2208
- inputs: [
2209
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2210
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2211
- ],
2212
- name: "FeeSet",
2213
- type: "event"
2214
- },
2215
- {
2216
- anonymous: !1,
2217
- inputs: [
2218
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2219
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2220
- ],
2221
- name: "OwnerSet",
2222
- type: "event"
2223
- },
2224
- {
2225
- inputs: [],
2226
- name: "fee",
2227
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2228
- stateMutability: "view",
2229
- type: "function"
2230
- },
2231
- {
2232
- inputs: [],
2233
- name: "feeRecipient",
2234
- outputs: [{ internalType: "address", name: "", type: "address" }],
2235
- stateMutability: "view",
2236
- type: "function"
2237
- },
2238
- {
2239
- inputs: [{ internalType: "address", name: "", type: "address" }],
2240
- name: "owners",
2241
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2242
- stateMutability: "view",
2243
- type: "function"
2244
- },
2245
- {
2246
- inputs: [
2247
- { internalType: "uint256", name: "_fee", type: "uint256" },
2248
- { internalType: "address", name: "_feeRecipient", type: "address" }
2249
- ],
2250
- name: "setFee",
2251
- outputs: [],
2252
- stateMutability: "nonpayable",
2253
- type: "function"
2254
- },
2255
- {
2256
- inputs: [
2257
- { internalType: "address", name: "owner", type: "address" },
2258
- { internalType: "bool", name: "active", type: "bool" }
2259
- ],
2260
- name: "setOwner",
2261
- outputs: [],
2262
- stateMutability: "nonpayable",
2263
- type: "function"
2264
- },
2265
- {
2266
- inputs: [
2267
- { internalType: "address", name: "tcRouter", type: "address" },
2268
- { internalType: "address", name: "tcVault", type: "address" },
2269
- { internalType: "string", name: "tcMemo", type: "string" },
2270
- { internalType: "address", name: "token", type: "address" },
2271
- { internalType: "uint256", name: "amount", type: "uint256" },
2272
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2273
- { internalType: "uint256", name: "deadline", type: "uint256" }
2274
- ],
2275
- name: "swapIn",
2276
- outputs: [],
2277
- stateMutability: "nonpayable",
2278
- type: "function"
2279
- },
2280
- {
2281
- inputs: [
2282
- { internalType: "address", name: "token", type: "address" },
2283
- { internalType: "address", name: "to", type: "address" },
2284
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2285
- ],
2286
- name: "swapOut",
2287
- outputs: [],
2288
- stateMutability: "payable",
2289
- type: "function"
2290
- },
2291
- {
2292
- inputs: [],
2293
- name: "swapRouter",
2294
- outputs: [{ internalType: "contract IUniswapRouterV2", name: "", type: "address" }],
2295
- stateMutability: "view",
2296
- type: "function"
2297
- },
2298
- {
2299
- inputs: [],
2300
- name: "tokenTransferProxy",
2301
- outputs: [
2302
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2303
- ],
2304
- stateMutability: "view",
2305
- type: "function"
2306
- },
2307
- {
2308
- inputs: [],
2309
- name: "weth",
2310
- outputs: [{ internalType: "address", name: "", type: "address" }],
2311
- stateMutability: "view",
2312
- type: "function"
2313
- },
2314
- { stateMutability: "payable", type: "receive" }
2315
- ], Rt = [
2316
- {
2317
- inputs: [
2318
- { internalType: "address", name: "_ttp", type: "address" },
2319
- { internalType: "address", name: "_weth", type: "address" },
2320
- { internalType: "address", name: "_swapRouter", type: "address" }
2321
- ],
2322
- stateMutability: "nonpayable",
2323
- type: "constructor"
2324
- },
2325
- {
2326
- anonymous: !1,
2327
- inputs: [
2328
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2329
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2330
- ],
2331
- name: "FeeSet",
2332
- type: "event"
2333
- },
2334
- {
2335
- anonymous: !1,
2336
- inputs: [
2337
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2338
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2339
- ],
2340
- name: "OwnerSet",
2341
- type: "event"
2342
- },
2343
- {
2344
- inputs: [],
2345
- name: "fee",
2346
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2347
- stateMutability: "view",
2348
- type: "function"
2349
- },
2350
- {
2351
- inputs: [],
2352
- name: "feeRecipient",
2353
- outputs: [{ internalType: "address", name: "", type: "address" }],
2354
- stateMutability: "view",
2355
- type: "function"
2356
- },
2357
- {
2358
- inputs: [{ internalType: "address", name: "", type: "address" }],
2359
- name: "owners",
2360
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2361
- stateMutability: "view",
2362
- type: "function"
2363
- },
2364
- {
2365
- inputs: [
2366
- { internalType: "uint256", name: "_fee", type: "uint256" },
2367
- { internalType: "address", name: "_feeRecipient", type: "address" }
2368
- ],
2369
- name: "setFee",
2370
- outputs: [],
2371
- stateMutability: "nonpayable",
2372
- type: "function"
2373
- },
2374
- {
2375
- inputs: [
2376
- { internalType: "address", name: "owner", type: "address" },
2377
- { internalType: "bool", name: "active", type: "bool" }
2378
- ],
2379
- name: "setOwner",
2380
- outputs: [],
2381
- stateMutability: "nonpayable",
2382
- type: "function"
2383
- },
2384
- {
2385
- inputs: [
2386
- { internalType: "address", name: "tcRouter", type: "address" },
2387
- { internalType: "address", name: "tcVault", type: "address" },
2388
- { internalType: "string", name: "tcMemo", type: "string" },
2389
- { internalType: "address", name: "token", type: "address" },
2390
- { internalType: "uint256", name: "amount", type: "uint256" },
2391
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2392
- { internalType: "uint256", name: "deadline", type: "uint256" }
2393
- ],
2394
- name: "swapIn",
2395
- outputs: [],
2396
- stateMutability: "nonpayable",
2397
- type: "function"
2398
- },
2399
- {
2400
- inputs: [
2401
- { internalType: "address", name: "token", type: "address" },
2402
- { internalType: "address", name: "to", type: "address" },
2403
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2404
- ],
2405
- name: "swapOut",
2406
- outputs: [],
2407
- stateMutability: "payable",
2408
- type: "function"
2409
- },
2410
- {
2411
- inputs: [],
2412
- name: "swapRouter",
2413
- outputs: [{ internalType: "contract IUniswapRouterV2AVAX", name: "", type: "address" }],
2414
- stateMutability: "view",
2415
- type: "function"
2416
- },
2417
- {
2418
- inputs: [],
2419
- name: "tokenTransferProxy",
2420
- outputs: [
2421
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2422
- ],
2423
- stateMutability: "view",
2424
- type: "function"
2425
- },
2426
- {
2427
- inputs: [],
2428
- name: "weth",
2429
- outputs: [{ internalType: "address", name: "", type: "address" }],
2430
- stateMutability: "view",
2431
- type: "function"
2432
- },
2433
- { stateMutability: "payable", type: "receive" }
2434
- ], Ot = [
2435
- {
2436
- inputs: [
2437
- { internalType: "address", name: "_ttp", type: "address" },
2438
- { internalType: "address", name: "_weth", type: "address" },
2439
- { internalType: "address", name: "_swapRouter", type: "address" }
2440
- ],
2441
- stateMutability: "nonpayable",
2442
- type: "constructor"
2443
- },
2444
- {
2445
- anonymous: !1,
2446
- inputs: [
2447
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2448
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2449
- ],
2450
- name: "FeeSet",
2451
- type: "event"
2452
- },
2453
- {
2454
- anonymous: !1,
2455
- inputs: [
2456
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2457
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2458
- ],
2459
- name: "OwnerSet",
2460
- type: "event"
2461
- },
2462
- {
2463
- inputs: [],
2464
- name: "fee",
2465
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2466
- stateMutability: "view",
2467
- type: "function"
2468
- },
2469
- {
2470
- inputs: [],
2471
- name: "feeRecipient",
2472
- outputs: [{ internalType: "address", name: "", type: "address" }],
2473
- stateMutability: "view",
2474
- type: "function"
2475
- },
2476
- {
2477
- inputs: [{ internalType: "address", name: "", type: "address" }],
2478
- name: "owners",
2479
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2480
- stateMutability: "view",
2481
- type: "function"
2482
- },
2483
- {
2484
- inputs: [
2485
- { internalType: "uint256", name: "_fee", type: "uint256" },
2486
- { internalType: "address", name: "_feeRecipient", type: "address" }
2487
- ],
2488
- name: "setFee",
2489
- outputs: [],
2490
- stateMutability: "nonpayable",
2491
- type: "function"
2492
- },
2493
- {
2494
- inputs: [
2495
- { internalType: "address", name: "owner", type: "address" },
2496
- { internalType: "bool", name: "active", type: "bool" }
2497
- ],
2498
- name: "setOwner",
2499
- outputs: [],
2500
- stateMutability: "nonpayable",
2501
- type: "function"
2502
- },
2503
- {
2504
- inputs: [
2505
- { internalType: "address", name: "tcRouter", type: "address" },
2506
- { internalType: "address", name: "tcVault", type: "address" },
2507
- { internalType: "string", name: "tcMemo", type: "string" },
2508
- { internalType: "address", name: "token", type: "address" },
2509
- { internalType: "uint256", name: "amount", type: "uint256" },
2510
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2511
- { internalType: "uint256", name: "deadline", type: "uint256" }
2512
- ],
2513
- name: "swapIn",
2514
- outputs: [],
2515
- stateMutability: "nonpayable",
2516
- type: "function"
2517
- },
2518
- {
2519
- inputs: [
2520
- { internalType: "address", name: "token", type: "address" },
2521
- { internalType: "address", name: "to", type: "address" },
2522
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2523
- ],
2524
- name: "swapOut",
2525
- outputs: [],
2526
- stateMutability: "payable",
2527
- type: "function"
2528
- },
2529
- {
2530
- inputs: [],
2531
- name: "swapRouter",
2532
- outputs: [{ internalType: "contract IUniswapRouterV2", name: "", type: "address" }],
2533
- stateMutability: "view",
2534
- type: "function"
2535
- },
2536
- {
2537
- inputs: [],
2538
- name: "tokenTransferProxy",
2539
- outputs: [
2540
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2541
- ],
2542
- stateMutability: "view",
2543
- type: "function"
2544
- },
2545
- {
2546
- inputs: [],
2547
- name: "weth",
2548
- outputs: [{ internalType: "address", name: "", type: "address" }],
2549
- stateMutability: "view",
2550
- type: "function"
2551
- },
2552
- { stateMutability: "payable", type: "receive" }
2553
- ], gt = [
2554
- {
2555
- inputs: [
2556
- { internalType: "address", name: "_ttp", type: "address" },
2557
- { internalType: "address", name: "_weth", type: "address" },
2558
- { internalType: "address", name: "_swapRouter", type: "address" },
2559
- { internalType: "address", name: "_legToken", type: "address" }
2560
- ],
2561
- stateMutability: "nonpayable",
2562
- type: "constructor"
2563
- },
2564
- {
2565
- anonymous: !1,
2566
- inputs: [
2567
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2568
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2569
- ],
2570
- name: "FeeSet",
2571
- type: "event"
2572
- },
2573
- {
2574
- anonymous: !1,
2575
- inputs: [
2576
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2577
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2578
- ],
2579
- name: "OwnerSet",
2580
- type: "event"
2581
- },
2582
- {
2583
- inputs: [],
2584
- name: "fee",
2585
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2586
- stateMutability: "view",
2587
- type: "function"
2588
- },
2589
- {
2590
- inputs: [],
2591
- name: "feeRecipient",
2592
- outputs: [{ internalType: "address", name: "", type: "address" }],
2593
- stateMutability: "view",
2594
- type: "function"
2595
- },
2596
- {
2597
- inputs: [],
2598
- name: "legToken",
2599
- outputs: [{ internalType: "address", name: "", type: "address" }],
2600
- stateMutability: "view",
2601
- type: "function"
2602
- },
2603
- {
2604
- inputs: [{ internalType: "address", name: "", type: "address" }],
2605
- name: "owners",
2606
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2607
- stateMutability: "view",
2608
- type: "function"
2609
- },
2610
- {
2611
- inputs: [
2612
- { internalType: "uint256", name: "_fee", type: "uint256" },
2613
- { internalType: "address", name: "_feeRecipient", type: "address" }
2614
- ],
2615
- name: "setFee",
2616
- outputs: [],
2617
- stateMutability: "nonpayable",
2618
- type: "function"
2619
- },
2620
- {
2621
- inputs: [
2622
- { internalType: "address", name: "owner", type: "address" },
2623
- { internalType: "bool", name: "active", type: "bool" }
2624
- ],
2625
- name: "setOwner",
2626
- outputs: [],
2627
- stateMutability: "nonpayable",
2628
- type: "function"
2629
- },
2630
- {
2631
- inputs: [
2632
- { internalType: "address", name: "tcRouter", type: "address" },
2633
- { internalType: "address", name: "tcVault", type: "address" },
2634
- { internalType: "string", name: "tcMemo", type: "string" },
2635
- { internalType: "address", name: "token", type: "address" },
2636
- { internalType: "uint256", name: "amount", type: "uint256" },
2637
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2638
- { internalType: "uint256", name: "deadline", type: "uint256" }
2639
- ],
2640
- name: "swapIn",
2641
- outputs: [],
2642
- stateMutability: "nonpayable",
2643
- type: "function"
2644
- },
2645
- {
2646
- inputs: [
2647
- { internalType: "address", name: "token", type: "address" },
2648
- { internalType: "address", name: "to", type: "address" },
2649
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2650
- ],
2651
- name: "swapOut",
2652
- outputs: [],
2653
- stateMutability: "payable",
2654
- type: "function"
2655
- },
2656
- {
2657
- inputs: [],
2658
- name: "swapRouter",
2659
- outputs: [{ internalType: "contract IUniswapRouterV2", name: "", type: "address" }],
2660
- stateMutability: "view",
2661
- type: "function"
2662
- },
2663
- {
2664
- inputs: [],
2665
- name: "tokenTransferProxy",
2666
- outputs: [
2667
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2668
- ],
2669
- stateMutability: "view",
2670
- type: "function"
2671
- },
2672
- {
2673
- inputs: [],
2674
- name: "weth",
2675
- outputs: [{ internalType: "address", name: "", type: "address" }],
2676
- stateMutability: "view",
2677
- type: "function"
2678
- },
2679
- { stateMutability: "payable", type: "receive" }
2680
- ], It = [
2681
- {
2682
- inputs: [
2683
- { internalType: "address", name: "_ttp", type: "address" },
2684
- { internalType: "address", name: "_weth", type: "address" },
2685
- { internalType: "address", name: "_swapRouter", type: "address" },
2686
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
2687
- ],
2688
- stateMutability: "nonpayable",
2689
- type: "constructor"
2690
- },
2691
- {
2692
- anonymous: !1,
2693
- inputs: [
2694
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2695
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2696
- ],
2697
- name: "FeeSet",
2698
- type: "event"
2699
- },
2700
- {
2701
- anonymous: !1,
2702
- inputs: [
2703
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2704
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2705
- ],
2706
- name: "OwnerSet",
2707
- type: "event"
2708
- },
2709
- {
2710
- inputs: [],
2711
- name: "fee",
2712
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2713
- stateMutability: "view",
2714
- type: "function"
2715
- },
2716
- {
2717
- inputs: [],
2718
- name: "feeRecipient",
2719
- outputs: [{ internalType: "address", name: "", type: "address" }],
2720
- stateMutability: "view",
2721
- type: "function"
2722
- },
2723
- {
2724
- inputs: [{ internalType: "address", name: "", type: "address" }],
2725
- name: "owners",
2726
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2727
- stateMutability: "view",
2728
- type: "function"
2729
- },
2730
- {
2731
- inputs: [],
2732
- name: "poolFee",
2733
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
2734
- stateMutability: "view",
2735
- type: "function"
2736
- },
2737
- {
2738
- inputs: [
2739
- { internalType: "uint256", name: "_fee", type: "uint256" },
2740
- { internalType: "address", name: "_feeRecipient", type: "address" }
2741
- ],
2742
- name: "setFee",
2743
- outputs: [],
2744
- stateMutability: "nonpayable",
2745
- type: "function"
2746
- },
2747
- {
2748
- inputs: [
2749
- { internalType: "address", name: "owner", type: "address" },
2750
- { internalType: "bool", name: "active", type: "bool" }
2751
- ],
2752
- name: "setOwner",
2753
- outputs: [],
2754
- stateMutability: "nonpayable",
2755
- type: "function"
2756
- },
2757
- {
2758
- inputs: [
2759
- { internalType: "address", name: "tcRouter", type: "address" },
2760
- { internalType: "address", name: "tcVault", type: "address" },
2761
- { internalType: "string", name: "tcMemo", type: "string" },
2762
- { internalType: "address", name: "token", type: "address" },
2763
- { internalType: "uint256", name: "amount", type: "uint256" },
2764
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2765
- { internalType: "uint256", name: "deadline", type: "uint256" }
2766
- ],
2767
- name: "swapIn",
2768
- outputs: [],
2769
- stateMutability: "nonpayable",
2770
- type: "function"
2771
- },
2772
- {
2773
- inputs: [
2774
- { internalType: "address", name: "token", type: "address" },
2775
- { internalType: "address", name: "to", type: "address" },
2776
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2777
- ],
2778
- name: "swapOut",
2779
- outputs: [],
2780
- stateMutability: "payable",
2781
- type: "function"
2782
- },
2783
- {
2784
- inputs: [],
2785
- name: "swapRouter",
2786
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
2787
- stateMutability: "view",
2788
- type: "function"
2789
- },
2790
- {
2791
- inputs: [],
2792
- name: "tokenTransferProxy",
2793
- outputs: [
2794
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2795
- ],
2796
- stateMutability: "view",
2797
- type: "function"
2798
- },
2799
- {
2800
- inputs: [],
2801
- name: "weth",
2802
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
2803
- stateMutability: "view",
2804
- type: "function"
2805
- },
2806
- { stateMutability: "payable", type: "receive" }
2807
- ], St = [
2808
- {
2809
- inputs: [
2810
- { internalType: "address", name: "_ttp", type: "address" },
2811
- { internalType: "address", name: "_weth", type: "address" },
2812
- { internalType: "address", name: "_swapRouter", type: "address" },
2813
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
2814
- ],
2815
- stateMutability: "nonpayable",
2816
- type: "constructor"
2817
- },
2818
- {
2819
- anonymous: !1,
2820
- inputs: [
2821
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2822
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2823
- ],
2824
- name: "FeeSet",
2825
- type: "event"
2826
- },
2827
- {
2828
- anonymous: !1,
2829
- inputs: [
2830
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2831
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2832
- ],
2833
- name: "OwnerSet",
2834
- type: "event"
2835
- },
2836
- {
2837
- inputs: [],
2838
- name: "fee",
2839
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2840
- stateMutability: "view",
2841
- type: "function"
2842
- },
2843
- {
2844
- inputs: [],
2845
- name: "feeRecipient",
2846
- outputs: [{ internalType: "address", name: "", type: "address" }],
2847
- stateMutability: "view",
2848
- type: "function"
2849
- },
2850
- {
2851
- inputs: [{ internalType: "address", name: "", type: "address" }],
2852
- name: "owners",
2853
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2854
- stateMutability: "view",
2855
- type: "function"
2856
- },
2857
- {
2858
- inputs: [],
2859
- name: "poolFee",
2860
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
2861
- stateMutability: "view",
2862
- type: "function"
2863
- },
2864
- {
2865
- inputs: [
2866
- { internalType: "uint256", name: "_fee", type: "uint256" },
2867
- { internalType: "address", name: "_feeRecipient", type: "address" }
2868
- ],
2869
- name: "setFee",
2870
- outputs: [],
2871
- stateMutability: "nonpayable",
2872
- type: "function"
2873
- },
2874
- {
2875
- inputs: [
2876
- { internalType: "address", name: "owner", type: "address" },
2877
- { internalType: "bool", name: "active", type: "bool" }
2878
- ],
2879
- name: "setOwner",
2880
- outputs: [],
2881
- stateMutability: "nonpayable",
2882
- type: "function"
2883
- },
2884
- {
2885
- inputs: [
2886
- { internalType: "address", name: "tcRouter", type: "address" },
2887
- { internalType: "address", name: "tcVault", type: "address" },
2888
- { internalType: "string", name: "tcMemo", type: "string" },
2889
- { internalType: "address", name: "token", type: "address" },
2890
- { internalType: "uint256", name: "amount", type: "uint256" },
2891
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2892
- { internalType: "uint256", name: "deadline", type: "uint256" }
2893
- ],
2894
- name: "swapIn",
2895
- outputs: [],
2896
- stateMutability: "nonpayable",
2897
- type: "function"
2898
- },
2899
- {
2900
- inputs: [
2901
- { internalType: "address", name: "token", type: "address" },
2902
- { internalType: "address", name: "to", type: "address" },
2903
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2904
- ],
2905
- name: "swapOut",
2906
- outputs: [],
2907
- stateMutability: "payable",
2908
- type: "function"
2909
- },
2910
- {
2911
- inputs: [],
2912
- name: "swapRouter",
2913
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
2914
- stateMutability: "view",
2915
- type: "function"
2916
- },
2917
- {
2918
- inputs: [],
2919
- name: "tokenTransferProxy",
2920
- outputs: [
2921
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2922
- ],
2923
- stateMutability: "view",
2924
- type: "function"
2925
- },
2926
- {
2927
- inputs: [],
2928
- name: "weth",
2929
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
2930
- stateMutability: "view",
2931
- type: "function"
2932
- },
2933
- { stateMutability: "payable", type: "receive" }
2934
- ], vt = [
2935
- {
2936
- inputs: [
2937
- { internalType: "address", name: "_ttp", type: "address" },
2938
- { internalType: "address", name: "_weth", type: "address" },
2939
- { internalType: "address", name: "_swapRouter", type: "address" },
2940
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
2941
- ],
2942
- stateMutability: "nonpayable",
2943
- type: "constructor"
2944
- },
2945
- {
2946
- anonymous: !1,
2947
- inputs: [
2948
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2949
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2950
- ],
2951
- name: "FeeSet",
2952
- type: "event"
2953
- },
2954
- {
2955
- anonymous: !1,
2956
- inputs: [
2957
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2958
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2959
- ],
2960
- name: "OwnerSet",
2961
- type: "event"
2962
- },
2963
- {
2964
- inputs: [],
2965
- name: "fee",
2966
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2967
- stateMutability: "view",
2968
- type: "function"
2969
- },
2970
- {
2971
- inputs: [],
2972
- name: "feeRecipient",
2973
- outputs: [{ internalType: "address", name: "", type: "address" }],
2974
- stateMutability: "view",
2975
- type: "function"
2976
- },
2977
- {
2978
- inputs: [{ internalType: "address", name: "", type: "address" }],
2979
- name: "owners",
2980
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2981
- stateMutability: "view",
2982
- type: "function"
2983
- },
2984
- {
2985
- inputs: [],
2986
- name: "poolFee",
2987
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
2988
- stateMutability: "view",
2989
- type: "function"
2990
- },
2991
- {
2992
- inputs: [
2993
- { internalType: "uint256", name: "_fee", type: "uint256" },
2994
- { internalType: "address", name: "_feeRecipient", type: "address" }
2995
- ],
2996
- name: "setFee",
2997
- outputs: [],
2998
- stateMutability: "nonpayable",
2999
- type: "function"
3000
- },
3001
- {
3002
- inputs: [
3003
- { internalType: "address", name: "owner", type: "address" },
3004
- { internalType: "bool", name: "active", type: "bool" }
3005
- ],
3006
- name: "setOwner",
3007
- outputs: [],
3008
- stateMutability: "nonpayable",
3009
- type: "function"
3010
- },
3011
- {
3012
- inputs: [
3013
- { internalType: "address", name: "tcRouter", type: "address" },
3014
- { internalType: "address", name: "tcVault", type: "address" },
3015
- { internalType: "string", name: "tcMemo", type: "string" },
3016
- { internalType: "address", name: "token", type: "address" },
3017
- { internalType: "uint256", name: "amount", type: "uint256" },
3018
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
3019
- { internalType: "uint256", name: "deadline", type: "uint256" }
3020
- ],
3021
- name: "swapIn",
3022
- outputs: [],
3023
- stateMutability: "nonpayable",
3024
- type: "function"
3025
- },
3026
- {
3027
- inputs: [
3028
- { internalType: "address", name: "token", type: "address" },
3029
- { internalType: "address", name: "to", type: "address" },
3030
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3031
- ],
3032
- name: "swapOut",
3033
- outputs: [],
3034
- stateMutability: "payable",
3035
- type: "function"
3036
- },
3037
- {
3038
- inputs: [],
3039
- name: "swapRouter",
3040
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
3041
- stateMutability: "view",
3042
- type: "function"
3043
- },
3044
- {
3045
- inputs: [],
3046
- name: "tokenTransferProxy",
3047
- outputs: [
3048
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3049
- ],
3050
- stateMutability: "view",
3051
- type: "function"
3052
- },
3053
- {
3054
- inputs: [],
3055
- name: "weth",
3056
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
3057
- stateMutability: "view",
3058
- type: "function"
3059
- },
3060
- { stateMutability: "payable", type: "receive" }
3061
- ], Mt = [
3062
- {
3063
- inputs: [
3064
- { internalType: "address", name: "_ttp", type: "address" },
3065
- { internalType: "address", name: "_weth", type: "address" },
3066
- { internalType: "address", name: "_swapRouter", type: "address" },
3067
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
3068
- ],
3069
- stateMutability: "nonpayable",
3070
- type: "constructor"
3071
- },
3072
- {
3073
- anonymous: !1,
3074
- inputs: [
3075
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
3076
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
3077
- ],
3078
- name: "FeeSet",
3079
- type: "event"
3080
- },
3081
- {
3082
- anonymous: !1,
3083
- inputs: [
3084
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
3085
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
3086
- ],
3087
- name: "OwnerSet",
3088
- type: "event"
3089
- },
3090
- {
3091
- inputs: [],
3092
- name: "fee",
3093
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3094
- stateMutability: "view",
3095
- type: "function"
3096
- },
3097
- {
3098
- inputs: [],
3099
- name: "feeRecipient",
3100
- outputs: [{ internalType: "address", name: "", type: "address" }],
3101
- stateMutability: "view",
3102
- type: "function"
3103
- },
3104
- {
3105
- inputs: [{ internalType: "address", name: "", type: "address" }],
3106
- name: "owners",
3107
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
3108
- stateMutability: "view",
3109
- type: "function"
3110
- },
3111
- {
3112
- inputs: [],
3113
- name: "poolFee",
3114
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
3115
- stateMutability: "view",
3116
- type: "function"
3117
- },
3118
- {
3119
- inputs: [
3120
- { internalType: "uint256", name: "_fee", type: "uint256" },
3121
- { internalType: "address", name: "_feeRecipient", type: "address" }
3122
- ],
3123
- name: "setFee",
3124
- outputs: [],
3125
- stateMutability: "nonpayable",
3126
- type: "function"
3127
- },
3128
- {
3129
- inputs: [
3130
- { internalType: "address", name: "owner", type: "address" },
3131
- { internalType: "bool", name: "active", type: "bool" }
3132
- ],
3133
- name: "setOwner",
3134
- outputs: [],
3135
- stateMutability: "nonpayable",
3136
- type: "function"
3137
- },
3138
- {
3139
- inputs: [
3140
- { internalType: "address", name: "tcRouter", type: "address" },
3141
- { internalType: "address", name: "tcVault", type: "address" },
3142
- { internalType: "string", name: "tcMemo", type: "string" },
3143
- { internalType: "address", name: "token", type: "address" },
3144
- { internalType: "uint256", name: "amount", type: "uint256" },
3145
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
3146
- { internalType: "uint256", name: "deadline", type: "uint256" }
3147
- ],
3148
- name: "swapIn",
3149
- outputs: [],
3150
- stateMutability: "nonpayable",
3151
- type: "function"
3152
- },
3153
- {
3154
- inputs: [
3155
- { internalType: "address", name: "token", type: "address" },
3156
- { internalType: "address", name: "to", type: "address" },
3157
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3158
- ],
3159
- name: "swapOut",
3160
- outputs: [],
3161
- stateMutability: "payable",
3162
- type: "function"
3163
- },
3164
- {
3165
- inputs: [],
3166
- name: "swapRouter",
3167
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
3168
- stateMutability: "view",
3169
- type: "function"
3170
- },
3171
- {
3172
- inputs: [],
3173
- name: "tokenTransferProxy",
3174
- outputs: [
3175
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3176
- ],
3177
- stateMutability: "view",
3178
- type: "function"
3179
- },
3180
- {
3181
- inputs: [],
3182
- name: "weth",
3183
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
3184
- stateMutability: "view",
3185
- type: "function"
3186
- },
3187
- { stateMutability: "payable", type: "receive" }
3188
- ], Se = {
3189
- ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: _t,
3190
- ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: ft,
3191
- ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: bt
3192
- }, Ct = {
3193
- ...Se,
3194
- // AVAX
3195
- ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: wt,
3196
- ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: ht,
3197
- ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Rt,
3198
- // BSC
3199
- ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: At,
3200
- // ETH
3201
- ["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Et,
3202
- ["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Ot,
3203
- ["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: gt,
3204
- ["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: It,
3205
- ["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: St,
3206
- ["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: vt,
3207
- ["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Mt
3208
- }, Nt = ({
3209
- streamSwap: e,
3210
- contractAddress: t,
3211
- recipient: n,
3212
- toChecksumAddress: a,
3213
- calldata: {
3214
- amount: i,
3215
- amountOutMin: r = "",
3216
- data: p = "",
3217
- deadline: d,
3218
- memo: y,
3219
- router: l,
3220
- memoStreamingSwap: o,
3221
- tcMemo: c,
3222
- tcRouter: h,
3223
- tcVault: w,
3224
- vault: R,
3225
- token: O
3226
- }
3227
- }) => {
3228
- const E = !!Se[t.toLowerCase()];
3229
- if (E && !l)
3230
- throw new Error("Router is required on calldata for swapIn with GenericContract");
3231
- const I = c || y, S = e && o || I;
3232
- if (!w && !R)
3233
- throw new Error("TC Vault is required on calldata");
3234
- if (!h && !l)
3235
- throw new Error("TC Router is required on calldata");
3236
- if (!S)
3237
- throw new Error("TC Memo is required on calldata");
3238
- if (!O)
3239
- throw new Error("Token is required on calldata");
3240
- const D = [
3241
- // v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
3242
- a(h || l),
3243
- a(w || R),
3244
- S.replace("{recipientAddress}", n),
3245
- a(O),
3246
- i
3247
- ], ve = E ? [a(l), p, d] : [r, d];
3248
- return [...D, ...ve];
3249
- }, xt = ({ chain: e, txHash: t }) => {
3250
- const n = we[e];
3251
- switch (e) {
3252
- case s.Binance:
3253
- case s.Bitcoin:
3254
- case s.BitcoinCash:
3255
- case s.Maya:
3256
- case s.Kujira:
3257
- case s.THORChain:
3258
- return `${n}/tx/${t}`;
3259
- case s.Arbitrum:
3260
- case s.Avalanche:
3261
- case s.BinanceSmartChain:
3262
- case s.Ethereum:
3263
- case s.Optimism:
3264
- case s.Polygon:
3265
- return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
3266
- case s.Cosmos:
3267
- return `${n}/transactions/${t}`;
3268
- case s.Dogecoin:
3269
- return `${n}/transaction/${t.toLowerCase()}`;
3270
- case s.Litecoin:
3271
- return `${n}/${t}`;
3272
- default:
3273
- throw new Error(`Unsupported chain: ${e}`);
3274
- }
3275
- }, Dt = ({ chain: e, address: t }) => {
3276
- const n = we[e];
3277
- switch (e) {
3278
- case s.Arbitrum:
3279
- case s.Avalanche:
3280
- case s.Binance:
3281
- case s.BinanceSmartChain:
3282
- case s.Bitcoin:
3283
- case s.BitcoinCash:
3284
- case s.Dogecoin:
3285
- case s.Ethereum:
3286
- case s.Maya:
3287
- case s.Optimism:
3288
- case s.Polygon:
3289
- case s.Kujira:
3290
- case s.THORChain:
3291
- return `${n}/address/${t}`;
3292
- case s.Cosmos:
3293
- return `${n}/account/${t}`;
3294
- case s.Litecoin:
3295
- return `${n}/${t}`;
3296
- default:
3297
- throw new Error(`Unsupported chain: ${e}`);
3298
- }
3299
- }, Bt = (e) => {
3300
- const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
3301
- return Ee(`${t}/thorchain/inbound_addresses`);
3302
- }, Pt = (e) => {
3303
- const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
3304
- return Ee(`${t}/thorchain/mimir`);
3305
- }, he = () => Object.values(s).reduce(
3306
- (e, t) => (e[t] = null, e),
3307
- {}
3308
- );
3309
- var P, z, K, N, Y, X;
3310
- class en {
3311
- constructor({ stagenet: t } = {}) {
3312
- T(this, "connectedChains", he());
3313
- T(this, "connectedWallets", he());
3314
- T(this, "stagenet", !1);
3315
- T(this, "getAddress", (t) => {
3316
- var n;
3317
- return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
3318
- });
3319
- T(this, "getExplorerTxUrl", (t, n) => xt({ chain: t, txHash: n }));
3320
- T(this, "getWallet", (t) => this.connectedWallets[t]);
3321
- T(this, "getExplorerAddressUrl", (t, n) => Dt({ chain: t, address: n }));
3322
- T(this, "getBalance", async (t, n) => {
3323
- const a = await this.getWalletByChain(t, n);
3324
- return (a == null ? void 0 : a.balance) || [];
3325
- });
3326
- T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: i }) => {
3327
- var d, y;
3328
- const { quoteMode: r } = a.meta, p = r.startsWith("ERC20-") ? s.Ethereum : r.startsWith("ARC20-") ? s.Avalanche : s.BinanceSmartChain;
3329
- if (!a.complete)
3330
- throw new m("core_swap_route_not_complete");
3331
- try {
3332
- if (Ue.includes(r)) {
3333
- const l = this.connectedWallets[p];
3334
- if (!(l != null && l.sendTransaction))
3335
- throw new m("core_wallet_connection_not_found");
3336
- if (!(t ? (d = a == null ? void 0 : a.streamingSwap) == null ? void 0 : d.transaction : a == null ? void 0 : a.transaction))
3337
- throw new m("core_swap_route_transaction_not_found");
3338
- const { isHexString: c, parseUnits: h } = await import("./index-cf1865cd.js"), { data: w, from: R, to: O, value: E } = a.transaction, I = {
3339
- data: w,
3340
- from: R,
3341
- to: O.toLowerCase(),
3342
- chainId: BigInt(Ke[p]),
3343
- value: E ? new ue({
3344
- value: c(E) ? E : h(E, "wei").toString(16)
3345
- }).baseValueBigInt : 0n
3346
- };
3347
- return l.sendTransaction(I, i);
3348
- }
3349
- if ($e.includes(r)) {
3350
- if (!a.calldata.fromAsset)
3351
- throw new m("core_swap_asset_not_recognized");
3352
- const l = await v.fromString(a.calldata.fromAsset);
3353
- if (!l)
3354
- throw new m("core_swap_asset_not_recognized");
3355
- const { address: o } = await f(this, P).call(this, l.chain), {
3356
- contract: c,
3357
- calldata: { expiration: h, amountIn: w, memo: R, memoStreamingSwap: O }
3358
- } = a, E = l.add(ue.fromBigInt(BigInt(w), l.decimal)), I = t && O || R;
3359
- return this.deposit({
3360
- expiration: h,
3361
- assetValue: E,
3362
- memo: I,
3363
- feeOptionKey: i,
3364
- router: c,
3365
- recipient: o
3366
- });
3367
- }
3368
- if (He.includes(r)) {
3369
- const { calldata: l, contract: o } = a;
3370
- if (!o)
3371
- throw new m("core_swap_contract_not_found");
3372
- const c = this.connectedWallets[p], h = this.getAddress(p);
3373
- if (!(c != null && c.sendTransaction) || !h)
3374
- throw new m("core_wallet_connection_not_found");
3375
- const { getProvider: w, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), O = w(p), E = Ct[o.toLowerCase()];
3376
- if (!E)
3377
- throw new m("core_swap_contract_not_supported", { contractAddress: o });
3378
- const S = await (await ((y = c.createContract) == null ? void 0 : y.call(c, o, E, O))).getFunction("swapIn").populateTransaction(
3379
- ...Nt({
3380
- streamSwap: t,
3381
- toChecksumAddress: R,
3382
- contractAddress: o,
3383
- recipient: n,
3384
- calldata: l
3385
- }),
3386
- { from: h }
3387
- );
3388
- return c.sendTransaction(S, i);
3389
- }
3390
- throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
3391
- } catch (l) {
3392
- throw new m("core_swap_transaction_error", l);
3393
- }
3394
- });
3395
- T(this, "getWalletByChain", async (t, n) => {
3396
- var r, p;
3397
- const a = this.getAddress(t);
3398
- if (!a)
3399
- return null;
3400
- const i = await ((r = this.getWallet(t)) == null ? void 0 : r.getBalance(a, n)) ?? [
3401
- v.fromChainOrSignature(t)
3402
- ];
3403
- return this.connectedChains[t] = {
3404
- address: a,
3405
- balance: i,
3406
- walletType: (p = this.connectedChains[t]) == null ? void 0 : p.walletType
3407
- }, { ...this.connectedChains[t] };
3408
- });
3409
- T(this, "approveAssetValue", (t, n) => f(this, K).call(this, { assetValue: t, type: "approve", contractAddress: n }));
3410
- T(this, "isAssetValueApproved", (t, n) => f(this, K).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
3411
- T(this, "validateAddress", ({ address: t, chain: n }) => {
3412
- var a, i;
3413
- return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
3414
- });
3415
- T(this, "transfer", async (t) => {
3416
- const n = this.connectedWallets[t.assetValue.chain];
3417
- if (!n)
3418
- throw new m("core_wallet_connection_not_found");
3419
- try {
3420
- return await n.transfer(f(this, X).call(this, t));
3421
- } catch (a) {
3422
- throw new m("core_swap_transaction_error", a);
3423
- }
3424
- });
3425
- T(this, "deposit", async ({
3426
- assetValue: t,
3427
- recipient: n,
3428
- router: a,
3429
- ...i
3430
- }) => {
3431
- const { chain: r, symbol: p, ticker: d } = t, y = this.connectedWallets[r];
3432
- if (!y)
3433
- throw new m("core_wallet_connection_not_found");
3434
- const l = f(this, X).call(this, { assetValue: t, recipient: n, router: a, ...i });
3435
- try {
3436
- switch (r) {
3437
- case s.THORChain: {
3438
- const o = y;
3439
- return await (n === "" ? o.deposit(l) : o.transfer(l));
3440
- }
3441
- case s.Ethereum:
3442
- case s.BinanceSmartChain:
3443
- case s.Avalanche: {
3444
- const { getChecksumAddressFromAsset: o } = await import("@swapkit/toolbox-evm"), c = r === s.Avalanche ? Pe : r === s.BinanceSmartChain ? Ve : Be;
3445
- return await y.call({
3446
- abi: c,
3447
- contractAddress: a || (await f(this, P).call(this, r)).router,
3448
- funcName: "depositWithExpiry",
3449
- funcParams: [
3450
- n,
3451
- o({ chain: r, symbol: p, ticker: d }, r),
3452
- // TODO: (@Towan) Re-Check on that conversion 🙏
3453
- t.getBaseValue("bigint").toString(),
3454
- l.memo,
3455
- i.expiration
3456
- ],
3457
- txOverrides: {
3458
- from: l.from,
3459
- value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
3460
- }
3461
- });
3462
- }
3463
- default:
3464
- return await y.transfer(l);
3465
- }
3466
- } catch (o) {
3467
- const c = ((o == null ? void 0 : o.message) || (o == null ? void 0 : o.toString())).toLowerCase(), h = c == null ? void 0 : c.includes("insufficient funds"), w = c == null ? void 0 : c.includes("gas"), R = c == null ? void 0 : c.includes("server"), O = h ? "core_transaction_deposit_insufficient_funds_error" : w ? "core_transaction_deposit_gas_error" : R ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
3468
- throw new m(O, o);
3469
- }
3470
- });
3471
- /**
3472
- * TC related Methods
3473
- */
3474
- T(this, "createLiquidity", async ({
3475
- runeAssetValue: t,
3476
- assetValue: n
3477
- }) => {
3478
- if (t.lte(0) || n.lte(0))
3479
- throw new m("core_transaction_create_liquidity_invalid_params");
3480
- let a = "", i = "";
3481
- try {
3482
- a = await f(this, N).call(this, {
3483
- assetValue: t,
3484
- memo: x(_.DEPOSIT, {
3485
- ...n,
3486
- address: this.getAddress(n.chain)
3487
- })
3488
- });
3489
- } catch (r) {
3490
- throw new m("core_transaction_create_liquidity_rune_error", r);
3491
- }
3492
- try {
3493
- i = await f(this, N).call(this, {
3494
- assetValue: n,
3495
- memo: x(_.DEPOSIT, {
3496
- ...n,
3497
- address: this.getAddress(s.THORChain)
3498
- })
3499
- });
3500
- } catch (r) {
3501
- throw new m("core_transaction_create_liquidity_asset_error", r);
3502
- }
3503
- return { runeTx: a, assetTx: i };
3504
- });
3505
- T(this, "addLiquidity", async ({
3506
- poolIdentifier: t,
3507
- runeAssetValue: n,
3508
- assetValue: a,
3509
- runeAddr: i,
3510
- assetAddr: r,
3511
- isPendingSymmAsset: p,
3512
- mode: d = "sym"
3513
- }) => {
3514
- const [y, ...l] = t.split("."), o = d === "sym", c = (n == null ? void 0 : n.gt(0)) && (o || d === "rune"), h = (a == null ? void 0 : a.gt(0)) && (o || d === "asset"), w = p || c, R = w ? i || this.getAddress(s.THORChain) : "", O = o || d === "asset" ? r || this.getAddress(y) : "";
3515
- if (!c && !h)
3516
- throw new m("core_transaction_add_liquidity_invalid_params");
3517
- if (w && !R)
3518
- throw new m("core_transaction_add_liquidity_no_rune_address");
3519
- let E, I;
3520
- const S = { chain: y, symbol: l.join(".") };
3521
- if (c && n)
3522
- try {
3523
- E = await f(this, N).call(this, {
3524
- assetValue: n,
3525
- memo: x(_.DEPOSIT, { ...S, address: O })
3526
- });
3527
- } catch (D) {
3528
- throw new m("core_transaction_add_liquidity_rune_error", D);
3529
- }
3530
- if (h && a)
3531
- try {
3532
- I = await f(this, N).call(this, {
3533
- assetValue: a,
3534
- memo: x(_.DEPOSIT, { ...S, address: R })
3535
- });
3536
- } catch (D) {
3537
- throw new m("core_transaction_add_liquidity_asset_error", D);
3538
- }
3539
- return { runeTx: E, assetTx: I };
3540
- });
3541
- T(this, "withdraw", async ({
3542
- memo: t,
3543
- assetValue: n,
3544
- percent: a,
3545
- from: i,
3546
- to: r
3547
- }) => {
3548
- const p = r === "rune" ? v.fromChainOrSignature(s.THORChain) : i === "sym" && r === "sym" || i === "rune" || i === "asset" ? void 0 : n;
3549
- try {
3550
- return await f(this, N).call(this, {
3551
- assetValue: _e(i === "asset" ? n.chain : s.THORChain),
3552
- memo: t || x(_.WITHDRAW, {
3553
- symbol: n.symbol,
3554
- chain: n.chain,
3555
- ticker: n.ticker,
3556
- basisPoints: Math.max(1e4, Math.round(a * 100)),
3557
- targetAssetString: p == null ? void 0 : p.toString(),
3558
- singleSide: !1
3559
- })
3560
- });
3561
- } catch (d) {
3562
- throw new m("core_transaction_withdraw_error", d);
3563
- }
3564
- });
3565
- T(this, "savings", async ({
3566
- assetValue: t,
3567
- memo: n,
3568
- percent: a,
3569
- type: i
3570
- }) => {
3571
- const r = i === "add" ? _.DEPOSIT : _.WITHDRAW, p = n || x(r, {
3572
- ticker: t.ticker,
3573
- symbol: t.symbol,
3574
- chain: t.chain,
3575
- singleSide: !0,
3576
- basisPoints: a ? Math.max(1e4, Math.round(a * 100)) : void 0
3577
- });
3578
- return f(this, N).call(this, { assetValue: t, memo: p });
3579
- });
3580
- T(this, "loan", ({
3581
- assetValue: t,
3582
- memo: n,
3583
- minAmount: a,
3584
- type: i
3585
- }) => f(this, N).call(this, {
3586
- assetValue: t,
3587
- memo: n || x(i === "open" ? _.OPEN_LOAN : _.CLOSE_LOAN, {
3588
- asset: t.toString(),
3589
- minAmount: a.toString(),
3590
- address: this.getAddress(t.chain)
3591
- })
3592
- }));
3593
- T(this, "nodeAction", ({
3594
- type: t,
3595
- assetValue: n,
3596
- address: a
3597
- }) => {
3598
- const i = t === "bond" ? _.BOND : t === "unbond" ? _.UNBOND : _.LEAVE, r = x(i, {
3599
- address: a,
3600
- unbondAmount: t === "unbond" ? n.baseValueNumber : void 0
3601
- });
3602
- return f(this, Y).call(this, {
3603
- memo: r,
3604
- assetValue: t === "bond" ? n : _e(s.THORChain)
3605
- });
3606
- });
3607
- T(this, "registerThorname", ({
3608
- assetValue: t,
3609
- ...n
3610
- }) => f(this, Y).call(this, { assetValue: t, memo: x(_.THORNAME_REGISTER, n) }));
3611
- T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
3612
- try {
3613
- t.forEach((r) => {
3614
- this[r.connectMethodName] = r.connect({
3615
- addChain: f(this, z),
3616
- config: n || {},
3617
- apis: a,
3618
- rpcUrls: i
3619
- });
3620
- });
3621
- } catch (r) {
3622
- throw new m("core_extend_error", r);
3623
- }
3624
- });
3625
- T(this, "estimateMaxSendableAmount", async ({
3626
- chain: t,
3627
- params: n
3628
- }) => {
3629
- const a = this.getWallet(t);
3630
- switch (t) {
3631
- case s.Arbitrum:
3632
- case s.Avalanche:
3633
- case s.BinanceSmartChain:
3634
- case s.Ethereum:
3635
- case s.Optimism:
3636
- case s.Polygon: {
3637
- const { estimateMaxSendableAmount: i } = await import("@swapkit/toolbox-evm");
3638
- return i({
3639
- ...n,
3640
- toolbox: a
3641
- });
3642
- }
3643
- case s.Bitcoin:
3644
- case s.BitcoinCash:
3645
- case s.Dogecoin:
3646
- case s.Litecoin:
3647
- return a.estimateMaxSendableAmount(n);
3648
- case s.Binance:
3649
- case s.THORChain:
3650
- case s.Cosmos: {
3651
- const { estimateMaxSendableAmount: i } = await import("@swapkit/toolbox-cosmos");
3652
- return i({
3653
- ...n,
3654
- toolbox: a
3655
- });
3656
- }
3657
- default:
3658
- throw new m("core_estimated_max_spendable_chain_not_supported");
3659
- }
3660
- });
3661
- /**
3662
- * Wallet connection methods
3663
- */
3664
- T(this, "connectXDEFI", async (t) => {
3665
- throw new m("core_wallet_xdefi_not_installed");
3666
- });
3667
- T(this, "connectEVMWallet", async (t, n) => {
3668
- throw new m("core_wallet_evmwallet_not_installed");
3669
- });
3670
- T(this, "connectWalletconnect", async (t, n) => {
3671
- throw new m("core_wallet_walletconnect_not_installed");
3672
- });
3673
- T(this, "connectKeystore", async (t, n) => {
3674
- throw new m("core_wallet_keystore_not_installed");
3675
- });
3676
- T(this, "connectLedger", async (t, n) => {
3677
- throw new m("core_wallet_ledger_not_installed");
3678
- });
3679
- T(this, "connectTrezor", async (t, n) => {
3680
- throw new m("core_wallet_trezor_not_installed");
3681
- });
3682
- T(this, "connectKeplr", async (t) => {
3683
- throw new m("core_wallet_keplr_not_installed");
3684
- });
3685
- T(this, "connectOkx", async (t) => {
3686
- throw new m("core_wallet_okx_not_installed");
3687
- });
3688
- T(this, "disconnectChain", (t) => {
3689
- this.connectedChains[t] = null, this.connectedWallets[t] = null;
3690
- });
3691
- B(this, P, async (t) => {
3692
- if (t === s.THORChain)
3693
- return {
3694
- gas_rate: "0",
3695
- router: "0",
3696
- address: "",
3697
- halted: !1,
3698
- chain: s.THORChain
3699
- };
3700
- const a = (await Bt(this.stagenet)).find((i) => i.chain === t);
3701
- if (!a)
3702
- throw new m("core_inbound_data_not_found");
3703
- if (a != null && a.halted)
3704
- throw new m("core_chain_halted");
3705
- return a;
3706
- });
3707
- B(this, z, ({ chain: t, wallet: n, walletMethods: a }) => {
3708
- this.connectedChains[t] = n, this.connectedWallets[t] = a;
3709
- });
3710
- B(this, K, async ({
3711
- assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: i, isSynthetic: r },
3712
- type: p = "checkOnly",
3713
- contractAddress: d
3714
- }) => {
3715
- const y = [s.Ethereum, s.Avalanche, s.BinanceSmartChain].includes(a);
3716
- if (y && i || !y || r)
3717
- return !0;
3718
- const o = this.connectedWallets[a], c = p === "checkOnly" ? o == null ? void 0 : o.isApproved : o == null ? void 0 : o.approve;
3719
- if (!c)
3720
- throw new m("core_wallet_connection_not_found");
3721
- const h = this.getAddress(a);
3722
- if (!n || !h)
3723
- throw new m("core_approve_asset_address_or_from_not_found");
3724
- const w = d || (await f(this, P).call(this, a)).router;
3725
- return c({
3726
- amount: t,
3727
- assetAddress: n,
3728
- from: h,
3729
- spenderAddress: w
3730
- });
3731
- });
3732
- B(this, N, async ({
3733
- assetValue: t,
3734
- memo: n,
3735
- feeOptionKey: a = k.Fast
3736
- }) => {
3737
- const {
3738
- gas_rate: i,
3739
- router: r,
3740
- address: p
3741
- } = await f(this, P).call(this, t.chain), d = (parseInt(i) || 0) * st[a];
3742
- return this.deposit({
3743
- assetValue: t,
3744
- recipient: p,
3745
- memo: n,
3746
- router: r,
3747
- feeRate: d
3748
- });
3749
- });
3750
- B(this, Y, async ({ memo: t, assetValue: n }) => {
3751
- const a = await Pt(this.stagenet);
3752
- if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
3753
- throw new m("core_chain_halted");
3754
- return this.deposit({ assetValue: n, recipient: "", memo: t });
3755
- });
3756
- B(this, X, ({ assetValue: t, ...n }) => ({
3757
- ...n,
3758
- memo: n.memo || "",
3759
- from: this.getAddress(t.chain),
3760
- assetValue: t
3761
- }));
3762
- this.stagenet = !!t;
3763
- }
3764
- }
3765
- P = new WeakMap(), z = new WeakMap(), K = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
3766
- export {
3767
- Ue as AGG_SWAP,
3768
- be as ApiError,
3769
- W as ApiUrl,
3770
- v as AssetValue,
3771
- b as BaseDecimal,
3772
- re as BigIntArithmetics,
3773
- s as Chain,
3774
- ye as ChainId,
3775
- Gt as ChainIdToChain,
3776
- Ke as ChainToChainId,
3777
- we as ChainToExplorerUrl,
3778
- Ft as ChainToHexChainId,
3779
- Ye as ChainToRPC,
3780
- Ge as ContractAddress,
3781
- kt as CosmosChainList,
3782
- We as DerivationPath,
3783
- u as ERROR_CODE,
3784
- ke as ERROR_MODULE,
3785
- fe as ERROR_TYPE,
3786
- Ht as EVMChainList,
3787
- Xe as ErrorCode,
3788
- k as FeeOption,
3789
- _ as MemoType,
3790
- Ut as NetworkDerivationPath,
3791
- Le as QuoteMode,
3792
- Ae as RPCUrl,
3793
- He as SWAP_IN,
3794
- $e as SWAP_OUT,
3795
- en as SwapKitCore,
3796
- m as SwapKitError,
3797
- ue as SwapKitNumber,
3798
- Pe as TCAvalancheDepositABI,
3799
- Ve as TCBscDepositABI,
3800
- Be as TCEthereumVaultAbi,
3801
- $t as UTXOChainList,
3802
- je as WalletOption,
3803
- Yt as assetFromString,
3804
- Kt as derivationPathToString,
3805
- Lt as erc20ABI,
3806
- Xt as filterAssets,
3807
- ge as formatBigIntToSafeValue,
3808
- st as gasFeeMultiplier,
3809
- pt as getAssetType,
3810
- ut as getAsymmetricAssetShare,
3811
- Qt as getAsymmetricAssetWithdrawAmount,
3812
- dt as getAsymmetricRuneShare,
3813
- jt as getAsymmetricRuneWithdrawAmount,
3814
- rt as getCommonAssetInfo,
3815
- Oe as getDecimal,
3816
- zt as getEstimatedPoolShare,
3817
- Zt as getLiquiditySlippage,
3818
- x as getMemoFor,
3819
- _e as getMinAmountByChain,
3820
- Ee as getRequest,
3821
- yt as getSymmetricPoolShare,
3822
- Jt as getSymmetricWithdraw,
3823
- Wt as getTHORNameCost,
3824
- it as isGasAsset,
3825
- Ze as postRequest,
3826
- qt as validateTHORName
3827
- };