@swapkit/core 1.0.0-rc.15 → 1.0.0-rc.150

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/index.js +183 -0
  2. package/dist/index.js.map +13 -0
  3. package/package.json +33 -47
  4. package/src/__tests__/helpers.test.ts +53 -0
  5. package/src/aggregator/contracts/avaxGeneric.ts +50 -50
  6. package/src/aggregator/contracts/avaxWoofi.ts +80 -80
  7. package/src/aggregator/contracts/bscGeneric.ts +59 -59
  8. package/src/aggregator/contracts/ethGeneric.ts +50 -50
  9. package/src/aggregator/contracts/index.ts +30 -28
  10. package/src/aggregator/contracts/pancakeV2.ts +80 -80
  11. package/src/aggregator/contracts/pangolin.ts +65 -65
  12. package/src/aggregator/contracts/routers/index.ts +58 -0
  13. package/src/aggregator/contracts/routers/kyber.ts +402 -0
  14. package/src/aggregator/contracts/routers/oneinch.ts +2188 -0
  15. package/src/aggregator/contracts/routers/pancakeswap.ts +340 -0
  16. package/src/aggregator/contracts/routers/pangolin.ts +340 -0
  17. package/src/aggregator/contracts/routers/sushiswap.ts +340 -0
  18. package/src/aggregator/contracts/routers/traderJoe.ts +340 -0
  19. package/src/aggregator/contracts/routers/uniswapv2.ts +340 -0
  20. package/src/aggregator/contracts/routers/uniswapv3.ts +254 -0
  21. package/src/aggregator/contracts/routers/woofi.ts +171 -0
  22. package/src/aggregator/contracts/sushiswap.ts +65 -65
  23. package/src/aggregator/contracts/traderJoe.ts +65 -65
  24. package/src/aggregator/contracts/uniswapV2.ts +65 -65
  25. package/src/aggregator/contracts/uniswapV2Leg.ts +70 -70
  26. package/src/aggregator/contracts/uniswapV3_100.ts +70 -70
  27. package/src/aggregator/contracts/uniswapV3_10000.ts +70 -70
  28. package/src/aggregator/contracts/uniswapV3_3000.ts +70 -70
  29. package/src/aggregator/contracts/uniswapV3_500.ts +70 -70
  30. package/src/aggregator/getSwapParams.ts +12 -12
  31. package/src/client.ts +233 -0
  32. package/src/helpers/explorerUrls.ts +38 -0
  33. package/src/index.ts +4 -4
  34. package/src/types.ts +29 -0
  35. package/LICENSE +0 -201
  36. package/dist/index-9e36735e.cjs +0 -1
  37. package/dist/index-cf1865cd.js +0 -649
  38. package/dist/index.cjs +0 -2
  39. package/dist/index.d.ts +0 -216
  40. package/dist/index.es.js +0 -4167
  41. package/src/client/__tests__/helpers.test.ts +0 -69
  42. package/src/client/explorerUrls.ts +0 -62
  43. package/src/client/index.ts +0 -699
  44. package/src/client/thornode.ts +0 -31
  45. package/src/client/types.ts +0 -103
