@swapkit/core 1.0.0-rc.17 → 1.0.0-rc.171

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 (35) hide show
  1. package/dist/index.js +3 -0
  2. package/dist/index.js.map +12 -0
  3. package/package.json +28 -49
  4. package/src/__tests__/helpers.test.ts +65 -0
  5. package/src/client.ts +457 -0
  6. package/src/helpers/explorerUrls.ts +45 -0
  7. package/src/index.ts +6 -4
  8. package/src/types.ts +44 -0
  9. package/LICENSE +0 -201
  10. package/dist/index-9e36735e.cjs +0 -1
  11. package/dist/index-cf1865cd.js +0 -649
  12. package/dist/index.cjs +0 -2
  13. package/dist/index.d.ts +0 -216
  14. package/dist/index.es.js +0 -4181
  15. package/src/aggregator/contracts/avaxGeneric.ts +0 -92
  16. package/src/aggregator/contracts/avaxWoofi.ts +0 -145
  17. package/src/aggregator/contracts/bscGeneric.ts +0 -106
  18. package/src/aggregator/contracts/ethGeneric.ts +0 -92
  19. package/src/aggregator/contracts/index.ts +0 -74
  20. package/src/aggregator/contracts/pancakeV2.ts +0 -145
  21. package/src/aggregator/contracts/pangolin.ts +0 -120
  22. package/src/aggregator/contracts/sushiswap.ts +0 -120
  23. package/src/aggregator/contracts/traderJoe.ts +0 -120
  24. package/src/aggregator/contracts/uniswapV2.ts +0 -120
  25. package/src/aggregator/contracts/uniswapV2Leg.ts +0 -128
  26. package/src/aggregator/contracts/uniswapV3_100.ts +0 -128
  27. package/src/aggregator/contracts/uniswapV3_10000.ts +0 -128
  28. package/src/aggregator/contracts/uniswapV3_3000.ts +0 -128
  29. package/src/aggregator/contracts/uniswapV3_500.ts +0 -128
  30. package/src/aggregator/getSwapParams.ts +0 -70
  31. package/src/client/__tests__/helpers.test.ts +0 -69
  32. package/src/client/explorerUrls.ts +0 -62
  33. package/src/client/index.ts +0 -699
  34. package/src/client/thornode.ts +0 -31
  35. package/src/client/types.ts +0 -103