package/dist/index.es.js DELETED
@@ -1,4167 +0,0 @@
1
- var Ge = Object.defineProperty;
2
- var We = (e, t, n) => t in e ? Ge(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), qe = (e, t, n) => {
4
- if (!t.has(e))
5
- throw TypeError("Cannot " + n);
6
- };
7
- var f = (e, t, n) => (qe(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 je = Object.defineProperty, Ye = (e, t, n) => t in e ? je(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 cn = [
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
- ], Ke = [
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
- ], Xe = [
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
- ], Je = [
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 Qe = /* @__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))(Qe || {});
604
- const ze = [
605
- "ERC20-ERC20",
606
- "ARC20-ARC20",
607
- "BEP20-BEP20"
608
- /* BSC_TO_BSC */
609
- ], Ze = [
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
- ], et = [
621
- "TC-TC",
622
- "TC-ERC20",
623
- "TC-ARC20",
624
- "TC-BEP20"
625
- /* TC_SUPPORTED_TO_BSC */
626
- ];
627
- var ve = /* @__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))(ve || {}), tt = /* @__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))(tt || {}), 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 nt = {
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
- }, ae = (e, t) => {
680
- let n = nt[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 mn = class Ce 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 || ae(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 = ae(s, d || []), this.code = s, this.type = o || ve.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 Ce(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 ae(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 || {}), at = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(at || {}), st = /* @__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))(st || {});
728
- const Tn = {
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 hn = [
747
- "ETH",
748
- "AVAX",
749
- "BSC",
750
- "ARB",
751
- "OP",
752
- "MATIC"
753
- /* Polygon */
754
- ], _n = [
755
- "BTC",
756
- "BCH",
757
- "DOGE",
758
- "LTC"
759
- /* Litecoin */
760
- ], fn = [
761
- "GAIA",
762
- "THOR",
763
- "BNB"
764
- /* Binance */
765
- ];
766
- var he = /* @__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))(he || {}), Me = /* @__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))(Me || {}), W = /* @__PURE__ */ ((e) => (e.Cosmos = "https://node-router.thorswap.net/cosmos/rest", e.Kujira = "https://lcd-kujira.synergynodes.com/", e.MayanodeMainnet = "https://mayanode.mayachain.info", e.MayanodeStagenet = "https://stagenet.mayanode.mayachain.info", e.ThornodeMainnet = "https://thornode.thorswap.net", e.ThornodeStagenet = "https://stagenet-thornode.ninerealms.com", e.ThorswapApi = "https://api.thorswap.finance", e.ThorswapStatic = "https://static.thorswap.net", e))(W || {});
767
- const ne = Object.values(i), it = Object.keys(i), _e = ne.reduce(
768
- (e, t) => {
769
- const n = it.find((a) => i[a] === t);
770
- return n && (e[t] = n), e;
771
- },
772
- {}
773
- ), rt = ne.reduce(
774
- (e, t) => (e[t] = he[_e[t]], e),
775
- {}
776
- ), ot = ne.reduce(
777
- (e, t) => (e[t] = Me[_e[t]], e),
778
- {}
779
- ), bn = ne.reduce(
780
- (e, t) => {
781
- const n = `${_e[t]}Hex`;
782
- return e[t] = he[n], e;
783
- },
784
- {}
785
- ), wn = {
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
- }, Ne = {
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 pt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e))(pt || {}), 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 || {}), dt = /* @__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))(dt || {}), ut = Object.defineProperty, lt = (e, t, n) => t in e ? ut(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, M = (e, t, n) => (lt(e, typeof t != "symbol" ? t + "" : t, n), n), yt = (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) => (yt(e, t, "access private method"), n);
835
- const ct = "0x313ce567", xe = async ({ chain: e, to: t }) => {
836
- try {
837
- const { result: n } = await be.post(ot[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: ct }, "latest"]
844
- })
845
- });
846
- return parseInt(BigInt(n).toString());
847
- } catch (n) {
848
- return console.error(n), b[e];
849
- }
850
- }, mt = async (e) => {
851
- if (e === i.Ethereum)
852
- return b.ETH;
853
- const [, t] = e.split("-");
854
- return t != null && t.startsWith("0x") ? xe({ chain: i.Ethereum, to: t }) : b.ETH;
855
- }, Tt = async (e) => {
856
- const [, t] = e.split("-");
857
- return t != null && t.startsWith("0x") ? xe({ chain: i.Avalanche, to: t.toLowerCase() }) : b.AVAX;
858
- }, ht = async (e) => (e === i.BinanceSmartChain, b.BSC), De = async ({ chain: e, symbol: t }) => {
859
- switch (e) {
860
- case i.Ethereum:
861
- return mt(t);
862
- case i.Avalanche:
863
- return Tt(t);
864
- case i.BinanceSmartChain:
865
- return ht(t);
866
- default:
867
- return b[e];
868
- }
869
- }, _t = {
870
- [k.Average]: 1.2,
871
- [k.Fast]: 1.5,
872
- [k.Fastest]: 2
873
- }, ft = ({ 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
- }, bt = (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
- }, wt = ({ 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
- }, An = (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
- }, At = new RegExp(
963
- /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
964
- "gmi"
965
- ), En = (e) => e.filter(
966
- (t) => !At.test(t.toString()) && !t.toString().includes("undefined")
967
- ), Et = ({
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
- }, Rt = ({
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
- }, Rn = ({
982
- percent: e,
983
- runeDepth: t,
984
- liquidityUnits: n,
985
- poolUnits: a
986
- }) => Et({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), gn = ({
987
- percent: e,
988
- assetDepth: t,
989
- liquidityUnits: n,
990
- poolUnits: a
991
- }) => Rt({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e), w = (e) => new Te({ value: e, decimal: b.THOR }), gt = ({
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
- }), On = ({
1000
- liquidityUnits: e,
1001
- poolUnits: t,
1002
- runeDepth: n,
1003
- assetDepth: a,
1004
- percent: s
1005
- }) => Object.fromEntries(
1006
- Object.entries(gt({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
1007
- ([r, o]) => [r, o.mul(s)]
1008
- )
1009
- ), In = ({
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
- }, Sn = ({
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
- }, Ot = ({
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 = Ot({ 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
- }, vn = (e) => {
1066
- if (e < 0)
1067
- throw new Error("Invalid number of year");
1068
- return 10 + e;
1069
- }, Cn = (e) => {
1070
- if (e.length > 30)
1071
- return !1;
1072
- const t = /^[a-zA-Z0-9+_-]+$/g;
1073
- return !!e.match(t);
1074
- }, Mn = ([e, t, n, a, s]) => `${e}'/${t}'/${n}'/${a}${typeof s != "number" ? "" : `/${s}`}`;
1075
- class we 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 Pe 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 J = (e) => e !== null && typeof e == "object", X = (...e) => {
1107
- for (const t of e)
1108
- if ((!J(t) || Array.isArray(t)) && t !== void 0)
1109
- throw new TypeError("The `options` argument must be an object");
1110
- return fe({}, ...e);
1111
- }, Be = (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
- }, fe = (...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 (J(a)) {
1122
- for (let [s, r] of Object.entries(a))
1123
- J(r) && s in t && (r = fe(t[s], r)), t = { ...t, [s]: r };
1124
- J(a.headers) && (n = Be(n, a.headers), t.headers = n);
1125
- }
1126
- return t;
1127
- }, It = (() => {
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
- })(), St = typeof globalThis.AbortController == "function", vt = typeof globalThis.ReadableStream == "function", Ct = typeof globalThis.FormData == "function", Ve = ["get", "post", "put", "patch", "head", "delete"], Mt = {
1139
- json: "application/json",
1140
- text: "text/*",
1141
- formData: "multipart/form-data",
1142
- arrayBuffer: "*/*",
1143
- blob: "*/*"
1144
- }, se = 2147483647, Le = Symbol("stop"), Nt = {
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
- }, xt = {
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
- }, Dt = (e) => Ve.includes(e) ? e.toUpperCase() : e, Pt = ["get", "put", "head", "delete", "options", "trace"], Bt = [408, 413, 429, 500, 502, 503, 504], Ue = [413, 429, 503], Ae = {
1172
- limit: 2,
1173
- methods: Pt,
1174
- statusCodes: Bt,
1175
- afterStatusCodes: Ue,
1176
- maxRetryAfter: Number.POSITIVE_INFINITY,
1177
- backoffLimit: Number.POSITIVE_INFINITY,
1178
- delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
1179
- }, Vt = (e = {}) => {
1180
- if (typeof e == "number")
1181
- return {
1182
- ...Ae,
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
- ...Ae,
1191
- ...e,
1192
- afterStatusCodes: Ue
1193
- };
1194
- };
1195
- async function Lt(e, t, n, a) {
1196
- return new Promise((s, r) => {
1197
- const o = setTimeout(() => {
1198
- n && n.abort(), r(new Pe(e));
1199
- }, a.timeout);
1200
- a.fetch(e, t).then(s).catch(r).then(() => {
1201
- clearTimeout(o);
1202
- });
1203
- });
1204
- }
1205
- async function Ut(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 Ht = (e, t) => {
1217
- const n = {};
1218
- for (const a in t)
1219
- !(a in xt) && !(a in Nt) && !(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 > se)
1226
- throw new RangeError(`The \`timeout\` option cannot be greater than ${se}`);
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 we(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 (!vt)
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(Mt))
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: Be(this._input.headers, n.headers),
1294
- hooks: fe({
1295
- beforeRequest: [],
1296
- beforeRetry: [],
1297
- beforeError: [],
1298
- afterResponse: []
1299
- }, n.hooks),
1300
- method: Dt(n.method ?? this._input.method),
1301
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1302
- prefixUrl: String(n.prefixUrl || ""),
1303
- retry: Vt(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 (St) {
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 (It && (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
- (Ct && 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 Pe)) {
1331
- if (t instanceof we) {
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), se);
1355
- if (a !== 0 && this._retryCount > 0) {
1356
- await Ut(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
- }) === Le)
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 = Ht(this.request, this._options);
1381
- return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Lt(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 re = (e) => {
1419
- const t = (n, a) => z.create(n, X(e, a));
1420
- for (const n of Ve)
1421
- t[n] = (a, s) => z.create(a, X(e, s, { method: n }));
1422
- return t.create = (n) => re(X(n)), t.extend = (n) => re(X(e, n)), t.stop = Le, t;
1423
- }, $t = re(), kt = $t, Ee = kt.create({
1424
- headers: {
1425
- referrer: "https://sk.thorswap.net",
1426
- referer: "https://sk.thorswap.net",
1427
- "Content-Type": "application/json"
1428
- }
1429
- }), be = {
1430
- get: (e, t) => Ee.get(e, t).json(),
1431
- post: (e, t) => Ee.post(e, t).json()
1432
- }, Re = Object.values(i), Ft = (e = "") => {
1433
- const t = e.toUpperCase(), [n] = t.split(".");
1434
- if (Re.includes(n))
1435
- return !0;
1436
- const [a] = t.split("/");
1437
- if (Re.includes(a))
1438
- return !0;
1439
- throw new Error(
1440
- `Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
1441
- );
1442
- }, q = 8, U = (e) => 10n ** BigInt(e), F = (e) => Math.log10(parseFloat(e.toString()));
1443
- function He({
1444
- value: e,
1445
- bigIntDecimal: t = q,
1446
- decimal: n = q
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, $, oe, $e, pe, ge, Z, de, H, G, ee, ue;
1460
- const Gt = class Q {
1461
- constructor(t) {
1462
- V(this, L), V(this, oe), V(this, pe), V(this, Z), V(this, H), V(this, ee), M(this, "decimalMultiplier", 10n ** 8n), M(this, "bigIntValue", 0n), M(this, "decimal");
1463
- const n = ye(t);
1464
- this.decimal = typeof t == "object" ? t.decimal : void 0, this.decimalMultiplier = U(
1465
- Math.max(O(this, ee, ue).call(this, O(this, H, G).call(this, n)), this.decimal || 0)
1466
- ), O(this, oe, $e).call(this, n);
1467
- }
1468
- static fromBigInt(t, n) {
1469
- return new Q({
1470
- decimal: n,
1471
- value: He({ value: t, bigIntDecimal: n, decimal: n })
1472
- });
1473
- }
1474
- static shiftDecimals({
1475
- value: t,
1476
- from: n,
1477
- to: a
1478
- }) {
1479
- return Q.fromBigInt(
1480
- new Q(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 = ye(t), s = O(this, H, G).call(this, a);
1561
- return s === "0" || s === "undefined" ? 0n : O(this, Z, de).call(this, s, n);
1562
- }
1563
- formatBigIntToSafeValue(t, n) {
1564
- const a = n || this.decimal || q, 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
- };
1602
- L = /* @__PURE__ */ new WeakSet(), $ = function(e, ...t) {
1603
- const n = O(this, pe, ge).call(this, this, ...t), a = U(n), s = t.reduce(
1604
- (o, p) => {
1605
- const u = this.getBigIntValue(p, n);
1606
- switch (e) {
1607
- case "add":
1608
- return o + u;
1609
- case "sub":
1610
- return o - u;
1611
- case "mul":
1612
- return o * u / a;
1613
- case "div": {
1614
- if (u === 0n)
1615
- throw new RangeError("Division by zero");
1616
- return o * a / u;
1617
- }
1618
- default:
1619
- return o;
1620
- }
1621
- },
1622
- //normalize is to precision multiplier base
1623
- this.bigIntValue * a / this.decimalMultiplier
1624
- ), r = He({
1625
- bigIntDecimal: n,
1626
- decimal: Math.max(n, F(this.decimalMultiplier)),
1627
- value: s
1628
- });
1629
- return new this.constructor({ decimal: this.decimal, value: r, identifier: this.toString() });
1630
- }, oe = /* @__PURE__ */ new WeakSet(), $e = function(e) {
1631
- const t = O(this, H, G).call(this, e) || "0";
1632
- this.bigIntValue = O(this, Z, de).call(this, t);
1633
- }, pe = /* @__PURE__ */ new WeakSet(), ge = function(...e) {
1634
- const t = e.map(
1635
- (n) => typeof n == "object" ? n.decimal || F(n.decimalMultiplier) : O(this, ee, ue).call(this, O(this, H, G).call(this, n))
1636
- ).filter(Boolean);
1637
- return Math.max(...t, q);
1638
- }, Z = /* @__PURE__ */ new WeakSet(), de = function(e, t) {
1639
- const n = t ? U(t) : this.decimalMultiplier, a = F(n), [s = "", r = ""] = e.split(".");
1640
- return BigInt(`${s}${r.padEnd(a, "0")}`);
1641
- }, H = /* @__PURE__ */ new WeakSet(), G = function(e) {
1642
- const t = `${typeof e == "number" ? Number(e).toLocaleString("fullwide", {
1643
- useGrouping: !1,
1644
- maximumFractionDigits: 20
1645
- }) : ye(e)}`.replaceAll(",", ".").split(".");
1646
- return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
1647
- }, ee = /* @__PURE__ */ new WeakSet(), ue = function(e) {
1648
- var t;
1649
- const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
1650
- return Math.max(n, q);
1651
- };
1652
- let le = Gt;
1653
- function ye(e) {
1654
- return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
1655
- }
1656
- let ce;
1657
- const ie = (e) => {
1658
- if (!ce)
1659
- throw new Error("Static assets not loaded, call await AssetValue.loadStaticAssets() first");
1660
- return ce.get(e.toUpperCase()) || { decimal: b.THOR, identifier: "" };
1661
- }, Oe = async (e, t = 0) => {
1662
- Ft(e);
1663
- const n = await De(me(e));
1664
- return new v({ decimal: n, value: t, identifier: e });
1665
- };
1666
- class v extends le {
1667
- constructor(t) {
1668
- super(
1669
- t.value instanceof le ? t.value : { decimal: t.decimal, value: t.value }
1670
- ), M(this, "address"), M(this, "chain"), M(this, "isSynthetic", !1), M(this, "isGasAsset", !1), M(this, "symbol"), M(this, "ticker"), M(this, "type");
1671
- const n = "identifier" in t ? t.identifier : `${t.chain}.${t.symbol}`, a = me(n);
1672
- this.type = wt(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;
1673
- }
1674
- get assetValue() {
1675
- return `${this.getValue("string")} ${this.ticker}`;
1676
- }
1677
- toString(t = !1) {
1678
- const n = this.isSynthetic ? this.ticker : `${this.chain}.${this.ticker}`;
1679
- return t ? n : (
1680
- // THOR.ETH/ETH | ETH.USDT-0x1234567890
1681
- `${this.chain}.${this.symbol}`
1682
- );
1683
- }
1684
- eq({ chain: t, symbol: n }) {
1685
- return this.chain === t && this.symbol === n;
1686
- }
1687
- static async fromString(t, n = 0) {
1688
- return Oe(t, n);
1689
- }
1690
- static fromStringSync(t, n = 0) {
1691
- const { decimal: a, identifier: s } = ie(
1692
- t
1693
- );
1694
- return s ? new v({ decimal: a, identifier: s, value: n }) : void 0;
1695
- }
1696
- static async fromIdentifier(t, n = 0) {
1697
- return Oe(t, n);
1698
- }
1699
- static fromIdentifierSync(t, n = 0) {
1700
- const { decimal: a, identifier: s } = ie(t);
1701
- return new v({ decimal: a, identifier: s, value: n });
1702
- }
1703
- static fromChainOrSignature(t, n = 0) {
1704
- const { decimal: a, identifier: s } = bt(t);
1705
- return new v({ value: n, decimal: a, identifier: s });
1706
- }
1707
- static async fromTCQuote(t, n = 0) {
1708
- const a = await De(me(t)), s = this.shiftDecimals({ value: n, from: b.THOR, to: a });
1709
- return new v({ value: s, identifier: t, decimal: a });
1710
- }
1711
- static fromTCQuoteStatic(t, n = 0) {
1712
- const a = ie(t), s = this.shiftDecimals({
1713
- value: n,
1714
- from: b.THOR,
1715
- to: a.decimal
1716
- });
1717
- return new v({ ...a, value: s });
1718
- }
1719
- static async loadStaticAssets() {
1720
- return new Promise(
1721
- async (t, n) => {
1722
- try {
1723
- const {
1724
- // Omit ThorchainList from import to avoid decimals conflict (TC uses 8 for all)
1725
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1726
- ThorchainList: a,
1727
- NativeList: s,
1728
- ...r
1729
- } = await import("@swapkit/tokens");
1730
- ce = [s, ...Object.values(r)].reduce(
1731
- (o, { tokens: p }) => (p.forEach(({ identifier: u, chain: y, ...d }) => {
1732
- const c = "decimals" in d ? d.decimals : b[y];
1733
- o.set(u, { identifier: u, decimal: c });
1734
- }), o),
1735
- /* @__PURE__ */ new Map()
1736
- ), t({ ok: !0 });
1737
- } catch (a) {
1738
- console.error(a), n({
1739
- ok: !1,
1740
- error: a,
1741
- message: "Couldn't load static assets. Ensure you have installed @swapkit/tokens package"
1742
- });
1743
- }
1744
- }
1745
- );
1746
- }
1747
- }
1748
- const Ie = (e) => {
1749
- const t = v.fromChainOrSignature(e);
1750
- switch (e) {
1751
- case i.Bitcoin:
1752
- case i.Litecoin:
1753
- case i.BitcoinCash:
1754
- return t.add(10001);
1755
- case i.Dogecoin:
1756
- return t.add(100000001);
1757
- case i.Avalanche:
1758
- case i.Ethereum:
1759
- return t.add(10 * 10 ** 9);
1760
- case i.THORChain:
1761
- case i.Maya:
1762
- return t.add(0);
1763
- default:
1764
- return t.add(1);
1765
- }
1766
- }, me = (e) => {
1767
- const t = e.slice(0, 14).includes("/"), n = e.includes(".") ? e : `${i.THORChain}.${e}`, [a, s] = n.split("."), [r, o] = s.split("-");
1768
- return {
1769
- address: o == null ? void 0 : o.toLowerCase(),
1770
- chain: a,
1771
- isGasAsset: ft({ chain: a, symbol: s }),
1772
- isSynthetic: t,
1773
- symbol: o ? `${r}-${(o == null ? void 0 : o.toLowerCase()) ?? ""}` : s,
1774
- ticker: t ? s : r
1775
- };
1776
- }, Wt = {
1777
- /**
1778
- * Core
1779
- */
1780
- core_wallet_connection_not_found: 10001,
1781
- core_estimated_max_spendable_chain_not_supported: 10002,
1782
- core_extend_error: 10003,
1783
- core_inbound_data_not_found: 10004,
1784
- core_approve_asset_address_or_from_not_found: 10005,
1785
- core_chain_halted: 10099,
1786
- /**
1787
- * Core - Wallet Connection
1788
- */
1789
- core_wallet_xdefi_not_installed: 10101,
1790
- core_wallet_evmwallet_not_installed: 10102,
1791
- core_wallet_walletconnect_not_installed: 10103,
1792
- core_wallet_keystore_not_installed: 10104,
1793
- core_wallet_ledger_not_installed: 10105,
1794
- core_wallet_trezor_not_installed: 10106,
1795
- core_wallet_keplr_not_installed: 10107,
1796
- core_wallet_okx_not_installed: 10108,
1797
- /**
1798
- * Core - Swap
1799
- */
1800
- core_swap_invalid_params: 10200,
1801
- core_swap_route_not_complete: 10201,
1802
- core_swap_asset_not_recognized: 10202,
1803
- core_swap_contract_not_found: 10203,
1804
- core_swap_route_transaction_not_found: 10204,
1805
- core_swap_contract_not_supported: 10205,
1806
- core_swap_transaction_error: 10206,
1807
- core_swap_quote_mode_not_supported: 10207,
1808
- /**
1809
- * Core - Transaction
1810
- */
1811
- core_transaction_deposit_error: 10301,
1812
- core_transaction_create_liquidity_rune_error: 10302,
1813
- core_transaction_create_liquidity_asset_error: 10303,
1814
- core_transaction_create_liquidity_invalid_params: 10304,
1815
- core_transaction_add_liquidity_invalid_params: 10305,
1816
- core_transaction_add_liquidity_no_rune_address: 10306,
1817
- core_transaction_add_liquidity_rune_error: 10307,
1818
- core_transaction_add_liquidity_asset_error: 10308,
1819
- core_transaction_withdraw_error: 10309,
1820
- core_transaction_deposit_to_pool_error: 10310,
1821
- core_transaction_deposit_insufficient_funds_error: 10311,
1822
- core_transaction_deposit_gas_error: 10312,
1823
- core_transaction_deposit_server_error: 10313,
1824
- /**
1825
- * Wallets
1826
- */
1827
- wallet_ledger_connection_error: 20001,
1828
- /**
1829
- * Helpers
1830
- */
1831
- helpers_number_different_decimals: 99101
1832
- };
1833
- class m extends Error {
1834
- constructor(t, n) {
1835
- console.error(n), super(t, { cause: { code: Wt[t], message: t } }), Object.setPrototypeOf(this, m.prototype);
1836
- }
1837
- }
1838
- class Te extends le {
1839
- eq(t) {
1840
- return this.eqValue(t);
1841
- }
1842
- }
1843
- const qt = [
1844
- {
1845
- inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
1846
- stateMutability: "nonpayable",
1847
- type: "constructor"
1848
- },
1849
- {
1850
- anonymous: !1,
1851
- inputs: [
1852
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1853
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
1854
- ],
1855
- name: "FeeSet",
1856
- type: "event"
1857
- },
1858
- {
1859
- anonymous: !1,
1860
- inputs: [
1861
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
1862
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
1863
- ],
1864
- name: "OwnerSet",
1865
- type: "event"
1866
- },
1867
- {
1868
- inputs: [],
1869
- name: "fee",
1870
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1871
- stateMutability: "view",
1872
- type: "function"
1873
- },
1874
- {
1875
- inputs: [],
1876
- name: "feeRecipient",
1877
- outputs: [{ internalType: "address", name: "", type: "address" }],
1878
- stateMutability: "view",
1879
- type: "function"
1880
- },
1881
- {
1882
- inputs: [{ internalType: "address", name: "", type: "address" }],
1883
- name: "owners",
1884
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
1885
- stateMutability: "view",
1886
- type: "function"
1887
- },
1888
- {
1889
- inputs: [
1890
- { internalType: "uint256", name: "_fee", type: "uint256" },
1891
- { internalType: "address", name: "_feeRecipient", type: "address" }
1892
- ],
1893
- name: "setFee",
1894
- outputs: [],
1895
- stateMutability: "nonpayable",
1896
- type: "function"
1897
- },
1898
- {
1899
- inputs: [
1900
- { internalType: "address", name: "owner", type: "address" },
1901
- { internalType: "bool", name: "active", type: "bool" }
1902
- ],
1903
- name: "setOwner",
1904
- outputs: [],
1905
- stateMutability: "nonpayable",
1906
- type: "function"
1907
- },
1908
- {
1909
- inputs: [
1910
- { internalType: "address", name: "tcRouter", type: "address" },
1911
- { internalType: "address", name: "tcVault", type: "address" },
1912
- { internalType: "string", name: "tcMemo", type: "string" },
1913
- { internalType: "address", name: "token", type: "address" },
1914
- { internalType: "uint256", name: "amount", type: "uint256" },
1915
- { internalType: "address", name: "router", type: "address" },
1916
- { internalType: "bytes", name: "data", type: "bytes" },
1917
- { internalType: "uint256", name: "deadline", type: "uint256" }
1918
- ],
1919
- name: "swapIn",
1920
- outputs: [],
1921
- stateMutability: "nonpayable",
1922
- type: "function"
1923
- },
1924
- {
1925
- inputs: [],
1926
- name: "tokenTransferProxy",
1927
- outputs: [
1928
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
1929
- ],
1930
- stateMutability: "view",
1931
- type: "function"
1932
- },
1933
- { stateMutability: "payable", type: "receive" }
1934
- ], jt = [
1935
- {
1936
- inputs: [
1937
- { internalType: "address", name: "_ttp", type: "address" },
1938
- { internalType: "address", name: "_weth", type: "address" },
1939
- { internalType: "address", name: "_swapRouter", type: "address" }
1940
- ],
1941
- stateMutability: "nonpayable",
1942
- type: "constructor"
1943
- },
1944
- {
1945
- anonymous: !1,
1946
- inputs: [
1947
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1948
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
1949
- ],
1950
- name: "FeeSet",
1951
- type: "event"
1952
- },
1953
- {
1954
- anonymous: !1,
1955
- inputs: [
1956
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
1957
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
1958
- ],
1959
- name: "OwnerSet",
1960
- type: "event"
1961
- },
1962
- {
1963
- anonymous: !1,
1964
- inputs: [
1965
- { indexed: !1, internalType: "address", name: "from", type: "address" },
1966
- { indexed: !1, internalType: "address", name: "token", type: "address" },
1967
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
1968
- { indexed: !1, internalType: "uint256", name: "out", type: "uint256" },
1969
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
1970
- { indexed: !1, internalType: "address", name: "vault", type: "address" },
1971
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
1972
- ],
1973
- name: "SwapIn",
1974
- type: "event"
1975
- },
1976
- {
1977
- anonymous: !1,
1978
- inputs: [
1979
- { indexed: !1, internalType: "address", name: "to", 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: "fee", type: "uint256" }
1983
- ],
1984
- name: "SwapOut",
1985
- type: "event"
1986
- },
1987
- {
1988
- inputs: [],
1989
- name: "fee",
1990
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
1991
- stateMutability: "view",
1992
- type: "function"
1993
- },
1994
- {
1995
- inputs: [],
1996
- name: "feeRecipient",
1997
- outputs: [{ internalType: "address", name: "", type: "address" }],
1998
- stateMutability: "view",
1999
- type: "function"
2000
- },
2001
- {
2002
- inputs: [{ internalType: "address", name: "", type: "address" }],
2003
- name: "owners",
2004
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2005
- stateMutability: "view",
2006
- type: "function"
2007
- },
2008
- {
2009
- inputs: [
2010
- { internalType: "uint256", name: "_fee", type: "uint256" },
2011
- { internalType: "address", name: "_feeRecipient", type: "address" }
2012
- ],
2013
- name: "setFee",
2014
- outputs: [],
2015
- stateMutability: "nonpayable",
2016
- type: "function"
2017
- },
2018
- {
2019
- inputs: [
2020
- { internalType: "address", name: "owner", type: "address" },
2021
- { internalType: "bool", name: "active", type: "bool" }
2022
- ],
2023
- name: "setOwner",
2024
- outputs: [],
2025
- stateMutability: "nonpayable",
2026
- type: "function"
2027
- },
2028
- {
2029
- inputs: [
2030
- { internalType: "address", name: "router", type: "address" },
2031
- { internalType: "address", name: "vault", type: "address" },
2032
- { internalType: "string", name: "memo", type: "string" },
2033
- { internalType: "address", name: "token", type: "address" },
2034
- { internalType: "uint256", name: "amount", type: "uint256" },
2035
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2036
- { internalType: "uint256", name: "deadline", type: "uint256" }
2037
- ],
2038
- name: "swapIn",
2039
- outputs: [],
2040
- stateMutability: "nonpayable",
2041
- type: "function"
2042
- },
2043
- {
2044
- inputs: [
2045
- { internalType: "address", name: "token", type: "address" },
2046
- { internalType: "address", name: "to", type: "address" },
2047
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2048
- ],
2049
- name: "swapOut",
2050
- outputs: [],
2051
- stateMutability: "payable",
2052
- type: "function"
2053
- },
2054
- {
2055
- inputs: [],
2056
- name: "swapRouter",
2057
- outputs: [{ internalType: "contract IWoofi", name: "", type: "address" }],
2058
- stateMutability: "view",
2059
- type: "function"
2060
- },
2061
- {
2062
- inputs: [],
2063
- name: "tokenTransferProxy",
2064
- outputs: [
2065
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2066
- ],
2067
- stateMutability: "view",
2068
- type: "function"
2069
- },
2070
- {
2071
- inputs: [],
2072
- name: "weth",
2073
- outputs: [{ internalType: "address", name: "", type: "address" }],
2074
- stateMutability: "view",
2075
- type: "function"
2076
- },
2077
- { stateMutability: "payable", type: "receive" }
2078
- ], Yt = [
2079
- {
2080
- inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
2081
- stateMutability: "nonpayable",
2082
- type: "constructor"
2083
- },
2084
- {
2085
- anonymous: !1,
2086
- inputs: [
2087
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2088
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2089
- ],
2090
- name: "FeeSet",
2091
- type: "event"
2092
- },
2093
- {
2094
- anonymous: !1,
2095
- inputs: [
2096
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2097
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2098
- ],
2099
- name: "OwnerSet",
2100
- type: "event"
2101
- },
2102
- {
2103
- anonymous: !1,
2104
- inputs: [
2105
- { indexed: !1, internalType: "address", name: "from", type: "address" },
2106
- { indexed: !1, internalType: "address", name: "token", type: "address" },
2107
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
2108
- { indexed: !1, internalType: "uint256", name: "out", type: "uint256" },
2109
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2110
- { indexed: !1, internalType: "address", name: "vault", type: "address" },
2111
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
2112
- ],
2113
- name: "SwapIn",
2114
- type: "event"
2115
- },
2116
- {
2117
- inputs: [],
2118
- name: "fee",
2119
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2120
- stateMutability: "view",
2121
- type: "function"
2122
- },
2123
- {
2124
- inputs: [],
2125
- name: "feeRecipient",
2126
- outputs: [{ internalType: "address", name: "", type: "address" }],
2127
- stateMutability: "view",
2128
- type: "function"
2129
- },
2130
- {
2131
- inputs: [{ internalType: "address", name: "", type: "address" }],
2132
- name: "owners",
2133
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2134
- stateMutability: "view",
2135
- type: "function"
2136
- },
2137
- {
2138
- inputs: [
2139
- { internalType: "uint256", name: "_fee", type: "uint256" },
2140
- { internalType: "address", name: "_feeRecipient", type: "address" }
2141
- ],
2142
- name: "setFee",
2143
- outputs: [],
2144
- stateMutability: "nonpayable",
2145
- type: "function"
2146
- },
2147
- {
2148
- inputs: [
2149
- { internalType: "address", name: "owner", type: "address" },
2150
- { internalType: "bool", name: "active", type: "bool" }
2151
- ],
2152
- name: "setOwner",
2153
- outputs: [],
2154
- stateMutability: "nonpayable",
2155
- type: "function"
2156
- },
2157
- {
2158
- inputs: [
2159
- { internalType: "address", name: "router", type: "address" },
2160
- { internalType: "address", name: "vault", type: "address" },
2161
- { internalType: "string", name: "memo", type: "string" },
2162
- { internalType: "address", name: "token", type: "address" },
2163
- { internalType: "uint256", name: "amount", type: "uint256" },
2164
- { internalType: "address", name: "swapRouter", type: "address" },
2165
- { internalType: "bytes", name: "data", type: "bytes" },
2166
- { internalType: "uint256", name: "deadline", type: "uint256" }
2167
- ],
2168
- name: "swapIn",
2169
- outputs: [],
2170
- stateMutability: "nonpayable",
2171
- type: "function"
2172
- },
2173
- {
2174
- inputs: [],
2175
- name: "tokenTransferProxy",
2176
- outputs: [
2177
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2178
- ],
2179
- stateMutability: "view",
2180
- type: "function"
2181
- },
2182
- { stateMutability: "payable", type: "receive" }
2183
- ], Kt = [
2184
- {
2185
- inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
2186
- stateMutability: "nonpayable",
2187
- type: "constructor"
2188
- },
2189
- {
2190
- anonymous: !1,
2191
- inputs: [
2192
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2193
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2194
- ],
2195
- name: "FeeSet",
2196
- type: "event"
2197
- },
2198
- {
2199
- anonymous: !1,
2200
- inputs: [
2201
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2202
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2203
- ],
2204
- name: "OwnerSet",
2205
- type: "event"
2206
- },
2207
- {
2208
- inputs: [],
2209
- name: "fee",
2210
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2211
- stateMutability: "view",
2212
- type: "function"
2213
- },
2214
- {
2215
- inputs: [],
2216
- name: "feeRecipient",
2217
- outputs: [{ internalType: "address", name: "", type: "address" }],
2218
- stateMutability: "view",
2219
- type: "function"
2220
- },
2221
- {
2222
- inputs: [{ internalType: "address", name: "", type: "address" }],
2223
- name: "owners",
2224
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2225
- stateMutability: "view",
2226
- type: "function"
2227
- },
2228
- {
2229
- inputs: [
2230
- { internalType: "uint256", name: "_fee", type: "uint256" },
2231
- { internalType: "address", name: "_feeRecipient", type: "address" }
2232
- ],
2233
- name: "setFee",
2234
- outputs: [],
2235
- stateMutability: "nonpayable",
2236
- type: "function"
2237
- },
2238
- {
2239
- inputs: [
2240
- { internalType: "address", name: "owner", type: "address" },
2241
- { internalType: "bool", name: "active", type: "bool" }
2242
- ],
2243
- name: "setOwner",
2244
- outputs: [],
2245
- stateMutability: "nonpayable",
2246
- type: "function"
2247
- },
2248
- {
2249
- inputs: [
2250
- { internalType: "address", name: "tcRouter", type: "address" },
2251
- { internalType: "address", name: "tcVault", type: "address" },
2252
- { internalType: "string", name: "tcMemo", type: "string" },
2253
- { internalType: "address", name: "token", type: "address" },
2254
- { internalType: "uint256", name: "amount", type: "uint256" },
2255
- { internalType: "address", name: "router", type: "address" },
2256
- { internalType: "bytes", name: "data", type: "bytes" },
2257
- { internalType: "uint256", name: "deadline", type: "uint256" }
2258
- ],
2259
- name: "swapIn",
2260
- outputs: [],
2261
- stateMutability: "nonpayable",
2262
- type: "function"
2263
- },
2264
- {
2265
- inputs: [],
2266
- name: "tokenTransferProxy",
2267
- outputs: [
2268
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2269
- ],
2270
- stateMutability: "view",
2271
- type: "function"
2272
- },
2273
- { stateMutability: "payable", type: "receive" }
2274
- ], Xt = [
2275
- {
2276
- inputs: [
2277
- { internalType: "address", name: "_ttp", type: "address" },
2278
- { internalType: "address", name: "_wbnb", type: "address" },
2279
- { internalType: "address", name: "_swapRouter", type: "address" }
2280
- ],
2281
- stateMutability: "nonpayable",
2282
- type: "constructor"
2283
- },
2284
- {
2285
- anonymous: !1,
2286
- inputs: [
2287
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2288
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2289
- ],
2290
- name: "FeeSet",
2291
- type: "event"
2292
- },
2293
- {
2294
- anonymous: !1,
2295
- inputs: [
2296
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2297
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2298
- ],
2299
- name: "OwnerSet",
2300
- type: "event"
2301
- },
2302
- {
2303
- anonymous: !1,
2304
- inputs: [
2305
- { indexed: !1, internalType: "address", name: "from", type: "address" },
2306
- { indexed: !1, internalType: "address", name: "token", type: "address" },
2307
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
2308
- { indexed: !1, internalType: "uint256", name: "out", type: "uint256" },
2309
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2310
- { indexed: !1, internalType: "address", name: "vault", type: "address" },
2311
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
2312
- ],
2313
- name: "SwapIn",
2314
- type: "event"
2315
- },
2316
- {
2317
- anonymous: !1,
2318
- inputs: [
2319
- { indexed: !1, internalType: "address", name: "to", 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: "fee", type: "uint256" }
2323
- ],
2324
- name: "SwapOut",
2325
- type: "event"
2326
- },
2327
- {
2328
- inputs: [],
2329
- name: "fee",
2330
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2331
- stateMutability: "view",
2332
- type: "function"
2333
- },
2334
- {
2335
- inputs: [],
2336
- name: "feeRecipient",
2337
- outputs: [{ internalType: "address", name: "", type: "address" }],
2338
- stateMutability: "view",
2339
- type: "function"
2340
- },
2341
- {
2342
- inputs: [{ internalType: "address", name: "", type: "address" }],
2343
- name: "owners",
2344
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2345
- stateMutability: "view",
2346
- type: "function"
2347
- },
2348
- {
2349
- inputs: [
2350
- { internalType: "uint256", name: "_fee", type: "uint256" },
2351
- { internalType: "address", name: "_feeRecipient", type: "address" }
2352
- ],
2353
- name: "setFee",
2354
- outputs: [],
2355
- stateMutability: "nonpayable",
2356
- type: "function"
2357
- },
2358
- {
2359
- inputs: [
2360
- { internalType: "address", name: "owner", type: "address" },
2361
- { internalType: "bool", name: "active", type: "bool" }
2362
- ],
2363
- name: "setOwner",
2364
- outputs: [],
2365
- stateMutability: "nonpayable",
2366
- type: "function"
2367
- },
2368
- {
2369
- inputs: [
2370
- { internalType: "address", name: "router", type: "address" },
2371
- { internalType: "address", name: "vault", type: "address" },
2372
- { internalType: "string", name: "memo", type: "string" },
2373
- { internalType: "address", name: "token", type: "address" },
2374
- { internalType: "uint256", name: "amount", type: "uint256" },
2375
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2376
- { internalType: "uint256", name: "deadline", type: "uint256" }
2377
- ],
2378
- name: "swapIn",
2379
- outputs: [],
2380
- stateMutability: "nonpayable",
2381
- type: "function"
2382
- },
2383
- {
2384
- inputs: [
2385
- { internalType: "address", name: "token", type: "address" },
2386
- { internalType: "address", name: "to", type: "address" },
2387
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2388
- ],
2389
- name: "swapOut",
2390
- outputs: [],
2391
- stateMutability: "payable",
2392
- type: "function"
2393
- },
2394
- {
2395
- inputs: [],
2396
- name: "swapRouter",
2397
- outputs: [{ internalType: "contract IPancakeRouterV2", name: "", type: "address" }],
2398
- stateMutability: "view",
2399
- type: "function"
2400
- },
2401
- {
2402
- inputs: [],
2403
- name: "tokenTransferProxy",
2404
- outputs: [
2405
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2406
- ],
2407
- stateMutability: "view",
2408
- type: "function"
2409
- },
2410
- {
2411
- inputs: [],
2412
- name: "wbnb",
2413
- outputs: [{ internalType: "address", name: "", type: "address" }],
2414
- stateMutability: "view",
2415
- type: "function"
2416
- },
2417
- { stateMutability: "payable", type: "receive" }
2418
- ], Jt = [
2419
- {
2420
- inputs: [
2421
- { internalType: "address", name: "_ttp", type: "address" },
2422
- { internalType: "address", name: "_weth", type: "address" },
2423
- { internalType: "address", name: "_swapRouter", type: "address" }
2424
- ],
2425
- stateMutability: "nonpayable",
2426
- type: "constructor"
2427
- },
2428
- {
2429
- anonymous: !1,
2430
- inputs: [
2431
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2432
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2433
- ],
2434
- name: "FeeSet",
2435
- type: "event"
2436
- },
2437
- {
2438
- anonymous: !1,
2439
- inputs: [
2440
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2441
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2442
- ],
2443
- name: "OwnerSet",
2444
- type: "event"
2445
- },
2446
- {
2447
- inputs: [],
2448
- name: "fee",
2449
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2450
- stateMutability: "view",
2451
- type: "function"
2452
- },
2453
- {
2454
- inputs: [],
2455
- name: "feeRecipient",
2456
- outputs: [{ internalType: "address", name: "", type: "address" }],
2457
- stateMutability: "view",
2458
- type: "function"
2459
- },
2460
- {
2461
- inputs: [{ internalType: "address", name: "", type: "address" }],
2462
- name: "owners",
2463
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2464
- stateMutability: "view",
2465
- type: "function"
2466
- },
2467
- {
2468
- inputs: [
2469
- { internalType: "uint256", name: "_fee", type: "uint256" },
2470
- { internalType: "address", name: "_feeRecipient", type: "address" }
2471
- ],
2472
- name: "setFee",
2473
- outputs: [],
2474
- stateMutability: "nonpayable",
2475
- type: "function"
2476
- },
2477
- {
2478
- inputs: [
2479
- { internalType: "address", name: "owner", type: "address" },
2480
- { internalType: "bool", name: "active", type: "bool" }
2481
- ],
2482
- name: "setOwner",
2483
- outputs: [],
2484
- stateMutability: "nonpayable",
2485
- type: "function"
2486
- },
2487
- {
2488
- inputs: [
2489
- { internalType: "address", name: "tcRouter", type: "address" },
2490
- { internalType: "address", name: "tcVault", type: "address" },
2491
- { internalType: "string", name: "tcMemo", type: "string" },
2492
- { internalType: "address", name: "token", type: "address" },
2493
- { internalType: "uint256", name: "amount", type: "uint256" },
2494
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2495
- { internalType: "uint256", name: "deadline", type: "uint256" }
2496
- ],
2497
- name: "swapIn",
2498
- outputs: [],
2499
- stateMutability: "nonpayable",
2500
- type: "function"
2501
- },
2502
- {
2503
- inputs: [
2504
- { internalType: "address", name: "token", type: "address" },
2505
- { internalType: "address", name: "to", type: "address" },
2506
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2507
- ],
2508
- name: "swapOut",
2509
- outputs: [],
2510
- stateMutability: "payable",
2511
- type: "function"
2512
- },
2513
- {
2514
- inputs: [],
2515
- name: "swapRouter",
2516
- outputs: [{ internalType: "contract IUniswapRouterV2AVAX", name: "", type: "address" }],
2517
- stateMutability: "view",
2518
- type: "function"
2519
- },
2520
- {
2521
- inputs: [],
2522
- name: "tokenTransferProxy",
2523
- outputs: [
2524
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2525
- ],
2526
- stateMutability: "view",
2527
- type: "function"
2528
- },
2529
- {
2530
- inputs: [],
2531
- name: "weth",
2532
- outputs: [{ internalType: "address", name: "", type: "address" }],
2533
- stateMutability: "view",
2534
- type: "function"
2535
- },
2536
- { stateMutability: "payable", type: "receive" }
2537
- ], Qt = [
2538
- {
2539
- inputs: [
2540
- { internalType: "address", name: "_ttp", type: "address" },
2541
- { internalType: "address", name: "_weth", type: "address" },
2542
- { internalType: "address", name: "_swapRouter", type: "address" }
2543
- ],
2544
- stateMutability: "nonpayable",
2545
- type: "constructor"
2546
- },
2547
- {
2548
- anonymous: !1,
2549
- inputs: [
2550
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2551
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2552
- ],
2553
- name: "FeeSet",
2554
- type: "event"
2555
- },
2556
- {
2557
- anonymous: !1,
2558
- inputs: [
2559
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2560
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2561
- ],
2562
- name: "OwnerSet",
2563
- type: "event"
2564
- },
2565
- {
2566
- inputs: [],
2567
- name: "fee",
2568
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2569
- stateMutability: "view",
2570
- type: "function"
2571
- },
2572
- {
2573
- inputs: [],
2574
- name: "feeRecipient",
2575
- outputs: [{ internalType: "address", name: "", type: "address" }],
2576
- stateMutability: "view",
2577
- type: "function"
2578
- },
2579
- {
2580
- inputs: [{ internalType: "address", name: "", type: "address" }],
2581
- name: "owners",
2582
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2583
- stateMutability: "view",
2584
- type: "function"
2585
- },
2586
- {
2587
- inputs: [
2588
- { internalType: "uint256", name: "_fee", type: "uint256" },
2589
- { internalType: "address", name: "_feeRecipient", type: "address" }
2590
- ],
2591
- name: "setFee",
2592
- outputs: [],
2593
- stateMutability: "nonpayable",
2594
- type: "function"
2595
- },
2596
- {
2597
- inputs: [
2598
- { internalType: "address", name: "owner", type: "address" },
2599
- { internalType: "bool", name: "active", type: "bool" }
2600
- ],
2601
- name: "setOwner",
2602
- outputs: [],
2603
- stateMutability: "nonpayable",
2604
- type: "function"
2605
- },
2606
- {
2607
- inputs: [
2608
- { internalType: "address", name: "tcRouter", type: "address" },
2609
- { internalType: "address", name: "tcVault", type: "address" },
2610
- { internalType: "string", name: "tcMemo", type: "string" },
2611
- { internalType: "address", name: "token", type: "address" },
2612
- { internalType: "uint256", name: "amount", type: "uint256" },
2613
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2614
- { internalType: "uint256", name: "deadline", type: "uint256" }
2615
- ],
2616
- name: "swapIn",
2617
- outputs: [],
2618
- stateMutability: "nonpayable",
2619
- type: "function"
2620
- },
2621
- {
2622
- inputs: [
2623
- { internalType: "address", name: "token", type: "address" },
2624
- { internalType: "address", name: "to", type: "address" },
2625
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2626
- ],
2627
- name: "swapOut",
2628
- outputs: [],
2629
- stateMutability: "payable",
2630
- type: "function"
2631
- },
2632
- {
2633
- inputs: [],
2634
- name: "swapRouter",
2635
- outputs: [{ internalType: "contract IUniswapRouterV2", name: "", type: "address" }],
2636
- stateMutability: "view",
2637
- type: "function"
2638
- },
2639
- {
2640
- inputs: [],
2641
- name: "tokenTransferProxy",
2642
- outputs: [
2643
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2644
- ],
2645
- stateMutability: "view",
2646
- type: "function"
2647
- },
2648
- {
2649
- inputs: [],
2650
- name: "weth",
2651
- outputs: [{ internalType: "address", name: "", type: "address" }],
2652
- stateMutability: "view",
2653
- type: "function"
2654
- },
2655
- { stateMutability: "payable", type: "receive" }
2656
- ], zt = [
2657
- {
2658
- inputs: [
2659
- { internalType: "address", name: "_ttp", type: "address" },
2660
- { internalType: "address", name: "_weth", type: "address" },
2661
- { internalType: "address", name: "_swapRouter", type: "address" }
2662
- ],
2663
- stateMutability: "nonpayable",
2664
- type: "constructor"
2665
- },
2666
- {
2667
- anonymous: !1,
2668
- inputs: [
2669
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2670
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2671
- ],
2672
- name: "FeeSet",
2673
- type: "event"
2674
- },
2675
- {
2676
- anonymous: !1,
2677
- inputs: [
2678
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2679
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2680
- ],
2681
- name: "OwnerSet",
2682
- type: "event"
2683
- },
2684
- {
2685
- inputs: [],
2686
- name: "fee",
2687
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2688
- stateMutability: "view",
2689
- type: "function"
2690
- },
2691
- {
2692
- inputs: [],
2693
- name: "feeRecipient",
2694
- outputs: [{ internalType: "address", name: "", type: "address" }],
2695
- stateMutability: "view",
2696
- type: "function"
2697
- },
2698
- {
2699
- inputs: [{ internalType: "address", name: "", type: "address" }],
2700
- name: "owners",
2701
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2702
- stateMutability: "view",
2703
- type: "function"
2704
- },
2705
- {
2706
- inputs: [
2707
- { internalType: "uint256", name: "_fee", type: "uint256" },
2708
- { internalType: "address", name: "_feeRecipient", type: "address" }
2709
- ],
2710
- name: "setFee",
2711
- outputs: [],
2712
- stateMutability: "nonpayable",
2713
- type: "function"
2714
- },
2715
- {
2716
- inputs: [
2717
- { internalType: "address", name: "owner", type: "address" },
2718
- { internalType: "bool", name: "active", type: "bool" }
2719
- ],
2720
- name: "setOwner",
2721
- outputs: [],
2722
- stateMutability: "nonpayable",
2723
- type: "function"
2724
- },
2725
- {
2726
- inputs: [
2727
- { internalType: "address", name: "tcRouter", type: "address" },
2728
- { internalType: "address", name: "tcVault", type: "address" },
2729
- { internalType: "string", name: "tcMemo", type: "string" },
2730
- { internalType: "address", name: "token", type: "address" },
2731
- { internalType: "uint256", name: "amount", type: "uint256" },
2732
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2733
- { internalType: "uint256", name: "deadline", type: "uint256" }
2734
- ],
2735
- name: "swapIn",
2736
- outputs: [],
2737
- stateMutability: "nonpayable",
2738
- type: "function"
2739
- },
2740
- {
2741
- inputs: [
2742
- { internalType: "address", name: "token", type: "address" },
2743
- { internalType: "address", name: "to", type: "address" },
2744
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2745
- ],
2746
- name: "swapOut",
2747
- outputs: [],
2748
- stateMutability: "payable",
2749
- type: "function"
2750
- },
2751
- {
2752
- inputs: [],
2753
- name: "swapRouter",
2754
- outputs: [{ internalType: "contract IUniswapRouterV2AVAX", name: "", type: "address" }],
2755
- stateMutability: "view",
2756
- type: "function"
2757
- },
2758
- {
2759
- inputs: [],
2760
- name: "tokenTransferProxy",
2761
- outputs: [
2762
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2763
- ],
2764
- stateMutability: "view",
2765
- type: "function"
2766
- },
2767
- {
2768
- inputs: [],
2769
- name: "weth",
2770
- outputs: [{ internalType: "address", name: "", type: "address" }],
2771
- stateMutability: "view",
2772
- type: "function"
2773
- },
2774
- { stateMutability: "payable", type: "receive" }
2775
- ], Zt = [
2776
- {
2777
- inputs: [
2778
- { internalType: "address", name: "_ttp", type: "address" },
2779
- { internalType: "address", name: "_weth", type: "address" },
2780
- { internalType: "address", name: "_swapRouter", type: "address" }
2781
- ],
2782
- stateMutability: "nonpayable",
2783
- type: "constructor"
2784
- },
2785
- {
2786
- anonymous: !1,
2787
- inputs: [
2788
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2789
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2790
- ],
2791
- name: "FeeSet",
2792
- type: "event"
2793
- },
2794
- {
2795
- anonymous: !1,
2796
- inputs: [
2797
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2798
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2799
- ],
2800
- name: "OwnerSet",
2801
- type: "event"
2802
- },
2803
- {
2804
- inputs: [],
2805
- name: "fee",
2806
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2807
- stateMutability: "view",
2808
- type: "function"
2809
- },
2810
- {
2811
- inputs: [],
2812
- name: "feeRecipient",
2813
- outputs: [{ internalType: "address", name: "", type: "address" }],
2814
- stateMutability: "view",
2815
- type: "function"
2816
- },
2817
- {
2818
- inputs: [{ internalType: "address", name: "", type: "address" }],
2819
- name: "owners",
2820
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2821
- stateMutability: "view",
2822
- type: "function"
2823
- },
2824
- {
2825
- inputs: [
2826
- { internalType: "uint256", name: "_fee", type: "uint256" },
2827
- { internalType: "address", name: "_feeRecipient", type: "address" }
2828
- ],
2829
- name: "setFee",
2830
- outputs: [],
2831
- stateMutability: "nonpayable",
2832
- type: "function"
2833
- },
2834
- {
2835
- inputs: [
2836
- { internalType: "address", name: "owner", type: "address" },
2837
- { internalType: "bool", name: "active", type: "bool" }
2838
- ],
2839
- name: "setOwner",
2840
- outputs: [],
2841
- stateMutability: "nonpayable",
2842
- type: "function"
2843
- },
2844
- {
2845
- inputs: [
2846
- { internalType: "address", name: "tcRouter", type: "address" },
2847
- { internalType: "address", name: "tcVault", type: "address" },
2848
- { internalType: "string", name: "tcMemo", type: "string" },
2849
- { internalType: "address", name: "token", type: "address" },
2850
- { internalType: "uint256", name: "amount", type: "uint256" },
2851
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2852
- { internalType: "uint256", name: "deadline", type: "uint256" }
2853
- ],
2854
- name: "swapIn",
2855
- outputs: [],
2856
- stateMutability: "nonpayable",
2857
- type: "function"
2858
- },
2859
- {
2860
- inputs: [
2861
- { internalType: "address", name: "token", type: "address" },
2862
- { internalType: "address", name: "to", type: "address" },
2863
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2864
- ],
2865
- name: "swapOut",
2866
- outputs: [],
2867
- stateMutability: "payable",
2868
- type: "function"
2869
- },
2870
- {
2871
- inputs: [],
2872
- name: "swapRouter",
2873
- outputs: [{ internalType: "contract IUniswapRouterV2", name: "", type: "address" }],
2874
- stateMutability: "view",
2875
- type: "function"
2876
- },
2877
- {
2878
- inputs: [],
2879
- name: "tokenTransferProxy",
2880
- outputs: [
2881
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
2882
- ],
2883
- stateMutability: "view",
2884
- type: "function"
2885
- },
2886
- {
2887
- inputs: [],
2888
- name: "weth",
2889
- outputs: [{ internalType: "address", name: "", type: "address" }],
2890
- stateMutability: "view",
2891
- type: "function"
2892
- },
2893
- { stateMutability: "payable", type: "receive" }
2894
- ], en = [
2895
- {
2896
- inputs: [
2897
- { internalType: "address", name: "_ttp", type: "address" },
2898
- { internalType: "address", name: "_weth", type: "address" },
2899
- { internalType: "address", name: "_swapRouter", type: "address" },
2900
- { internalType: "address", name: "_legToken", type: "address" }
2901
- ],
2902
- stateMutability: "nonpayable",
2903
- type: "constructor"
2904
- },
2905
- {
2906
- anonymous: !1,
2907
- inputs: [
2908
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
2909
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
2910
- ],
2911
- name: "FeeSet",
2912
- type: "event"
2913
- },
2914
- {
2915
- anonymous: !1,
2916
- inputs: [
2917
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
2918
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
2919
- ],
2920
- name: "OwnerSet",
2921
- type: "event"
2922
- },
2923
- {
2924
- inputs: [],
2925
- name: "fee",
2926
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
2927
- stateMutability: "view",
2928
- type: "function"
2929
- },
2930
- {
2931
- inputs: [],
2932
- name: "feeRecipient",
2933
- outputs: [{ internalType: "address", name: "", type: "address" }],
2934
- stateMutability: "view",
2935
- type: "function"
2936
- },
2937
- {
2938
- inputs: [],
2939
- name: "legToken",
2940
- outputs: [{ internalType: "address", name: "", type: "address" }],
2941
- stateMutability: "view",
2942
- type: "function"
2943
- },
2944
- {
2945
- inputs: [{ internalType: "address", name: "", type: "address" }],
2946
- name: "owners",
2947
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
2948
- stateMutability: "view",
2949
- type: "function"
2950
- },
2951
- {
2952
- inputs: [
2953
- { internalType: "uint256", name: "_fee", type: "uint256" },
2954
- { internalType: "address", name: "_feeRecipient", type: "address" }
2955
- ],
2956
- name: "setFee",
2957
- outputs: [],
2958
- stateMutability: "nonpayable",
2959
- type: "function"
2960
- },
2961
- {
2962
- inputs: [
2963
- { internalType: "address", name: "owner", type: "address" },
2964
- { internalType: "bool", name: "active", type: "bool" }
2965
- ],
2966
- name: "setOwner",
2967
- outputs: [],
2968
- stateMutability: "nonpayable",
2969
- type: "function"
2970
- },
2971
- {
2972
- inputs: [
2973
- { internalType: "address", name: "tcRouter", type: "address" },
2974
- { internalType: "address", name: "tcVault", type: "address" },
2975
- { internalType: "string", name: "tcMemo", type: "string" },
2976
- { internalType: "address", name: "token", type: "address" },
2977
- { internalType: "uint256", name: "amount", type: "uint256" },
2978
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
2979
- { internalType: "uint256", name: "deadline", type: "uint256" }
2980
- ],
2981
- name: "swapIn",
2982
- outputs: [],
2983
- stateMutability: "nonpayable",
2984
- type: "function"
2985
- },
2986
- {
2987
- inputs: [
2988
- { internalType: "address", name: "token", type: "address" },
2989
- { internalType: "address", name: "to", type: "address" },
2990
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
2991
- ],
2992
- name: "swapOut",
2993
- outputs: [],
2994
- stateMutability: "payable",
2995
- type: "function"
2996
- },
2997
- {
2998
- inputs: [],
2999
- name: "swapRouter",
3000
- outputs: [{ internalType: "contract IUniswapRouterV2", name: "", type: "address" }],
3001
- stateMutability: "view",
3002
- type: "function"
3003
- },
3004
- {
3005
- inputs: [],
3006
- name: "tokenTransferProxy",
3007
- outputs: [
3008
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3009
- ],
3010
- stateMutability: "view",
3011
- type: "function"
3012
- },
3013
- {
3014
- inputs: [],
3015
- name: "weth",
3016
- outputs: [{ internalType: "address", name: "", type: "address" }],
3017
- stateMutability: "view",
3018
- type: "function"
3019
- },
3020
- { stateMutability: "payable", type: "receive" }
3021
- ], tn = [
3022
- {
3023
- inputs: [
3024
- { internalType: "address", name: "_ttp", type: "address" },
3025
- { internalType: "address", name: "_weth", type: "address" },
3026
- { internalType: "address", name: "_swapRouter", type: "address" },
3027
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
3028
- ],
3029
- stateMutability: "nonpayable",
3030
- type: "constructor"
3031
- },
3032
- {
3033
- anonymous: !1,
3034
- inputs: [
3035
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
3036
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
3037
- ],
3038
- name: "FeeSet",
3039
- type: "event"
3040
- },
3041
- {
3042
- anonymous: !1,
3043
- inputs: [
3044
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
3045
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
3046
- ],
3047
- name: "OwnerSet",
3048
- type: "event"
3049
- },
3050
- {
3051
- inputs: [],
3052
- name: "fee",
3053
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3054
- stateMutability: "view",
3055
- type: "function"
3056
- },
3057
- {
3058
- inputs: [],
3059
- name: "feeRecipient",
3060
- outputs: [{ internalType: "address", name: "", type: "address" }],
3061
- stateMutability: "view",
3062
- type: "function"
3063
- },
3064
- {
3065
- inputs: [{ internalType: "address", name: "", type: "address" }],
3066
- name: "owners",
3067
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
3068
- stateMutability: "view",
3069
- type: "function"
3070
- },
3071
- {
3072
- inputs: [],
3073
- name: "poolFee",
3074
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
3075
- stateMutability: "view",
3076
- type: "function"
3077
- },
3078
- {
3079
- inputs: [
3080
- { internalType: "uint256", name: "_fee", type: "uint256" },
3081
- { internalType: "address", name: "_feeRecipient", type: "address" }
3082
- ],
3083
- name: "setFee",
3084
- outputs: [],
3085
- stateMutability: "nonpayable",
3086
- type: "function"
3087
- },
3088
- {
3089
- inputs: [
3090
- { internalType: "address", name: "owner", type: "address" },
3091
- { internalType: "bool", name: "active", type: "bool" }
3092
- ],
3093
- name: "setOwner",
3094
- outputs: [],
3095
- stateMutability: "nonpayable",
3096
- type: "function"
3097
- },
3098
- {
3099
- inputs: [
3100
- { internalType: "address", name: "tcRouter", type: "address" },
3101
- { internalType: "address", name: "tcVault", type: "address" },
3102
- { internalType: "string", name: "tcMemo", type: "string" },
3103
- { internalType: "address", name: "token", type: "address" },
3104
- { internalType: "uint256", name: "amount", type: "uint256" },
3105
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
3106
- { internalType: "uint256", name: "deadline", type: "uint256" }
3107
- ],
3108
- name: "swapIn",
3109
- outputs: [],
3110
- stateMutability: "nonpayable",
3111
- type: "function"
3112
- },
3113
- {
3114
- inputs: [
3115
- { internalType: "address", name: "token", type: "address" },
3116
- { internalType: "address", name: "to", type: "address" },
3117
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3118
- ],
3119
- name: "swapOut",
3120
- outputs: [],
3121
- stateMutability: "payable",
3122
- type: "function"
3123
- },
3124
- {
3125
- inputs: [],
3126
- name: "swapRouter",
3127
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
3128
- stateMutability: "view",
3129
- type: "function"
3130
- },
3131
- {
3132
- inputs: [],
3133
- name: "tokenTransferProxy",
3134
- outputs: [
3135
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3136
- ],
3137
- stateMutability: "view",
3138
- type: "function"
3139
- },
3140
- {
3141
- inputs: [],
3142
- name: "weth",
3143
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
3144
- stateMutability: "view",
3145
- type: "function"
3146
- },
3147
- { stateMutability: "payable", type: "receive" }
3148
- ], nn = [
3149
- {
3150
- inputs: [
3151
- { internalType: "address", name: "_ttp", type: "address" },
3152
- { internalType: "address", name: "_weth", type: "address" },
3153
- { internalType: "address", name: "_swapRouter", type: "address" },
3154
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
3155
- ],
3156
- stateMutability: "nonpayable",
3157
- type: "constructor"
3158
- },
3159
- {
3160
- anonymous: !1,
3161
- inputs: [
3162
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
3163
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
3164
- ],
3165
- name: "FeeSet",
3166
- type: "event"
3167
- },
3168
- {
3169
- anonymous: !1,
3170
- inputs: [
3171
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
3172
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
3173
- ],
3174
- name: "OwnerSet",
3175
- type: "event"
3176
- },
3177
- {
3178
- inputs: [],
3179
- name: "fee",
3180
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3181
- stateMutability: "view",
3182
- type: "function"
3183
- },
3184
- {
3185
- inputs: [],
3186
- name: "feeRecipient",
3187
- outputs: [{ internalType: "address", name: "", type: "address" }],
3188
- stateMutability: "view",
3189
- type: "function"
3190
- },
3191
- {
3192
- inputs: [{ internalType: "address", name: "", type: "address" }],
3193
- name: "owners",
3194
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
3195
- stateMutability: "view",
3196
- type: "function"
3197
- },
3198
- {
3199
- inputs: [],
3200
- name: "poolFee",
3201
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
3202
- stateMutability: "view",
3203
- type: "function"
3204
- },
3205
- {
3206
- inputs: [
3207
- { internalType: "uint256", name: "_fee", type: "uint256" },
3208
- { internalType: "address", name: "_feeRecipient", type: "address" }
3209
- ],
3210
- name: "setFee",
3211
- outputs: [],
3212
- stateMutability: "nonpayable",
3213
- type: "function"
3214
- },
3215
- {
3216
- inputs: [
3217
- { internalType: "address", name: "owner", type: "address" },
3218
- { internalType: "bool", name: "active", type: "bool" }
3219
- ],
3220
- name: "setOwner",
3221
- outputs: [],
3222
- stateMutability: "nonpayable",
3223
- type: "function"
3224
- },
3225
- {
3226
- inputs: [
3227
- { internalType: "address", name: "tcRouter", type: "address" },
3228
- { internalType: "address", name: "tcVault", type: "address" },
3229
- { internalType: "string", name: "tcMemo", type: "string" },
3230
- { internalType: "address", name: "token", type: "address" },
3231
- { internalType: "uint256", name: "amount", type: "uint256" },
3232
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
3233
- { internalType: "uint256", name: "deadline", type: "uint256" }
3234
- ],
3235
- name: "swapIn",
3236
- outputs: [],
3237
- stateMutability: "nonpayable",
3238
- type: "function"
3239
- },
3240
- {
3241
- inputs: [
3242
- { internalType: "address", name: "token", type: "address" },
3243
- { internalType: "address", name: "to", type: "address" },
3244
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3245
- ],
3246
- name: "swapOut",
3247
- outputs: [],
3248
- stateMutability: "payable",
3249
- type: "function"
3250
- },
3251
- {
3252
- inputs: [],
3253
- name: "swapRouter",
3254
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
3255
- stateMutability: "view",
3256
- type: "function"
3257
- },
3258
- {
3259
- inputs: [],
3260
- name: "tokenTransferProxy",
3261
- outputs: [
3262
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3263
- ],
3264
- stateMutability: "view",
3265
- type: "function"
3266
- },
3267
- {
3268
- inputs: [],
3269
- name: "weth",
3270
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
3271
- stateMutability: "view",
3272
- type: "function"
3273
- },
3274
- { stateMutability: "payable", type: "receive" }
3275
- ], an = [
3276
- {
3277
- inputs: [
3278
- { internalType: "address", name: "_ttp", type: "address" },
3279
- { internalType: "address", name: "_weth", type: "address" },
3280
- { internalType: "address", name: "_swapRouter", type: "address" },
3281
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
3282
- ],
3283
- stateMutability: "nonpayable",
3284
- type: "constructor"
3285
- },
3286
- {
3287
- anonymous: !1,
3288
- inputs: [
3289
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
3290
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
3291
- ],
3292
- name: "FeeSet",
3293
- type: "event"
3294
- },
3295
- {
3296
- anonymous: !1,
3297
- inputs: [
3298
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
3299
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
3300
- ],
3301
- name: "OwnerSet",
3302
- type: "event"
3303
- },
3304
- {
3305
- inputs: [],
3306
- name: "fee",
3307
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3308
- stateMutability: "view",
3309
- type: "function"
3310
- },
3311
- {
3312
- inputs: [],
3313
- name: "feeRecipient",
3314
- outputs: [{ internalType: "address", name: "", type: "address" }],
3315
- stateMutability: "view",
3316
- type: "function"
3317
- },
3318
- {
3319
- inputs: [{ internalType: "address", name: "", type: "address" }],
3320
- name: "owners",
3321
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
3322
- stateMutability: "view",
3323
- type: "function"
3324
- },
3325
- {
3326
- inputs: [],
3327
- name: "poolFee",
3328
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
3329
- stateMutability: "view",
3330
- type: "function"
3331
- },
3332
- {
3333
- inputs: [
3334
- { internalType: "uint256", name: "_fee", type: "uint256" },
3335
- { internalType: "address", name: "_feeRecipient", type: "address" }
3336
- ],
3337
- name: "setFee",
3338
- outputs: [],
3339
- stateMutability: "nonpayable",
3340
- type: "function"
3341
- },
3342
- {
3343
- inputs: [
3344
- { internalType: "address", name: "owner", type: "address" },
3345
- { internalType: "bool", name: "active", type: "bool" }
3346
- ],
3347
- name: "setOwner",
3348
- outputs: [],
3349
- stateMutability: "nonpayable",
3350
- type: "function"
3351
- },
3352
- {
3353
- inputs: [
3354
- { internalType: "address", name: "tcRouter", type: "address" },
3355
- { internalType: "address", name: "tcVault", type: "address" },
3356
- { internalType: "string", name: "tcMemo", type: "string" },
3357
- { internalType: "address", name: "token", type: "address" },
3358
- { internalType: "uint256", name: "amount", type: "uint256" },
3359
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
3360
- { internalType: "uint256", name: "deadline", type: "uint256" }
3361
- ],
3362
- name: "swapIn",
3363
- outputs: [],
3364
- stateMutability: "nonpayable",
3365
- type: "function"
3366
- },
3367
- {
3368
- inputs: [
3369
- { internalType: "address", name: "token", type: "address" },
3370
- { internalType: "address", name: "to", type: "address" },
3371
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3372
- ],
3373
- name: "swapOut",
3374
- outputs: [],
3375
- stateMutability: "payable",
3376
- type: "function"
3377
- },
3378
- {
3379
- inputs: [],
3380
- name: "swapRouter",
3381
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
3382
- stateMutability: "view",
3383
- type: "function"
3384
- },
3385
- {
3386
- inputs: [],
3387
- name: "tokenTransferProxy",
3388
- outputs: [
3389
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3390
- ],
3391
- stateMutability: "view",
3392
- type: "function"
3393
- },
3394
- {
3395
- inputs: [],
3396
- name: "weth",
3397
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
3398
- stateMutability: "view",
3399
- type: "function"
3400
- },
3401
- { stateMutability: "payable", type: "receive" }
3402
- ], sn = [
3403
- {
3404
- inputs: [
3405
- { internalType: "address", name: "_ttp", type: "address" },
3406
- { internalType: "address", name: "_weth", type: "address" },
3407
- { internalType: "address", name: "_swapRouter", type: "address" },
3408
- { internalType: "uint24", name: "_poolFee", type: "uint24" }
3409
- ],
3410
- stateMutability: "nonpayable",
3411
- type: "constructor"
3412
- },
3413
- {
3414
- anonymous: !1,
3415
- inputs: [
3416
- { indexed: !1, internalType: "uint256", name: "fee", type: "uint256" },
3417
- { indexed: !1, internalType: "address", name: "feeRecipient", type: "address" }
3418
- ],
3419
- name: "FeeSet",
3420
- type: "event"
3421
- },
3422
- {
3423
- anonymous: !1,
3424
- inputs: [
3425
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
3426
- { indexed: !1, internalType: "bool", name: "active", type: "bool" }
3427
- ],
3428
- name: "OwnerSet",
3429
- type: "event"
3430
- },
3431
- {
3432
- inputs: [],
3433
- name: "fee",
3434
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
3435
- stateMutability: "view",
3436
- type: "function"
3437
- },
3438
- {
3439
- inputs: [],
3440
- name: "feeRecipient",
3441
- outputs: [{ internalType: "address", name: "", type: "address" }],
3442
- stateMutability: "view",
3443
- type: "function"
3444
- },
3445
- {
3446
- inputs: [{ internalType: "address", name: "", type: "address" }],
3447
- name: "owners",
3448
- outputs: [{ internalType: "bool", name: "", type: "bool" }],
3449
- stateMutability: "view",
3450
- type: "function"
3451
- },
3452
- {
3453
- inputs: [],
3454
- name: "poolFee",
3455
- outputs: [{ internalType: "uint24", name: "", type: "uint24" }],
3456
- stateMutability: "view",
3457
- type: "function"
3458
- },
3459
- {
3460
- inputs: [
3461
- { internalType: "uint256", name: "_fee", type: "uint256" },
3462
- { internalType: "address", name: "_feeRecipient", type: "address" }
3463
- ],
3464
- name: "setFee",
3465
- outputs: [],
3466
- stateMutability: "nonpayable",
3467
- type: "function"
3468
- },
3469
- {
3470
- inputs: [
3471
- { internalType: "address", name: "owner", type: "address" },
3472
- { internalType: "bool", name: "active", type: "bool" }
3473
- ],
3474
- name: "setOwner",
3475
- outputs: [],
3476
- stateMutability: "nonpayable",
3477
- type: "function"
3478
- },
3479
- {
3480
- inputs: [
3481
- { internalType: "address", name: "tcRouter", type: "address" },
3482
- { internalType: "address", name: "tcVault", type: "address" },
3483
- { internalType: "string", name: "tcMemo", type: "string" },
3484
- { internalType: "address", name: "token", type: "address" },
3485
- { internalType: "uint256", name: "amount", type: "uint256" },
3486
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
3487
- { internalType: "uint256", name: "deadline", type: "uint256" }
3488
- ],
3489
- name: "swapIn",
3490
- outputs: [],
3491
- stateMutability: "nonpayable",
3492
- type: "function"
3493
- },
3494
- {
3495
- inputs: [
3496
- { internalType: "address", name: "token", type: "address" },
3497
- { internalType: "address", name: "to", type: "address" },
3498
- { internalType: "uint256", name: "amountOutMin", type: "uint256" }
3499
- ],
3500
- name: "swapOut",
3501
- outputs: [],
3502
- stateMutability: "payable",
3503
- type: "function"
3504
- },
3505
- {
3506
- inputs: [],
3507
- name: "swapRouter",
3508
- outputs: [{ internalType: "contract IUniswapRouterV3", name: "", type: "address" }],
3509
- stateMutability: "view",
3510
- type: "function"
3511
- },
3512
- {
3513
- inputs: [],
3514
- name: "tokenTransferProxy",
3515
- outputs: [
3516
- { internalType: "contract TSAggregatorTokenTransferProxy", name: "", type: "address" }
3517
- ],
3518
- stateMutability: "view",
3519
- type: "function"
3520
- },
3521
- {
3522
- inputs: [],
3523
- name: "weth",
3524
- outputs: [{ internalType: "contract IWETH9", name: "", type: "address" }],
3525
- stateMutability: "view",
3526
- type: "function"
3527
- },
3528
- { stateMutability: "payable", type: "receive" }
3529
- ], ke = {
3530
- ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: qt,
3531
- ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: Yt,
3532
- ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Kt
3533
- }, rn = {
3534
- ...ke,
3535
- // AVAX
3536
- ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: Jt,
3537
- ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: jt,
3538
- ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: zt,
3539
- // BSC
3540
- ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: Xt,
3541
- // ETH
3542
- ["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Qt,
3543
- ["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Zt,
3544
- ["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: en,
3545
- ["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: tn,
3546
- ["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: nn,
3547
- ["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: an,
3548
- ["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: sn
3549
- }, on = ({
3550
- streamSwap: e,
3551
- contractAddress: t,
3552
- recipient: n,
3553
- toChecksumAddress: a,
3554
- calldata: {
3555
- amount: s,
3556
- amountOutMin: r = "",
3557
- data: o = "",
3558
- deadline: p,
3559
- memo: u,
3560
- router: y,
3561
- memoStreamingSwap: d,
3562
- tcMemo: c,
3563
- tcRouter: _,
3564
- tcVault: A,
3565
- vault: R,
3566
- token: g
3567
- }
3568
- }) => {
3569
- const E = !!ke[t.toLowerCase()];
3570
- if (E && !y)
3571
- throw new Error("Router is required on calldata for swapIn with GenericContract");
3572
- const I = c || u, S = e && d || I;
3573
- if (!A && !R)
3574
- throw new Error("TC Vault is required on calldata");
3575
- if (!_ && !y)
3576
- throw new Error("TC Router is required on calldata");
3577
- if (!S)
3578
- throw new Error("TC Memo is required on calldata");
3579
- if (!g)
3580
- throw new Error("Token is required on calldata");
3581
- const D = [
3582
- // v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
3583
- a(_ || y),
3584
- a(A || R),
3585
- S.replace("{recipientAddress}", n),
3586
- a(g),
3587
- s
3588
- ], Fe = E ? [a(y), o, p] : [r, p];
3589
- return [...D, ...Fe];
3590
- }, pn = ({ chain: e, txHash: t }) => {
3591
- const n = Ne[e];
3592
- switch (e) {
3593
- case i.Binance:
3594
- case i.Bitcoin:
3595
- case i.BitcoinCash:
3596
- case i.Maya:
3597
- case i.Kujira:
3598
- case i.THORChain:
3599
- return `${n}/tx/${t}`;
3600
- case i.Arbitrum:
3601
- case i.Avalanche:
3602
- case i.BinanceSmartChain:
3603
- case i.Ethereum:
3604
- case i.Optimism:
3605
- case i.Polygon:
3606
- return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
3607
- case i.Cosmos:
3608
- return `${n}/transactions/${t}`;
3609
- case i.Dogecoin:
3610
- return `${n}/transaction/${t.toLowerCase()}`;
3611
- case i.Litecoin:
3612
- return `${n}/${t}`;
3613
- default:
3614
- throw new Error(`Unsupported chain: ${e}`);
3615
- }
3616
- }, dn = ({ chain: e, address: t }) => {
3617
- const n = Ne[e];
3618
- switch (e) {
3619
- case i.Arbitrum:
3620
- case i.Avalanche:
3621
- case i.Binance:
3622
- case i.BinanceSmartChain:
3623
- case i.Bitcoin:
3624
- case i.BitcoinCash:
3625
- case i.Dogecoin:
3626
- case i.Ethereum:
3627
- case i.Maya:
3628
- case i.Optimism:
3629
- case i.Polygon:
3630
- case i.Kujira:
3631
- case i.THORChain:
3632
- return `${n}/address/${t}`;
3633
- case i.Cosmos:
3634
- return `${n}/account/${t}`;
3635
- case i.Litecoin:
3636
- return `${n}/${t}`;
3637
- default:
3638
- throw new Error(`Unsupported chain: ${e}`);
3639
- }
3640
- }, un = (e) => {
3641
- const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
3642
- return be.get(`${t}/thorchain/inbound_addresses`);
3643
- }, ln = (e) => {
3644
- const t = e ? W.ThornodeStagenet : W.ThornodeMainnet;
3645
- return be.get(`${t}/thorchain/mimir`);
3646
- }, Se = () => Object.values(i).reduce(
3647
- (e, t) => (e[t] = null, e),
3648
- {}
3649
- );
3650
- var B, te, j, N, Y, K;
3651
- class Nn {
3652
- constructor({ stagenet: t } = {}) {
3653
- T(this, "connectedChains", Se());
3654
- T(this, "connectedWallets", Se());
3655
- T(this, "stagenet", !1);
3656
- T(this, "getAddress", (t) => {
3657
- var n;
3658
- return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
3659
- });
3660
- T(this, "getExplorerTxUrl", (t, n) => pn({ chain: t, txHash: n }));
3661
- T(this, "getWallet", (t) => this.connectedWallets[t]);
3662
- T(this, "getExplorerAddressUrl", (t, n) => dn({ chain: t, address: n }));
3663
- T(this, "getBalance", async (t, n) => {
3664
- const a = await this.getWalletByChain(t, n);
3665
- return (a == null ? void 0 : a.balance) || [];
3666
- });
3667
- T(this, "swap", async ({ streamSwap: t, recipient: n, route: a, feeOptionKey: s }) => {
3668
- var p, u;
3669
- const { quoteMode: r } = a.meta, o = r.startsWith("ERC20-") ? i.Ethereum : r.startsWith("ARC20-") ? i.Avalanche : i.BinanceSmartChain;
3670
- if (!a.complete)
3671
- throw new m("core_swap_route_not_complete");
3672
- try {
3673
- if (ze.includes(r)) {
3674
- const y = this.connectedWallets[o];
3675
- if (!(y != null && y.sendTransaction))
3676
- throw new m("core_wallet_connection_not_found");
3677
- if (!(t ? (p = a == null ? void 0 : a.streamingSwap) == null ? void 0 : p.transaction : a == null ? void 0 : a.transaction))
3678
- throw new m("core_swap_route_transaction_not_found");
3679
- const { isHexString: c, parseUnits: _ } = await import("./index-cf1865cd.js"), { data: A, from: R, to: g, value: E } = a.transaction, I = {
3680
- data: A,
3681
- from: R,
3682
- to: g.toLowerCase(),
3683
- chainId: BigInt(rt[o]),
3684
- value: E ? new Te({
3685
- value: c(E) ? E : _(E, "wei").toString(16)
3686
- }).baseValueBigInt : 0n
3687
- };
3688
- return y.sendTransaction(I, s);
3689
- }
3690
- if (et.includes(r)) {
3691
- if (!a.calldata.fromAsset)
3692
- throw new m("core_swap_asset_not_recognized");
3693
- const y = await v.fromString(a.calldata.fromAsset);
3694
- if (!y)
3695
- throw new m("core_swap_asset_not_recognized");
3696
- const { address: d } = await f(this, B).call(this, y.chain), {
3697
- contract: c,
3698
- calldata: { expiration: _, amountIn: A, memo: R, memoStreamingSwap: g }
3699
- } = a, E = y.add(Te.fromBigInt(BigInt(A), y.decimal)), I = t && g || R;
3700
- return this.deposit({
3701
- expiration: _,
3702
- assetValue: E,
3703
- memo: I,
3704
- feeOptionKey: s,
3705
- router: c,
3706
- recipient: d
3707
- });
3708
- }
3709
- if (Ze.includes(r)) {
3710
- const { calldata: y, contract: d } = a;
3711
- if (!d)
3712
- throw new m("core_swap_contract_not_found");
3713
- const c = this.connectedWallets[o], _ = this.getAddress(o);
3714
- if (!(c != null && c.sendTransaction) || !_)
3715
- throw new m("core_wallet_connection_not_found");
3716
- const { getProvider: A, toChecksumAddress: R } = await import("@swapkit/toolbox-evm"), g = A(o), E = rn[d.toLowerCase()];
3717
- if (!E)
3718
- throw new m("core_swap_contract_not_supported", { contractAddress: d });
3719
- const S = await (await ((u = c.createContract) == null ? void 0 : u.call(c, d, E, g))).getFunction("swapIn").populateTransaction(
3720
- ...on({
3721
- streamSwap: t,
3722
- toChecksumAddress: R,
3723
- contractAddress: d,
3724
- recipient: n,
3725
- calldata: y
3726
- }),
3727
- { from: _ }
3728
- );
3729
- return c.sendTransaction(S, s);
3730
- }
3731
- throw new m("core_swap_quote_mode_not_supported", { quoteMode: r });
3732
- } catch (y) {
3733
- throw new m("core_swap_transaction_error", y);
3734
- }
3735
- });
3736
- T(this, "getWalletByChain", async (t, n) => {
3737
- var r, o;
3738
- const a = this.getAddress(t);
3739
- if (!a)
3740
- return null;
3741
- const s = await ((r = this.getWallet(t)) == null ? void 0 : r.getBalance(a, n)) ?? [
3742
- v.fromChainOrSignature(t)
3743
- ];
3744
- return this.connectedChains[t] = {
3745
- address: a,
3746
- balance: s,
3747
- walletType: (o = this.connectedChains[t]) == null ? void 0 : o.walletType
3748
- }, { ...this.connectedChains[t] };
3749
- });
3750
- T(this, "approveAssetValue", (t, n) => f(this, j).call(this, { assetValue: t, type: "approve", contractAddress: n }));
3751
- T(this, "isAssetValueApproved", (t, n) => f(this, j).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
3752
- T(this, "validateAddress", ({ address: t, chain: n }) => {
3753
- var a, s;
3754
- return (s = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : s.call(a, t);
3755
- });
3756
- T(this, "transfer", async (t) => {
3757
- const n = this.connectedWallets[t.assetValue.chain];
3758
- if (!n)
3759
- throw new m("core_wallet_connection_not_found");
3760
- try {
3761
- return await n.transfer(f(this, K).call(this, t));
3762
- } catch (a) {
3763
- throw new m("core_swap_transaction_error", a);
3764
- }
3765
- });
3766
- T(this, "deposit", async ({
3767
- assetValue: t,
3768
- recipient: n,
3769
- router: a,
3770
- ...s
3771
- }) => {
3772
- const { chain: r, symbol: o, ticker: p } = t, u = this.connectedWallets[r];
3773
- if (!u)
3774
- throw new m("core_wallet_connection_not_found");
3775
- const y = f(this, K).call(this, { assetValue: t, recipient: n, router: a, ...s });
3776
- try {
3777
- switch (r) {
3778
- case i.THORChain: {
3779
- const d = u;
3780
- return await (n === "" ? d.deposit(y) : d.transfer(y));
3781
- }
3782
- case i.Ethereum:
3783
- case i.BinanceSmartChain:
3784
- case i.Avalanche: {
3785
- const { getChecksumAddressFromAsset: d } = await import("@swapkit/toolbox-evm"), c = r === i.Avalanche ? Xe : r === i.BinanceSmartChain ? Je : Ke;
3786
- return await u.call({
3787
- abi: c,
3788
- contractAddress: a || (await f(this, B).call(this, r)).router,
3789
- funcName: "depositWithExpiry",
3790
- funcParams: [
3791
- n,
3792
- d({ chain: r, symbol: o, ticker: p }, r),
3793
- // TODO: (@Towan) Re-Check on that conversion 🙏
3794
- t.getBaseValue("bigint").toString(),
3795
- y.memo,
3796
- s.expiration
3797
- ],
3798
- txOverrides: {
3799
- from: y.from,
3800
- value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
3801
- }
3802
- });
3803
- }
3804
- default:
3805
- return await u.transfer(y);
3806
- }
3807
- } catch (d) {
3808
- 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";
3809
- throw new m(g, d);
3810
- }
3811
- });
3812
- /**
3813
- * TC related Methods
3814
- */
3815
- T(this, "createLiquidity", async ({
3816
- runeAssetValue: t,
3817
- assetValue: n
3818
- }) => {
3819
- if (t.lte(0) || n.lte(0))
3820
- throw new m("core_transaction_create_liquidity_invalid_params");
3821
- let a = "", s = "";
3822
- try {
3823
- a = await f(this, N).call(this, {
3824
- assetValue: t,
3825
- memo: x(h.DEPOSIT, {
3826
- ...n,
3827
- address: this.getAddress(n.chain)
3828
- })
3829
- });
3830
- } catch (r) {
3831
- throw new m("core_transaction_create_liquidity_rune_error", r);
3832
- }
3833
- try {
3834
- s = await f(this, N).call(this, {
3835
- assetValue: n,
3836
- memo: x(h.DEPOSIT, {
3837
- ...n,
3838
- address: this.getAddress(i.THORChain)
3839
- })
3840
- });
3841
- } catch (r) {
3842
- throw new m("core_transaction_create_liquidity_asset_error", r);
3843
- }
3844
- return { runeTx: a, assetTx: s };
3845
- });
3846
- T(this, "addLiquidity", async ({
3847
- poolIdentifier: t,
3848
- runeAssetValue: n,
3849
- assetValue: a,
3850
- runeAddr: s,
3851
- assetAddr: r,
3852
- isPendingSymmAsset: o,
3853
- mode: p = "sym"
3854
- }) => {
3855
- 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) : "";
3856
- if (!c && !_)
3857
- throw new m("core_transaction_add_liquidity_invalid_params");
3858
- if (A && !R)
3859
- throw new m("core_transaction_add_liquidity_no_rune_address");
3860
- let E, I;
3861
- const S = { chain: u, symbol: y.join(".") };
3862
- if (c && n)
3863
- try {
3864
- E = await f(this, N).call(this, {
3865
- assetValue: n,
3866
- memo: x(h.DEPOSIT, { ...S, address: g })
3867
- });
3868
- } catch (D) {
3869
- throw new m("core_transaction_add_liquidity_rune_error", D);
3870
- }
3871
- if (_ && a)
3872
- try {
3873
- I = await f(this, N).call(this, {
3874
- assetValue: a,
3875
- memo: x(h.DEPOSIT, { ...S, address: R })
3876
- });
3877
- } catch (D) {
3878
- throw new m("core_transaction_add_liquidity_asset_error", D);
3879
- }
3880
- return { runeTx: E, assetTx: I };
3881
- });
3882
- T(this, "withdraw", async ({
3883
- memo: t,
3884
- assetValue: n,
3885
- percent: a,
3886
- from: s,
3887
- to: r
3888
- }) => {
3889
- const o = r === "rune" ? v.fromChainOrSignature(i.THORChain) : s === "sym" && r === "sym" || s === "rune" || s === "asset" ? void 0 : n;
3890
- try {
3891
- return await f(this, N).call(this, {
3892
- assetValue: Ie(s === "asset" ? n.chain : i.THORChain),
3893
- memo: t || x(h.WITHDRAW, {
3894
- symbol: n.symbol,
3895
- chain: n.chain,
3896
- ticker: n.ticker,
3897
- basisPoints: Math.max(1e4, Math.round(a * 100)),
3898
- targetAssetString: o == null ? void 0 : o.toString(),
3899
- singleSide: !1
3900
- })
3901
- });
3902
- } catch (p) {
3903
- throw new m("core_transaction_withdraw_error", p);
3904
- }
3905
- });
3906
- T(this, "savings", async ({
3907
- assetValue: t,
3908
- memo: n,
3909
- percent: a,
3910
- type: s
3911
- }) => {
3912
- const r = s === "add" ? h.DEPOSIT : h.WITHDRAW, o = n || x(r, {
3913
- ticker: t.ticker,
3914
- symbol: t.symbol,
3915
- chain: t.chain,
3916
- singleSide: !0,
3917
- basisPoints: a ? Math.max(1e4, Math.round(a * 100)) : void 0
3918
- });
3919
- return f(this, N).call(this, { assetValue: t, memo: o });
3920
- });
3921
- T(this, "loan", ({
3922
- assetValue: t,
3923
- memo: n,
3924
- minAmount: a,
3925
- type: s
3926
- }) => f(this, N).call(this, {
3927
- assetValue: t,
3928
- memo: n || x(s === "open" ? h.OPEN_LOAN : h.CLOSE_LOAN, {
3929
- asset: t.toString(),
3930
- minAmount: a.toString(),
3931
- address: this.getAddress(t.chain)
3932
- })
3933
- }));
3934
- T(this, "nodeAction", ({
3935
- type: t,
3936
- assetValue: n,
3937
- address: a
3938
- }) => {
3939
- const s = t === "bond" ? h.BOND : t === "unbond" ? h.UNBOND : h.LEAVE, r = x(s, {
3940
- address: a,
3941
- unbondAmount: t === "unbond" ? n.baseValueNumber : void 0
3942
- });
3943
- return f(this, Y).call(this, {
3944
- memo: r,
3945
- assetValue: t === "bond" ? n : Ie(i.THORChain)
3946
- });
3947
- });
3948
- T(this, "registerThorname", ({
3949
- assetValue: t,
3950
- ...n
3951
- }) => f(this, Y).call(this, { assetValue: t, memo: x(h.THORNAME_REGISTER, n) }));
3952
- T(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: s = {} }) => {
3953
- try {
3954
- t.forEach((r) => {
3955
- this[r.connectMethodName] = r.connect({
3956
- addChain: f(this, te),
3957
- config: n || {},
3958
- apis: a,
3959
- rpcUrls: s
3960
- });
3961
- });
3962
- } catch (r) {
3963
- throw new m("core_extend_error", r);
3964
- }
3965
- });
3966
- T(this, "estimateMaxSendableAmount", async ({
3967
- chain: t,
3968
- params: n
3969
- }) => {
3970
- const a = this.getWallet(t);
3971
- switch (t) {
3972
- case i.Arbitrum:
3973
- case i.Avalanche:
3974
- case i.BinanceSmartChain:
3975
- case i.Ethereum:
3976
- case i.Optimism:
3977
- case i.Polygon: {
3978
- const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-evm");
3979
- return s({
3980
- ...n,
3981
- toolbox: a
3982
- });
3983
- }
3984
- case i.Bitcoin:
3985
- case i.BitcoinCash:
3986
- case i.Dogecoin:
3987
- case i.Litecoin:
3988
- return a.estimateMaxSendableAmount(n);
3989
- case i.Binance:
3990
- case i.THORChain:
3991
- case i.Cosmos: {
3992
- const { estimateMaxSendableAmount: s } = await import("@swapkit/toolbox-cosmos");
3993
- return s({
3994
- ...n,
3995
- toolbox: a
3996
- });
3997
- }
3998
- default:
3999
- throw new m("core_estimated_max_spendable_chain_not_supported");
4000
- }
4001
- });
4002
- /**
4003
- * Wallet connection methods
4004
- */
4005
- T(this, "connectXDEFI", async (t) => {
4006
- throw new m("core_wallet_xdefi_not_installed");
4007
- });
4008
- T(this, "connectEVMWallet", async (t, n) => {
4009
- throw new m("core_wallet_evmwallet_not_installed");
4010
- });
4011
- T(this, "connectWalletconnect", async (t, n) => {
4012
- throw new m("core_wallet_walletconnect_not_installed");
4013
- });
4014
- T(this, "connectKeystore", async (t, n) => {
4015
- throw new m("core_wallet_keystore_not_installed");
4016
- });
4017
- T(this, "connectLedger", async (t, n) => {
4018
- throw new m("core_wallet_ledger_not_installed");
4019
- });
4020
- T(this, "connectTrezor", async (t, n) => {
4021
- throw new m("core_wallet_trezor_not_installed");
4022
- });
4023
- T(this, "connectKeplr", async (t) => {
4024
- throw new m("core_wallet_keplr_not_installed");
4025
- });
4026
- T(this, "connectOkx", async (t) => {
4027
- throw new m("core_wallet_okx_not_installed");
4028
- });
4029
- T(this, "disconnectChain", (t) => {
4030
- this.connectedChains[t] = null, this.connectedWallets[t] = null;
4031
- });
4032
- P(this, B, async (t) => {
4033
- if (t === i.THORChain)
4034
- return {
4035
- gas_rate: "0",
4036
- router: "0",
4037
- address: "",
4038
- halted: !1,
4039
- chain: i.THORChain
4040
- };
4041
- const a = (await un(this.stagenet)).find((s) => s.chain === t);
4042
- if (!a)
4043
- throw new m("core_inbound_data_not_found");
4044
- if (a != null && a.halted)
4045
- throw new m("core_chain_halted");
4046
- return a;
4047
- });
4048
- P(this, te, ({ chain: t, wallet: n, walletMethods: a }) => {
4049
- this.connectedChains[t] = n, this.connectedWallets[t] = a;
4050
- });
4051
- P(this, j, async ({
4052
- assetValue: { baseValueBigInt: t, address: n, chain: a, isGasAsset: s, isSynthetic: r },
4053
- type: o = "checkOnly",
4054
- contractAddress: p
4055
- }) => {
4056
- const u = [i.Ethereum, i.Avalanche, i.BinanceSmartChain].includes(a);
4057
- if (u && s || !u || r)
4058
- return !0;
4059
- const d = this.connectedWallets[a], c = o === "checkOnly" ? d == null ? void 0 : d.isApproved : d == null ? void 0 : d.approve;
4060
- if (!c)
4061
- throw new m("core_wallet_connection_not_found");
4062
- const _ = this.getAddress(a);
4063
- if (!n || !_)
4064
- throw new m("core_approve_asset_address_or_from_not_found");
4065
- const A = p || (await f(this, B).call(this, a)).router;
4066
- return c({
4067
- amount: t,
4068
- assetAddress: n,
4069
- from: _,
4070
- spenderAddress: A
4071
- });
4072
- });
4073
- P(this, N, async ({
4074
- assetValue: t,
4075
- memo: n,
4076
- feeOptionKey: a = k.Fast
4077
- }) => {
4078
- const {
4079
- gas_rate: s,
4080
- router: r,
4081
- address: o
4082
- } = await f(this, B).call(this, t.chain), p = (parseInt(s) || 0) * _t[a];
4083
- return this.deposit({
4084
- assetValue: t,
4085
- recipient: o,
4086
- memo: n,
4087
- router: r,
4088
- feeRate: p
4089
- });
4090
- });
4091
- P(this, Y, async ({ memo: t, assetValue: n }) => {
4092
- const a = await ln(this.stagenet);
4093
- if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
4094
- throw new m("core_chain_halted");
4095
- return this.deposit({ assetValue: n, recipient: "", memo: t });
4096
- });
4097
- P(this, K, ({ assetValue: t, ...n }) => ({
4098
- ...n,
4099
- memo: n.memo || "",
4100
- from: this.getAddress(t.chain),
4101
- assetValue: t
4102
- }));
4103
- this.stagenet = !!t;
4104
- }
4105
- }
4106
- B = new WeakMap(), te = new WeakMap(), j = new WeakMap(), N = new WeakMap(), Y = new WeakMap(), K = new WeakMap();
4107
- export {
4108
- ze as AGG_SWAP,
4109
- mn as ApiError,
4110
- W as ApiUrl,
4111
- v as AssetValue,
4112
- b as BaseDecimal,
4113
- le as BigIntArithmetics,
4114
- i as Chain,
4115
- he as ChainId,
4116
- wn as ChainIdToChain,
4117
- rt as ChainToChainId,
4118
- Ne as ChainToExplorerUrl,
4119
- bn as ChainToHexChainId,
4120
- ot as ChainToRPC,
4121
- at as ContractAddress,
4122
- fn as CosmosChainList,
4123
- st as DerivationPath,
4124
- l as ERROR_CODE,
4125
- tt as ERROR_MODULE,
4126
- ve as ERROR_TYPE,
4127
- hn as EVMChainList,
4128
- pt as ErrorCode,
4129
- k as FeeOption,
4130
- h as MemoType,
4131
- Tn as NetworkDerivationPath,
4132
- Qe as QuoteMode,
4133
- Me as RPCUrl,
4134
- be as RequestClient,
4135
- Ze as SWAP_IN,
4136
- et as SWAP_OUT,
4137
- Nn as SwapKitCore,
4138
- m as SwapKitError,
4139
- Te as SwapKitNumber,
4140
- Xe as TCAvalancheDepositABI,
4141
- Je as TCBscDepositABI,
4142
- Ke as TCEthereumVaultAbi,
4143
- _n as UTXOChainList,
4144
- dt as WalletOption,
4145
- An as assetFromString,
4146
- Mn as derivationPathToString,
4147
- cn as erc20ABI,
4148
- En as filterAssets,
4149
- He as formatBigIntToSafeValue,
4150
- _t as gasFeeMultiplier,
4151
- wt as getAssetType,
4152
- Rt as getAsymmetricAssetShare,
4153
- gn as getAsymmetricAssetWithdrawAmount,
4154
- Et as getAsymmetricRuneShare,
4155
- Rn as getAsymmetricRuneWithdrawAmount,
4156
- bt as getCommonAssetInfo,
4157
- De as getDecimal,
4158
- In as getEstimatedPoolShare,
4159
- Sn as getLiquiditySlippage,
4160
- x as getMemoFor,
4161
- Ie as getMinAmountByChain,
4162
- gt as getSymmetricPoolShare,
4163
- On as getSymmetricWithdraw,
4164
- vn as getTHORNameCost,
4165
- ft as isGasAsset,
4166
- Cn as validateTHORName
4167
- };