package/dist/index.es.js DELETED
@@ -1,4181 +0,0 @@
1
- var qe = Object.defineProperty;
2
- var We = (e, t, n) => t in e ? qe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var T = (e, t, n) => (We(e, typeof t != "symbol" ? t + "" : t, n), n), je = (e, t, n) => {
4
- if (!t.has(e))
5
- throw TypeError("Cannot " + n);
6
- };
7
- var f = (e, t, n) => (je(e, t, "read from private field"), n ? n.call(e) : t.get(e)), P = (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 Ke = Object.defineProperty, Ye = (e, t, n) => t in e ? Ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, C = (e, t, n) => (Ye(e, typeof t != "symbol" ? t + "" : t, n), n);
13
- const mn = [
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
- ], Xe = [
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
- ], Je = [
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
- ], Qe = [
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 ze = /* @__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))(ze || {});
604
- const Ze = [
605
- "ERC20-ERC20",
606
- "ARC20-ARC20",
607
- "BEP20-BEP20"
608
- /* BSC_TO_BSC */
609
- ], et = [
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
- ], tt = [
621
- "TC-TC",
622
- "TC-ERC20",
623
- "TC-ARC20",
624
- "TC-BEP20"
625
- /* TC_SUPPORTED_TO_BSC */
626
- ];
627
- var Me = /* @__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))(Me || {}), nt = /* @__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))(nt || {}), l = /* @__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))(l || {});
628
- const at = {
629
- [l.INVALID_INPUT_PARAMETERS]: "Invalid input parameters: {0}.",
630
- [l.UNKNOWN_PROVIDERS]: "Unknown providers: {0}.",
631
- [l.CANNOT_FIND_INBOUND_ADDRESS]: "Cannot find inbound address.",
632
- [l.NO_INBOUND_ADDRESSES]: "No inbound addresses.",
633
- [l.CHAIN_HALTED_OR_UNSUPPORTED]: "Chain {0} halted or unsupported.",
634
- [l.MISSING_INPUT_PARAMETER]: "Missing input parameter: {0}.",
635
- [l.INVALID_TYPE_GENERIC]: "Invalid type",
636
- [l.INVALID_NUMBER_STRING]: "Invalid number string.",
637
- [l.INVALID_NUMBER]: "Invalid number.",
638
- [l.INVALID_BOOLEAN]: "Invalid boolean.",
639
- [l.INVALID_OBJECT]: "Invalid object.",
640
- [l.INVALID_ARRAY]: "Invalid array.",
641
- [l.SELL_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Sell amount must be a positive integer.",
642
- [l.SELL_BUY_ASSETS_ARE_THE_SAME]: "Sell and buy assets are the same.",
643
- [l.MISSING_SOURCE_ADDRESS_FOR_SYNTH]: "Source address is required for synth quote.",
644
- [l.AFF_ADDRESS_AND_BPS_OR_NEITHER]: "Must provide affiliateAddress and affiliateBasisPoints params, or neither.",
645
- [l.AFF_ADDRESS_TOO_LONG]: "affiliateAddress too long: 3 characters max.",
646
- [l.AFF_BPS_INTEGER_0_100]: "affiliateBasisPoints must be an integer between 0 and 100.",
647
- [l.SOURCE_ADDRESS_INVALID_FOR_SELL_CHAIN]: "Source address {0} invalid for sell chain.",
648
- [l.DESTINATION_ADDRESS_INVALID_FOR_BUY_CHAIN]: "Destination address {0} invalid for buy chain.",
649
- [l.PREFERRED_PROFVIDER_NOT_SUPPORTED]: "Preferred provider not supported.",
650
- [l.DESTINATION_ADDRESS_SMART_CONTRACT]: "Destination address is a smart contract.",
651
- [l.BUY_AMOUNT_MUST_BE_POSITIVE_INTEGER]: "Buy amount must be a positive integer.",
652
- [l.INVALID_PROVIDER]: "Invalid provider {0}.",
653
- [l.MISSING_CROSS_CHAIN_PROVIDER]: "Missing cross-chain provider.",
654
- [l.MISSING_AVAX_PROVIDER]: "Missing AVAX provider.",
655
- [l.MISSING_BSC_PROVIDER]: "Missing BSC provider.",
656
- [l.MISSING_ETH_PROVIDER]: "Missing ETH provider.",
657
- [l.MISSING_ARB_PROVIDER]: "Missing ARB provider.",
658
- [l.INVALID_PROVIDER_FOR_SWAP_OUT]: "Invalid provider for swap out.",
659
- [l.INVALID_CHAIN]: "Invalid chain {0}.",
660
- [l.INVALID_ASSET]: "Invalid asset {0}.",
661
- [l.UNSUPPORTED_CHAIN]: "Unsupported chain {0}.",
662
- [l.UNSUPPORTED_ASSET]: "Unsupported asset {0}.",
663
- [l.UNSUPPORTED_ASSET_FOR_SWAPOUT]: "Unsupported asset {0} for swap out.",
664
- [l.THORNODE_QUOTE_GENERIC_ERROR]: "ThorNode quote generic error.",
665
- [l.INVALID_SOURCE_ADDRESS]: "Invalid source address {0}",
666
- [l.INVALID_DESTINATION_ADDRESS]: "Invalid destination address {0}",
667
- [l.NOT_ENOUGH_SYNTH_BALANCE]: "Source address doesn't have enough synth balance for this quote.",
668
- [l.SYNTH_MINTING_CAP_REACHED]: "Synth minting cap reached.",
669
- [l.INVALID_QUOTE_MODE]: "Invalid quote mode.",
670
- [l.NO_QUOTES]: "No quotes to service this request.",
671
- [l.SERVICE_UNAVAILABLE_GENERIC]: "Service unavailable.",
672
- [l.MISSING_GAS_DATA_GENERIC]: "Missing gas data.",
673
- [l.MISSING_TOKEN_INFO_GENERIC]: "Missing token info.",
674
- [l.CANT_FIND_TOKEN_LIST]: "Can't find tokenlist {0}.",
675
- [l.NO_PRICE]: "No price for asset {0}.",
676
- [l.PRICE_IS_STALE]: "Price is stale for asset {0}.",
677
- [l.ADDRESS_NOT_WHITELISTED]: "Address {0} not whitelisted for airdrop.",
678
- [l.ADDRESS_ALREADY_CLAIMED]: "Address {0} already claimed the airdrop."
679
- }, ie = (e, t) => {
680
- let n = at[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
- let Tn = class Ne extends Error {
686
- constructor({
687
- status: t,
688
- revision: n,
689
- module: a,
690
- code: s,
691
- message: r,
692
- type: o,
693
- options: { shouldLog: p, shouldThrow: u, shouldTrace: y } = {
694
- shouldLog: !0,
695
- shouldThrow: !0,
696
- shouldTrace: !0
697
- },
698
- displayMessageParams: d
699
- }) {
700
- const c = r || ie(s, d || []) || "";
701
- super(c), C(this, "status"), C(this, "revision"), C(this, "type"), C(this, "module"), C(this, "code"), C(this, "message"), C(this, "display"), C(this, "stack"), C(this, "options"), C(this, "displayMessageParams"), this.status = t, this.revision = n || "NO_REVISION", this.module = a, this.message = c, this.display = ie(s, d || []), this.code = s, this.type = o || Me.UNHANDLED_ERROR, this.options = {
702
- shouldLog: p || !0,
703
- shouldTrace: y || !0,
704
- shouldThrow: u || !1
705
- }, this.displayMessageParams = d || [], this.options.shouldTrace && Error.captureStackTrace(this);
706
- }
707
- static fromErrorInfo(t) {
708
- return new Ne(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 ie(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 i = /* @__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))(i || {}), st = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(st || {}), it = /* @__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))(it || {});
728
- const hn = {
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 _n = [
747
- "ETH",
748
- "AVAX",
749
- "BSC",
750
- "ARB",
751
- "OP",
752
- "MATIC"
753
- /* Polygon */
754
- ], fn = [
755
- "BTC",
756
- "BCH",
757
- "DOGE",
758
- "LTC"
759
- /* Litecoin */
760
- ], bn = [
761
- "GAIA",
762
- "THOR",
763
- "BNB"
764
- /* Binance */
765
- ];
766
- var fe = /* @__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))(fe || {}), xe = /* @__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))(xe || {}), q = /* @__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))(q || {});
767
- const ae = Object.values(i), rt = Object.keys(i), be = ae.reduce(
768
- (e, t) => {
769
- const n = rt.find((a) => i[a] === t);
770
- return n && (e[t] = n), e;
771
- },
772
- {}
773
- ), ot = ae.reduce(
774
- (e, t) => (e[t] = fe[be[t]], e),
775
- {}
776
- ), pt = ae.reduce(
777
- (e, t) => (e[t] = xe[be[t]], e),
778
- {}
779
- ), wn = ae.reduce(
780
- (e, t) => {
781
- const n = `${be[t]}Hex`;
782
- return e[t] = fe[n], e;
783
- },
784
- {}
785
- ), An = {
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
- }, De = {
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 dt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(dt || {}), h = /* @__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))(h || {}), k = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(k || {}), ut = /* @__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))(ut || {}), lt = Object.defineProperty, yt = (e, t, n) => t in e ? lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, M = (e, t, n) => (yt(e, typeof t != "symbol" ? t + "" : t, n), n), ct = (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
- }, O = (e, t, n) => (ct(e, t, "access private method"), n);
835
- const mt = "0x313ce567", Pe = async ({ chain: e, to: t }) => {
836
- try {
837
- const { result: n } = await Ae.post(pt[e], {
838
- headers: { accept: "*/*", "cache-control": "no-cache" },
839
- body: JSON.stringify({
840
- id: 44,
841
- jsonrpc: "2.0",
842
- method: "eth_call",
843
- params: [{ to: t.toLowerCase(), data: mt }, "latest"]
844
- })
845
- });
846
- return parseInt(BigInt(n).toString());
847
- } catch (n) {
848
- return console.error(n), b[e];
849
- }
850
- }, Tt = async (e) => {
851
- if (e === i.Ethereum)
852
- return b.ETH;
853
- const [, t] = e.split("-");
854
- return t != null && t.startsWith("0x") ? Pe({ chain: i.Ethereum, to: t }) : b.ETH;
855
- }, ht = async (e) => {
856
- const [, t] = e.split("-");
857
- return t != null && t.startsWith("0x") ? Pe({ chain: i.Avalanche, to: t.toLowerCase() }) : b.AVAX;
858
- }, _t = async (e) => (e === i.BinanceSmartChain, b.BSC), Be = async ({ chain: e, symbol: t }) => {
859
- switch (e) {
860
- case i.Ethereum:
861
- return Tt(t);
862
- case i.Avalanche:
863
- return ht(t);
864
- case i.BinanceSmartChain:
865
- return _t(t);
866
- default:
867
- return b[e];
868
- }
869
- }, ft = {
870
- [k.Average]: 1.2,
871
- [k.Fast]: 1.5,
872
- [k.Fastest]: 2
873
- }, bt = ({ chain: e, symbol: t }) => {
874
- switch (e) {
875
- case i.Bitcoin:
876
- case i.BitcoinCash:
877
- case i.Litecoin:
878
- case i.Dogecoin:
879
- case i.Binance:
880
- case i.Ethereum:
881
- case i.Avalanche:
882
- return t === e;
883
- case i.Arbitrum:
884
- case i.Optimism:
885
- return t === "ETH";
886
- case i.Maya:
887
- return t === "CACAO";
888
- case i.Kujira:
889
- return t === "KUJI";
890
- case i.Cosmos:
891
- return t === "ATOM";
892
- case i.Polygon:
893
- return t === "MATIC";
894
- case i.BinanceSmartChain:
895
- return t === "BNB";
896
- case i.THORChain:
897
- return t === "RUNE";
898
- }
899
- }, wt = (e) => {
900
- switch (e) {
901
- case "ETH.THOR":
902
- return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
903
- case "ETH.vTHOR":
904
- return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
905
- case i.Cosmos:
906
- return { identifier: "GAIA.ATOM", decimal: b[e] };
907
- case i.THORChain:
908
- return { identifier: "THOR.RUNE", decimal: b[e] };
909
- case i.BinanceSmartChain:
910
- return { identifier: "BSC.BNB", decimal: b[e] };
911
- case i.Maya:
912
- return { identifier: "MAYA.CACAO", decimal: b.MAYA };
913
- case "MAYA.MAYA":
914
- return { identifier: "MAYA.MAYA", decimal: 4 };
915
- case i.Kujira:
916
- case i.Arbitrum:
917
- case i.Optimism:
918
- case i.BitcoinCash:
919
- case i.Litecoin:
920
- case i.Dogecoin:
921
- case i.Binance:
922
- case i.Avalanche:
923
- case i.Polygon:
924
- case i.Bitcoin:
925
- case i.Ethereum:
926
- return { identifier: `${e}.${e}`, decimal: b[e] };
927
- }
928
- }, At = ({ chain: e, symbol: t }) => {
929
- if (t.includes("/"))
930
- return "Synth";
931
- switch (e) {
932
- case i.Bitcoin:
933
- case i.BitcoinCash:
934
- case i.Dogecoin:
935
- case i.Litecoin:
936
- case i.Maya:
937
- case i.THORChain:
938
- return "Native";
939
- case i.Cosmos:
940
- return t === "ATOM" ? "Native" : i.Cosmos;
941
- case i.Kujira:
942
- return t === i.Kujira ? "Native" : i.Kujira;
943
- case i.Binance:
944
- return t === i.Binance ? "Native" : "BEP2";
945
- case i.BinanceSmartChain:
946
- return t === i.Binance ? "Native" : "BEP20";
947
- case i.Ethereum:
948
- return t === i.Ethereum ? "Native" : "ERC20";
949
- case i.Avalanche:
950
- return t === i.Avalanche ? "Native" : i.Avalanche;
951
- case i.Polygon:
952
- return t === i.Polygon ? "Native" : "POLYGON";
953
- case i.Arbitrum:
954
- return [i.Ethereum, i.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
955
- case i.Optimism:
956
- return [i.Ethereum, i.Optimism].includes(t) ? "Native" : "OPTIMISM";
957
- }
958
- }, En = (e) => {
959
- var t;
960
- const [n, ...a] = e.split("."), s = e.includes("/"), r = a.join("."), o = (t = r == null ? void 0 : r.split("-")) == null ? void 0 : t[0];
961
- return { chain: n, symbol: r, ticker: o, synth: s };
962
- }, Et = new RegExp(
963
- /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
964
- "gmi"
965
- ), Rn = (e) => e.filter(
966
- (t) => !Et.test(t.toString()) && !t.toString().includes("undefined")
967
- ), Rt = ({
968
- liquidityUnits: e,
969
- poolUnits: t,
970
- runeDepth: n
971
- }) => {
972
- const a = w(e), s = w(t), r = w(n), o = a.mul(r), p = s.mul(s).mul(2), u = s.mul(a).mul(2), y = a.mul(a), d = s.mul(s).mul(s);
973
- return o.mul(p.sub(u).add(y)).div(d);
974
- }, gt = ({
975
- liquidityUnits: e,
976
- poolUnits: t,
977
- assetDepth: n
978
- }) => {
979
- const a = w(e), s = w(t), r = w(n), o = a.mul(r), p = s.mul(s).mul(2), u = s.mul(a).mul(2), y = a.mul(a), d = o.mul(p.sub(u).add(y)), c = s.mul(s).mul(s);
980
- return d.div(c);
981
- }, gn = ({
982
- percent: e,
983
- runeDepth: t,
984
- liquidityUnits: n,
985
- poolUnits: a
986
- }) => Rt({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), On = ({
987
- percent: e,
988
- assetDepth: t,
989
- liquidityUnits: n,
990
- poolUnits: a
991
- }) => gt({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), w = (e) => new j({ value: e, decimal: b.THOR }), Ot = ({
992
- liquidityUnits: e,
993
- poolUnits: t,
994
- runeDepth: n,
995
- assetDepth: a
996
- }) => ({
997
- assetAmount: w(a).mul(e).div(t),
998
- runeAmount: w(n).mul(e).div(t)
999
- }), In = ({
1000
- liquidityUnits: e,
1001
- poolUnits: t,
1002
- runeDepth: n,
1003
- assetDepth: a,
1004
- percent: s
1005
- }) => Object.fromEntries(
1006
- Object.entries(Ot({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
1007
- ([r, o]) => [r, o.mul(s)]
1008
- )
1009
- ), Sn = ({
1010
- runeDepth: e,
1011
- poolUnits: t,
1012
- assetDepth: n,
1013
- liquidityUnits: a,
1014
- runeAmount: s,
1015
- assetAmount: r
1016
- }) => {
1017
- const o = w(e), p = w(n), u = w(t), y = w(s), d = w(r), c = y.mul(p), _ = d.mul(o), A = y.mul(d), R = o.mul(p), g = u.mul(c.add(_.add(A.mul(2)))), E = c.add(_.add(R.mul(2))), I = g.div(E), S = w(a).add(I);
1018
- if (I.baseValueNumber === 0)
1019
- return S.div(u).baseValueNumber;
1020
- const D = u.add(S);
1021
- return S.div(D).baseValueNumber;
1022
- }, vn = ({
1023
- runeAmount: e,
1024
- assetAmount: t,
1025
- runeDepth: n,
1026
- assetDepth: a
1027
- }) => {
1028
- const s = w(n), r = w(a), o = w(t), p = w(e), u = o.mul(s).sub(r.mul(p)), y = r.mul(p).add(s.mul(r));
1029
- return Math.abs(u.div(y).baseValueNumber);
1030
- }, It = ({
1031
- symbol: e,
1032
- ticker: t,
1033
- chain: n
1034
- }) => n === "ETH" && t !== "ETH" ? `${t}-${e.slice(-3)}` : e, x = (e, t) => {
1035
- switch (e) {
1036
- case h.LEAVE:
1037
- case h.BOND: {
1038
- const { address: n } = t;
1039
- return `${e}:${n}`;
1040
- }
1041
- case h.UNBOND: {
1042
- const { address: n, unbondAmount: a } = t;
1043
- return `${e}:${n}:${a * 10 ** 8}`;
1044
- }
1045
- case h.THORNAME_REGISTER: {
1046
- const { name: n, chain: a, address: s, owner: r } = t;
1047
- return `${e}:${n}:${a}:${s}${r ? `:${r}` : ""}`;
1048
- }
1049
- case h.DEPOSIT: {
1050
- const { chain: n, symbol: a, address: s, singleSide: r } = t;
1051
- return r ? `${e}:${n}/${a}::t:0` : `${e}:${n}.${a}:${s || ""}:t:0`;
1052
- }
1053
- case h.WITHDRAW: {
1054
- const { chain: n, ticker: a, symbol: s, basisPoints: r, targetAssetString: o, singleSide: p } = t, u = !p && o ? `:${o}` : "", y = It({ chain: n, symbol: s, ticker: a });
1055
- return `${e}:${n}${p ? "/" : "."}${y}:${r}${u}`;
1056
- }
1057
- case h.OPEN_LOAN:
1058
- case h.CLOSE_LOAN: {
1059
- const { asset: n, address: a } = t;
1060
- return `${e}:${n}:${a}`;
1061
- }
1062
- default:
1063
- return "";
1064
- }
1065
- }, Cn = (e) => {
1066
- if (e < 0)
1067
- throw new Error("Invalid number of year");
1068
- return 10 + e;
1069
- }, Mn = (e) => {
1070
- if (e.length > 30)
1071
- return !1;
1072
- const t = /^[a-zA-Z0-9+_-]+$/g;
1073
- return !!e.match(t);
1074
- }, Nn = ([e, t, n, a, s]) => `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
1075
- class Ee extends Error {
1076
- constructor(t, n, a) {
1077
- const s = t.status || t.status === 0 ? t.status : "", r = t.statusText || "", o = `${s} ${r}`.trim(), p = o ? `status code ${o}` : "an unknown error";
1078
- super(`Request failed with ${p}`), Object.defineProperty(this, "response", {
1079
- enumerable: !0,
1080
- configurable: !0,
1081
- writable: !0,
1082
- value: void 0
1083
- }), Object.defineProperty(this, "request", {
1084
- enumerable: !0,
1085
- configurable: !0,
1086
- writable: !0,
1087
- value: void 0
1088
- }), Object.defineProperty(this, "options", {
1089
- enumerable: !0,
1090
- configurable: !0,
1091
- writable: !0,
1092
- value: void 0
1093
- }), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
1094
- }
1095
- }
1096
- class Ve extends Error {
1097
- constructor(t) {
1098
- super("Request timed out"), Object.defineProperty(this, "request", {
1099
- enumerable: !0,
1100
- configurable: !0,
1101
- writable: !0,
1102
- value: void 0
1103
- }), this.name = "TimeoutError", this.request = t;
1104
- }
1105
- }
1106
- const Q = (e) => e !== null && typeof e == "object", J = (...e) => {
1107
- for (const t of e)
1108
- if ((!Q(t) || Array.isArray(t)) && t !== void 0)
1109
- throw new TypeError("The `options` argument must be an object");
1110
- return we({}, ...e);
1111
- }, Le = (e = {}, t = {}) => {
1112
- const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, s = new globalThis.Headers(t);
1113
- for (const [r, o] of s.entries())
1114
- a && o === "undefined" || o === void 0 ? n.delete(r) : n.set(r, o);
1115
- return n;
1116
- }, we = (...e) => {
1117
- let t = {}, n = {};
1118
- for (const a of e)
1119
- if (Array.isArray(a))
1120
- Array.isArray(t) || (t = []), t = [...t, ...a];
1121
- else if (Q(a)) {
1122
- for (let [s, r] of Object.entries(a))
1123
- Q(r) && s in t && (r = we(t[s], r)), t = { ...t, [s]: r };
1124
- Q(a.headers) && (n = Le(n, a.headers), t.headers = n);
1125
- }
1126
- return t;
1127
- }, St = (() => {
1128
- let e = !1, t = !1;
1129
- const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
1130
- return n && a && (t = new globalThis.Request("https://empty.invalid", {
1131
- body: new globalThis.ReadableStream(),
1132
- method: "POST",
1133
- // @ts-expect-error - Types are outdated.
1134
- get duplex() {
1135
- return e = !0, "half";
1136
- }
1137
- }).headers.has("Content-Type")), e && !t;
1138
- })(), vt = typeof globalThis.AbortController == "function", Ct = typeof globalThis.ReadableStream == "function", Mt = typeof globalThis.FormData == "function", Ue = ["get", "post", "put", "patch", "head", "delete"], Nt = {
1139
- json: "application/json",
1140
- text: "text/*",
1141
- formData: "multipart/form-data",
1142
- arrayBuffer: "*/*",
1143
- blob: "*/*"
1144
- }, re = 2147483647, He = Symbol("stop"), xt = {
1145
- json: !0,
1146
- parseJson: !0,
1147
- searchParams: !0,
1148
- prefixUrl: !0,
1149
- retry: !0,
1150
- timeout: !0,
1151
- hooks: !0,
1152
- throwHttpErrors: !0,
1153
- onDownloadProgress: !0,
1154
- fetch: !0
1155
- }, Dt = {
1156
- method: !0,
1157
- headers: !0,
1158
- body: !0,
1159
- mode: !0,
1160
- credentials: !0,
1161
- cache: !0,
1162
- redirect: !0,
1163
- referrer: !0,
1164
- referrerPolicy: !0,
1165
- integrity: !0,
1166
- keepalive: !0,
1167
- signal: !0,
1168
- window: !0,
1169
- dispatcher: !0,
1170
- duplex: !0
1171
- }, Pt = (e) => Ue.includes(e) ? e.toUpperCase() : e, Bt = ["get", "put", "head", "delete", "options", "trace"], Vt = [408, 413, 429, 500, 502, 503, 504], $e = [413, 429, 503], Re = {
1172
- limit: 2,
1173
- methods: Bt,
1174
- statusCodes: Vt,
1175
- afterStatusCodes: $e,
1176
- maxRetryAfter: Number.POSITIVE_INFINITY,
1177
- backoffLimit: Number.POSITIVE_INFINITY,
1178
- delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
1179
- }, Lt = (e = {}) => {
1180
- if (typeof e == "number")
1181
- return {
1182
- ...Re,
1183
- limit: e
1184
- };
1185
- if (e.methods && !Array.isArray(e.methods))
1186
- throw new Error("retry.methods must be an array");
1187
- if (e.statusCodes && !Array.isArray(e.statusCodes))
1188
- throw new Error("retry.statusCodes must be an array");
1189
- return {
1190
- ...Re,
1191
- ...e,
1192
- afterStatusCodes: $e
1193
- };
1194
- };
1195
- async function Ut(e, t, n, a) {
1196
- return new Promise((s, r) => {
1197
- const o = setTimeout(() => {
1198
- n && n.abort(), r(new Ve(e));
1199
- }, a.timeout);
1200
- a.fetch(e, t).then(s).catch(r).then(() => {
1201
- clearTimeout(o);
1202
- });
1203
- });
1204
- }
1205
- async function Ht(e, { signal: t }) {
1206
- return new Promise((n, a) => {
1207
- t && (t.throwIfAborted(), t.addEventListener("abort", s, { once: !0 }));
1208
- function s() {
1209
- clearTimeout(r), a(t.reason);
1210
- }
1211
- const r = setTimeout(() => {
1212
- t == null || t.removeEventListener("abort", s), n();
1213
- }, e);
1214
- });
1215
- }
1216
- const $t = (e, t) => {
1217
- const n = {};
1218
- for (const a in t)
1219
- !(a in Dt) && !(a in xt) && !(a in e) && (n[a] = t[a]);
1220
- return n;
1221
- };
1222
- class Z {
1223
- static create(t, n) {
1224
- const a = new Z(t, n), s = async () => {
1225
- if (typeof a._options.timeout == "number" && a._options.timeout > re)
1226
- throw new RangeError(`The \`timeout\` option cannot be greater than ${re}`);
1227
- await Promise.resolve();
1228
- let o = await a._fetch();
1229
- for (const p of a._options.hooks.afterResponse) {
1230
- const u = await p(a.request, a._options, a._decorateResponse(o.clone()));
1231
- u instanceof globalThis.Response && (o = u);
1232
- }
1233
- if (a._decorateResponse(o), !o.ok && a._options.throwHttpErrors) {
1234
- let p = new Ee(o, a.request, a._options);
1235
- for (const u of a._options.hooks.beforeError)
1236
- p = await u(p);
1237
- throw p;
1238
- }
1239
- if (a._options.onDownloadProgress) {
1240
- if (typeof a._options.onDownloadProgress != "function")
1241
- throw new TypeError("The `onDownloadProgress` option must be a function");
1242
- if (!Ct)
1243
- throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
1244
- return a._stream(o.clone(), a._options.onDownloadProgress);
1245
- }
1246
- return o;
1247
- }, r = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(s) : s();
1248
- for (const [o, p] of Object.entries(Nt))
1249
- r[o] = async () => {
1250
- a.request.headers.set("accept", a.request.headers.get("accept") || p);
1251
- const u = (await r).clone();
1252
- if (o === "json") {
1253
- if (u.status === 204 || (await u.clone().arrayBuffer()).byteLength === 0)
1254
- return "";
1255
- if (n.parseJson)
1256
- return n.parseJson(await u.text());
1257
- }
1258
- return u[o]();
1259
- };
1260
- return r;
1261
- }
1262
- // eslint-disable-next-line complexity
1263
- constructor(t, n = {}) {
1264
- if (Object.defineProperty(this, "request", {
1265
- enumerable: !0,
1266
- configurable: !0,
1267
- writable: !0,
1268
- value: void 0
1269
- }), Object.defineProperty(this, "abortController", {
1270
- enumerable: !0,
1271
- configurable: !0,
1272
- writable: !0,
1273
- value: void 0
1274
- }), Object.defineProperty(this, "_retryCount", {
1275
- enumerable: !0,
1276
- configurable: !0,
1277
- writable: !0,
1278
- value: 0
1279
- }), Object.defineProperty(this, "_input", {
1280
- enumerable: !0,
1281
- configurable: !0,
1282
- writable: !0,
1283
- value: void 0
1284
- }), Object.defineProperty(this, "_options", {
1285
- enumerable: !0,
1286
- configurable: !0,
1287
- writable: !0,
1288
- value: void 0
1289
- }), this._input = t, this._options = {
1290
- // TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
1291
- credentials: this._input.credentials || "same-origin",
1292
- ...n,
1293
- headers: Le(this._input.headers, n.headers),
1294
- hooks: we({
1295
- beforeRequest: [],
1296
- beforeRetry: [],
1297
- beforeError: [],
1298
- afterResponse: []
1299
- }, n.hooks),
1300
- method: Pt(n.method ?? this._input.method),
1301
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1302
- prefixUrl: String(n.prefixUrl || ""),
1303
- retry: Lt(n.retry),
1304
- throwHttpErrors: n.throwHttpErrors !== !1,
1305
- timeout: n.timeout ?? 1e4,
1306
- fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
1307
- }, typeof this._input != "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request))
1308
- throw new TypeError("`input` must be a string, URL, or Request");
1309
- if (this._options.prefixUrl && typeof this._input == "string") {
1310
- if (this._input.startsWith("/"))
1311
- throw new Error("`input` must not begin with a slash when using `prefixUrl`");
1312
- this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
1313
- }
1314
- if (vt) {
1315
- if (this.abortController = new globalThis.AbortController(), this._options.signal) {
1316
- const a = this._options.signal;
1317
- this._options.signal.addEventListener("abort", () => {
1318
- this.abortController.abort(a.reason);
1319
- });
1320
- }
1321
- this._options.signal = this.abortController.signal;
1322
- }
1323
- if (St && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
1324
- const a = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, a);
1325
- (Mt && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(s, { ...this.request }), this._options);
1326
- }
1327
- this._options.json !== void 0 && (this._options.body = JSON.stringify(this._options.json), this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json"), this.request = new globalThis.Request(this.request, { body: this._options.body }));
1328
- }
1329
- _calculateRetryDelay(t) {
1330
- if (this._retryCount++, this._retryCount < this._options.retry.limit && !(t instanceof Ve)) {
1331
- if (t instanceof Ee) {
1332
- if (!this._options.retry.statusCodes.includes(t.response.status))
1333
- return 0;
1334
- const a = t.response.headers.get("Retry-After");
1335
- if (a && this._options.retry.afterStatusCodes.includes(t.response.status)) {
1336
- let s = Number(a);
1337
- return Number.isNaN(s) ? s = Date.parse(a) - Date.now() : s *= 1e3, this._options.retry.maxRetryAfter !== void 0 && s > this._options.retry.maxRetryAfter ? 0 : s;
1338
- }
1339
- if (t.response.status === 413)
1340
- return 0;
1341
- }
1342
- const n = this._options.retry.delay(this._retryCount);
1343
- return Math.min(this._options.retry.backoffLimit, n);
1344
- }
1345
- return 0;
1346
- }
1347
- _decorateResponse(t) {
1348
- return this._options.parseJson && (t.json = async () => this._options.parseJson(await t.text())), t;
1349
- }
1350
- async _retry(t) {
1351
- try {
1352
- return await t();
1353
- } catch (n) {
1354
- const a = Math.min(this._calculateRetryDelay(n), re);
1355
- if (a !== 0 && this._retryCount > 0) {
1356
- await Ht(a, { signal: this._options.signal });
1357
- for (const s of this._options.hooks.beforeRetry)
1358
- if (await s({
1359
- request: this.request,
1360
- options: this._options,
1361
- error: n,
1362
- retryCount: this._retryCount
1363
- }) === He)
1364
- return;
1365
- return this._retry(t);
1366
- }
1367
- throw n;
1368
- }
1369
- }
1370
- async _fetch() {
1371
- for (const n of this._options.hooks.beforeRequest) {
1372
- const a = await n(this.request, this._options);
1373
- if (a instanceof Request) {
1374
- this.request = a;
1375
- break;
1376
- }
1377
- if (a instanceof Response)
1378
- return a;
1379
- }
1380
- const t = $t(this.request, this._options);
1381
- return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Ut(this.request.clone(), t, this.abortController, this._options);
1382
- }
1383
- /* istanbul ignore next */
1384
- _stream(t, n) {
1385
- const a = Number(t.headers.get("content-length")) || 0;
1386
- let s = 0;
1387
- return t.status === 204 ? (n && n({ percent: 1, totalBytes: a, transferredBytes: s }, new Uint8Array()), new globalThis.Response(null, {
1388
- status: t.status,
1389
- statusText: t.statusText,
1390
- headers: t.headers
1391
- })) : new globalThis.Response(new globalThis.ReadableStream({
1392
- async start(r) {
1393
- const o = t.body.getReader();
1394
- n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
1395
- async function p() {
1396
- const { done: u, value: y } = await o.read();
1397
- if (u) {
1398
- r.close();
1399
- return;
1400
- }
1401
- if (n) {
1402
- s += y.byteLength;
1403
- const d = a === 0 ? 0 : s / a;
1404
- n({ percent: d, transferredBytes: s, totalBytes: a }, y);
1405
- }
1406
- r.enqueue(y), await p();
1407
- }
1408
- await p();
1409
- }
1410
- }), {
1411
- status: t.status,
1412
- statusText: t.statusText,
1413
- headers: t.headers
1414
- });
1415
- }
1416
- }
1417
- /*! MIT License © Sindre Sorhus */
1418
- const pe = (e) => {
1419
- const t = (n, a) => Z.create(n, J(e, a));
1420
- for (const n of Ue)
1421
- t[n] = (a, s) => Z.create(a, J(e, s, { method: n }));
1422
- return t.create = (n) => pe(J(n)), t.extend = (n) => pe(J(e, n)), t.stop = He, t;
1423
- }, kt = pe(), Ft = kt, ge = Ft.create({
1424
- headers: {
1425
- referrer: "https://sk.thorswap.net",
1426
- referer: "https://sk.thorswap.net",
1427
- "Content-Type": "application/json"
1428
- }
1429
- }), Ae = {
1430
- get: (e, t) => ge.get(e, t).json(),
1431
- post: (e, t) => ge.post(e, t).json()
1432
- }, Oe = Object.values(i), Gt = (e = "") => {
1433
- const t = e.toUpperCase(), [n] = t.split(".");
1434
- if (Oe.includes(n))
1435
- return !0;
1436
- const [a] = t.split("/");
1437
- if (Oe.includes(a))
1438
- return !0;
1439
- throw new Error(
1440
- `Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
1441
- );
1442
- }, W = 8, U = (e) => 10n ** BigInt(e), F = (e) => Math.log10(parseFloat(e.toString()));
1443
- function se({
1444
- value: e,
1445
- bigIntDecimal: t = W,
1446
- decimal: n = W
1447
- }) {
1448
- const a = e < 0n;
1449
- let s = e.toString().substring(a ? 1 : 0);
1450
- const r = n - (s.length - 1);
1451
- r > 0 && (s = "0".repeat(r) + s);
1452
- const o = s.length - n;
1453
- let p = s.slice(-n);
1454
- return parseInt(p[t]) >= 5 ? p = `${p.substring(0, t - 1)}${(parseInt(p[t - 1]) + 1).toString()}` : p = p.substring(0, t), `${a ? "-" : ""}${s.slice(0, o)}.${p}`.replace(
1455
- /\.?0*$/,
1456
- ""
1457
- );
1458
- }
1459
- var L, $, de, ke, ue, Ie, ee, le, H, G, te, ye;
1460
- const qt = class ce {
1461
- constructor(t) {
1462
- V(this, L), V(this, de), V(this, ue), V(this, ee), V(this, H), V(this, te), M(this, "decimalMultiplier", 10n ** 8n), M(this, "bigIntValue", 0n), M(this, "decimal");
1463
- const n = Te(t);
1464
- this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = U(
1465
- Math.max(O(this, te, ye).call(this, O(this, H, G).call(this, n)), this.decimal || 0)
1466
- ), O(this, de, ke).call(this, n);
1467
- }
1468
- static fromBigInt(t, n) {
1469
- return new ce({
1470
- decimal: n,
1471
- value: se({ value: t, bigIntDecimal: n, decimal: n })
1472
- });
1473
- }
1474
- static shiftDecimals({
1475
- value: t,
1476
- from: n,
1477
- to: a
1478
- }) {
1479
- return this.fromBigInt(
1480
- new ce(t).bigIntValue * U(a) / U(n),
1481
- a
1482
- );
1483
- }
1484
- /**
1485
- * @deprecated Use `getBaseValue('string')` instead
1486
- */
1487
- get baseValue() {
1488
- return this.getBaseValue("string");
1489
- }
1490
- /**
1491
- * @deprecated Use `getBaseValue('number')` instead
1492
- */
1493
- get baseValueNumber() {
1494
- return this.getBaseValue("number");
1495
- }
1496
- /**
1497
- * @deprecated Use `getBaseValue('bigint')` instead
1498
- */
1499
- get baseValueBigInt() {
1500
- return this.getBaseValue("bigint");
1501
- }
1502
- set(t) {
1503
- return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
1504
- }
1505
- add(...t) {
1506
- return O(this, L, $).call(this, "add", ...t);
1507
- }
1508
- sub(...t) {
1509
- return O(this, L, $).call(this, "sub", ...t);
1510
- }
1511
- mul(...t) {
1512
- return O(this, L, $).call(this, "mul", ...t);
1513
- }
1514
- div(...t) {
1515
- return O(this, L, $).call(this, "div", ...t);
1516
- }
1517
- gt(t) {
1518
- return this.bigIntValue > this.getBigIntValue(t);
1519
- }
1520
- gte(t) {
1521
- return this.bigIntValue >= this.getBigIntValue(t);
1522
- }
1523
- lt(t) {
1524
- return this.bigIntValue < this.getBigIntValue(t);
1525
- }
1526
- lte(t) {
1527
- return this.bigIntValue <= this.getBigIntValue(t);
1528
- }
1529
- eqValue(t) {
1530
- return this.bigIntValue === this.getBigIntValue(t);
1531
- }
1532
- getValue(t) {
1533
- const n = this.formatBigIntToSafeValue(
1534
- this.bigIntValue,
1535
- this.decimal || F(this.decimalMultiplier)
1536
- );
1537
- switch (t) {
1538
- case "number":
1539
- return Number(n);
1540
- case "string":
1541
- return n;
1542
- default:
1543
- return this.bigIntValue * BigInt(this.decimal || 8n) / this.decimalMultiplier;
1544
- }
1545
- }
1546
- getBaseValue(t) {
1547
- const n = this.decimalMultiplier / U(this.decimal || b.THOR), a = this.bigIntValue / n;
1548
- switch (t) {
1549
- case "number":
1550
- return Number(a);
1551
- case "string":
1552
- return a.toString();
1553
- default:
1554
- return a;
1555
- }
1556
- }
1557
- getBigIntValue(t, n) {
1558
- if (!n && typeof t == "object")
1559
- return t.bigIntValue;
1560
- const a = Te(t), s = O(this, H, G).call(this, a);
1561
- return s === "0" || s === "undefined" ? 0n : O(this, ee, le).call(this, s, n);
1562
- }
1563
- formatBigIntToSafeValue(t, n) {
1564
- const a = n || this.decimal || W, s = Math.max(
1565
- a,
1566
- F(this.decimalMultiplier)
1567
- ), r = t < 0n, o = t.toString().substring(r ? 1 : 0), p = s - (o.length - 1), u = p > 0 ? "0".repeat(p) + o : o, y = u.length - s;
1568
- let d = u.slice(-s);
1569
- return parseInt(d[a]) >= 5 ? d = `${d.substring(0, a - 1)}${(parseInt(d[a - 1]) + 1).toString()}` : d = d.substring(0, a), `${r ? "-" : ""}${u.slice(
1570
- 0,
1571
- y
1572
- )}.${d}`.replace(/\.?0*$/, "");
1573
- }
1574
- toSignificant(t = 6) {
1575
- const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "", o = parseInt(s) ? s.length + r.length : r.length;
1576
- if (o <= t)
1577
- return this.getValue("string");
1578
- if (s.length >= t)
1579
- return s.slice(0, t).padEnd(s.length, "0");
1580
- if (parseInt(s))
1581
- return `${s}.${r.slice(0, t - s.length)}`.padEnd(
1582
- o - t,
1583
- "0"
1584
- );
1585
- const p = parseInt(r), u = `${p}`.slice(0, t);
1586
- return `0.${u.padStart(
1587
- r.length - `${p}`.length + u.length,
1588
- "0"
1589
- )}`;
1590
- }
1591
- toFixed(t = 6) {
1592
- const [n, a] = this.getValue("string").split("."), s = n || "", r = a || "";
1593
- if (parseInt(s))
1594
- return `${s}.${r.slice(0, t)}`.padEnd(t, "0");
1595
- const o = parseInt(r), p = `${o}`.slice(0, t);
1596
- return `0.${p.padStart(
1597
- r.length - `${o}`.length + p.length,
1598
- "0"
1599
- )}`;
1600
- }
1601
- toAbbreviation(t = 2) {
1602
- const n = this.getValue("number"), a = ["", "K", "M", "B", "T", "Q", "Qi", "S"], s = Math.floor(Math.log10(Math.abs(n)) / 3), r = a[s];
1603
- if (!r)
1604
- return n;
1605
- const o = 10 ** (s * 3);
1606
- return `${(n / o).toFixed(t)}${r}`;
1607
- }
1608
- };
1609
- L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
1610
- const n = O(this, ue, Ie).call(this, this, ...t), a = U(n), s = t.reduce(
1611
- (o, p) => {
1612
- const u = this.getBigIntValue(p, n);
1613
- switch (e) {
1614
- case "add":
1615
- return o + u;
1616
- case "sub":
1617
- return o - u;
1618
- case "mul":
1619
- return o * u / a;
1620
- case "div": {
1621
- if (u === 0n)
1622
- throw new RangeError("Division by zero");
1623
- return o * a / u;
1624
- }
1625
- default:
1626
- return o;
1627
- }
1628
- },
1629
- //normalize is to precision multiplier base
1630
- this.bigIntValue * a / this.decimalMultiplier
1631
- ), r = se({
1632
- bigIntDecimal: n,
1633
- decimal: Math.max(n, F(this.decimalMultiplier)),
1634
- value: s
1635
- });
1636
- return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
1637
- }, de = /* @__PURE__ */ new WeakSet(), ke = function(e) {
1638
- const t = O(this, H, G).call(this, e) || "0";
1639
- this.bigIntValue = O(this, ee, le).call(this, t);
1640
- }, ue = /* @__PURE__ */ new WeakSet(), Ie = function(...e) {
1641
- const t = e.map(
1642
- (n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : O(this, te, ye).call(this, O(this, H, G).call(this, n))
1643
- ).filter(Boolean);
1644
- return Math.max(...t, W);
1645
- }, ee = /* @__PURE__ */ new WeakSet(), le = function(e, t) {
1646
- const n = t ? U(t) : this.decimalMultiplier, a = F(n), [s = "", r = ""] = e.split(".");
1647
- return BigInt(`${s}${r.padEnd(a, "0")}`);
1648
- }, H = /* @__PURE__ */ new WeakSet(), G = function(e) {
1649
- const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
1650
- useGrouping: !1,
1651
- maximumFractionDigits: 20
1652
- }) : Te(e)}`.replaceAll(",", ".").split(".");
1653
- return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
1654
- }, te = /* @__PURE__ */ new WeakSet(), ye = function(e) {
1655
- var t;
1656
- const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
1657
- return Math.max(n, W);
1658
- };
1659
- let me = qt;
1660
- function Te(e) {
1661
- return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
1662
- }
1663
- const z = (e, t) => typeof e == "bigint" ? se({ value: e, bigIntDecimal: t, decimal: t }) : e;
1664
- let he;
1665
- const oe = (e) => {
1666
- if (!he)
1667
- throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
1668
- return he.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
1669
- }, Se = async (e, t = 0) => {
1670
- Gt(e);
1671
- const n = await Be(_e(e)), a = z(t, n);
1672
- return new v({ decimal: n, value: a, identifier: e });
1673
- };
1674
- class v extends me {
1675
- constructor(t) {
1676
- super(
1677
- t.value instanceof me ? t.value : { decimal: t.decimal, value: t.value }
1678
- ), M(this, "address"), M(this, "chain"), M(this, "isSynthetic", !1), M(this, "isGasAsset", !1), M(this, "symbol"), M(this, "ticker"), M(this, "type");
1679
- const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = _e(n);
1680
- this.type = At(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;
1681
- }
1682
- get assetValue() {
1683
- return `${this.getValue("string")} ${this.ticker}`;
1684
- }
1685
- toString(t = !1) {
1686
- const n = this.isSynthetic ? this.ticker : `${this.chain}.${this.ticker}`;
1687
- return t ? n : (
1688
- // THOR.ETH/ETH | ETH.USDT-0x1234567890
1689
- `${this.chain}.${this.symbol}`
1690
- );
1691
- }
1692
- eq({ chain: t, symbol: n }) {
1693
- return this.chain === t && this.symbol === n;
1694
- }
1695
- static async fromString(t, n = 0) {
1696
- return Se(t, n);
1697
- }
1698
- static fromStringSync(t, n = 0) {
1699
- const { decimal: a, identifier: s } = oe(
1700
- t
1701
- ), r = z(n, a);
1702
- return s ? new v({ decimal: a, identifier: s, value: r }) : void 0;
1703
- }
1704
- static async fromIdentifier(t, n = 0) {
1705
- return Se(t, n);
1706
- }
1707
- static fromIdentifierSync(t, n = 0) {
1708
- const { decimal: a, identifier: s } = oe(t), r = z(n, a);
1709
- return new v({ decimal: a, identifier: s, value: r });
1710
- }
1711
- static fromChainOrSignature(t, n = 0) {
1712
- const { decimal: a, identifier: s } = wt(t), r = z(n, a);
1713
- return new v({ value: r, decimal: a, identifier: s });
1714
- }
1715
- static async fromTCQuote(t, n = 0) {
1716
- const a = await Be(_e(t)), s = this.shiftDecimals({ value: n, from: b.THOR, to: a });
1717
- return new v({ value: s, identifier: t, decimal: a });
1718
- }
1719
- static fromTCQuoteStatic(t, n = 0) {
1720
- const a = oe(t), s = this.shiftDecimals({
1721
- value: n,
1722
- from: b.THOR,
1723
- to: a.decimal
1724
- });
1725
- return new v({ ...a, value: s });
1726
- }
1727
- static async loadStaticAssets() {
1728
- return new Promise(
1729
- async (t, n) => {
1730
- try {
1731
- const {
1732
- // Omit ThorchainList from import to avoid decimals conflict (TC uses 8 for all)
1733
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1734
- ThorchainList: a,
1735
- NativeList: s,
1736
- ...r
1737
- } = await import("@swapkit/tokens");
1738
- he = [s, ...Object.values(r)].reduce(
1739
- (o, { tokens: p }) => (p.forEach(({ identifier: u, chain: y, ...d }) => {
1740
- const c = "decimals" in d ? d.decimals : b[y];
1741
- o.set(u, { identifier: u, decimal: c });
1742
- }), o),
1743
- /* @__PURE__ */ new Map()
1744
- ), t({ ok: !0 });
1745
- } catch (a) {
1746
- console.error(a), n({
1747
- ok: !1,
1748
- error: a,
1749
- message: "Couldn't load static assets. Ensure you have installed @swapkit/tokens package"
1750
- });
1751
- }
1752
- }
1753
- );
1754
- }
1755
- }
1756
- const ve = (e) => {
1757
- const t = v.fromChainOrSignature(e);
1758
- switch (e) {
1759
- case i.Bitcoin:
1760
- case i.Litecoin:
1761
- case i.BitcoinCash:
1762
- return t.add(10001);
1763
- case i.Dogecoin:
1764
- return t.add(100000001);
1765
- case i.Avalanche:
1766
- case i.Ethereum:
1767
- return t.add(10 * 10 ** 9);
1768
- case i.THORChain:
1769
- case i.Maya:
1770
- return t.add(0);
1771
- default:
1772
- return t.add(1);
1773
- }
1774
- }, _e = (e) => {
1775
- const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${i.THORChain}.${e}`, [a, s] = n.split("."), [r, o] = s.split("-");
1776
- return {
1777
- address: o == null ? void 0 : o.toLowerCase(),
1778
- chain: a,
1779
- isGasAsset: bt({ chain: a, symbol: s }),
1780
- isSynthetic: t,
1781
- symbol: o ? `${r}-${(o == null ? void 0 : o.toLowerCase()) ?? ""}` : s,
1782
- ticker: t ? s : r
1783
- };
1784
- }, Wt = {
1785
- /**
1786
- * Core
1787
- */
1788
- core_wallet_connection_not_found: 10001,
1789
- core_estimated_max_spendable_chain_not_supported: 10002,
1790
- core_extend_error: 10003,
1791
- core_inbound_data_not_found: 10004,
1792
- core_approve_asset_address_or_from_not_found: 10005,
1793
- core_chain_halted: 10099,
1794
- /**
1795
- * Core - Wallet Connection
1796
- */
1797
- core_wallet_xdefi_not_installed: 10101,
1798
- core_wallet_evmwallet_not_installed: 10102,
1799
- core_wallet_walletconnect_not_installed: 10103,
1800
- core_wallet_keystore_not_installed: 10104,
1801
- core_wallet_ledger_not_installed: 10105,
1802
- core_wallet_trezor_not_installed: 10106,
1803
- core_wallet_keplr_not_installed: 10107,
1804
- core_wallet_okx_not_installed: 10108,
1805
- /**
1806
- * Core - Swap
1807
- */
1808
- core_swap_invalid_params: 10200,
1809
- core_swap_route_not_complete: 10201,
1810
- core_swap_asset_not_recognized: 10202,
1811
- core_swap_contract_not_found: 10203,
1812
- core_swap_route_transaction_not_found: 10204,
1813
- core_swap_contract_not_supported: 10205,
1814
- core_swap_transaction_error: 10206,
1815
- core_swap_quote_mode_not_supported: 10207,
1816
- /**
1817
- * Core - Transaction
1818
- */
1819
- core_transaction_deposit_error: 10301,
1820
- core_transaction_create_liquidity_rune_error: 10302,
1821
- core_transaction_create_liquidity_asset_error: 10303,
1822
- core_transaction_create_liquidity_invalid_params: 10304,
1823
- core_transaction_add_liquidity_invalid_params: 10305,
1824
- core_transaction_add_liquidity_no_rune_address: 10306,
1825
- core_transaction_add_liquidity_rune_error: 10307,
1826
- core_transaction_add_liquidity_asset_error: 10308,
1827
- core_transaction_withdraw_error: 10309,
1828
- core_transaction_deposit_to_pool_error: 10310,
1829
- core_transaction_deposit_insufficient_funds_error: 10311,
1830
- core_transaction_deposit_gas_error: 10312,
1831
- core_transaction_deposit_server_error: 10313,
1832
- /**
1833
- * Wallets
1834
- */
1835
- wallet_ledger_connection_error: 20001,
1836
- /**
1837
- * Helpers
1838
- */
1839
- helpers_number_different_decimals: 99101
1840
- };
1841
- class m extends Error {
1842
- constructor(t, n) {
1843
- console.error(n), super(t, { cause: { code: Wt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
1844
- }
1845
- }
1846
- class j extends me {
1847
- eq(t) {
1848
- return this.eqValue(t);
1849
- }
1850
- static fromBigInt(t, n) {
1851
- return new j({
1852
- decimal: n,
1853
- value: se({ value: t, bigIntDecimal: n, decimal: n })
1854
- });
1855
- }
1856
- }
1857
- const jt = [
1858
- {
1859
- inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1860
- stateMutability: "nonpayable",
1861
- type: "constructor"
1862
- },
1863
- {
1864
- anonymous: !1,
1865
- inputs: [
1866
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1867
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
1868
- ],
1869
- name: "FeeSet",
1870
- type: "event"
1871
- },
1872
- {
1873
- anonymous: !1,
1874
- inputs: [
1875
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
1876
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
1877
- ],
1878
- name: "OwnerSet",
1879
- type: "event"
1880
- },
1881
- {
1882
- inputs: [],
1883
- name: "fee",
1884
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1885
- stateMutability: "view",
1886
- type: "function"
1887
- },
1888
- {
1889
- inputs: [],
1890
- name: "feeRecipient",
1891
- outputs: [{ internalType: "address", name: "", type: "address" }],
1892
- stateMutability: "view",
1893
- type: "function"
1894
- },
1895
- {
1896
- inputs: [{ internalType: "address", name: "", type: "address" }],
1897
- name: "owners",
1898
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1899
- stateMutability: "view",
1900
- type: "function"
1901
- },
1902
- {
1903
- inputs: [
1904
- { internalType: "uint256", name: "_fee", type: "uint256" },
1905
- { internalType: "address", name: "_feeRecipient", type: "address" }
1906
- ],
1907
- name: "setFee",
1908
- outputs: [],
1909
- stateMutability: "nonpayable",
1910
- type: "function"
1911
- },
1912
- {
1913
- inputs: [
1914
- { internalType: "address", name: "owner", type: "address" },
1915
- { internalType: "bool", name: "active", type: "bool" }
1916
- ],
1917
- name: "setOwner",
1918
- outputs: [],
1919
- stateMutability: "nonpayable",
1920
- type: "function"
1921
- },
1922
- {
1923
- inputs: [
1924
- { internalType: "address", name: "tcRouter", type: "address" },
1925
- { internalType: "address", name: "tcVault", type: "address" },
1926
- { internalType: "string", name: "tcMemo", type: "string" },
1927
- { internalType: "address", name: "token", type: "address" },
1928
- { internalType: "uint256", name: "amount", type: "uint256" },
1929
- { internalType: "address", name: "router", type: "address" },
1930
- { internalType: "bytes", name: "data", type: "bytes" },
1931
- { internalType: "uint256", name: "deadline", type: "uint256" }
1932
- ],
1933
- name: "swapIn",
1934
- outputs: [],
1935
- stateMutability: "nonpayable",
1936
- type: "function"
1937
- },
1938
- {
1939
- inputs: [],
1940
- name: "tokenTransferProxy",
1941
- outputs: [
1942
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
1943
- ],
1944
- stateMutability: "view",
1945
- type: "function"
1946
- },
1947
- { stateMutability: "payable", type: "receive" }
1948
- ], Kt = [
1949
- {
1950
- inputs: [
1951
- { internalType: "address", name: "_ttp", type: "address" },
1952
- { internalType: "address", name: "_weth", type: "address" },
1953
- { internalType: "address", name: "_swapRouter", type: "address" }
1954
- ],
1955
- stateMutability: "nonpayable",
1956
- type: "constructor"
1957
- },
1958
- {
1959
- anonymous: !1,
1960
- inputs: [
1961
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1962
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
1963
- ],
1964
- name: "FeeSet",
1965
- type: "event"
1966
- },
1967
- {
1968
- anonymous: !1,
1969
- inputs: [
1970
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
1971
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
1972
- ],
1973
- name: "OwnerSet",
1974
- type: "event"
1975
- },
1976
- {
1977
- anonymous: !1,
1978
- inputs: [
1979
- { indexed: !1, internalType: "address", name: "from", type: "address" },
1980
- { indexed: !1, internalType: "address", name: "token", type: "address" },
1981
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
1982
- { indexed: !1, internalType: "uint256", name: "out", type: "uint256" },
1983
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1984
- { indexed: !1, internalType: "address", name: "vault", type: "address" },
1985
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
1986
- ],
1987
- name: "SwapIn",
1988
- type: "event"
1989
- },
1990
- {
1991
- anonymous: !1,
1992
- inputs: [
1993
- { indexed: !1, internalType: "address", name: "to", type: "address" },
1994
- { indexed: !1, internalType: "address", name: "token", type: "address" },
1995
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
1996
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" }
1997
- ],
1998
- name: "SwapOut",
1999
- type: "event"
2000
- },
2001
- {
2002
- inputs: [],
2003
- name: "fee",
2004
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2005
- stateMutability: "view",
2006
- type: "function"
2007
- },
2008
- {
2009
- inputs: [],
2010
- name: "feeRecipient",
2011
- outputs: [{ internalType: "address", name: "", type: "address" }],
2012
- stateMutability: "view",
2013
- type: "function"
2014
- },
2015
- {
2016
- inputs: [{ internalType: "address", name: "", type: "address" }],
2017
- name: "owners",
2018
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2019
- stateMutability: "view",
2020
- type: "function"
2021
- },
2022
- {
2023
- inputs: [
2024
- { internalType: "uint256", name: "_fee", type: "uint256" },
2025
- { internalType: "address", name: "_feeRecipient", type: "address" }
2026
- ],
2027
- name: "setFee",
2028
- outputs: [],
2029
- stateMutability: "nonpayable",
2030
- type: "function"
2031
- },
2032
- {
2033
- inputs: [
2034
- { internalType: "address", name: "owner", type: "address" },
2035
- { internalType: "bool", name: "active", type: "bool" }
2036
- ],
2037
- name: "setOwner",
2038
- outputs: [],
2039
- stateMutability: "nonpayable",
2040
- type: "function"
2041
- },
2042
- {
2043
- inputs: [
2044
- { internalType: "address", name: "router", type: "address" },
2045
- { internalType: "address", name: "vault", type: "address" },
2046
- { internalType: "string", name: "memo", type: "string" },
2047
- { internalType: "address", name: "token", type: "address" },
2048
- { internalType: "uint256", name: "amount", type: "uint256" },
2049
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2050
- { internalType: "uint256", name: "deadline", type: "uint256" }
2051
- ],
2052
- name: "swapIn",
2053
- outputs: [],
2054
- stateMutability: "nonpayable",
2055
- type: "function"
2056
- },
2057
- {
2058
- inputs: [
2059
- { internalType: "address", name: "token", type: "address" },
2060
- { internalType: "address", name: "to", type: "address" },
2061
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2062
- ],
2063
- name: "swapOut",
2064
- outputs: [],
2065
- stateMutability: "payable",
2066
- type: "function"
2067
- },
2068
- {
2069
- inputs: [],
2070
- name: "swapRouter",
2071
- outputs: [{ internalType: "contract IWoofi", name: "", type: "address" }],
2072
- stateMutability: "view",
2073
- type: "function"
2074
- },
2075
- {
2076
- inputs: [],
2077
- name: "tokenTransferProxy",
2078
- outputs: [
2079
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2080
- ],
2081
- stateMutability: "view",
2082
- type: "function"
2083
- },
2084
- {
2085
- inputs: [],
2086
- name: "weth",
2087
- outputs: [{ internalType: "address", name: "", type: "address" }],
2088
- stateMutability: "view",
2089
- type: "function"
2090
- },
2091
- { stateMutability: "payable", type: "receive" }
2092
- ], Yt = [
2093
- {
2094
- inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
2095
- stateMutability: "nonpayable",
2096
- type: "constructor"
2097
- },
2098
- {
2099
- anonymous: !1,
2100
- inputs: [
2101
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2102
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2103
- ],
2104
- name: "FeeSet",
2105
- type: "event"
2106
- },
2107
- {
2108
- anonymous: !1,
2109
- inputs: [
2110
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2111
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2112
- ],
2113
- name: "OwnerSet",
2114
- type: "event"
2115
- },
2116
- {
2117
- anonymous: !1,
2118
- inputs: [
2119
- { indexed: !1, internalType: "address", name: "from", type: "address" },
2120
- { indexed: !1, internalType: "address", name: "token", type: "address" },
2121
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
2122
- { indexed: !1, internalType: "uint256", name: "out", type: "uint256" },
2123
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2124
- { indexed: !1, internalType: "address", name: "vault", type: "address" },
2125
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
2126
- ],
2127
- name: "SwapIn",
2128
- type: "event"
2129
- },
2130
- {
2131
- inputs: [],
2132
- name: "fee",
2133
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2134
- stateMutability: "view",
2135
- type: "function"
2136
- },
2137
- {
2138
- inputs: [],
2139
- name: "feeRecipient",
2140
- outputs: [{ internalType: "address", name: "", type: "address" }],
2141
- stateMutability: "view",
2142
- type: "function"
2143
- },
2144
- {
2145
- inputs: [{ internalType: "address", name: "", type: "address" }],
2146
- name: "owners",
2147
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2148
- stateMutability: "view",
2149
- type: "function"
2150
- },
2151
- {
2152
- inputs: [
2153
- { internalType: "uint256", name: "_fee", type: "uint256" },
2154
- { internalType: "address", name: "_feeRecipient", type: "address" }
2155
- ],
2156
- name: "setFee",
2157
- outputs: [],
2158
- stateMutability: "nonpayable",
2159
- type: "function"
2160
- },
2161
- {
2162
- inputs: [
2163
- { internalType: "address", name: "owner", type: "address" },
2164
- { internalType: "bool", name: "active", type: "bool" }
2165
- ],
2166
- name: "setOwner",
2167
- outputs: [],
2168
- stateMutability: "nonpayable",
2169
- type: "function"
2170
- },
2171
- {
2172
- inputs: [
2173
- { internalType: "address", name: "router", type: "address" },
2174
- { internalType: "address", name: "vault", type: "address" },
2175
- { internalType: "string", name: "memo", type: "string" },
2176
- { internalType: "address", name: "token", type: "address" },
2177
- { internalType: "uint256", name: "amount", type: "uint256" },
2178
- { internalType: "address", name: "swapRouter", type: "address" },
2179
- { internalType: "bytes", name: "data", type: "bytes" },
2180
- { internalType: "uint256", name: "deadline", type: "uint256" }
2181
- ],
2182
- name: "swapIn",
2183
- outputs: [],
2184
- stateMutability: "nonpayable",
2185
- type: "function"
2186
- },
2187
- {
2188
- inputs: [],
2189
- name: "tokenTransferProxy",
2190
- outputs: [
2191
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2192
- ],
2193
- stateMutability: "view",
2194
- type: "function"
2195
- },
2196
- { stateMutability: "payable", type: "receive" }
2197
- ], Xt = [
2198
- {
2199
- inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
2200
- stateMutability: "nonpayable",
2201
- type: "constructor"
2202
- },
2203
- {
2204
- anonymous: !1,
2205
- inputs: [
2206
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2207
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2208
- ],
2209
- name: "FeeSet",
2210
- type: "event"
2211
- },
2212
- {
2213
- anonymous: !1,
2214
- inputs: [
2215
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2216
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2217
- ],
2218
- name: "OwnerSet",
2219
- type: "event"
2220
- },
2221
- {
2222
- inputs: [],
2223
- name: "fee",
2224
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2225
- stateMutability: "view",
2226
- type: "function"
2227
- },
2228
- {
2229
- inputs: [],
2230
- name: "feeRecipient",
2231
- outputs: [{ internalType: "address", name: "", type: "address" }],
2232
- stateMutability: "view",
2233
- type: "function"
2234
- },
2235
- {
2236
- inputs: [{ internalType: "address", name: "", type: "address" }],
2237
- name: "owners",
2238
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2239
- stateMutability: "view",
2240
- type: "function"
2241
- },
2242
- {
2243
- inputs: [
2244
- { internalType: "uint256", name: "_fee", type: "uint256" },
2245
- { internalType: "address", name: "_feeRecipient", type: "address" }
2246
- ],
2247
- name: "setFee",
2248
- outputs: [],
2249
- stateMutability: "nonpayable",
2250
- type: "function"
2251
- },
2252
- {
2253
- inputs: [
2254
- { internalType: "address", name: "owner", type: "address" },
2255
- { internalType: "bool", name: "active", type: "bool" }
2256
- ],
2257
- name: "setOwner",
2258
- outputs: [],
2259
- stateMutability: "nonpayable",
2260
- type: "function"
2261
- },
2262
- {
2263
- inputs: [
2264
- { internalType: "address", name: "tcRouter", type: "address" },
2265
- { internalType: "address", name: "tcVault", type: "address" },
2266
- { internalType: "string", name: "tcMemo", type: "string" },
2267
- { internalType: "address", name: "token", type: "address" },
2268
- { internalType: "uint256", name: "amount", type: "uint256" },
2269
- { internalType: "address", name: "router", type: "address" },
2270
- { internalType: "bytes", name: "data", type: "bytes" },
2271
- { internalType: "uint256", name: "deadline", type: "uint256" }
2272
- ],
2273
- name: "swapIn",
2274
- outputs: [],
2275
- stateMutability: "nonpayable",
2276
- type: "function"
2277
- },
2278
- {
2279
- inputs: [],
2280
- name: "tokenTransferProxy",
2281
- outputs: [
2282
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2283
- ],
2284
- stateMutability: "view",
2285
- type: "function"
2286
- },
2287
- { stateMutability: "payable", type: "receive" }
2288
- ], Jt = [
2289
- {
2290
- inputs: [
2291
- { internalType: "address", name: "_ttp", type: "address" },
2292
- { internalType: "address", name: "_wbnb", type: "address" },
2293
- { internalType: "address", name: "_swapRouter", type: "address" }
2294
- ],
2295
- stateMutability: "nonpayable",
2296
- type: "constructor"
2297
- },
2298
- {
2299
- anonymous: !1,
2300
- inputs: [
2301
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2302
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2303
- ],
2304
- name: "FeeSet",
2305
- type: "event"
2306
- },
2307
- {
2308
- anonymous: !1,
2309
- inputs: [
2310
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2311
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2312
- ],
2313
- name: "OwnerSet",
2314
- type: "event"
2315
- },
2316
- {
2317
- anonymous: !1,
2318
- inputs: [
2319
- { indexed: !1, internalType: "address", name: "from", type: "address" },
2320
- { indexed: !1, internalType: "address", name: "token", type: "address" },
2321
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
2322
- { indexed: !1, internalType: "uint256", name: "out", type: "uint256" },
2323
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2324
- { indexed: !1, internalType: "address", name: "vault", type: "address" },
2325
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
2326
- ],
2327
- name: "SwapIn",
2328
- type: "event"
2329
- },
2330
- {
2331
- anonymous: !1,
2332
- inputs: [
2333
- { indexed: !1, internalType: "address", name: "to", type: "address" },
2334
- { indexed: !1, internalType: "address", name: "token", type: "address" },
2335
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
2336
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" }
2337
- ],
2338
- name: "SwapOut",
2339
- type: "event"
2340
- },
2341
- {
2342
- inputs: [],
2343
- name: "fee",
2344
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2345
- stateMutability: "view",
2346
- type: "function"
2347
- },
2348
- {
2349
- inputs: [],
2350
- name: "feeRecipient",
2351
- outputs: [{ internalType: "address", name: "", type: "address" }],
2352
- stateMutability: "view",
2353
- type: "function"
2354
- },
2355
- {
2356
- inputs: [{ internalType: "address", name: "", type: "address" }],
2357
- name: "owners",
2358
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2359
- stateMutability: "view",
2360
- type: "function"
2361
- },
2362
- {
2363
- inputs: [
2364
- { internalType: "uint256", name: "_fee", type: "uint256" },
2365
- { internalType: "address", name: "_feeRecipient", type: "address" }
2366
- ],
2367
- name: "setFee",
2368
- outputs: [],
2369
- stateMutability: "nonpayable",
2370
- type: "function"
2371
- },
2372
- {
2373
- inputs: [
2374
- { internalType: "address", name: "owner", type: "address" },
2375
- { internalType: "bool", name: "active", type: "bool" }
2376
- ],
2377
- name: "setOwner",
2378
- outputs: [],
2379
- stateMutability: "nonpayable",
2380
- type: "function"
2381
- },
2382
- {
2383
- inputs: [
2384
- { internalType: "address", name: "router", type: "address" },
2385
- { internalType: "address", name: "vault", type: "address" },
2386
- { internalType: "string", name: "memo", type: "string" },
2387
- { internalType: "address", name: "token", type: "address" },
2388
- { internalType: "uint256", name: "amount", type: "uint256" },
2389
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2390
- { internalType: "uint256", name: "deadline", type: "uint256" }
2391
- ],
2392
- name: "swapIn",
2393
- outputs: [],
2394
- stateMutability: "nonpayable",
2395
- type: "function"
2396
- },
2397
- {
2398
- inputs: [
2399
- { internalType: "address", name: "token", type: "address" },
2400
- { internalType: "address", name: "to", type: "address" },
2401
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2402
- ],
2403
- name: "swapOut",
2404
- outputs: [],
2405
- stateMutability: "payable",
2406
- type: "function"
2407
- },
2408
- {
2409
- inputs: [],
2410
- name: "swapRouter",
2411
- outputs: [{ internalType: "contract IPancakeRouterV2", name: "", type: "address" }],
2412
- stateMutability: "view",
2413
- type: "function"
2414
- },
2415
- {
2416
- inputs: [],
2417
- name: "tokenTransferProxy",
2418
- outputs: [
2419
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2420
- ],
2421
- stateMutability: "view",
2422
- type: "function"
2423
- },
2424
- {
2425
- inputs: [],
2426
- name: "wbnb",
2427
- outputs: [{ internalType: "address", name: "", type: "address" }],
2428
- stateMutability: "view",
2429
- type: "function"
2430
- },
2431
- { stateMutability: "payable", type: "receive" }
2432
- ], Qt = [
2433
- {
2434
- inputs: [
2435
- { internalType: "address", name: "_ttp", type: "address" },
2436
- { internalType: "address", name: "_weth", type: "address" },
2437
- { internalType: "address", name: "_swapRouter", type: "address" }
2438
- ],
2439
- stateMutability: "nonpayable",
2440
- type: "constructor"
2441
- },
2442
- {
2443
- anonymous: !1,
2444
- inputs: [
2445
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2446
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2447
- ],
2448
- name: "FeeSet",
2449
- type: "event"
2450
- },
2451
- {
2452
- anonymous: !1,
2453
- inputs: [
2454
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2455
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2456
- ],
2457
- name: "OwnerSet",
2458
- type: "event"
2459
- },
2460
- {
2461
- inputs: [],
2462
- name: "fee",
2463
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2464
- stateMutability: "view",
2465
- type: "function"
2466
- },
2467
- {
2468
- inputs: [],
2469
- name: "feeRecipient",
2470
- outputs: [{ internalType: "address", name: "", type: "address" }],
2471
- stateMutability: "view",
2472
- type: "function"
2473
- },
2474
- {
2475
- inputs: [{ internalType: "address", name: "", type: "address" }],
2476
- name: "owners",
2477
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2478
- stateMutability: "view",
2479
- type: "function"
2480
- },
2481
- {
2482
- inputs: [
2483
- { internalType: "uint256", name: "_fee", type: "uint256" },
2484
- { internalType: "address", name: "_feeRecipient", type: "address" }
2485
- ],
2486
- name: "setFee",
2487
- outputs: [],
2488
- stateMutability: "nonpayable",
2489
- type: "function"
2490
- },
2491
- {
2492
- inputs: [
2493
- { internalType: "address", name: "owner", type: "address" },
2494
- { internalType: "bool", name: "active", type: "bool" }
2495
- ],
2496
- name: "setOwner",
2497
- outputs: [],
2498
- stateMutability: "nonpayable",
2499
- type: "function"
2500
- },
2501
- {
2502
- inputs: [
2503
- { internalType: "address", name: "tcRouter", type: "address" },
2504
- { internalType: "address", name: "tcVault", type: "address" },
2505
- { internalType: "string", name: "tcMemo", type: "string" },
2506
- { internalType: "address", name: "token", type: "address" },
2507
- { internalType: "uint256", name: "amount", type: "uint256" },
2508
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2509
- { internalType: "uint256", name: "deadline", type: "uint256" }
2510
- ],
2511
- name: "swapIn",
2512
- outputs: [],
2513
- stateMutability: "nonpayable",
2514
- type: "function"
2515
- },
2516
- {
2517
- inputs: [
2518
- { internalType: "address", name: "token", type: "address" },
2519
- { internalType: "address", name: "to", type: "address" },
2520
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2521
- ],
2522
- name: "swapOut",
2523
- outputs: [],
2524
- stateMutability: "payable",
2525
- type: "function"
2526
- },
2527
- {
2528
- inputs: [],
2529
- name: "swapRouter",
2530
- outputs: [{ internalType: "contract IUniswapRouterV2AVAX", name: "", type: "address" }],
2531
- stateMutability: "view",
2532
- type: "function"
2533
- },
2534
- {
2535
- inputs: [],
2536
- name: "tokenTransferProxy",
2537
- outputs: [
2538
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2539
- ],
2540
- stateMutability: "view",
2541
- type: "function"
2542
- },
2543
- {
2544
- inputs: [],
2545
- name: "weth",
2546
- outputs: [{ internalType: "address", name: "", type: "address" }],
2547
- stateMutability: "view",
2548
- type: "function"
2549
- },
2550
- { stateMutability: "payable", type: "receive" }
2551
- ], zt = [
2552
- {
2553
- inputs: [
2554
- { internalType: "address", name: "_ttp", type: "address" },
2555
- { internalType: "address", name: "_weth", type: "address" },
2556
- { internalType: "address", name: "_swapRouter", type: "address" }
2557
- ],
2558
- stateMutability: "nonpayable",
2559
- type: "constructor"
2560
- },
2561
- {
2562
- anonymous: !1,
2563
- inputs: [
2564
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2565
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2566
- ],
2567
- name: "FeeSet",
2568
- type: "event"
2569
- },
2570
- {
2571
- anonymous: !1,
2572
- inputs: [
2573
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2574
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2575
- ],
2576
- name: "OwnerSet",
2577
- type: "event"
2578
- },
2579
- {
2580
- inputs: [],
2581
- name: "fee",
2582
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2583
- stateMutability: "view",
2584
- type: "function"
2585
- },
2586
- {
2587
- inputs: [],
2588
- name: "feeRecipient",
2589
- outputs: [{ internalType: "address", name: "", type: "address" }],
2590
- stateMutability: "view",
2591
- type: "function"
2592
- },
2593
- {
2594
- inputs: [{ internalType: "address", name: "", type: "address" }],
2595
- name: "owners",
2596
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2597
- stateMutability: "view",
2598
- type: "function"
2599
- },
2600
- {
2601
- inputs: [
2602
- { internalType: "uint256", name: "_fee", type: "uint256" },
2603
- { internalType: "address", name: "_feeRecipient", type: "address" }
2604
- ],
2605
- name: "setFee",
2606
- outputs: [],
2607
- stateMutability: "nonpayable",
2608
- type: "function"
2609
- },
2610
- {
2611
- inputs: [
2612
- { internalType: "address", name: "owner", type: "address" },
2613
- { internalType: "bool", name: "active", type: "bool" }
2614
- ],
2615
- name: "setOwner",
2616
- outputs: [],
2617
- stateMutability: "nonpayable",
2618
- type: "function"
2619
- },
2620
- {
2621
- inputs: [
2622
- { internalType: "address", name: "tcRouter", type: "address" },
2623
- { internalType: "address", name: "tcVault", type: "address" },
2624
- { internalType: "string", name: "tcMemo", type: "string" },
2625
- { internalType: "address", name: "token", type: "address" },
2626
- { internalType: "uint256", name: "amount", type: "uint256" },
2627
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2628
- { internalType: "uint256", name: "deadline", type: "uint256" }
2629
- ],
2630
- name: "swapIn",
2631
- outputs: [],
2632
- stateMutability: "nonpayable",
2633
- type: "function"
2634
- },
2635
- {
2636
- inputs: [
2637
- { internalType: "address", name: "token", type: "address" },
2638
- { internalType: "address", name: "to", type: "address" },
2639
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2640
- ],
2641
- name: "swapOut",
2642
- outputs: [],
2643
- stateMutability: "payable",
2644
- type: "function"
2645
- },
2646
- {
2647
- inputs: [],
2648
- name: "swapRouter",
2649
- outputs: [{ internalType: "contract IUniswapRouterV2", name: "", type: "address" }],
2650
- stateMutability: "view",
2651
- type: "function"
2652
- },
2653
- {
2654
- inputs: [],
2655
- name: "tokenTransferProxy",
2656
- outputs: [
2657
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2658
- ],
2659
- stateMutability: "view",
2660
- type: "function"
2661
- },
2662
- {
2663
- inputs: [],
2664
- name: "weth",
2665
- outputs: [{ internalType: "address", name: "", type: "address" }],
2666
- stateMutability: "view",
2667
- type: "function"
2668
- },
2669
- { stateMutability: "payable", type: "receive" }
2670
- ], Zt = [
2671
- {
2672
- inputs: [
2673
- { internalType: "address", name: "_ttp", type: "address" },
2674
- { internalType: "address", name: "_weth", type: "address" },
2675
- { internalType: "address", name: "_swapRouter", type: "address" }
2676
- ],
2677
- stateMutability: "nonpayable",
2678
- type: "constructor"
2679
- },
2680
- {
2681
- anonymous: !1,
2682
- inputs: [
2683
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2684
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2685
- ],
2686
- name: "FeeSet",
2687
- type: "event"
2688
- },
2689
- {
2690
- anonymous: !1,
2691
- inputs: [
2692
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2693
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2694
- ],
2695
- name: "OwnerSet",
2696
- type: "event"
2697
- },
2698
- {
2699
- inputs: [],
2700
- name: "fee",
2701
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2702
- stateMutability: "view",
2703
- type: "function"
2704
- },
2705
- {
2706
- inputs: [],
2707
- name: "feeRecipient",
2708
- outputs: [{ internalType: "address", name: "", type: "address" }],
2709
- stateMutability: "view",
2710
- type: "function"
2711
- },
2712
- {
2713
- inputs: [{ internalType: "address", name: "", type: "address" }],
2714
- name: "owners",
2715
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2716
- stateMutability: "view",
2717
- type: "function"
2718
- },
2719
- {
2720
- inputs: [
2721
- { internalType: "uint256", name: "_fee", type: "uint256" },
2722
- { internalType: "address", name: "_feeRecipient", type: "address" }
2723
- ],
2724
- name: "setFee",
2725
- outputs: [],
2726
- stateMutability: "nonpayable",
2727
- type: "function"
2728
- },
2729
- {
2730
- inputs: [
2731
- { internalType: "address", name: "owner", type: "address" },
2732
- { internalType: "bool", name: "active", type: "bool" }
2733
- ],
2734
- name: "setOwner",
2735
- outputs: [],
2736
- stateMutability: "nonpayable",
2737
- type: "function"
2738
- },
2739
- {
2740
- inputs: [
2741
- { internalType: "address", name: "tcRouter", type: "address" },
2742
- { internalType: "address", name: "tcVault", type: "address" },
2743
- { internalType: "string", name: "tcMemo", type: "string" },
2744
- { internalType: "address", name: "token", type: "address" },
2745
- { internalType: "uint256", name: "amount", type: "uint256" },
2746
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2747
- { internalType: "uint256", name: "deadline", type: "uint256" }
2748
- ],
2749
- name: "swapIn",
2750
- outputs: [],
2751
- stateMutability: "nonpayable",
2752
- type: "function"
2753
- },
2754
- {
2755
- inputs: [
2756
- { internalType: "address", name: "token", type: "address" },
2757
- { internalType: "address", name: "to", type: "address" },
2758
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2759
- ],
2760
- name: "swapOut",
2761
- outputs: [],
2762
- stateMutability: "payable",
2763
- type: "function"
2764
- },
2765
- {
2766
- inputs: [],
2767
- name: "swapRouter",
2768
- outputs: [{ internalType: "contract IUniswapRouterV2AVAX", name: "", type: "address" }],
2769
- stateMutability: "view",
2770
- type: "function"
2771
- },
2772
- {
2773
- inputs: [],
2774
- name: "tokenTransferProxy",
2775
- outputs: [
2776
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2777
- ],
2778
- stateMutability: "view",
2779
- type: "function"
2780
- },
2781
- {
2782
- inputs: [],
2783
- name: "weth",
2784
- outputs: [{ internalType: "address", name: "", type: "address" }],
2785
- stateMutability: "view",
2786
- type: "function"
2787
- },
2788
- { stateMutability: "payable", type: "receive" }
2789
- ], en = [
2790
- {
2791
- inputs: [
2792
- { internalType: "address", name: "_ttp", type: "address" },
2793
- { internalType: "address", name: "_weth", type: "address" },
2794
- { internalType: "address", name: "_swapRouter", type: "address" }
2795
- ],
2796
- stateMutability: "nonpayable",
2797
- type: "constructor"
2798
- },
2799
- {
2800
- anonymous: !1,
2801
- inputs: [
2802
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2803
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2804
- ],
2805
- name: "FeeSet",
2806
- type: "event"
2807
- },
2808
- {
2809
- anonymous: !1,
2810
- inputs: [
2811
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2812
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2813
- ],
2814
- name: "OwnerSet",
2815
- type: "event"
2816
- },
2817
- {
2818
- inputs: [],
2819
- name: "fee",
2820
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2821
- stateMutability: "view",
2822
- type: "function"
2823
- },
2824
- {
2825
- inputs: [],
2826
- name: "feeRecipient",
2827
- outputs: [{ internalType: "address", name: "", type: "address" }],
2828
- stateMutability: "view",
2829
- type: "function"
2830
- },
2831
- {
2832
- inputs: [{ internalType: "address", name: "", type: "address" }],
2833
- name: "owners",
2834
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2835
- stateMutability: "view",
2836
- type: "function"
2837
- },
2838
- {
2839
- inputs: [
2840
- { internalType: "uint256", name: "_fee", type: "uint256" },
2841
- { internalType: "address", name: "_feeRecipient", type: "address" }
2842
- ],
2843
- name: "setFee",
2844
- outputs: [],
2845
- stateMutability: "nonpayable",
2846
- type: "function"
2847
- },
2848
- {
2849
- inputs: [
2850
- { internalType: "address", name: "owner", type: "address" },
2851
- { internalType: "bool", name: "active", type: "bool" }
2852
- ],
2853
- name: "setOwner",
2854
- outputs: [],
2855
- stateMutability: "nonpayable",
2856
- type: "function"
2857
- },
2858
- {
2859
- inputs: [
2860
- { internalType: "address", name: "tcRouter", type: "address" },
2861
- { internalType: "address", name: "tcVault", type: "address" },
2862
- { internalType: "string", name: "tcMemo", type: "string" },
2863
- { internalType: "address", name: "token", type: "address" },
2864
- { internalType: "uint256", name: "amount", type: "uint256" },
2865
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2866
- { internalType: "uint256", name: "deadline", type: "uint256" }
2867
- ],
2868
- name: "swapIn",
2869
- outputs: [],
2870
- stateMutability: "nonpayable",
2871
- type: "function"
2872
- },
2873
- {
2874
- inputs: [
2875
- { internalType: "address", name: "token", type: "address" },
2876
- { internalType: "address", name: "to", type: "address" },
2877
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2878
- ],
2879
- name: "swapOut",
2880
- outputs: [],
2881
- stateMutability: "payable",
2882
- type: "function"
2883
- },
2884
- {
2885
- inputs: [],
2886
- name: "swapRouter",
2887
- outputs: [{ internalType: "contract IUniswapRouterV2", name: "", type: "address" }],
2888
- stateMutability: "view",
2889
- type: "function"
2890
- },
2891
- {
2892
- inputs: [],
2893
- name: "tokenTransferProxy",
2894
- outputs: [
2895
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2896
- ],
2897
- stateMutability: "view",
2898
- type: "function"
2899
- },
2900
- {
2901
- inputs: [],
2902
- name: "weth",
2903
- outputs: [{ internalType: "address", name: "", type: "address" }],
2904
- stateMutability: "view",
2905
- type: "function"
2906
- },
2907
- { stateMutability: "payable", type: "receive" }
2908
- ], tn = [
2909
- {
2910
- inputs: [
2911
- { internalType: "address", name: "_ttp", type: "address" },
2912
- { internalType: "address", name: "_weth", type: "address" },
2913
- { internalType: "address", name: "_swapRouter", type: "address" },
2914
- { internalType: "address", name: "_legToken", type: "address" }
2915
- ],
2916
- stateMutability: "nonpayable",
2917
- type: "constructor"
2918
- },
2919
- {
2920
- anonymous: !1,
2921
- inputs: [
2922
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2923
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2924
- ],
2925
- name: "FeeSet",
2926
- type: "event"
2927
- },
2928
- {
2929
- anonymous: !1,
2930
- inputs: [
2931
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2932
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2933
- ],
2934
- name: "OwnerSet",
2935
- type: "event"
2936
- },
2937
- {
2938
- inputs: [],
2939
- name: "fee",
2940
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2941
- stateMutability: "view",
2942
- type: "function"
2943
- },
2944
- {
2945
- inputs: [],
2946
- name: "feeRecipient",
2947
- outputs: [{ internalType: "address", name: "", type: "address" }],
2948
- stateMutability: "view",
2949
- type: "function"
2950
- },
2951
- {
2952
- inputs: [],
2953
- name: "legToken",
2954
- outputs: [{ internalType: "address", name: "", type: "address" }],
2955
- stateMutability: "view",
2956
- type: "function"
2957
- },
2958
- {
2959
- inputs: [{ internalType: "address", name: "", type: "address" }],
2960
- name: "owners",
2961
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2962
- stateMutability: "view",
2963
- type: "function"
2964
- },
2965
- {
2966
- inputs: [
2967
- { internalType: "uint256", name: "_fee", type: "uint256" },
2968
- { internalType: "address", name: "_feeRecipient", type: "address" }
2969
- ],
2970
- name: "setFee",
2971
- outputs: [],
2972
- stateMutability: "nonpayable",
2973
- type: "function"
2974
- },
2975
- {
2976
- inputs: [
2977
- { internalType: "address", name: "owner", type: "address" },
2978
- { internalType: "bool", name: "active", type: "bool" }
2979
- ],
2980
- name: "setOwner",
2981
- outputs: [],
2982
- stateMutability: "nonpayable",
2983
- type: "function"
2984
- },
2985
- {
2986
- inputs: [
2987
- { internalType: "address", name: "tcRouter", type: "address" },
2988
- { internalType: "address", name: "tcVault", type: "address" },
2989
- { internalType: "string", name: "tcMemo", type: "string" },
2990
- { internalType: "address", name: "token", type: "address" },
2991
- { internalType: "uint256", name: "amount", type: "uint256" },
2992
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2993
- { internalType: "uint256", name: "deadline", type: "uint256" }
2994
- ],
2995
- name: "swapIn",
2996
- outputs: [],
2997
- stateMutability: "nonpayable",
2998
- type: "function"
2999
- },
3000
- {
3001
- inputs: [
3002
- { internalType: "address", name: "token", type: "address" },
3003
- { internalType: "address", name: "to", type: "address" },
3004
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3005
- ],
3006
- name: "swapOut",
3007
- outputs: [],
3008
- stateMutability: "payable",
3009
- type: "function"
3010
- },
3011
- {
3012
- inputs: [],
3013
- name: "swapRouter",
3014
- outputs: [{ internalType: "contract IUniswapRouterV2", name: "", type: "address" }],
3015
- stateMutability: "view",
3016
- type: "function"
3017
- },
3018
- {
3019
- inputs: [],
3020
- name: "tokenTransferProxy",
3021
- outputs: [
3022
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3023
- ],
3024
- stateMutability: "view",
3025
- type: "function"
3026
- },
3027
- {
3028
- inputs: [],
3029
- name: "weth",
3030
- outputs: [{ internalType: "address", name: "", type: "address" }],
3031
- stateMutability: "view",
3032
- type: "function"
3033
- },
3034
- { stateMutability: "payable", type: "receive" }
3035
- ], nn = [
3036
- {
3037
- inputs: [
3038
- { internalType: "address", name: "_ttp", type: "address" },
3039
- { internalType: "address", name: "_weth", type: "address" },
3040
- { internalType: "address", name: "_swapRouter", type: "address" },
3041
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
3042
- ],
3043
- stateMutability: "nonpayable",
3044
- type: "constructor"
3045
- },
3046
- {
3047
- anonymous: !1,
3048
- inputs: [
3049
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
3050
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
3051
- ],
3052
- name: "FeeSet",
3053
- type: "event"
3054
- },
3055
- {
3056
- anonymous: !1,
3057
- inputs: [
3058
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
3059
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
3060
- ],
3061
- name: "OwnerSet",
3062
- type: "event"
3063
- },
3064
- {
3065
- inputs: [],
3066
- name: "fee",
3067
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3068
- stateMutability: "view",
3069
- type: "function"
3070
- },
3071
- {
3072
- inputs: [],
3073
- name: "feeRecipient",
3074
- outputs: [{ internalType: "address", name: "", type: "address" }],
3075
- stateMutability: "view",
3076
- type: "function"
3077
- },
3078
- {
3079
- inputs: [{ internalType: "address", name: "", type: "address" }],
3080
- name: "owners",
3081
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
3082
- stateMutability: "view",
3083
- type: "function"
3084
- },
3085
- {
3086
- inputs: [],
3087
- name: "poolFee",
3088
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
3089
- stateMutability: "view",
3090
- type: "function"
3091
- },
3092
- {
3093
- inputs: [
3094
- { internalType: "uint256", name: "_fee", type: "uint256" },
3095
- { internalType: "address", name: "_feeRecipient", type: "address" }
3096
- ],
3097
- name: "setFee",
3098
- outputs: [],
3099
- stateMutability: "nonpayable",
3100
- type: "function"
3101
- },
3102
- {
3103
- inputs: [
3104
- { internalType: "address", name: "owner", type: "address" },
3105
- { internalType: "bool", name: "active", type: "bool" }
3106
- ],
3107
- name: "setOwner",
3108
- outputs: [],
3109
- stateMutability: "nonpayable",
3110
- type: "function"
3111
- },
3112
- {
3113
- inputs: [
3114
- { internalType: "address", name: "tcRouter", type: "address" },
3115
- { internalType: "address", name: "tcVault", type: "address" },
3116
- { internalType: "string", name: "tcMemo", type: "string" },
3117
- { internalType: "address", name: "token", type: "address" },
3118
- { internalType: "uint256", name: "amount", type: "uint256" },
3119
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
3120
- { internalType: "uint256", name: "deadline", type: "uint256" }
3121
- ],
3122
- name: "swapIn",
3123
- outputs: [],
3124
- stateMutability: "nonpayable",
3125
- type: "function"
3126
- },
3127
- {
3128
- inputs: [
3129
- { internalType: "address", name: "token", type: "address" },
3130
- { internalType: "address", name: "to", type: "address" },
3131
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3132
- ],
3133
- name: "swapOut",
3134
- outputs: [],
3135
- stateMutability: "payable",
3136
- type: "function"
3137
- },
3138
- {
3139
- inputs: [],
3140
- name: "swapRouter",
3141
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
3142
- stateMutability: "view",
3143
- type: "function"
3144
- },
3145
- {
3146
- inputs: [],
3147
- name: "tokenTransferProxy",
3148
- outputs: [
3149
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3150
- ],
3151
- stateMutability: "view",
3152
- type: "function"
3153
- },
3154
- {
3155
- inputs: [],
3156
- name: "weth",
3157
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
3158
- stateMutability: "view",
3159
- type: "function"
3160
- },
3161
- { stateMutability: "payable", type: "receive" }
3162
- ], an = [
3163
- {
3164
- inputs: [
3165
- { internalType: "address", name: "_ttp", type: "address" },
3166
- { internalType: "address", name: "_weth", type: "address" },
3167
- { internalType: "address", name: "_swapRouter", type: "address" },
3168
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
3169
- ],
3170
- stateMutability: "nonpayable",
3171
- type: "constructor"
3172
- },
3173
- {
3174
- anonymous: !1,
3175
- inputs: [
3176
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
3177
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
3178
- ],
3179
- name: "FeeSet",
3180
- type: "event"
3181
- },
3182
- {
3183
- anonymous: !1,
3184
- inputs: [
3185
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
3186
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
3187
- ],
3188
- name: "OwnerSet",
3189
- type: "event"
3190
- },
3191
- {
3192
- inputs: [],
3193
- name: "fee",
3194
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3195
- stateMutability: "view",
3196
- type: "function"
3197
- },
3198
- {
3199
- inputs: [],
3200
- name: "feeRecipient",
3201
- outputs: [{ internalType: "address", name: "", type: "address" }],
3202
- stateMutability: "view",
3203
- type: "function"
3204
- },
3205
- {
3206
- inputs: [{ internalType: "address", name: "", type: "address" }],
3207
- name: "owners",
3208
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
3209
- stateMutability: "view",
3210
- type: "function"
3211
- },
3212
- {
3213
- inputs: [],
3214
- name: "poolFee",
3215
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
3216
- stateMutability: "view",
3217
- type: "function"
3218
- },
3219
- {
3220
- inputs: [
3221
- { internalType: "uint256", name: "_fee", type: "uint256" },
3222
- { internalType: "address", name: "_feeRecipient", type: "address" }
3223
- ],
3224
- name: "setFee",
3225
- outputs: [],
3226
- stateMutability: "nonpayable",
3227
- type: "function"
3228
- },
3229
- {
3230
- inputs: [
3231
- { internalType: "address", name: "owner", type: "address" },
3232
- { internalType: "bool", name: "active", type: "bool" }
3233
- ],
3234
- name: "setOwner",
3235
- outputs: [],
3236
- stateMutability: "nonpayable",
3237
- type: "function"
3238
- },
3239
- {
3240
- inputs: [
3241
- { internalType: "address", name: "tcRouter", type: "address" },
3242
- { internalType: "address", name: "tcVault", type: "address" },
3243
- { internalType: "string", name: "tcMemo", type: "string" },
3244
- { internalType: "address", name: "token", type: "address" },
3245
- { internalType: "uint256", name: "amount", type: "uint256" },
3246
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
3247
- { internalType: "uint256", name: "deadline", type: "uint256" }
3248
- ],
3249
- name: "swapIn",
3250
- outputs: [],
3251
- stateMutability: "nonpayable",
3252
- type: "function"
3253
- },
3254
- {
3255
- inputs: [
3256
- { internalType: "address", name: "token", type: "address" },
3257
- { internalType: "address", name: "to", type: "address" },
3258
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3259
- ],
3260
- name: "swapOut",
3261
- outputs: [],
3262
- stateMutability: "payable",
3263
- type: "function"
3264
- },
3265
- {
3266
- inputs: [],
3267
- name: "swapRouter",
3268
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
3269
- stateMutability: "view",
3270
- type: "function"
3271
- },
3272
- {
3273
- inputs: [],
3274
- name: "tokenTransferProxy",
3275
- outputs: [
3276
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3277
- ],
3278
- stateMutability: "view",
3279
- type: "function"
3280
- },
3281
- {
3282
- inputs: [],
3283
- name: "weth",
3284
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
3285
- stateMutability: "view",
3286
- type: "function"
3287
- },
3288
- { stateMutability: "payable", type: "receive" }
3289
- ], sn = [
3290
- {
3291
- inputs: [
3292
- { internalType: "address", name: "_ttp", type: "address" },
3293
- { internalType: "address", name: "_weth", type: "address" },
3294
- { internalType: "address", name: "_swapRouter", type: "address" },
3295
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
3296
- ],
3297
- stateMutability: "nonpayable",
3298
- type: "constructor"
3299
- },
3300
- {
3301
- anonymous: !1,
3302
- inputs: [
3303
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
3304
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
3305
- ],
3306
- name: "FeeSet",
3307
- type: "event"
3308
- },
3309
- {
3310
- anonymous: !1,
3311
- inputs: [
3312
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
3313
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
3314
- ],
3315
- name: "OwnerSet",
3316
- type: "event"
3317
- },
3318
- {
3319
- inputs: [],
3320
- name: "fee",
3321
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3322
- stateMutability: "view",
3323
- type: "function"
3324
- },
3325
- {
3326
- inputs: [],
3327
- name: "feeRecipient",
3328
- outputs: [{ internalType: "address", name: "", type: "address" }],
3329
- stateMutability: "view",
3330
- type: "function"
3331
- },
3332
- {
3333
- inputs: [{ internalType: "address", name: "", type: "address" }],
3334
- name: "owners",
3335
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
3336
- stateMutability: "view",
3337
- type: "function"
3338
- },
3339
- {
3340
- inputs: [],
3341
- name: "poolFee",
3342
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
3343
- stateMutability: "view",
3344
- type: "function"
3345
- },
3346
- {
3347
- inputs: [
3348
- { internalType: "uint256", name: "_fee", type: "uint256" },
3349
- { internalType: "address", name: "_feeRecipient", type: "address" }
3350
- ],
3351
- name: "setFee",
3352
- outputs: [],
3353
- stateMutability: "nonpayable",
3354
- type: "function"
3355
- },
3356
- {
3357
- inputs: [
3358
- { internalType: "address", name: "owner", type: "address" },
3359
- { internalType: "bool", name: "active", type: "bool" }
3360
- ],
3361
- name: "setOwner",
3362
- outputs: [],
3363
- stateMutability: "nonpayable",
3364
- type: "function"
3365
- },
3366
- {
3367
- inputs: [
3368
- { internalType: "address", name: "tcRouter", type: "address" },
3369
- { internalType: "address", name: "tcVault", type: "address" },
3370
- { internalType: "string", name: "tcMemo", type: "string" },
3371
- { internalType: "address", name: "token", type: "address" },
3372
- { internalType: "uint256", name: "amount", type: "uint256" },
3373
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
3374
- { internalType: "uint256", name: "deadline", type: "uint256" }
3375
- ],
3376
- name: "swapIn",
3377
- outputs: [],
3378
- stateMutability: "nonpayable",
3379
- type: "function"
3380
- },
3381
- {
3382
- inputs: [
3383
- { internalType: "address", name: "token", type: "address" },
3384
- { internalType: "address", name: "to", type: "address" },
3385
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3386
- ],
3387
- name: "swapOut",
3388
- outputs: [],
3389
- stateMutability: "payable",
3390
- type: "function"
3391
- },
3392
- {
3393
- inputs: [],
3394
- name: "swapRouter",
3395
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
3396
- stateMutability: "view",
3397
- type: "function"
3398
- },
3399
- {
3400
- inputs: [],
3401
- name: "tokenTransferProxy",
3402
- outputs: [
3403
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3404
- ],
3405
- stateMutability: "view",
3406
- type: "function"
3407
- },
3408
- {
3409
- inputs: [],
3410
- name: "weth",
3411
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
3412
- stateMutability: "view",
3413
- type: "function"
3414
- },
3415
- { stateMutability: "payable", type: "receive" }
3416
- ], rn = [
3417
- {
3418
- inputs: [
3419
- { internalType: "address", name: "_ttp", type: "address" },
3420
- { internalType: "address", name: "_weth", type: "address" },
3421
- { internalType: "address", name: "_swapRouter", type: "address" },
3422
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
3423
- ],
3424
- stateMutability: "nonpayable",
3425
- type: "constructor"
3426
- },
3427
- {
3428
- anonymous: !1,
3429
- inputs: [
3430
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
3431
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
3432
- ],
3433
- name: "FeeSet",
3434
- type: "event"
3435
- },
3436
- {
3437
- anonymous: !1,
3438
- inputs: [
3439
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
3440
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
3441
- ],
3442
- name: "OwnerSet",
3443
- type: "event"
3444
- },
3445
- {
3446
- inputs: [],
3447
- name: "fee",
3448
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3449
- stateMutability: "view",
3450
- type: "function"
3451
- },
3452
- {
3453
- inputs: [],
3454
- name: "feeRecipient",
3455
- outputs: [{ internalType: "address", name: "", type: "address" }],
3456
- stateMutability: "view",
3457
- type: "function"
3458
- },
3459
- {
3460
- inputs: [{ internalType: "address", name: "", type: "address" }],
3461
- name: "owners",
3462
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
3463
- stateMutability: "view",
3464
- type: "function"
3465
- },
3466
- {
3467
- inputs: [],
3468
- name: "poolFee",
3469
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
3470
- stateMutability: "view",
3471
- type: "function"
3472
- },
3473
- {
3474
- inputs: [
3475
- { internalType: "uint256", name: "_fee", type: "uint256" },
3476
- { internalType: "address", name: "_feeRecipient", type: "address" }
3477
- ],
3478
- name: "setFee",
3479
- outputs: [],
3480
- stateMutability: "nonpayable",
3481
- type: "function"
3482
- },
3483
- {
3484
- inputs: [
3485
- { internalType: "address", name: "owner", type: "address" },
3486
- { internalType: "bool", name: "active", type: "bool" }
3487
- ],
3488
- name: "setOwner",
3489
- outputs: [],
3490
- stateMutability: "nonpayable",
3491
- type: "function"
3492
- },
3493
- {
3494
- inputs: [
3495
- { internalType: "address", name: "tcRouter", type: "address" },
3496
- { internalType: "address", name: "tcVault", type: "address" },
3497
- { internalType: "string", name: "tcMemo", type: "string" },
3498
- { internalType: "address", name: "token", type: "address" },
3499
- { internalType: "uint256", name: "amount", type: "uint256" },
3500
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
3501
- { internalType: "uint256", name: "deadline", type: "uint256" }
3502
- ],
3503
- name: "swapIn",
3504
- outputs: [],
3505
- stateMutability: "nonpayable",
3506
- type: "function"
3507
- },
3508
- {
3509
- inputs: [
3510
- { internalType: "address", name: "token", type: "address" },
3511
- { internalType: "address", name: "to", type: "address" },
3512
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3513
- ],
3514
- name: "swapOut",
3515
- outputs: [],
3516
- stateMutability: "payable",
3517
- type: "function"
3518
- },
3519
- {
3520
- inputs: [],
3521
- name: "swapRouter",
3522
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
3523
- stateMutability: "view",
3524
- type: "function"
3525
- },
3526
- {
3527
- inputs: [],
3528
- name: "tokenTransferProxy",
3529
- outputs: [
3530
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3531
- ],
3532
- stateMutability: "view",
3533
- type: "function"
3534
- },
3535
- {
3536
- inputs: [],
3537
- name: "weth",
3538
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
3539
- stateMutability: "view",
3540
- type: "function"
3541
- },
3542
- { stateMutability: "payable", type: "receive" }
3543
- ], Fe = {
3544
- ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: jt,
3545
- ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Yt,
3546
- ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Xt
3547
- }, on = {
3548
- ...Fe,
3549
- // AVAX
3550
- ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: Qt,
3551
- ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Kt,
3552
- ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Zt,
3553
- // BSC
3554
- ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: Jt,
3555
- // ETH
3556
- ["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: zt,
3557
- ["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: en,
3558
- ["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: tn,
3559
- ["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: nn,
3560
- ["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: an,
3561
- ["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: sn,
3562
- ["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: rn
3563
- }, pn = ({
3564
- streamSwap: e,
3565
- contractAddress: t,
3566
- recipient: n,
3567
- toChecksumAddress: a,
3568
- calldata: {
3569
- amount: s,
3570
- amountOutMin: r = "",
3571
- data: o = "",
3572
- deadline: p,
3573
- memo: u,
3574
- router: y,
3575
- memoStreamingSwap: d,
3576
- tcMemo: c,
3577
- tcRouter: _,
3578
- tcVault: A,
3579
- vault: R,
3580
- token: g
3581
- }
3582
- }) => {
3583
- const E = !!Fe[t.toLowerCase()];
3584
- if (E && !y)
3585
- throw new Error("Router is required on calldata for swapIn with GenericContract");
3586
- const I = c || u, S = e && d || I;
3587
- if (!A && !R)
3588
- throw new Error("TC Vault is required on calldata");
3589
- if (!_ && !y)
3590
- throw new Error("TC Router is required on calldata");
3591
- if (!S)
3592
- throw new Error("TC Memo is required on calldata");
3593
- if (!g)
3594
- throw new Error("Token is required on calldata");
3595
- const D = [
3596
- // v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
3597
- a(_ || y),
3598
- a(A || R),
3599
- S.replace("{recipientAddress}", n),
3600
- a(g),
3601
- s
3602
- ], Ge = E ? [a(y), o, p] : [r, p];
3603
- return [...D, ...Ge];
3604
- }, dn = ({ chain: e, txHash: t }) => {
3605
- const n = De[e];
3606
- switch (e) {
3607
- case i.Binance:
3608
- case i.Bitcoin:
3609
- case i.BitcoinCash:
3610
- case i.Maya:
3611
- case i.Kujira:
3612
- case i.THORChain:
3613
- return `${n}/tx/${t}`;
3614
- case i.Arbitrum:
3615
- case i.Avalanche:
3616
- case i.BinanceSmartChain:
3617
- case i.Ethereum:
3618
- case i.Optimism:
3619
- case i.Polygon:
3620
- return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
3621
- case i.Cosmos:
3622
- return `${n}/transactions/${t}`;
3623
- case i.Dogecoin:
3624
- return `${n}/transaction/${t.toLowerCase()}`;
3625
- case i.Litecoin:
3626
- return `${n}/${t}`;
3627
- default:
3628
- throw new Error(`Unsupported chain: ${e}`);
3629
- }
3630
- }, un = ({ chain: e, address: t }) => {
3631
- const n = De[e];
3632
- switch (e) {
3633
- case i.Arbitrum:
3634
- case i.Avalanche:
3635
- case i.Binance:
3636
- case i.BinanceSmartChain:
3637
- case i.Bitcoin:
3638
- case i.BitcoinCash:
3639
- case i.Dogecoin:
3640
- case i.Ethereum:
3641
- case i.Maya:
3642
- case i.Optimism:
3643
- case i.Polygon:
3644
- case i.Kujira:
3645
- case i.THORChain:
3646
- return `${n}/address/${t}`;
3647
- case i.Cosmos:
3648
- return `${n}/account/${t}`;
3649
- case i.Litecoin:
3650
- return `${n}/${t}`;
3651
- default:
3652
- throw new Error(`Unsupported chain: ${e}`);
3653
- }
3654
- }, ln = (e) => {
3655
- const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
3656
- return Ae.get(`${t}/thorchain/inbound_addresses`);
3657
- }, yn = (e) => {
3658
- const t = e ? q.ThornodeStagenet : q.ThornodeMainnet;
3659
- return Ae.get(`${t}/thorchain/mimir`);
3660
- }, Ce = () => Object.values(i).reduce(
3661
- (e, t) => (e[t] = null, e),
3662
- {}
3663
- );
3664
- var B, ne, K, N, Y, X;
3665
- class xn {
3666
- constructor({ stagenet: t } = {}) {
3667
- T(this, "connectedChains", Ce());
3668
- T(this, "connectedWallets", Ce());
3669
- T(this, "stagenet", !1);
3670
- T(this, "getAddress", (t) => {
3671
- var n;
3672
- return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
3673
- });
3674
- T(this, "getExplorerTxUrl", (t, n) => dn({ chain: t, txHash: n }));
3675
- T(this, "getWallet", (t) => this.connectedWallets[t]);
3676
- T(this, "getExplorerAddressUrl", (t, n) => un({ chain: t, address: n }));
3677
- T(this, "getBalance", async (t, n) => {
3678
- const a = await this.getWalletByChain(t, n);
3679
- return (a == null ? void 0 : a.balance) || [];
3680
- });
3681
- T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: s }) => {
3682
- var p, u;
3683
- const { quoteMode: r } = a.meta, o = r.startsWith("ERC20-") ? i.Ethereum : r.startsWith("ARC20-") ? i.Avalanche : i.BinanceSmartChain;
3684
- if (!a.complete)
3685
- throw new m("core_swap_route_not_complete");
3686
- try {
3687
- if (Ze.includes(r)) {
3688
- const y = this.connectedWallets[o];
3689
- if (!(y != null && y.sendTransaction))
3690
- throw new m("core_wallet_connection_not_found");
3691
- if (!(t ? (p = a == null ? void 0 : a.streamingSwap) == null ? void 0 : p.transaction : a == null ? void 0 : a.transaction))
3692
- throw new m("core_swap_route_transaction_not_found");
3693
- const { isHexString: c, parseUnits: _ } = await import("./index-cf1865cd.js"), { data: A, from: R, to: g, value: E } = a.transaction, I = {
3694
- data: A,
3695
- from: R,
3696
- to: g.toLowerCase(),
3697
- chainId: BigInt(ot[o]),
3698
- value: E ? new j({
3699
- value: c(E) ? E : _(E, "wei").toString(16)
3700
- }).baseValueBigInt : 0n
3701
- };
3702
- return y.sendTransaction(I, s);
3703
- }
3704
- if (tt.includes(r)) {
3705
- if (!a.calldata.fromAsset)
3706
- throw new m("core_swap_asset_not_recognized");
3707
- const y = await v.fromString(a.calldata.fromAsset);
3708
- if (!y)
3709
- throw new m("core_swap_asset_not_recognized");
3710
- const { address: d } = await f(this, B).call(this, y.chain), {
3711
- contract: c,
3712
- calldata: { expiration: _, amountIn: A, memo: R, memoStreamingSwap: g }
3713
- } = a, E = y.add(j.fromBigInt(BigInt(A), y.decimal)), I = t && g || R;
3714
- return this.deposit({
3715
- expiration: _,
3716
- assetValue: E,
3717
- memo: I,
3718
- feeOptionKey: s,
3719
- router: c,
3720
- recipient: d
3721
- });
3722
- }
3723
- if (et.includes(r)) {
3724
- const { calldata: y, contract: d } = a;
3725
- if (!d)
3726
- throw new m("core_swap_contract_not_found");
3727
- const c = this.connectedWallets[o], _ = this.getAddress(o);
3728
- if (!(c != null && c.sendTransaction) || !_)
3729
- throw new m("core_wallet_connection_not_found");
3730
- const { getProvider: A, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), g = A(o), E = on[d.toLowerCase()];
3731
- if (!E)
3732
- throw new m("core_swap_contract_not_supported", { contractAddress: d });
3733
- const S = await (await ((u = c.createContract) == null ? void 0 : u.call(c, d, E, g))).getFunction("swapIn").populateTransaction(
3734
- ...pn({
3735
- streamSwap: t,
3736
- toChecksumAddress: R,
3737
- contractAddress: d,
3738
- recipient: n,
3739
- calldata: y
3740
- }),
3741
- { from: _ }
3742
- );
3743
- return c.sendTransaction(S, s);
3744
- }
3745
- throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
3746
- } catch (y) {
3747
- throw new m("core_swap_transaction_error", y);
3748
- }
3749
- });
3750
- T(this, "getWalletByChain", async (t, n) => {
3751
- var r, o;
3752
- const a = this.getAddress(t);
3753
- if (!a)
3754
- return null;
3755
- const s = await ((r = this.getWallet(t)) == null ? void 0 : r.getBalance(a, n)) ?? [
3756
- v.fromChainOrSignature(t)
3757
- ];
3758
- return this.connectedChains[t] = {
3759
- address: a,
3760
- balance: s,
3761
- walletType: (o = this.connectedChains[t]) == null ? void 0 : o.walletType
3762
- }, { ...this.connectedChains[t] };
3763
- });
3764
- T(this, "approveAssetValue", (t, n) => f(this, K).call(this, { assetValue: t, type: "approve", contractAddress: n }));
3765
- T(this, "isAssetValueApproved", (t, n) => f(this, K).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
3766
- T(this, "validateAddress", ({ address: t, chain: n }) => {
3767
- var a, s;
3768
- return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
3769
- });
3770
- T(this, "transfer", async (t) => {
3771
- const n = this.connectedWallets[t.assetValue.chain];
3772
- if (!n)
3773
- throw new m("core_wallet_connection_not_found");
3774
- try {
3775
- return await n.transfer(f(this, X).call(this, t));
3776
- } catch (a) {
3777
- throw new m("core_swap_transaction_error", a);
3778
- }
3779
- });
3780
- T(this, "deposit", async ({
3781
- assetValue: t,
3782
- recipient: n,
3783
- router: a,
3784
- ...s
3785
- }) => {
3786
- const { chain: r, symbol: o, ticker: p } = t, u = this.connectedWallets[r];
3787
- if (!u)
3788
- throw new m("core_wallet_connection_not_found");
3789
- const y = f(this, X).call(this, { assetValue: t, recipient: n, router: a, ...s });
3790
- try {
3791
- switch (r) {
3792
- case i.THORChain: {
3793
- const d = u;
3794
- return await (n === "" ? d.deposit(y) : d.transfer(y));
3795
- }
3796
- case i.Ethereum:
3797
- case i.BinanceSmartChain:
3798
- case i.Avalanche: {
3799
- const { getChecksumAddressFromAsset: d } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ? Je : r === i.BinanceSmartChain ? Qe : Xe;
3800
- return await u.call({
3801
- abi: c,
3802
- contractAddress: a || (await f(this, B).call(this, r)).router,
3803
- funcName: "depositWithExpiry",
3804
- funcParams: [
3805
- n,
3806
- d({ chain: r, symbol: o, ticker: p }, r),
3807
- // TODO: (@Towan) Re-Check on that conversion 🙏
3808
- t.getBaseValue("bigint").toString(),
3809
- y.memo,
3810
- s.expiration
3811
- ],
3812
- txOverrides: {
3813
- from: y.from,
3814
- value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
3815
- }
3816
- });
3817
- }
3818
- default:
3819
- return await u.transfer(y);
3820
- }
3821
- } catch (d) {
3822
- const c = ((d == null ? void 0 : d.message) || (d == null ? void 0 : d.toString())).toLowerCase(), _ = c == null ? void 0 : c.includes("insufficient funds"), A = c == null ? void 0 : c.includes("gas"), R = c == null ? void 0 : c.includes("server"), g = _ ? "core_transaction_deposit_insufficient_funds_error" : A ? "core_transaction_deposit_gas_error" : R ? "core_transaction_deposit_server_error" : "core_transaction_deposit_error";
3823
- throw new m(g, d);
3824
- }
3825
- });
3826
- /**
3827
- * TC related Methods
3828
- */
3829
- T(this, "createLiquidity", async ({
3830
- runeAssetValue: t,
3831
- assetValue: n
3832
- }) => {
3833
- if (t.lte(0) || n.lte(0))
3834
- throw new m("core_transaction_create_liquidity_invalid_params");
3835
- let a = "", s = "";
3836
- try {
3837
- a = await f(this, N).call(this, {
3838
- assetValue: t,
3839
- memo: x(h.DEPOSIT, {
3840
- ...n,
3841
- address: this.getAddress(n.chain)
3842
- })
3843
- });
3844
- } catch (r) {
3845
- throw new m("core_transaction_create_liquidity_rune_error", r);
3846
- }
3847
- try {
3848
- s = await f(this, N).call(this, {
3849
- assetValue: n,
3850
- memo: x(h.DEPOSIT, {
3851
- ...n,
3852
- address: this.getAddress(i.THORChain)
3853
- })
3854
- });
3855
- } catch (r) {
3856
- throw new m("core_transaction_create_liquidity_asset_error", r);
3857
- }
3858
- return { runeTx: a, assetTx: s };
3859
- });
3860
- T(this, "addLiquidity", async ({
3861
- poolIdentifier: t,
3862
- runeAssetValue: n,
3863
- assetValue: a,
3864
- runeAddr: s,
3865
- assetAddr: r,
3866
- isPendingSymmAsset: o,
3867
- mode: p = "sym"
3868
- }) => {
3869
- const [u, ...y] = t.split("."), d = p === "sym", c = (n == null ? void 0 : n.gt(0)) && (d || p === "rune"), _ = (a == null ? void 0 : a.gt(0)) && (d || p === "asset"), A = o || c, R = A ? s || this.getAddress(i.THORChain) : "", g = d || p === "asset" ? r || this.getAddress(u) : "";
3870
- if (!c && !_)
3871
- throw new m("core_transaction_add_liquidity_invalid_params");
3872
- if (A && !R)
3873
- throw new m("core_transaction_add_liquidity_no_rune_address");
3874
- let E, I;
3875
- const S = { chain: u, symbol: y.join(".") };
3876
- if (c && n)
3877
- try {
3878
- E = await f(this, N).call(this, {
3879
- assetValue: n,
3880
- memo: x(h.DEPOSIT, { ...S, address: g })
3881
- });
3882
- } catch (D) {
3883
- throw new m("core_transaction_add_liquidity_rune_error", D);
3884
- }
3885
- if (_ && a)
3886
- try {
3887
- I = await f(this, N).call(this, {
3888
- assetValue: a,
3889
- memo: x(h.DEPOSIT, { ...S, address: R })
3890
- });
3891
- } catch (D) {
3892
- throw new m("core_transaction_add_liquidity_asset_error", D);
3893
- }
3894
- return { runeTx: E, assetTx: I };
3895
- });
3896
- T(this, "withdraw", async ({
3897
- memo: t,
3898
- assetValue: n,
3899
- percent: a,
3900
- from: s,
3901
- to: r
3902
- }) => {
3903
- const o = r === "rune" ? v.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n;
3904
- try {
3905
- return await f(this, N).call(this, {
3906
- assetValue: ve(s === "asset" ? n.chain : i.THORChain),
3907
- memo: t || x(h.WITHDRAW, {
3908
- symbol: n.symbol,
3909
- chain: n.chain,
3910
- ticker: n.ticker,
3911
- basisPoints: Math.max(1e4, Math.round(a * 100)),
3912
- targetAssetString: o == null ? void 0 : o.toString(),
3913
- singleSide: !1
3914
- })
3915
- });
3916
- } catch (p) {
3917
- throw new m("core_transaction_withdraw_error", p);
3918
- }
3919
- });
3920
- T(this, "savings", async ({
3921
- assetValue: t,
3922
- memo: n,
3923
- percent: a,
3924
- type: s
3925
- }) => {
3926
- const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n || x(r, {
3927
- ticker: t.ticker,
3928
- symbol: t.symbol,
3929
- chain: t.chain,
3930
- singleSide: !0,
3931
- basisPoints: a ? Math.max(1e4, Math.round(a * 100)) : void 0
3932
- });
3933
- return f(this, N).call(this, { assetValue: t, memo: o });
3934
- });
3935
- T(this, "loan", ({
3936
- assetValue: t,
3937
- memo: n,
3938
- minAmount: a,
3939
- type: s
3940
- }) => f(this, N).call(this, {
3941
- assetValue: t,
3942
- memo: n || x(s === "open" ? h.OPEN_LOAN : h.CLOSE_LOAN, {
3943
- asset: t.toString(),
3944
- minAmount: a.toString(),
3945
- address: this.getAddress(t.chain)
3946
- })
3947
- }));
3948
- T(this, "nodeAction", ({
3949
- type: t,
3950
- assetValue: n,
3951
- address: a
3952
- }) => {
3953
- const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r = x(s, {
3954
- address: a,
3955
- unbondAmount: t === "unbond" ? n.baseValueNumber : void 0
3956
- });
3957
- return f(this, Y).call(this, {
3958
- memo: r,
3959
- assetValue: t === "bond" ? n : ve(i.THORChain)
3960
- });
3961
- });
3962
- T(this, "registerThorname", ({
3963
- assetValue: t,
3964
- ...n
3965
- }) => f(this, Y).call(this, { assetValue: t, memo: x(h.THORNAME_REGISTER, n) }));
3966
- T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
3967
- try {
3968
- t.forEach((r) => {
3969
- this[r.connectMethodName] = r.connect({
3970
- addChain: f(this, ne),
3971
- config: n || {},
3972
- apis: a,
3973
- rpcUrls: s
3974
- });
3975
- });
3976
- } catch (r) {
3977
- throw new m("core_extend_error", r);
3978
- }
3979
- });
3980
- T(this, "estimateMaxSendableAmount", async ({
3981
- chain: t,
3982
- params: n
3983
- }) => {
3984
- const a = this.getWallet(t);
3985
- switch (t) {
3986
- case i.Arbitrum:
3987
- case i.Avalanche:
3988
- case i.BinanceSmartChain:
3989
- case i.Ethereum:
3990
- case i.Optimism:
3991
- case i.Polygon: {
3992
- const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-evm");
3993
- return s({
3994
- ...n,
3995
- toolbox: a
3996
- });
3997
- }
3998
- case i.Bitcoin:
3999
- case i.BitcoinCash:
4000
- case i.Dogecoin:
4001
- case i.Litecoin:
4002
- return a.estimateMaxSendableAmount(n);
4003
- case i.Binance:
4004
- case i.THORChain:
4005
- case i.Cosmos: {
4006
- const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-cosmos");
4007
- return s({
4008
- ...n,
4009
- toolbox: a
4010
- });
4011
- }
4012
- default:
4013
- throw new m("core_estimated_max_spendable_chain_not_supported");
4014
- }
4015
- });
4016
- /**
4017
- * Wallet connection methods
4018
- */
4019
- T(this, "connectXDEFI", async (t) => {
4020
- throw new m("core_wallet_xdefi_not_installed");
4021
- });
4022
- T(this, "connectEVMWallet", async (t, n) => {
4023
- throw new m("core_wallet_evmwallet_not_installed");
4024
- });
4025
- T(this, "connectWalletconnect", async (t, n) => {
4026
- throw new m("core_wallet_walletconnect_not_installed");
4027
- });
4028
- T(this, "connectKeystore", async (t, n) => {
4029
- throw new m("core_wallet_keystore_not_installed");
4030
- });
4031
- T(this, "connectLedger", async (t, n) => {
4032
- throw new m("core_wallet_ledger_not_installed");
4033
- });
4034
- T(this, "connectTrezor", async (t, n) => {
4035
- throw new m("core_wallet_trezor_not_installed");
4036
- });
4037
- T(this, "connectKeplr", async (t) => {
4038
- throw new m("core_wallet_keplr_not_installed");
4039
- });
4040
- T(this, "connectOkx", async (t) => {
4041
- throw new m("core_wallet_okx_not_installed");
4042
- });
4043
- T(this, "disconnectChain", (t) => {
4044
- this.connectedChains[t] = null, this.connectedWallets[t] = null;
4045
- });
4046
- P(this, B, async (t) => {
4047
- if (t === i.THORChain)
4048
- return {
4049
- gas_rate: "0",
4050
- router: "0",
4051
- address: "",
4052
- halted: !1,
4053
- chain: i.THORChain
4054
- };
4055
- const a = (await ln(this.stagenet)).find((s) => s.chain === t);
4056
- if (!a)
4057
- throw new m("core_inbound_data_not_found");
4058
- if (a != null && a.halted)
4059
- throw new m("core_chain_halted");
4060
- return a;
4061
- });
4062
- P(this, ne, ({ chain: t, wallet: n, walletMethods: a }) => {
4063
- this.connectedChains[t] = n, this.connectedWallets[t] = a;
4064
- });
4065
- P(this, K, async ({
4066
- assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: s, isSynthetic: r },
4067
- type: o = "checkOnly",
4068
- contractAddress: p
4069
- }) => {
4070
- const u = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(a);
4071
- if (u && s || !u || r)
4072
- return !0;
4073
- const d = this.connectedWallets[a], c = o === "checkOnly" ? d == null ? void 0 : d.isApproved : d == null ? void 0 : d.approve;
4074
- if (!c)
4075
- throw new m("core_wallet_connection_not_found");
4076
- const _ = this.getAddress(a);
4077
- if (!n || !_)
4078
- throw new m("core_approve_asset_address_or_from_not_found");
4079
- const A = p || (await f(this, B).call(this, a)).router;
4080
- return c({
4081
- amount: t,
4082
- assetAddress: n,
4083
- from: _,
4084
- spenderAddress: A
4085
- });
4086
- });
4087
- P(this, N, async ({
4088
- assetValue: t,
4089
- memo: n,
4090
- feeOptionKey: a = k.Fast
4091
- }) => {
4092
- const {
4093
- gas_rate: s,
4094
- router: r,
4095
- address: o
4096
- } = await f(this, B).call(this, t.chain), p = (parseInt(s) || 0) * ft[a];
4097
- return this.deposit({
4098
- assetValue: t,
4099
- recipient: o,
4100
- memo: n,
4101
- router: r,
4102
- feeRate: p
4103
- });
4104
- });
4105
- P(this, Y, async ({ memo: t, assetValue: n }) => {
4106
- const a = await yn(this.stagenet);
4107
- if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
4108
- throw new m("core_chain_halted");
4109
- return this.deposit({ assetValue: n, recipient: "", memo: t });
4110
- });
4111
- P(this, X, ({ assetValue: t, ...n }) => ({
4112
- ...n,
4113
- memo: n.memo || "",
4114
- from: this.getAddress(t.chain),
4115
- assetValue: t
4116
- }));
4117
- this.stagenet = !!t;
4118
- }
4119
- }
4120
- B = new WeakMap(), ne = new WeakMap(), K = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), X = new WeakMap();
4121
- export {
4122
- Ze as AGG_SWAP,
4123
- Tn as ApiError,
4124
- q as ApiUrl,
4125
- v as AssetValue,
4126
- b as BaseDecimal,
4127
- me as BigIntArithmetics,
4128
- i as Chain,
4129
- fe as ChainId,
4130
- An as ChainIdToChain,
4131
- ot as ChainToChainId,
4132
- De as ChainToExplorerUrl,
4133
- wn as ChainToHexChainId,
4134
- pt as ChainToRPC,
4135
- st as ContractAddress,
4136
- bn as CosmosChainList,
4137
- it as DerivationPath,
4138
- l as ERROR_CODE,
4139
- nt as ERROR_MODULE,
4140
- Me as ERROR_TYPE,
4141
- _n as EVMChainList,
4142
- dt as ErrorCode,
4143
- k as FeeOption,
4144
- h as MemoType,
4145
- hn as NetworkDerivationPath,
4146
- ze as QuoteMode,
4147
- xe as RPCUrl,
4148
- Ae as RequestClient,
4149
- et as SWAP_IN,
4150
- tt as SWAP_OUT,
4151
- xn as SwapKitCore,
4152
- m as SwapKitError,
4153
- j as SwapKitNumber,
4154
- Je as TCAvalancheDepositABI,
4155
- Qe as TCBscDepositABI,
4156
- Xe as TCEthereumVaultAbi,
4157
- fn as UTXOChainList,
4158
- ut as WalletOption,
4159
- En as assetFromString,
4160
- Nn as derivationPathToString,
4161
- mn as erc20ABI,
4162
- Rn as filterAssets,
4163
- se as formatBigIntToSafeValue,
4164
- ft as gasFeeMultiplier,
4165
- At as getAssetType,
4166
- gt as getAsymmetricAssetShare,
4167
- On as getAsymmetricAssetWithdrawAmount,
4168
- Rt as getAsymmetricRuneShare,
4169
- gn as getAsymmetricRuneWithdrawAmount,
4170
- wt as getCommonAssetInfo,
4171
- Be as getDecimal,
4172
- Sn as getEstimatedPoolShare,
4173
- vn as getLiquiditySlippage,
4174
- x as getMemoFor,
4175
- ve as getMinAmountByChain,
4176
- Ot as getSymmetricPoolShare,
4177
- In as getSymmetricWithdraw,
4178
- Cn as getTHORNameCost,
4179
- bt as isGasAsset,
4180
- Mn as validateTHORName
4181
- };