@swapkit/core 1.0.0-rc.114 → 1.0.0-rc.116

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.
package/dist/index.es.js CHANGED
@@ -1,2133 +1,187 @@
1
- var bt = Object.defineProperty;
2
- var ft = (e, t, n) => t in e ? bt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var m = (e, t, n) => (ft(e, typeof t != "symbol" ? t + "" : t, n), n), ht = (e, t, n) => {
4
- if (!t.has(e))
5
- throw TypeError("Cannot " + n);
1
+ var re = Object.defineProperty;
2
+ var ye = (r, e, t) => e in r ? re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var y = (r, e, t) => (ye(r, typeof e != "symbol" ? e + "" : e, t), t), ue = (r, e, t) => {
4
+ if (!e.has(r))
5
+ throw TypeError("Cannot " + t);
6
6
  };
7
- var A = (e, t, n) => (ht(e, t, "read from private field"), n ? n.call(e) : t.get(e)), V = (e, t, n) => {
8
- if (t.has(e))
7
+ var M = (r, e, t) => (ue(r, e, "read from private field"), t ? t.call(r) : e.get(r)), F = (r, e, t) => {
8
+ if (e.has(r))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
- t instanceof WeakSet ? t.add(e) : t.set(e, n);
10
+ e instanceof WeakSet ? e.add(r) : e.set(r, t);
11
11
  };
12
- const Jn = [
13
- { inputs: [], stateMutability: "nonpayable", type: "constructor" },
14
- {
15
- anonymous: !1,
16
- inputs: [
17
- { indexed: !0, internalType: "address", name: "owner", type: "address" },
18
- { indexed: !0, internalType: "address", name: "spender", type: "address" },
19
- { indexed: !1, internalType: "uint256", name: "value", type: "uint256" }
20
- ],
21
- name: "Approval",
22
- type: "event"
23
- },
24
- {
25
- anonymous: !1,
26
- inputs: [
27
- { indexed: !0, internalType: "address", name: "from", type: "address" },
28
- { indexed: !0, internalType: "address", name: "to", type: "address" },
29
- { indexed: !1, internalType: "uint256", name: "value", type: "uint256" }
30
- ],
31
- name: "Transfer",
32
- type: "event"
33
- },
34
- {
35
- inputs: [
36
- { internalType: "address", name: "", type: "address" },
37
- { internalType: "address", name: "", type: "address" }
38
- ],
39
- name: "allowance",
40
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
41
- stateMutability: "view",
42
- type: "function"
43
- },
44
- {
45
- inputs: [
46
- { internalType: "address", name: "spender", type: "address" },
47
- { internalType: "uint256", name: "value", type: "uint256" }
48
- ],
49
- name: "approve",
50
- outputs: [{ internalType: "bool", name: "success", type: "bool" }],
51
- stateMutability: "nonpayable",
52
- type: "function"
53
- },
54
- {
55
- inputs: [{ internalType: "address", name: "", type: "address" }],
56
- name: "balanceOf",
57
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
58
- stateMutability: "view",
59
- type: "function"
60
- },
61
- {
62
- inputs: [],
63
- name: "decimals",
64
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
65
- stateMutability: "view",
66
- type: "function"
67
- },
68
- {
69
- inputs: [],
70
- name: "name",
71
- outputs: [{ internalType: "string", name: "", type: "string" }],
72
- stateMutability: "view",
73
- type: "function"
74
- },
75
- {
76
- inputs: [],
77
- name: "symbol",
78
- outputs: [{ internalType: "string", name: "", type: "string" }],
79
- stateMutability: "view",
80
- type: "function"
81
- },
82
- {
83
- inputs: [],
84
- name: "totalSupply",
85
- outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
86
- stateMutability: "view",
87
- type: "function"
88
- },
89
- {
90
- inputs: [
91
- { internalType: "address", name: "to", type: "address" },
92
- { internalType: "uint256", name: "value", type: "uint256" }
93
- ],
94
- name: "transfer",
95
- outputs: [{ internalType: "bool", name: "success", type: "bool" }],
96
- stateMutability: "nonpayable",
97
- type: "function"
98
- },
99
- {
100
- inputs: [
101
- { internalType: "address", name: "from", type: "address" },
102
- { internalType: "address", name: "to", type: "address" },
103
- { internalType: "uint256", name: "value", type: "uint256" }
104
- ],
105
- name: "transferFrom",
106
- outputs: [{ internalType: "bool", name: "success", type: "bool" }],
107
- stateMutability: "nonpayable",
108
- type: "function"
109
- }
110
- ], wt = [
111
- {
112
- inputs: [{ internalType: "address", name: "rune", type: "address" }],
113
- stateMutability: "nonpayable",
114
- type: "constructor"
115
- },
116
- {
117
- anonymous: !1,
118
- inputs: [
119
- { indexed: !0, internalType: "address", name: "to", type: "address" },
120
- { indexed: !0, internalType: "address", name: "asset", type: "address" },
121
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
122
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
123
- ],
124
- name: "Deposit",
125
- type: "event"
126
- },
127
- {
128
- anonymous: !1,
129
- inputs: [
130
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
131
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
132
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
133
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
134
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
135
- ],
136
- name: "TransferAllowance",
137
- type: "event"
138
- },
139
- {
140
- anonymous: !1,
141
- inputs: [
142
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
143
- { indexed: !0, internalType: "address", name: "to", type: "address" },
144
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
145
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
146
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
147
- ],
148
- name: "TransferOut",
149
- type: "event"
150
- },
151
- {
152
- anonymous: !1,
153
- inputs: [
154
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
155
- { indexed: !1, internalType: "address", name: "target", type: "address" },
156
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
157
- { indexed: !1, internalType: "address", name: "finalAsset", type: "address" },
158
- { indexed: !1, internalType: "address", name: "to", type: "address" },
159
- { indexed: !1, internalType: "uint256", name: "amountOutMin", type: "uint256" },
160
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
161
- ],
162
- name: "TransferOutAndCall",
163
- type: "event"
164
- },
165
- {
166
- anonymous: !1,
167
- inputs: [
168
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
169
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
170
- {
171
- components: [
172
- { internalType: "address", name: "asset", type: "address" },
173
- { internalType: "uint256", name: "amount", type: "uint256" }
174
- ],
175
- indexed: !1,
176
- internalType: "struct THORChain_Router.Coin[]",
177
- name: "coins",
178
- type: "tuple[]"
179
- },
180
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
181
- ],
182
- name: "VaultTransfer",
183
- type: "event"
184
- },
185
- {
186
- inputs: [],
187
- name: "RUNE",
188
- outputs: [{ internalType: "address", name: "", type: "address" }],
189
- stateMutability: "view",
190
- type: "function"
191
- },
192
- {
193
- inputs: [
194
- { internalType: "address payable", name: "vault", type: "address" },
195
- { internalType: "address", name: "asset", type: "address" },
196
- { internalType: "uint256", name: "amount", type: "uint256" },
197
- { internalType: "string", name: "memo", type: "string" }
198
- ],
199
- name: "deposit",
200
- outputs: [],
201
- stateMutability: "payable",
202
- type: "function"
203
- },
204
- {
205
- inputs: [
206
- { internalType: "address payable", name: "vault", type: "address" },
207
- { internalType: "address", name: "asset", type: "address" },
208
- { internalType: "uint256", name: "amount", type: "uint256" },
209
- { internalType: "string", name: "memo", type: "string" },
210
- { internalType: "uint256", name: "expiration", type: "uint256" }
211
- ],
212
- name: "depositWithExpiry",
213
- outputs: [],
214
- stateMutability: "payable",
215
- type: "function"
216
- },
217
- {
218
- inputs: [
219
- { internalType: "address", name: "router", type: "address" },
220
- { internalType: "address payable", name: "asgard", type: "address" },
221
- {
222
- components: [
223
- { internalType: "address", name: "asset", type: "address" },
224
- { internalType: "uint256", name: "amount", type: "uint256" }
225
- ],
226
- internalType: "struct THORChain_Router.Coin[]",
227
- name: "coins",
228
- type: "tuple[]"
229
- },
230
- { internalType: "string", name: "memo", type: "string" }
231
- ],
232
- name: "returnVaultAssets",
233
- outputs: [],
234
- stateMutability: "payable",
235
- type: "function"
236
- },
237
- {
238
- inputs: [
239
- { internalType: "address", name: "router", type: "address" },
240
- { internalType: "address", name: "newVault", type: "address" },
241
- { internalType: "address", name: "asset", type: "address" },
242
- { internalType: "uint256", name: "amount", type: "uint256" },
243
- { internalType: "string", name: "memo", type: "string" }
244
- ],
245
- name: "transferAllowance",
246
- outputs: [],
247
- stateMutability: "nonpayable",
248
- type: "function"
249
- },
250
- {
251
- inputs: [
252
- { internalType: "address payable", name: "to", type: "address" },
253
- { internalType: "address", name: "asset", type: "address" },
254
- { internalType: "uint256", name: "amount", type: "uint256" },
255
- { internalType: "string", name: "memo", type: "string" }
256
- ],
257
- name: "transferOut",
258
- outputs: [],
259
- stateMutability: "payable",
260
- type: "function"
261
- },
262
- {
263
- inputs: [
264
- { internalType: "address payable", name: "aggregator", type: "address" },
265
- { internalType: "address", name: "finalToken", type: "address" },
266
- { internalType: "address", name: "to", type: "address" },
267
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
268
- { internalType: "string", name: "memo", type: "string" }
269
- ],
270
- name: "transferOutAndCall",
271
- outputs: [],
272
- stateMutability: "payable",
273
- type: "function"
274
- },
275
- {
276
- inputs: [
277
- { internalType: "address", name: "vault", type: "address" },
278
- { internalType: "address", name: "token", type: "address" }
279
- ],
280
- name: "vaultAllowance",
281
- outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
282
- stateMutability: "view",
283
- type: "function"
284
- }
285
- ], At = [
286
- { inputs: [], stateMutability: "nonpayable", type: "constructor" },
287
- {
288
- anonymous: !1,
289
- inputs: [
290
- { indexed: !0, internalType: "address", name: "to", type: "address" },
291
- { indexed: !0, internalType: "address", name: "asset", type: "address" },
292
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
293
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
294
- ],
295
- name: "Deposit",
296
- type: "event"
297
- },
298
- {
299
- anonymous: !1,
300
- inputs: [
301
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
302
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
303
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
304
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
305
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
306
- ],
307
- name: "TransferAllowance",
308
- type: "event"
309
- },
310
- {
311
- anonymous: !1,
312
- inputs: [
313
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
314
- { indexed: !0, internalType: "address", name: "to", type: "address" },
315
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
316
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
317
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
318
- ],
319
- name: "TransferOut",
320
- type: "event"
321
- },
322
- {
323
- anonymous: !1,
324
- inputs: [
325
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
326
- { indexed: !1, internalType: "address", name: "target", type: "address" },
327
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
328
- { indexed: !1, internalType: "address", name: "finalAsset", type: "address" },
329
- { indexed: !1, internalType: "address", name: "to", type: "address" },
330
- { indexed: !1, internalType: "uint256", name: "amountOutMin", type: "uint256" },
331
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
332
- ],
333
- name: "TransferOutAndCall",
334
- type: "event"
335
- },
336
- {
337
- anonymous: !1,
338
- inputs: [
339
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
340
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
341
- {
342
- components: [
343
- { internalType: "address", name: "asset", type: "address" },
344
- { internalType: "uint256", name: "amount", type: "uint256" }
345
- ],
346
- indexed: !1,
347
- internalType: "struct AvaxRouter.Coin[]",
348
- name: "coins",
349
- type: "tuple[]"
350
- },
351
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
352
- ],
353
- name: "VaultTransfer",
354
- type: "event"
355
- },
356
- {
357
- inputs: [
358
- { internalType: "address payable", name: "vault", type: "address" },
359
- { internalType: "address", name: "asset", type: "address" },
360
- { internalType: "uint256", name: "amount", type: "uint256" },
361
- { internalType: "string", name: "memo", type: "string" }
362
- ],
363
- name: "deposit",
364
- outputs: [],
365
- stateMutability: "payable",
366
- type: "function"
367
- },
368
- {
369
- inputs: [
370
- { internalType: "address payable", name: "vault", type: "address" },
371
- { internalType: "address", name: "asset", type: "address" },
372
- { internalType: "uint256", name: "amount", type: "uint256" },
373
- { internalType: "string", name: "memo", type: "string" },
374
- { internalType: "uint256", name: "expiration", type: "uint256" }
375
- ],
376
- name: "depositWithExpiry",
377
- outputs: [],
378
- stateMutability: "payable",
379
- type: "function"
380
- },
381
- {
382
- inputs: [
383
- { internalType: "address", name: "router", type: "address" },
384
- { internalType: "address payable", name: "asgard", type: "address" },
385
- {
386
- components: [
387
- { internalType: "address", name: "asset", type: "address" },
388
- { internalType: "uint256", name: "amount", type: "uint256" }
389
- ],
390
- internalType: "struct AvaxRouter.Coin[]",
391
- name: "coins",
392
- type: "tuple[]"
393
- },
394
- { internalType: "string", name: "memo", type: "string" }
395
- ],
396
- name: "returnVaultAssets",
397
- outputs: [],
398
- stateMutability: "payable",
399
- type: "function"
400
- },
401
- {
402
- inputs: [
403
- { internalType: "address", name: "router", type: "address" },
404
- { internalType: "address", name: "newVault", type: "address" },
405
- { internalType: "address", name: "asset", type: "address" },
406
- { internalType: "uint256", name: "amount", type: "uint256" },
407
- { internalType: "string", name: "memo", type: "string" }
408
- ],
409
- name: "transferAllowance",
410
- outputs: [],
411
- stateMutability: "nonpayable",
412
- type: "function"
413
- },
414
- {
415
- inputs: [
416
- { internalType: "address payable", name: "to", type: "address" },
417
- { internalType: "address", name: "asset", type: "address" },
418
- { internalType: "uint256", name: "amount", type: "uint256" },
419
- { internalType: "string", name: "memo", type: "string" }
420
- ],
421
- name: "transferOut",
422
- outputs: [],
423
- stateMutability: "payable",
424
- type: "function"
425
- },
426
- {
427
- inputs: [
428
- { internalType: "address payable", name: "target", type: "address" },
429
- { internalType: "address", name: "finalToken", type: "address" },
430
- { internalType: "address", name: "to", type: "address" },
431
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
432
- { internalType: "string", name: "memo", type: "string" }
433
- ],
434
- name: "transferOutAndCall",
435
- outputs: [],
436
- stateMutability: "payable",
437
- type: "function"
438
- },
439
- {
440
- inputs: [
441
- { internalType: "address", name: "vault", type: "address" },
442
- { internalType: "address", name: "token", type: "address" }
443
- ],
444
- name: "vaultAllowance",
445
- outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
446
- stateMutability: "view",
447
- type: "function"
448
- }
449
- ], gt = [
450
- { inputs: [], stateMutability: "nonpayable", type: "constructor" },
451
- {
452
- anonymous: !1,
453
- inputs: [
454
- { indexed: !0, internalType: "address", name: "to", type: "address" },
455
- { indexed: !0, internalType: "address", name: "asset", type: "address" },
456
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
457
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
458
- ],
459
- name: "Deposit",
460
- type: "event"
461
- },
462
- {
463
- anonymous: !1,
464
- inputs: [
465
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
466
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
467
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
468
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
469
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
470
- ],
471
- name: "TransferAllowance",
472
- type: "event"
473
- },
474
- {
475
- anonymous: !1,
476
- inputs: [
477
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
478
- { indexed: !0, internalType: "address", name: "to", type: "address" },
479
- { indexed: !1, internalType: "address", name: "asset", type: "address" },
480
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
481
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
482
- ],
483
- name: "TransferOut",
484
- type: "event"
485
- },
486
- {
487
- anonymous: !1,
488
- inputs: [
489
- { indexed: !0, internalType: "address", name: "vault", type: "address" },
490
- { indexed: !1, internalType: "address", name: "target", type: "address" },
491
- { indexed: !1, internalType: "uint256", name: "amount", type: "uint256" },
492
- { indexed: !1, internalType: "address", name: "finalAsset", type: "address" },
493
- { indexed: !1, internalType: "address", name: "to", type: "address" },
494
- { indexed: !1, internalType: "uint256", name: "amountOutMin", type: "uint256" },
495
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
496
- ],
497
- name: "TransferOutAndCall",
498
- type: "event"
499
- },
500
- {
501
- anonymous: !1,
502
- inputs: [
503
- { indexed: !0, internalType: "address", name: "oldVault", type: "address" },
504
- { indexed: !0, internalType: "address", name: "newVault", type: "address" },
505
- {
506
- components: [
507
- { internalType: "address", name: "asset", type: "address" },
508
- { internalType: "uint256", name: "amount", type: "uint256" }
509
- ],
510
- indexed: !1,
511
- internalType: "struct THORChain_Router.Coin[]",
512
- name: "coins",
513
- type: "tuple[]"
514
- },
515
- { indexed: !1, internalType: "string", name: "memo", type: "string" }
516
- ],
517
- name: "VaultTransfer",
518
- type: "event"
519
- },
520
- {
521
- inputs: [
522
- { internalType: "address payable", name: "vault", type: "address" },
523
- { internalType: "address", name: "asset", type: "address" },
524
- { internalType: "uint256", name: "amount", type: "uint256" },
525
- { internalType: "string", name: "memo", type: "string" },
526
- { internalType: "uint256", name: "expiration", type: "uint256" }
527
- ],
528
- name: "depositWithExpiry",
529
- outputs: [],
530
- stateMutability: "payable",
531
- type: "function"
532
- },
533
- {
534
- inputs: [
535
- { internalType: "address", name: "router", type: "address" },
536
- { internalType: "address payable", name: "asgard", type: "address" },
537
- {
538
- components: [
539
- { internalType: "address", name: "asset", type: "address" },
540
- { internalType: "uint256", name: "amount", type: "uint256" }
541
- ],
542
- internalType: "struct THORChain_Router.Coin[]",
543
- name: "coins",
544
- type: "tuple[]"
545
- },
546
- { internalType: "string", name: "memo", type: "string" }
547
- ],
548
- name: "returnVaultAssets",
549
- outputs: [],
550
- stateMutability: "payable",
551
- type: "function"
552
- },
553
- {
554
- inputs: [
555
- { internalType: "address", name: "router", type: "address" },
556
- { internalType: "address", name: "newVault", type: "address" },
557
- { internalType: "address", name: "asset", type: "address" },
558
- { internalType: "uint256", name: "amount", type: "uint256" },
559
- { internalType: "string", name: "memo", type: "string" }
560
- ],
561
- name: "transferAllowance",
562
- outputs: [],
563
- stateMutability: "nonpayable",
564
- type: "function"
565
- },
566
- {
567
- inputs: [
568
- { internalType: "address payable", name: "to", type: "address" },
569
- { internalType: "address", name: "asset", type: "address" },
570
- { internalType: "uint256", name: "amount", type: "uint256" },
571
- { internalType: "string", name: "memo", type: "string" }
572
- ],
573
- name: "transferOut",
574
- outputs: [],
575
- stateMutability: "payable",
576
- type: "function"
577
- },
578
- {
579
- inputs: [
580
- { internalType: "address payable", name: "target", type: "address" },
581
- { internalType: "address", name: "finalToken", type: "address" },
582
- { internalType: "address", name: "to", type: "address" },
583
- { internalType: "uint256", name: "amountOutMin", type: "uint256" },
584
- { internalType: "string", name: "memo", type: "string" }
585
- ],
586
- name: "transferOutAndCall",
587
- outputs: [],
588
- stateMutability: "payable",
589
- type: "function"
590
- },
591
- {
592
- inputs: [
593
- { internalType: "address", name: "vault", type: "address" },
594
- { internalType: "address", name: "token", type: "address" }
595
- ],
596
- name: "vaultAllowance",
597
- outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
598
- stateMutability: "view",
599
- type: "function"
600
- }
601
- ];
602
- var _t = /* @__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))(_t || {});
603
- const Mt = [
604
- "ERC20-ERC20",
605
- "ARC20-ARC20",
606
- "BEP20-BEP20"
607
- /* BSC_TO_BSC */
608
- ], vt = [
609
- "ERC20-TC",
610
- "ERC20-ARC20",
611
- "ERC20-BEP20",
612
- "ARC20-TC",
613
- "ARC20-ERC20",
614
- "ARC20-BEP20",
615
- "BEP20-TC",
616
- "BEP20-ERC20",
617
- "BEP20-ARC20"
618
- /* BSC_TO_AVAX */
619
- ], Ct = [
620
- "TC-TC",
621
- "TC-ERC20",
622
- "TC-ARC20",
623
- "TC-BEP20"
624
- /* TC_SUPPORTED_TO_BSC */
625
- ];
626
- var r = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dash = "DASH", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polkadot = "DOT", e.Chainflip = "FLIP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(r || {}), Et = /* @__PURE__ */ ((e) => (e.ARB = "0x0000000000000000000000000000000000000000", e.AVAX = "0x0000000000000000000000000000000000000000", e.ETH = "0x0000000000000000000000000000000000000000", e.BSC = "0x0000000000000000000000000000000000000000", e.MATIC = "0x0000000000000000000000000000000000001010", e.OP = "0x4200000000000000000000000000000000000042", e))(Et || {}), Ot = /* @__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.DASH = "m/44'/5'/0'/0", e.DOGE = "m/44'/3'/0'/0", e.DOT = "////", e.ETH = "m/44'/60'/0'/0", e.FLIP = "////", 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))(Ot || {});
627
- const Zn = {
628
- ARB: [44, 60, 0, 0, 0],
629
- AVAX: [44, 60, 0, 0, 0],
630
- BCH: [44, 145, 0, 0, 0],
631
- BNB: [44, 714, 0, 0, 0],
632
- BSC: [44, 60, 0, 0, 0],
633
- BTC: [84, 0, 0, 0, 0],
634
- DASH: [44, 5, 0, 0, 0],
635
- DOGE: [44, 3, 0, 0, 0],
636
- ETH: [44, 60, 0, 0, 0],
637
- GAIA: [44, 118, 0, 0, 0],
638
- KUJI: [44, 118, 0, 0, 0],
639
- LTC: [84, 2, 0, 0, 0],
640
- MATIC: [44, 60, 0, 0, 0],
641
- MAYA: [44, 931, 0, 0, 0],
642
- OP: [44, 60, 0, 0, 0],
643
- THOR: [44, 931, 0, 0, 0],
644
- // Polkadot and related network derivation path is not number based
645
- DOT: [0, 0, 0, 0, 0],
646
- FLIP: [0, 0, 0, 0, 0]
647
- };
648
- var g = /* @__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.DOT = 10] = "DOT", e[e.ETH = 18] = "ETH", e[e.FLIP = 18] = "FLIP", 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[e.ZEC = 8] = "ZEC", e))(g || {});
649
- const zn = [
650
- "DOT",
651
- "FLIP"
652
- /* Chainflip */
653
- ], je = [
654
- "ETH",
655
- "AVAX",
656
- "BSC",
657
- "ARB",
658
- "OP",
659
- "MATIC"
660
- /* Polygon */
661
- ], ea = je, xt = [
662
- "BTC",
663
- "BCH",
664
- "DASH",
665
- "DOGE",
666
- "LTC"
667
- /* Litecoin */
668
- ], ta = xt, kt = [
669
- "GAIA",
670
- "THOR",
671
- "BNB",
672
- "MAYA",
673
- "KUJI"
674
- /* Kujira */
675
- ], na = kt, St = [
676
- "AVAX",
677
- "BNB",
678
- "BSC",
679
- "BTC",
680
- "BCH",
681
- "GAIA",
682
- "DOGE",
683
- "ETH",
684
- "LTC",
685
- "THOR"
686
- /* THORChain */
687
- ], aa = St;
688
- var Re = /* @__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.Chainflip = "chainflip", e.Cosmos = "cosmoshub-4", e.Dash = "dash", 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.Polkadot = "polkadot", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(Re || {}), Ke = /* @__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.Chainflip = "wss://mainnet-archive.chainflip.io", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Dash = "https://node-router.thorswap.net/dash", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Kujira = "https://rpc-kujira.synergynodes.com/", 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.Polkadot = "wss://rpc.polkadot.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(Ke || {}), U = /* @__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.net", e.ThorswapStatic = "https://static.thorswap.net", e))(U || {});
689
- const ce = Object.values(r), Rt = Object.keys(r), Ie = ce.reduce(
690
- (e, t) => {
691
- const n = Rt.find((a) => r[a] === t);
692
- return n && (e[t] = n), e;
693
- },
694
- {}
695
- ), Qe = ce.reduce(
696
- (e, t) => (e[t] = Re[Ie[t]], e),
697
- {}
698
- ), It = ce.reduce(
699
- (e, t) => (e[t] = Ke[Ie[t]], e),
700
- {}
701
- ), ia = ce.reduce(
702
- (e, t) => {
703
- const n = `${Ie[t]}Hex`;
704
- return e[t] = Re[n], e;
705
- },
706
- {}
707
- ), sa = {
708
- "0xa4b1": "ARB",
709
- 42161: "ARB",
710
- "0xa86a": "AVAX",
711
- 43114: "AVAX",
712
- "0x38": "BSC",
713
- 56: "BSC",
714
- "Binance-Chain-Tigris": "BNB",
715
- bitcoincash: "BCH",
716
- bitcoin: "BTC",
717
- chainflip: "FLIP",
718
- "cosmoshub-4": "GAIA",
719
- dash: "DASH",
720
- dogecoin: "DOGE",
721
- "0x1": "ETH",
722
- "kaiyo-1": "KUJI",
723
- 1: "ETH",
724
- litecoin: "LTC",
725
- "mayachain-stagenet-v1": "MAYA",
726
- "mayachain-mainnet-v1": "MAYA",
727
- "0xa": "OP",
728
- 10: "OP",
729
- polkadot: "DOT",
730
- "0x89": "MATIC",
731
- 137: "MATIC",
732
- "thorchain-stagenet-v2": "THOR",
733
- "thorchain-mainnet-v1": "THOR"
734
- /* THORChain */
735
- }, Ye = {
736
- ARB: "https://arbiscan.io",
737
- AVAX: "https://snowtrace.io",
738
- BSC: "https://bscscan.com",
739
- BNB: "https://explorer.binance.org",
740
- BCH: "https://www.blockchair.com/bitcoin-cash",
741
- BTC: "https://blockchair.com/bitcoin",
742
- FLIP: "https://explorer.polkascan.io/polkadot",
743
- GAIA: "https://cosmos.bigdipper.live",
744
- DASH: "https://blockchair.com/dash",
745
- DOGE: "https://blockchair.com/dogecoin",
746
- KUJI: "https://finder.kujira.network/kaiyo-1",
747
- ETH: "https://etherscan.io",
748
- LTC: "https://blockchair.com/litecoin",
749
- MAYA: "https://www.mayascan.org",
750
- OP: "https://optimistic.etherscan.io",
751
- DOT: "https://polkadot.subscan.io/",
752
- MATIC: "https://polygonscan.com",
753
- THOR: "https://runescan.io"
754
- };
755
- var w = /* @__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))(w || {}), Y = /* @__PURE__ */ ((e) => (e.Average = "average", e.Fast = "fast", e.Fastest = "fastest", e))(Y || {}), Bt = /* @__PURE__ */ ((e) => (e.KEYSTORE = "KEYSTORE", e.KEEPKEY = "KEEPKEY", 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.OKX_MOBILE = "OKX_MOBILE", e.BRAVE = "BRAVE", e.WALLETCONNECT = "WALLETCONNECT", e))(Bt || {}), Pt = /* @__PURE__ */ ((e) => (e[e.NoError = 36864] = "NoError", e[e.LockedDevice = 21781] = "LockedDevice", e[e.TC_NotFound = 65535] = "TC_NotFound", e))(Pt || {}), Ht = Object.defineProperty, Dt = (e, t, n) => t in e ? Ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, P = (e, t, n) => (Dt(e, typeof t != "symbol" ? t + "" : t, n), n), Ft = (e, t, n) => {
756
- if (!t.has(e))
757
- throw TypeError("Cannot " + n);
758
- }, Z = (e, t, n) => {
759
- if (t.has(e))
760
- throw TypeError("Cannot add the same private member more than once");
761
- t instanceof WeakSet ? t.add(e) : t.set(e, n);
762
- }, E = (e, t, n) => (Ft(e, t, "access private method"), n), be = /* @__PURE__ */ ((e) => (e.Arbitrum = "ARB", e.Avalanche = "AVAX", e.Binance = "BNB", e.BinanceSmartChain = "BSC", e.Bitcoin = "BTC", e.BitcoinCash = "BCH", e.Cosmos = "GAIA", e.Dash = "DASH", e.Dogecoin = "DOGE", e.Ethereum = "ETH", e.Kujira = "KUJI", e.Litecoin = "LTC", e.Maya = "MAYA", e.Optimism = "OP", e.Polkadot = "DOT", e.Chainflip = "FLIP", e.Polygon = "MATIC", e.THORChain = "THOR", e))(be || {}), Be = /* @__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.Chainflip = "chainflip", e.Cosmos = "cosmoshub-4", e.Dash = "dash", 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.Polkadot = "polkadot", e.Polygon = "137", e.PolygonHex = "0x89", e.THORChain = "thorchain-mainnet-v1", e.THORChainStagenet = "thorchain-stagenet-v2", e))(Be || {}), Je = /* @__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.Chainflip = "wss://mainnet-archive.chainflip.io", e.Cosmos = "https://node-router.thorswap.net/cosmos/rpc", e.Dash = "https://node-router.thorswap.net/dash", e.Dogecoin = "https://node-router.thorswap.net/dogecoin", e.Ethereum = "https://node-router.thorswap.net/ethereum", e.Kujira = "https://rpc-kujira.synergynodes.com/", 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.Polkadot = "wss://rpc.polkadot.io", e.Polygon = "https://polygon-rpc.com", e.THORChain = "https://rpc.thorswap.net", e.THORChainStagenet = "https://stagenet-rpc.ninerealms.com", e))(Je || {}), N = /* @__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.net", e.ThorswapStatic = "https://static.thorswap.net", e))(N || {});
763
- const fe = Object.values(be), Lt = Object.keys(be), Pe = fe.reduce(
764
- (e, t) => {
765
- const n = Lt.find((a) => be[a] === t);
766
- return n && (e[t] = n), e;
767
- },
768
- {}
769
- );
770
- fe.reduce(
771
- (e, t) => (e[t] = Be[Pe[t]], e),
772
- {}
773
- );
774
- fe.reduce(
775
- (e, t) => (e[t] = Je[Pe[t]], e),
776
- {}
777
- );
778
- fe.reduce(
779
- (e, t) => {
780
- const n = `${Pe[t]}Hex`;
781
- return e[t] = Be[n], e;
782
- },
783
- {}
784
- );
785
- class Ve extends Error {
786
- constructor(t, n, a) {
787
- const i = t.status || t.status === 0 ? t.status : "", s = t.statusText || "", p = `${i} ${s}`.trim(), u = p ? `status code ${p}` : "an unknown error";
788
- super(`Request failed with ${u}`), Object.defineProperty(this, "response", {
789
- enumerable: !0,
790
- configurable: !0,
791
- writable: !0,
792
- value: void 0
793
- }), Object.defineProperty(this, "request", {
794
- enumerable: !0,
795
- configurable: !0,
796
- writable: !0,
797
- value: void 0
798
- }), Object.defineProperty(this, "options", {
799
- enumerable: !0,
800
- configurable: !0,
801
- writable: !0,
802
- value: void 0
803
- }), this.name = "HTTPError", this.response = t, this.request = n, this.options = a;
804
- }
805
- }
806
- class Ze extends Error {
807
- constructor(t) {
808
- super("Request timed out"), Object.defineProperty(this, "request", {
809
- enumerable: !0,
810
- configurable: !0,
811
- writable: !0,
812
- value: void 0
813
- }), this.name = "TimeoutError", this.request = t;
814
- }
815
- }
816
- const pe = (e) => e !== null && typeof e == "object", re = (...e) => {
817
- for (const t of e)
818
- if ((!pe(t) || Array.isArray(t)) && t !== void 0)
819
- throw new TypeError("The `options` argument must be an object");
820
- return He({}, ...e);
821
- }, ze = (e = {}, t = {}) => {
822
- const n = new globalThis.Headers(e), a = t instanceof globalThis.Headers, i = new globalThis.Headers(t);
823
- for (const [s, p] of i.entries())
824
- a && p === "undefined" || p === void 0 ? n.delete(s) : n.set(s, p);
825
- return n;
826
- }, He = (...e) => {
827
- let t = {}, n = {};
828
- for (const a of e)
829
- if (Array.isArray(a))
830
- Array.isArray(t) || (t = []), t = [...t, ...a];
831
- else if (pe(a)) {
832
- for (let [i, s] of Object.entries(a))
833
- pe(s) && i in t && (s = He(t[i], s)), t = { ...t, [i]: s };
834
- pe(a.headers) && (n = ze(n, a.headers), t.headers = n);
835
- }
836
- return t;
837
- }, Vt = (() => {
838
- let e = !1, t = !1;
839
- const n = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
840
- return n && a && (t = new globalThis.Request("https://empty.invalid", {
841
- body: new globalThis.ReadableStream(),
842
- method: "POST",
843
- // @ts-expect-error - Types are outdated.
844
- get duplex() {
845
- return e = !0, "half";
846
- }
847
- }).headers.has("Content-Type")), e && !t;
848
- })(), Nt = typeof globalThis.AbortController == "function", qt = typeof globalThis.ReadableStream == "function", Wt = typeof globalThis.FormData == "function", et = ["get", "post", "put", "patch", "head", "delete"], $t = {
849
- json: "application/json",
850
- text: "text/*",
851
- formData: "multipart/form-data",
852
- arrayBuffer: "*/*",
853
- blob: "*/*"
854
- }, Ae = 2147483647, tt = Symbol("stop"), Ut = {
855
- json: !0,
856
- parseJson: !0,
857
- searchParams: !0,
858
- prefixUrl: !0,
859
- retry: !0,
860
- timeout: !0,
861
- hooks: !0,
862
- throwHttpErrors: !0,
863
- onDownloadProgress: !0,
864
- fetch: !0
865
- }, Xt = {
866
- method: !0,
867
- headers: !0,
868
- body: !0,
869
- mode: !0,
870
- credentials: !0,
871
- cache: !0,
872
- redirect: !0,
873
- referrer: !0,
874
- referrerPolicy: !0,
875
- integrity: !0,
876
- keepalive: !0,
877
- signal: !0,
878
- window: !0,
879
- dispatcher: !0,
880
- duplex: !0
881
- }, Gt = (e) => et.includes(e) ? e.toUpperCase() : e, jt = ["get", "put", "head", "delete", "options", "trace"], Kt = [408, 413, 429, 500, 502, 503, 504], nt = [413, 429, 503], Ne = {
882
- limit: 2,
883
- methods: jt,
884
- statusCodes: Kt,
885
- afterStatusCodes: nt,
886
- maxRetryAfter: Number.POSITIVE_INFINITY,
887
- backoffLimit: Number.POSITIVE_INFINITY,
888
- delay: (e) => 0.3 * 2 ** (e - 1) * 1e3
889
- }, Qt = (e = {}) => {
890
- if (typeof e == "number")
891
- return {
892
- ...Ne,
893
- limit: e
894
- };
895
- if (e.methods && !Array.isArray(e.methods))
896
- throw new Error("retry.methods must be an array");
897
- if (e.statusCodes && !Array.isArray(e.statusCodes))
898
- throw new Error("retry.statusCodes must be an array");
899
- return {
900
- ...Ne,
901
- ...e,
902
- afterStatusCodes: nt
903
- };
904
- };
905
- async function Yt(e, t, n, a) {
906
- return new Promise((i, s) => {
907
- const p = setTimeout(() => {
908
- n && n.abort(), s(new Ze(e));
909
- }, a.timeout);
910
- a.fetch(e, t).then(i).catch(s).then(() => {
911
- clearTimeout(p);
912
- });
913
- });
914
- }
915
- async function Jt(e, { signal: t }) {
916
- return new Promise((n, a) => {
917
- t && (t.throwIfAborted(), t.addEventListener("abort", i, { once: !0 }));
918
- function i() {
919
- clearTimeout(s), a(t.reason);
920
- }
921
- const s = setTimeout(() => {
922
- t == null || t.removeEventListener("abort", i), n();
923
- }, e);
924
- });
925
- }
926
- const Zt = (e, t) => {
927
- const n = {};
928
- for (const a in t)
929
- !(a in Xt) && !(a in Ut) && !(a in e) && (n[a] = t[a]);
930
- return n;
931
- };
932
- class oe {
933
- static create(t, n) {
934
- const a = new oe(t, n), i = async () => {
935
- if (typeof a._options.timeout == "number" && a._options.timeout > Ae)
936
- throw new RangeError(`The \`timeout\` option cannot be greater than ${Ae}`);
937
- await Promise.resolve();
938
- let p = await a._fetch();
939
- for (const u of a._options.hooks.afterResponse) {
940
- const y = await u(a.request, a._options, a._decorateResponse(p.clone()));
941
- y instanceof globalThis.Response && (p = y);
942
- }
943
- if (a._decorateResponse(p), !p.ok && a._options.throwHttpErrors) {
944
- let u = new Ve(p, a.request, a._options);
945
- for (const y of a._options.hooks.beforeError)
946
- u = await y(u);
947
- throw u;
948
- }
949
- if (a._options.onDownloadProgress) {
950
- if (typeof a._options.onDownloadProgress != "function")
951
- throw new TypeError("The `onDownloadProgress` option must be a function");
952
- if (!qt)
953
- throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
954
- return a._stream(p.clone(), a._options.onDownloadProgress);
955
- }
956
- return p;
957
- }, s = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(i) : i();
958
- for (const [p, u] of Object.entries($t))
959
- s[p] = async () => {
960
- a.request.headers.set("accept", a.request.headers.get("accept") || u);
961
- const y = (await s).clone();
962
- if (p === "json") {
963
- if (y.status === 204 || (await y.clone().arrayBuffer()).byteLength === 0)
964
- return "";
965
- if (n.parseJson)
966
- return n.parseJson(await y.text());
967
- }
968
- return y[p]();
969
- };
970
- return s;
971
- }
972
- // eslint-disable-next-line complexity
973
- constructor(t, n = {}) {
974
- Object.defineProperty(this, "request", {
975
- enumerable: !0,
976
- configurable: !0,
977
- writable: !0,
978
- value: void 0
979
- }), Object.defineProperty(this, "abortController", {
980
- enumerable: !0,
981
- configurable: !0,
982
- writable: !0,
983
- value: void 0
984
- }), Object.defineProperty(this, "_retryCount", {
985
- enumerable: !0,
986
- configurable: !0,
987
- writable: !0,
988
- value: 0
989
- }), Object.defineProperty(this, "_input", {
990
- enumerable: !0,
991
- configurable: !0,
992
- writable: !0,
993
- value: void 0
994
- }), Object.defineProperty(this, "_options", {
995
- enumerable: !0,
996
- configurable: !0,
997
- writable: !0,
998
- value: void 0
999
- }), this._input = t;
1000
- const a = "credentials" in Request.prototype;
1001
- if (this._options = {
1002
- credentials: a ? this._input.credentials : void 0,
1003
- ...n,
1004
- headers: ze(this._input.headers, n.headers),
1005
- hooks: He({
1006
- beforeRequest: [],
1007
- beforeRetry: [],
1008
- beforeError: [],
1009
- afterResponse: []
1010
- }, n.hooks),
1011
- method: Gt(n.method ?? this._input.method),
1012
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
1013
- prefixUrl: String(n.prefixUrl || ""),
1014
- retry: Qt(n.retry),
1015
- throwHttpErrors: n.throwHttpErrors !== !1,
1016
- timeout: n.timeout ?? 1e4,
1017
- fetch: n.fetch ?? globalThis.fetch.bind(globalThis)
1018
- }, typeof this._input != "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request))
1019
- throw new TypeError("`input` must be a string, URL, or Request");
1020
- if (this._options.prefixUrl && typeof this._input == "string") {
1021
- if (this._input.startsWith("/"))
1022
- throw new Error("`input` must not begin with a slash when using `prefixUrl`");
1023
- this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
1024
- }
1025
- if (Nt) {
1026
- if (this.abortController = new globalThis.AbortController(), this._options.signal) {
1027
- const i = this._options.signal;
1028
- this._options.signal.addEventListener("abort", () => {
1029
- this.abortController.abort(i.reason);
1030
- });
1031
- }
1032
- this._options.signal = this.abortController.signal;
1033
- }
1034
- if (Vt && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
1035
- const i = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, i);
1036
- (Wt && 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);
1037
- }
1038
- 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 }));
1039
- }
1040
- _calculateRetryDelay(t) {
1041
- if (this._retryCount++, this._retryCount <= this._options.retry.limit && !(t instanceof Ze)) {
1042
- if (t instanceof Ve) {
1043
- if (!this._options.retry.statusCodes.includes(t.response.status))
1044
- return 0;
1045
- const a = t.response.headers.get("Retry-After");
1046
- if (a && this._options.retry.afterStatusCodes.includes(t.response.status)) {
1047
- let i = Number(a);
1048
- return Number.isNaN(i) ? i = Date.parse(a) - Date.now() : i *= 1e3, this._options.retry.maxRetryAfter !== void 0 && i > this._options.retry.maxRetryAfter ? 0 : i;
1049
- }
1050
- if (t.response.status === 413)
1051
- return 0;
1052
- }
1053
- const n = this._options.retry.delay(this._retryCount);
1054
- return Math.min(this._options.retry.backoffLimit, n);
1055
- }
1056
- return 0;
1057
- }
1058
- _decorateResponse(t) {
1059
- return this._options.parseJson && (t.json = async () => this._options.parseJson(await t.text())), t;
1060
- }
1061
- async _retry(t) {
1062
- try {
1063
- return await t();
1064
- } catch (n) {
1065
- const a = Math.min(this._calculateRetryDelay(n), Ae);
1066
- if (a !== 0 && this._retryCount > 0) {
1067
- await Jt(a, { signal: this._options.signal });
1068
- for (const i of this._options.hooks.beforeRetry)
1069
- if (await i({
1070
- request: this.request,
1071
- options: this._options,
1072
- error: n,
1073
- retryCount: this._retryCount
1074
- }) === tt)
1075
- return;
1076
- return this._retry(t);
1077
- }
1078
- throw n;
1079
- }
1080
- }
1081
- async _fetch() {
1082
- for (const n of this._options.hooks.beforeRequest) {
1083
- const a = await n(this.request, this._options);
1084
- if (a instanceof Request) {
1085
- this.request = a;
1086
- break;
1087
- }
1088
- if (a instanceof Response)
1089
- return a;
1090
- }
1091
- const t = Zt(this.request, this._options);
1092
- return this._options.timeout === !1 ? this._options.fetch(this.request.clone(), t) : Yt(this.request.clone(), t, this.abortController, this._options);
1093
- }
1094
- /* istanbul ignore next */
1095
- _stream(t, n) {
1096
- const a = Number(t.headers.get("content-length")) || 0;
1097
- let i = 0;
1098
- return t.status === 204 ? (n && n({ percent: 1, totalBytes: a, transferredBytes: i }, new Uint8Array()), new globalThis.Response(null, {
1099
- status: t.status,
1100
- statusText: t.statusText,
1101
- headers: t.headers
1102
- })) : new globalThis.Response(new globalThis.ReadableStream({
1103
- async start(s) {
1104
- const p = t.body.getReader();
1105
- n && n({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
1106
- async function u() {
1107
- const { done: y, value: o } = await p.read();
1108
- if (y) {
1109
- s.close();
1110
- return;
1111
- }
1112
- if (n) {
1113
- i += o.byteLength;
1114
- const l = a === 0 ? 0 : i / a;
1115
- n({ percent: l, transferredBytes: i, totalBytes: a }, o);
1116
- }
1117
- s.enqueue(o), await u();
1118
- }
1119
- await u();
1120
- }
1121
- }), {
1122
- status: t.status,
1123
- statusText: t.statusText,
1124
- headers: t.headers
1125
- });
1126
- }
1127
- }
1128
- /*! MIT License © Sindre Sorhus */
1129
- const Ce = (e) => {
1130
- const t = (n, a) => oe.create(n, re(e, a));
1131
- for (const n of et)
1132
- t[n] = (a, i) => oe.create(a, re(e, i, { method: n }));
1133
- return t.create = (n) => Ce(re(n)), t.extend = (n) => Ce(re(e, n)), t.stop = tt, t;
1134
- }, at = Ce();
1135
- let ue;
1136
- const L = {
1137
- CachedPrices: `${N.ThorswapApi}/tokenlist/cached-price`,
1138
- GasRates: `${N.ThorswapApi}/resource-worker/gasPrice/getAll`,
1139
- Quote: `${N.ThorswapApi}/aggregator/tokens/quote`,
1140
- Txn: `${N.ThorswapApi}/apiusage/v2/txn`,
1141
- TokenlistProviders: `${N.ThorswapApi}/tokenlist/providers`,
1142
- TokenList: `${N.ThorswapStatic}/token-list`,
1143
- Thorname: `${N.ThorswapApi}/thorname`
1144
- }, it = typeof window < "u" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" }, qe = () => ue || (ue = at.create({ headers: it }), ue), ra = ({ apiKey: e, ...t }) => {
1145
- ue = at.create({
1146
- ...t,
1147
- headers: { ...it, ...t.headers, "x-api-key": e }
1148
- });
1149
- }, x = {
1150
- get: (e, t) => qe().get(e, t).json(),
1151
- post: (e, t) => qe().post(e, t).json()
1152
- }, zt = ({ tokens: e, ...t }) => {
1153
- const n = new URLSearchParams(), a = e.filter(
1154
- (i, s, p) => p.findIndex((u) => u === i) === s
1155
- );
1156
- for (const i of a)
1157
- n.append("tokens", JSON.stringify(i));
1158
- return t.metadata && n.append("metadata", "true"), t.lookup && n.append("lookup", "true"), t.sparkline && n.append("sparkline", "true"), x.post(L.CachedPrices, {
1159
- body: n.toString(),
1160
- headers: { "Content-Type": "application/x-www-form-urlencoded" }
1161
- });
1162
- }, pa = {
1163
- getCachedPrices: zt,
1164
- getQuote: (e) => x.get(L.Quote, { searchParams: e }),
1165
- getGasRates: () => x.get(L.GasRates),
1166
- getTxnDetails: (e) => x.get(L.Txn, { searchParams: e }),
1167
- getTokenlistProviders: () => x.get(L.TokenlistProviders),
1168
- getTokenList: (e) => x.get(`${L.TokenList}/${e}.json`),
1169
- getThornameAddresses: (e) => x.get(`${L.Thorname}/${e}`),
1170
- getThornameRegisteredChains: (e) => x.get(`${L.Thorname}/chains/${e}`),
1171
- getThornameRlookup: (e, t) => x.get(`${L.Thorname}/rlookup`, { searchParams: { address: e, chain: t } })
1172
- };
1173
- var en = /* @__PURE__ */ ((e) => (e.SWAP_TC_TO_TC = "SWAP:TC-TC", e.SWAP_ETH_TO_TC = "SWAP:ERC20-TC", e.SWAP_TC_TO_ETH = "SWAP:TC-ERC20", e.SWAP_ETH_TO_ETH = "SWAP:ERC20-ERC20", e.SWAP_AVAX_TO_TC = "SWAP:AVAX-TC", e.SWAP_TC_TO_AVAX = "SWAP:TC-AVAX", e.SWAP_AVAX_TO_AVAX = "SWAP:AVAX-AVAX", e.SWAP_ETH_TO_AVAX = "SWAP:ETH-AVAX", e.SWAP_AVAX_TO_ETH = "SWAP:AVAX-ETH", e.SWAP_TC_TO_GAIA = "SWAP:TC-GAIA", e.SWAP_GAIA_TO_TC = "SWAP:GAIA-TC", e.SWAP_TC_TO_BNB = "SWAP:TC-BNB", e.SWAP_BNB_TO_TC = "SWAP:BNB-TC", e.SWAP_TC_TO_BTC = "SWAP:TC-BTC", e.SWAP_BTC_TO_TC = "SWAP:BTC-TC", e.SWAP_TC_TO_BCH = "SWAP:TC-BCH", e.SWAP_BCH_TO_TC = "SWAP:BCH-TC", e.SWAP_TC_TO_LTC = "SWAP:TC-LTC", e.SWAP_LTC_TO_TC = "SWAP:LTC-TC", e.SWAP_TC_TO_DOGE = "SWAP:TC-DOGE", e.SWAP_DOGE_TO_TC = "SWAP:DOGE-TC", e.TC_STATUS = "TC:STATUS", e.TC_TRANSFER = "TC:TRANSFER", e.TC_DEPOSIT = "TC:DEPOSIT", e.TC_SEND = "TC:SEND", e.TC_SWITCH = "TC:SWITCH", e.TC_LP_ADD = "TC:ADDLIQUIDITY", e.TC_LP_WITHDRAW = "TC:WITHDRAW", e.TC_TNS_CREATE = "TC:TNS-CREATE", e.TC_TNS_EXTEND = "TC:TNS-EXTEND", e.TC_TNS_UPDATE = "TC:TNS-UPDATE", e.TC_SAVINGS_ADD = "TC:ADDSAVINGS", e.TC_SAVINGS_WITHDRAW = "TC:WITHDRAWSAVINGS", e.TC_LENDING_OPEN = "TC:LENDINGOPEN", e.TC_LENDING_CLOSE = "TC:LENDINGCLOSE", e.ETH_APPROVAL = "ETH:APPROVAL", e.ETH_STATUS = "ETH:STATUS", e.ETH_TRANSFER_TO_TC = "ETH:TRANSFER:IN", e.ETH_TRANSFER_FROM_TC = "ETH:TRANSFER:OUT", e.AVAX_APPROVAL = "AVAX:APPROVAL", e.AVAX_STATUS = "AVAX:STATUS", e.AVAX_TRANSFER_TO_TC = "AVAX:TRANSFER:IN", e.AVAX_TRANSFER_FROM_TC = "AVAX:TRANSFER:OUT", e.BSC_APPROVAL = "BSC:APPROVAL", e.BSC_STATUS = "BSC:STATUS", e.BSC_TRANSFER_TO_TC = "BSC:TRANSFER:IN", e.BSC_TRANSFER_FROM_TC = "BSC:TRANSFER:OUT", e.APPROVAL = "APPROVAL", e.STATUS = "STATUS", e.TRANSFER_TO_TC = "TRANSFER:IN", e.TRANSFER_FROM_TC = "TRANSFER:OUT", e.UNSUPPORTED = "UNSUPPORTED", e.TC_LENDING = "TC:LENDING", e))(en || {}), tn = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.SUCCESS = "success", e.CANCELLED = "cancelled", e.REFUNDED = "refunded", e.REPLACED = "replaced", e.ERROR = "error", e.UNKNOWN = "unknown", e.NOT_STARTED = "not_started", e.NOT_FOUND = "not_found", e.RETRIES_EXCEEDED = "retries_exceeded", e.STREAMING = "streaming", e))(tn || {}), nn = /* @__PURE__ */ ((e) => (e[e.NOT_STARTED = 0] = "NOT_STARTED", e[e.SUCCESS = 1] = "SUCCESS", e[e.REFUNDED = 2] = "REFUNDED", e))(nn || {});
1174
- const an = "0x313ce567", st = async ({ chain: e, to: t }) => {
1175
- try {
1176
- const { result: n } = await x.post(It[e], {
1177
- headers: {
1178
- accept: "*/*",
1179
- "content-type": "application/json",
1180
- "cache-control": "no-cache"
1181
- },
1182
- body: JSON.stringify({
1183
- id: 44,
1184
- jsonrpc: "2.0",
1185
- method: "eth_call",
1186
- params: [{ to: t.toLowerCase(), data: an }, "latest"]
1187
- })
1188
- });
1189
- return Number.parseInt(BigInt(n).toString());
1190
- } catch (n) {
1191
- return console.error(n), g[e];
1192
- }
1193
- }, sn = (e) => {
1194
- if (e === r.Ethereum)
1195
- return g.ETH;
1196
- const [, t] = e.split("-");
1197
- return t != null && t.startsWith("0x") ? st({ chain: r.Ethereum, to: t }) : g.ETH;
1198
- }, rn = (e) => {
1199
- const [, t] = e.split("-");
1200
- return t != null && t.startsWith("0x") ? st({ chain: r.Avalanche, to: t.toLowerCase() }) : g.AVAX;
1201
- }, pn = (e) => (e === r.BinanceSmartChain, g.BSC), un = ({ chain: e, symbol: t }) => {
1202
- switch (e) {
1203
- case r.Ethereum:
1204
- return sn(t);
1205
- case r.Avalanche:
1206
- return rn(t);
1207
- case r.BinanceSmartChain:
1208
- return pn(t);
1209
- default:
1210
- return g[e];
1211
- }
1212
- }, yn = {
1213
- [Y.Average]: 1.2,
1214
- [Y.Fast]: 1.5,
1215
- [Y.Fastest]: 2
1216
- }, rt = ({ chain: e, symbol: t }) => {
1217
- switch (e) {
1218
- case r.Arbitrum:
1219
- case r.Optimism:
1220
- return t === "ETH";
1221
- case r.Maya:
1222
- return t === "CACAO";
1223
- case r.Kujira:
1224
- return t === "KUJI";
1225
- case r.Cosmos:
1226
- return t === "ATOM";
1227
- case r.Polygon:
1228
- return t === "MATIC";
1229
- case r.BinanceSmartChain:
1230
- return t === "BNB";
1231
- case r.THORChain:
1232
- return t === "RUNE";
1233
- default:
1234
- return t === e;
1235
- }
1236
- }, on = (e) => {
1237
- switch (e) {
1238
- case `${r.Ethereum}.THOR`:
1239
- return { identifier: "ETH.THOR-0xa5f2211b9b8170f694421f2046281775e8468044", decimal: 18 };
1240
- case `${r.Ethereum}.vTHOR`:
1241
- return { identifier: "ETH.vTHOR-0x815c23eca83261b6ec689b60cc4a58b54bc24d8d", decimal: 18 };
1242
- case r.Cosmos:
1243
- return { identifier: "GAIA.ATOM", decimal: g[e] };
1244
- case r.THORChain:
1245
- return { identifier: "THOR.RUNE", decimal: g[e] };
1246
- case r.BinanceSmartChain:
1247
- return { identifier: "BSC.BNB", decimal: g[e] };
1248
- case r.Maya:
1249
- return { identifier: "MAYA.CACAO", decimal: g.MAYA };
1250
- case `${r.Maya}.MAYA`:
1251
- return { identifier: "MAYA.MAYA", decimal: 4 };
1252
- case `${r.Kujira}.USK`:
1253
- return { identifier: `${r.Kujira}.USK`, decimal: 6 };
1254
- default:
1255
- return { identifier: `${e}.${e}`, decimal: g[e] };
1256
- }
1257
- }, dn = ({ chain: e, symbol: t }) => {
1258
- if (t.includes("/"))
1259
- return "Synth";
1260
- switch (e) {
1261
- case r.Cosmos:
1262
- return t === "ATOM" ? "Native" : r.Cosmos;
1263
- case r.Kujira:
1264
- return t === r.Kujira ? "Native" : r.Kujira;
1265
- case r.Binance:
1266
- return t === r.Binance ? "Native" : "BEP2";
1267
- case r.BinanceSmartChain:
1268
- return t === r.Binance ? "Native" : "BEP20";
1269
- case r.Ethereum:
1270
- return t === r.Ethereum ? "Native" : "ERC20";
1271
- case r.Avalanche:
1272
- return t === r.Avalanche ? "Native" : r.Avalanche;
1273
- case r.Polygon:
1274
- return t === r.Polygon ? "Native" : "POLYGON";
1275
- case r.Arbitrum:
1276
- return [r.Ethereum, r.Arbitrum].includes(t) ? "Native" : "ARBITRUM";
1277
- case r.Optimism:
1278
- return [r.Ethereum, r.Optimism].includes(t) ? "Native" : "OPTIMISM";
1279
- default:
1280
- return "Native";
1281
- }
1282
- }, ua = (e) => {
1283
- var t;
1284
- const [n, ...a] = e.split("."), i = e.includes("/"), s = a.join("."), p = (t = s == null ? void 0 : s.split("-")) == null ? void 0 : t[0];
1285
- return { chain: n, symbol: s, ticker: p, synth: i };
1286
- }, ln = new RegExp(
1287
- /(.)\1{6}|\.ORG|\.NET|\.FINANCE|\.COM|WWW|HTTP|\\\\|\/\/|[\s$%:[\]]/,
1288
- "gmi"
1289
- ), mn = (e) => {
1290
- const [t, n] = e.split(".");
1291
- if (!je.includes(t))
1292
- return !0;
1293
- const [, a] = n.split("-");
1294
- return rt({ chain: t, symbol: n }) || !!a;
1295
- }, ya = (e) => e.filter(({ chain: t, value: n, symbol: a }) => {
1296
- const i = `${t}.${a}`;
1297
- return !ln.test(i) && mn(i) && n !== "0";
1298
- });
1299
- function Tn({
1300
- liquidityUnits: e,
1301
- poolUnits: t,
1302
- runeDepth: n
1303
- }) {
1304
- const a = S(e), i = S(t), s = S(n), p = a.mul(s), u = i.mul(i).mul(2), y = i.mul(a).mul(2), o = a.mul(a), l = i.mul(i).mul(i);
1305
- return p.mul(u.sub(y).add(o)).div(l);
1306
- }
1307
- function cn({
1308
- liquidityUnits: e,
1309
- poolUnits: t,
1310
- assetDepth: n
1311
- }) {
1312
- const a = S(e), i = S(t), s = S(n), p = a.mul(s), u = i.mul(i).mul(2), y = i.mul(a).mul(2), o = a.mul(a), l = p.mul(u.sub(y).add(o)), b = i.mul(i).mul(i);
1313
- return l.div(b);
1314
- }
1315
- function oa({
1316
- percent: e,
1317
- runeDepth: t,
1318
- liquidityUnits: n,
1319
- poolUnits: a
1320
- }) {
1321
- return Tn({ runeDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
1322
- }
1323
- function da({
1324
- percent: e,
1325
- assetDepth: t,
1326
- liquidityUnits: n,
1327
- poolUnits: a
1328
- }) {
1329
- return cn({ assetDepth: t, liquidityUnits: n, poolUnits: a }).mul(e);
1330
- }
1331
- function S(e) {
1332
- return F.fromBigInt(BigInt(e), g.THOR);
1333
- }
1334
- function bn({
1335
- liquidityUnits: e,
1336
- poolUnits: t,
1337
- runeDepth: n,
1338
- assetDepth: a
1339
- }) {
1340
- return {
1341
- assetAmount: S(a).mul(e).div(t),
1342
- runeAmount: S(n).mul(e).div(t)
1343
- };
1344
- }
1345
- function la({
1346
- liquidityUnits: e,
1347
- poolUnits: t,
1348
- runeDepth: n,
1349
- assetDepth: a,
1350
- percent: i
1351
- }) {
1352
- return Object.fromEntries(
1353
- Object.entries(bn({ liquidityUnits: e, poolUnits: t, runeDepth: n, assetDepth: a })).map(
1354
- ([s, p]) => [s, p.mul(i)]
1355
- )
1356
- );
1357
- }
1358
- function ma({
1359
- runeDepth: e,
1360
- poolUnits: t,
1361
- assetDepth: n,
1362
- liquidityUnits: a,
1363
- runeAmount: i,
1364
- assetAmount: s
1365
- }) {
1366
- const p = new F({ value: e, decimal: 8 }), u = new F({ value: n, decimal: 8 }), y = new F({ value: t, decimal: 8 }), o = new F({ value: i, decimal: 8 }), l = new F({ value: s, decimal: 8 }), b = o.mul(u), T = l.mul(p), f = o.mul(l), _ = p.mul(u), M = y.mul(b.add(T.add(f.mul(2)))), v = b.add(T.add(_.mul(2))), C = M.div(v), R = S(a).add(C);
1367
- if (C.getBaseValue("number") === 0)
1368
- return R.div(y).getBaseValue("number");
1369
- const J = y.add(R);
1370
- return R.div(J).getBaseValue("number");
1371
- }
1372
- function Ta({
1373
- runeAmount: e,
1374
- assetAmount: t,
1375
- runeDepth: n,
1376
- assetDepth: a
1377
- }) {
1378
- if (e === "0" || t === "0" || n === "0" || a === "0")
1379
- return 0;
1380
- const i = S(n), s = S(a), p = S(t), u = S(e), y = p.mul(i).sub(s.mul(u)), o = s.mul(u).add(i.mul(s));
1381
- return Math.abs(y.div(o).getBaseValue("number"));
1382
- }
1383
- const B = (e, t) => {
1384
- switch (e) {
1385
- case w.LEAVE:
1386
- case w.BOND: {
1387
- const { address: n } = t;
1388
- return `${e}:${n}`;
1389
- }
1390
- case w.UNBOND: {
1391
- const { address: n, unbondAmount: a } = t;
1392
- return `${e}:${n}:${a}`;
1393
- }
1394
- case w.THORNAME_REGISTER: {
1395
- const { name: n, chain: a, address: i, owner: s } = t;
1396
- return `${e}:${n}:${a}:${i}${s ? `:${s}` : ""}`;
1397
- }
1398
- case w.DEPOSIT: {
1399
- const { chain: n, symbol: a, address: i, singleSide: s } = t;
1400
- return s ? `${e}:${n}/${a}` : `${e}:${((p, u) => {
1401
- switch (p) {
1402
- case r.Litecoin:
1403
- return "l";
1404
- case r.Dogecoin:
1405
- return "d";
1406
- case r.BitcoinCash:
1407
- return "c";
1408
- default:
1409
- return `${p}.${u}`;
1410
- }
1411
- })(n, a)}:${i || ""}`;
1412
- }
1413
- case w.WITHDRAW: {
1414
- const { chain: n, ticker: a, symbol: i, basisPoints: s, targetAssetString: p, singleSide: u } = t, y = n === "ETH" && a !== "ETH" ? `${a}-${i.slice(-3)}` : i, o = !u && p ? `:${p}` : "";
1415
- return `${e}:${n}${u ? "/" : "."}${y}:${s}${o}`;
1416
- }
1417
- case w.OPEN_LOAN:
1418
- case w.CLOSE_LOAN: {
1419
- const { asset: n, address: a } = t;
1420
- return `${e}:${n}:${a}`;
1421
- }
1422
- default:
1423
- return "";
1424
- }
1425
- };
1426
- function ca(e) {
1427
- if (e < 0)
1428
- throw new Error("Invalid number of year");
1429
- return 10 + e;
1430
- }
1431
- function ba(e) {
1432
- if (e < 0)
1433
- throw new Error("Invalid number of year");
1434
- return Math.round((10 + e * 1.0512) * 1e10) / 1e10;
1435
- }
1436
- function fa(e) {
1437
- if (e.length > 30)
1438
- return !1;
1439
- const t = /^[a-zA-Z0-9+_-]+$/g;
1440
- return !!e.match(t);
1441
- }
1442
- function ha(e) {
1443
- if (e.length > 30)
1444
- return !1;
1445
- const t = /^[a-zA-Z0-9+_-]+$/g;
1446
- return !!e.match(t);
1447
- }
1448
- function wa([e, t, n, a, i]) {
1449
- return `${e}'/${t}'/${n}'/${a}${typeof i != "number" ? "" : `/${i}`}`;
1450
- }
1451
- const We = [...Object.values(r), "TERRA"];
1452
- function fn(e = "") {
1453
- const t = e.toUpperCase(), [n] = t.split(".");
1454
- if (We.includes(n))
1455
- return !0;
1456
- const [a] = t.split("/");
1457
- if (We.includes(a))
1458
- return !0;
1459
- throw new Error(
1460
- `Invalid identifier: ${e}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`
1461
- );
1462
- }
1463
- const ne = 8, W = (e) => 10n ** BigInt(e), te = (e) => Math.log10(Number.parseFloat(e.toString()));
1464
- function he({
1465
- value: e,
1466
- bigIntDecimal: t = ne,
1467
- decimal: n = ne
1468
- }) {
1469
- if (n === 0)
1470
- return e.toString();
1471
- const a = e < 0n;
1472
- let i = e.toString().substring(a ? 1 : 0);
1473
- const s = n - (i.length - 1);
1474
- s > 0 && (i = "0".repeat(s) + i);
1475
- const p = i.length - n;
1476
- let u = i.slice(-n);
1477
- return Number.parseInt(u[t]) >= 5 ? u = `${u.substring(0, t - 1)}${(Number.parseInt(u[t - 1]) + 1).toString()}` : u = u.substring(0, t), `${a ? "-" : ""}${i.slice(0, p)}.${u}`.replace(
1478
- /\.?0*$/,
1479
- ""
1480
- );
1481
- }
1482
- var G, z, q, j, Ee, pt, ye, ge, de, Oe;
1483
- const hn = class xe {
1484
- constructor(t) {
1485
- Z(this, G), Z(this, q), Z(this, Ee), Z(this, ye), Z(this, de), P(this, "decimalMultiplier", 10n ** 8n), P(this, "bigIntValue", 0n), P(this, "decimal");
1486
- const n = Se(t), a = typeof t == "object";
1487
- this.decimal = a ? t.decimal : void 0, this.decimalMultiplier = a && "decimalMultiplier" in t ? t.decimalMultiplier : W(Math.max(ut(le(n)), this.decimal || 0)), E(this, Ee, pt).call(this, n);
1488
- }
1489
- static fromBigInt(t, n) {
1490
- return new xe({
1491
- decimal: n,
1492
- value: he({ value: t, bigIntDecimal: n, decimal: n })
1493
- });
1494
- }
1495
- static shiftDecimals({
1496
- value: t,
1497
- from: n,
1498
- to: a
1499
- }) {
1500
- return xe.fromBigInt(
1501
- t.getBaseValue("bigint") * W(a) / W(n),
1502
- a
1503
- );
1504
- }
1505
- set(t) {
1506
- return new this.constructor({ decimal: this.decimal, value: t, identifier: this.toString() });
1507
- }
1508
- add(...t) {
1509
- return E(this, G, z).call(this, "add", ...t);
1510
- }
1511
- sub(...t) {
1512
- return E(this, G, z).call(this, "sub", ...t);
1513
- }
1514
- mul(...t) {
1515
- return E(this, G, z).call(this, "mul", ...t);
1516
- }
1517
- div(...t) {
1518
- return E(this, G, z).call(this, "div", ...t);
1519
- }
1520
- gt(t) {
1521
- return E(this, q, j).call(this, "gt", t);
1522
- }
1523
- gte(t) {
1524
- return E(this, q, j).call(this, "gte", t);
1525
- }
1526
- lt(t) {
1527
- return E(this, q, j).call(this, "lt", t);
1528
- }
1529
- lte(t) {
1530
- return E(this, q, j).call(this, "lte", t);
1531
- }
1532
- eqValue(t) {
1533
- return E(this, q, j).call(this, "eqValue", t);
1534
- }
1535
- // @ts-expect-error False positive
1536
- getValue(t) {
1537
- const n = this.formatBigIntToSafeValue(
1538
- this.bigIntValue,
1539
- this.decimal || te(this.decimalMultiplier)
1540
- );
1541
- switch (t) {
1542
- case "number":
1543
- return Number(n);
1544
- case "string":
1545
- return n;
1546
- case "bigint":
1547
- return this.bigIntValue * 10n ** BigInt(this.decimal || 8n) / this.decimalMultiplier;
1548
- }
1549
- }
1550
- // @ts-expect-error
1551
- getBaseValue(t) {
1552
- const n = this.decimalMultiplier / W(this.decimal || g.THOR), a = this.bigIntValue / n;
1553
- switch (t) {
1554
- case "number":
1555
- return Number(a);
1556
- case "string":
1557
- return a.toString();
1558
- case "bigint":
1559
- return a;
1560
- }
1561
- }
1562
- getBigIntValue(t, n) {
1563
- if (!n && typeof t == "object")
1564
- return t.bigIntValue;
1565
- const a = Se(t), i = le(a);
1566
- return i === "0" || i === "undefined" ? 0n : E(this, de, Oe).call(this, i, n);
1567
- }
1568
- toSignificant(t = 6) {
1569
- const [n, a] = this.getValue("string").split("."), i = n || "", s = a || "";
1570
- if ((Number.parseInt(i) ? i.length + s.length : s.length) <= t)
1571
- return this.getValue("string");
1572
- if (i.length >= t)
1573
- return i.slice(0, t).padEnd(i.length, "0");
1574
- if (Number.parseInt(i))
1575
- return `${i}.${s.slice(0, t - i.length)}`.padEnd(
1576
- t - i.length,
1577
- "0"
1578
- );
1579
- const p = Number.parseInt(s), u = `${p}`.slice(0, t);
1580
- return `0.${u.padStart(
1581
- s.length - `${p}`.length + u.length,
1582
- "0"
1583
- )}`;
1584
- }
1585
- toFixed(t = 6) {
1586
- const [n, a] = this.getValue("string").split("."), i = n || "", s = a || "";
1587
- if (Number.parseInt(i))
1588
- return `${i}.${s.slice(0, t)}`.padEnd(t, "0");
1589
- const p = Number.parseInt(s), u = `${p}`.slice(0, t);
1590
- return `0.${u.padStart(
1591
- s.length - `${p}`.length + u.length,
1592
- "0"
1593
- )}`;
1594
- }
1595
- toAbbreviation(t = 2) {
1596
- const n = this.getValue("number"), a = ["", "K", "M", "B", "T", "Q", "Qi", "S"], i = Math.floor(Math.log10(Math.abs(n)) / 3), s = a[i];
1597
- if (!s)
1598
- return this.getValue("string");
1599
- const p = 10 ** (i * 3);
1600
- return `${(n / p).toFixed(t)}${s}`;
1601
- }
1602
- toCurrency(t = "$", {
1603
- currencyPosition: n = "start",
1604
- decimal: a = 2,
1605
- decimalSeparator: i = ".",
1606
- thousandSeparator: s = ","
1607
- } = {}) {
1608
- const p = this.getValue("number"), [u, y = ""] = p.toFixed(6).split("."), o = u.replace(/\B(?=(\d{3})+(?!\d))/g, s), l = u || y ? u === "0" ? `${Number.parseFloat(`0.${y}`)}`.replace(".", i) : `${o}${Number.parseInt(y) ? `${i}${y.slice(0, a)}` : ""}` : "0.00";
1609
- return `${n === "start" ? t : ""}${l}${n === "end" ? t : ""}`;
1610
- }
1611
- formatBigIntToSafeValue(t, n) {
1612
- const a = n || this.decimal || ne, i = Math.max(
1613
- a,
1614
- te(this.decimalMultiplier)
1615
- ), s = t < 0n, p = t.toString().substring(s ? 1 : 0), u = i - (p.length - 1), y = u > 0 ? "0".repeat(u) + p : p, o = y.length - i;
1616
- let l = y.slice(-i);
1617
- return Number.parseInt(l[a]) >= 5 ? l = `${l.substring(0, a - 1)}${(Number.parseInt(l[a - 1]) + 1).toString()}` : l = l.substring(0, a), `${s ? "-" : ""}${y.slice(
1618
- 0,
1619
- o
1620
- )}.${l}`.replace(/\.?0*$/, "");
1621
- }
1622
- };
1623
- G = /* @__PURE__ */ new WeakSet(), z = function(e, ...t) {
1624
- const n = E(this, ye, ge).call(this, this, ...t), a = Math.max(n, te(this.decimalMultiplier)), i = W(a), s = t.reduce(
1625
- (u, y) => {
1626
- const o = this.getBigIntValue(y, a);
1627
- switch (e) {
1628
- case "add":
1629
- return u + o;
1630
- case "sub":
1631
- return u - o;
1632
- case "mul":
1633
- return u * o / i;
1634
- case "div": {
1635
- if (o === 0n)
1636
- throw new RangeError("Division by zero");
1637
- return u * i / o;
1638
- }
1639
- default:
1640
- return u;
1641
- }
1642
- },
1643
- //normalize is to precision multiplier base
1644
- this.bigIntValue * i / this.decimalMultiplier
1645
- ), p = he({
1646
- bigIntDecimal: a,
1647
- decimal: a,
1648
- value: s
1649
- });
1650
- return new this.constructor({
1651
- decimalMultiplier: W(a),
1652
- decimal: this.decimal,
1653
- value: p,
1654
- identifier: this.toString()
1655
- });
1656
- }, q = /* @__PURE__ */ new WeakSet(), j = function(e, ...t) {
1657
- const n = E(this, ye, ge).call(this, this, ...t), a = this.getBigIntValue(t[0], n), i = this.getBigIntValue(this, n);
1658
- switch (e) {
1659
- case "gt":
1660
- return i > a;
1661
- case "gte":
1662
- return i >= a;
1663
- case "lt":
1664
- return i < a;
1665
- case "lte":
1666
- return i <= a;
1667
- case "eqValue":
1668
- return i === a;
1669
- }
1670
- }, Ee = /* @__PURE__ */ new WeakSet(), pt = function(e) {
1671
- const t = le(e) || "0";
1672
- this.bigIntValue = E(this, de, Oe).call(this, t);
1673
- }, ye = /* @__PURE__ */ new WeakSet(), ge = function(...e) {
1674
- const t = e.map((n) => typeof n == "object" ? n.decimal || te(n.decimalMultiplier) : ut(le(n))).filter(Boolean);
1675
- return Math.max(...t, ne);
1676
- }, de = /* @__PURE__ */ new WeakSet(), Oe = function(e, t) {
1677
- const n = t ? W(t) : this.decimalMultiplier, a = te(n), [i = "", s = ""] = e.split(".");
1678
- return BigInt(`${i}${s.padEnd(a, "0")}`);
1679
- };
1680
- let ke = hn;
1681
- const wn = Intl.NumberFormat("fullwide", {
1682
- useGrouping: !1,
1683
- maximumFractionDigits: 20
1684
- });
1685
- function le(e) {
1686
- const t = `${typeof e == "number" ? wn.format(e) : Se(e)}`.replaceAll(",", ".").split(".");
1687
- return t.length > 1 ? `${t.slice(0, -1).join("")}.${t.at(-1)}` : t[0];
1688
- }
1689
- function ut(e) {
1690
- var t;
1691
- const n = ((t = e.split(".")[1]) == null ? void 0 : t.length) || 0;
1692
- return Math.max(n, ne);
1693
- }
1694
- function Se(e) {
1695
- return typeof e == "object" ? "getValue" in e ? e.getValue("string") : e.value : e;
1696
- }
1697
- class F extends ke {
1698
- eq(t) {
1699
- return this.eqValue(t);
1700
- }
1701
- static fromBigInt(t, n) {
1702
- return new F({
1703
- decimal: n,
1704
- value: he({ value: t, bigIntDecimal: n, decimal: n })
1705
- });
1706
- }
1707
- }
1708
- const K = /* @__PURE__ */ new Map();
1709
- class k extends ke {
1710
- constructor({
1711
- value: t,
1712
- decimal: n,
1713
- tax: a,
1714
- chain: i,
1715
- symbol: s,
1716
- identifier: p
1717
- }) {
1718
- super(typeof t == "object" ? t : { decimal: n, value: t }), P(this, "address"), P(this, "chain"), P(this, "isGasAsset", !1), P(this, "isSynthetic", !1), P(this, "symbol"), P(this, "tax"), P(this, "ticker"), P(this, "type");
1719
- const u = ee(p || `${i}.${s}`);
1720
- this.type = dn(u), this.tax = a, this.chain = u.chain, this.ticker = u.ticker, this.symbol = u.symbol, this.address = u.address, this.isSynthetic = u.isSynthetic, this.isGasAsset = u.isGasAsset;
1721
- }
1722
- toString() {
1723
- return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
1724
- }
1725
- toUrl() {
1726
- return this.isSynthetic ? `${this.chain}.${this.symbol.replace("/", ".")}` : this.toString();
1727
- }
1728
- eq({ chain: t, symbol: n }) {
1729
- return this.chain === t && this.symbol === n;
1730
- }
1731
- chainId() {
1732
- return Qe[this.chain];
1733
- }
1734
- // THOR.RUNE
1735
- // THOR.ETH.ETH
1736
- // ETH.THOR-0x1234567890
1737
- static fromUrl(t, n = 0) {
1738
- const [a, i, s] = t.split(".");
1739
- if (!(a && i))
1740
- throw new Error("Invalid asset url");
1741
- const p = a === r.THORChain && s ? `${a}.${i}/${s}` : t;
1742
- return Me(p, n);
1743
- }
1744
- static fromString(t, n = 0) {
1745
- return Me(t, n);
1746
- }
1747
- static fromIdentifier(t, n = 0) {
1748
- return Me(t, n);
1749
- }
1750
- static fromStringSync(t, n = 0) {
1751
- const { chain: a, isSynthetic: i } = ee(t), s = K.get(t.toUpperCase());
1752
- if (i)
1753
- return ve(t, n);
1754
- const { tax: p, decimal: u, identifier: y } = s || {
1755
- decimal: g[a],
1756
- identifier: t
1757
- };
1758
- return new k({
1759
- tax: p,
1760
- value: Q(n, u),
1761
- identifier: i ? t : y,
1762
- decimal: i ? 8 : u
1763
- });
1764
- }
1765
- static async fromStringWithBase(t, n = 0, a = g.THOR) {
1766
- const i = ke.shiftDecimals({
1767
- value: F.fromBigInt(BigInt(n)),
1768
- from: 0,
1769
- to: a
1770
- }).getBaseValue("string");
1771
- return (await k.fromString(t, n)).set(i);
1772
- }
1773
- static fromStringWithBaseSync(t, n = 0, a = g.THOR) {
1774
- const { chain: i, isSynthetic: s } = ee(t), p = K.get(t.toUpperCase());
1775
- if (s)
1776
- return ve(t, n);
1777
- const { tax: u, decimal: y, identifier: o } = p || {
1778
- decimal: g[i],
1779
- identifier: t
1780
- };
1781
- return new k({
1782
- tax: u,
1783
- value: Q(BigInt(n), a),
1784
- identifier: o,
1785
- decimal: y
1786
- });
1787
- }
1788
- static fromIdentifierSync(t, n = 0) {
1789
- const { chain: a, isSynthetic: i } = ee(t), s = K.get(t);
1790
- if (i)
1791
- return ve(t, n);
1792
- const { tax: p, decimal: u, identifier: y } = s || {
1793
- decimal: g[a],
1794
- identifier: t
1795
- };
1796
- return new k({ tax: p, decimal: u, identifier: y, value: Q(n, u) });
1797
- }
1798
- static fromChainOrSignature(t, n = 0) {
1799
- const { decimal: a, identifier: i } = on(t);
1800
- return new k({ value: Q(n, a), decimal: a, identifier: i });
1801
- }
1802
- static loadStaticAssets() {
1803
- return new Promise(
1804
- (t, n) => {
1805
- try {
1806
- import("@swapkit/tokens").then((a) => {
1807
- for (const i of Object.values(a))
1808
- for (const { identifier: s, chain: p, ...u } of i.tokens)
1809
- K.set(s.toUpperCase(), {
1810
- identifier: s,
1811
- decimal: "decimals" in u ? u.decimals : g[p]
1812
- });
1813
- t({ ok: !0 });
1814
- });
1815
- } catch (a) {
1816
- console.error(a), n({
1817
- ok: !1,
1818
- error: a,
1819
- message: "Couldn't load static assets. Ensure you have installed @swapkit/tokens package"
1820
- });
1821
- }
1822
- }
1823
- );
1824
- }
1825
- }
1826
- function _e(e) {
1827
- const t = k.fromChainOrSignature(e);
1828
- switch (e) {
1829
- case r.Bitcoin:
1830
- case r.Litecoin:
1831
- case r.BitcoinCash:
1832
- return t.set(10001e-8);
1833
- case r.Dogecoin:
1834
- return t.set(1.00000001);
1835
- case r.Avalanche:
1836
- case r.Ethereum:
1837
- return t.set(1e-8);
1838
- case r.THORChain:
1839
- case r.Maya:
1840
- return t.set(0);
1841
- case r.Cosmos:
1842
- return t.set(1e-6);
1843
- default:
1844
- return t.set(1e-8);
1845
- }
1846
- }
1847
- async function Me(e, t = 0) {
1848
- fn(e);
1849
- const n = K.get(e.toUpperCase()), a = (n == null ? void 0 : n.decimal) || await un(ee(e));
1850
- return n || K.set(e.toUpperCase(), { identifier: e, decimal: a }), new k({ decimal: a, value: Q(t, a), identifier: e });
1851
- }
1852
- function ve(e, t = 0) {
1853
- const [n, a] = e.split(".")[0].toUpperCase() === r.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
1854
- if (!(n && a))
1855
- throw new Error("Invalid asset identifier");
1856
- return new k({
1857
- decimal: 8,
1858
- value: Q(t, 8),
1859
- identifier: `${r.THORChain}.${n}/${a}`
1860
- });
1861
- }
1862
- function Q(e, t) {
1863
- return typeof e == "bigint" ? he({ value: e, bigIntDecimal: t, decimal: t }) : e;
1864
- }
1865
- function ee(e) {
1866
- const t = e.slice(0, 14).includes("/"), [n, a] = e.split(".")[0].toUpperCase() === r.THORChain ? e.split(".").slice(1).join().split("/") : e.split("/");
1867
- if (t && !(n && a))
1868
- throw new Error("Invalid asset identifier");
1869
- const i = e.includes(".") && !t ? e : `${r.THORChain}.${a}`, [s, ...p] = i.split("."), [u, y] = (t ? a : p.join(".")).split("-"), o = t ? a : p.join(".");
1870
- return {
1871
- address: y == null ? void 0 : y.toLowerCase(),
1872
- chain: s,
1873
- isGasAsset: rt({ chain: s, symbol: o }),
1874
- isSynthetic: t,
1875
- symbol: (t ? `${n}/` : "") + (y ? `${u}-${(y == null ? void 0 : y.toLowerCase()) ?? ""}` : o),
1876
- ticker: u
1877
- };
1878
- }
1879
- const An = {
1880
- /**
1881
- * Core
1882
- */
1883
- core_wallet_connection_not_found: 10001,
1884
- core_estimated_max_spendable_chain_not_supported: 10002,
1885
- core_extend_error: 10003,
1886
- core_inbound_data_not_found: 10004,
1887
- core_approve_asset_address_or_from_not_found: 10005,
1888
- core_plugin_not_found: 10006,
1889
- core_chain_halted: 10099,
1890
- /**
1891
- * Core - Wallet Connection
1892
- */
1893
- core_wallet_xdefi_not_installed: 10101,
1894
- core_wallet_evmwallet_not_installed: 10102,
1895
- core_wallet_walletconnect_not_installed: 10103,
1896
- core_wallet_keystore_not_installed: 10104,
1897
- core_wallet_ledger_not_installed: 10105,
1898
- core_wallet_trezor_not_installed: 10106,
1899
- core_wallet_keplr_not_installed: 10107,
1900
- core_wallet_okx_not_installed: 10108,
1901
- core_wallet_keepkey_not_installed: 10109,
1902
- /**
1903
- * Core - Swap
1904
- */
1905
- core_swap_invalid_params: 10200,
1906
- core_swap_route_not_complete: 10201,
1907
- core_swap_asset_not_recognized: 10202,
1908
- core_swap_contract_not_found: 10203,
1909
- core_swap_route_transaction_not_found: 10204,
1910
- core_swap_contract_not_supported: 10205,
1911
- core_swap_transaction_error: 10206,
1912
- core_swap_quote_mode_not_supported: 10207,
1913
- /**
1914
- * Core - Transaction
1915
- */
1916
- core_transaction_deposit_error: 10301,
1917
- core_transaction_create_liquidity_rune_error: 10302,
1918
- core_transaction_create_liquidity_asset_error: 10303,
1919
- core_transaction_create_liquidity_invalid_params: 10304,
1920
- core_transaction_add_liquidity_invalid_params: 10305,
1921
- core_transaction_add_liquidity_no_rune_address: 10306,
1922
- core_transaction_add_liquidity_rune_error: 10307,
1923
- core_transaction_add_liquidity_asset_error: 10308,
1924
- core_transaction_withdraw_error: 10309,
1925
- core_transaction_deposit_to_pool_error: 10310,
1926
- core_transaction_deposit_insufficient_funds_error: 10311,
1927
- core_transaction_deposit_gas_error: 10312,
1928
- core_transaction_invalid_sender_address: 10313,
1929
- core_transaction_deposit_server_error: 10314,
1930
- core_transaction_user_rejected: 10315,
1931
- /**
1932
- * Wallets
1933
- */
1934
- wallet_ledger_connection_error: 20001,
1935
- wallet_ledger_connection_claimed: 20002,
1936
- wallet_ledger_get_address_error: 20003,
1937
- wallet_ledger_device_not_found: 20004,
1938
- wallet_ledger_device_locked: 20005,
1939
- /**
1940
- * Chainflip
1941
- */
1942
- chainflip_channel_error: 30001,
1943
- chainflip_broker_recipient_error: 30002,
1944
- /**
1945
- * THORChain
1946
- */
1947
- /**
1948
- * Helpers
1949
- */
1950
- helpers_number_different_decimals: 99101
1951
- };
1952
- class d extends Error {
1953
- constructor(t, n) {
1954
- n && console.error(n, {
1955
- stack: n == null ? void 0 : n.stack,
1956
- message: n == null ? void 0 : n.message
1957
- }), super(t, {
1958
- cause: { code: An[t], message: t }
1959
- }), Object.setPrototypeOf(this, d.prototype);
1960
- }
1961
- }
1962
- const yt = ({ chain: e, txHash: t }) => {
1963
- const n = Ye[e];
1964
- switch (e) {
1965
- case r.Binance:
1966
- case r.Maya:
1967
- case r.Kujira:
1968
- case r.THORChain:
1969
- return `${n}/tx/${t.startsWith("0x") ? t.slice(2) : t}`;
1970
- case r.Arbitrum:
1971
- case r.Avalanche:
1972
- case r.BinanceSmartChain:
1973
- case r.Ethereum:
1974
- case r.Optimism:
1975
- case r.Polkadot:
1976
- case r.Polygon:
1977
- return `${n}/tx/${t.startsWith("0x") ? t : `0x${t}`}`;
1978
- case r.Cosmos:
1979
- return `${n}/transactions/${t}`;
1980
- case r.Litecoin:
1981
- case r.Bitcoin:
1982
- case r.BitcoinCash:
1983
- case r.Dogecoin:
1984
- return `${n}/transaction/${t.toLowerCase()}`;
12
+ import { AssetValue as L, SwapKitError as s, RequestClient as N, SwapKitNumber as oe, getMemoFor as O, getMinAmountByChain as U, gasFeeMultiplier as de } from "@swapkit/helpers";
13
+ export * from "@swapkit/helpers";
14
+ import { ChainToExplorerUrl as Y, Chain as a, ApiUrl as B, AGG_SWAP as le, ChainToChainId as me, SWAP_OUT as Te, SWAP_IN as ce, FeeOption as K, TCAvalancheDepositABI as be, TCBscDepositABI as fe, TCEthereumVaultAbi as we, MemoType as v } from "@swapkit/types";
15
+ export * from "@swapkit/types";
16
+ const ee = ({ chain: r, txHash: e }) => {
17
+ const t = Y[r];
18
+ switch (r) {
19
+ case a.Binance:
20
+ case a.Maya:
21
+ case a.Kujira:
22
+ case a.THORChain:
23
+ return `${t}/tx/${e.startsWith("0x") ? e.slice(2) : e}`;
24
+ case a.Arbitrum:
25
+ case a.Avalanche:
26
+ case a.BinanceSmartChain:
27
+ case a.Ethereum:
28
+ case a.Optimism:
29
+ case a.Polkadot:
30
+ case a.Polygon:
31
+ return `${t}/tx/${e.startsWith("0x") ? e : `0x${e}`}`;
32
+ case a.Cosmos:
33
+ return `${t}/transactions/${e}`;
34
+ case a.Litecoin:
35
+ case a.Bitcoin:
36
+ case a.BitcoinCash:
37
+ case a.Dogecoin:
38
+ return `${t}/transaction/${e.toLowerCase()}`;
1985
39
  default:
1986
- throw new Error(`Unsupported chain: ${e}`);
40
+ throw new Error(`Unsupported chain: ${r}`);
1987
41
  }
1988
- }, ot = ({ chain: e, address: t }) => {
1989
- const n = Ye[e];
1990
- switch (e) {
1991
- case r.Arbitrum:
1992
- case r.Avalanche:
1993
- case r.Binance:
1994
- case r.BinanceSmartChain:
1995
- case r.Bitcoin:
1996
- case r.BitcoinCash:
1997
- case r.Dogecoin:
1998
- case r.Ethereum:
1999
- case r.Kujira:
2000
- case r.Litecoin:
2001
- case r.Maya:
2002
- case r.Optimism:
2003
- case r.Polkadot:
2004
- case r.Polygon:
2005
- case r.THORChain:
2006
- return `${n}/address/${t}`;
2007
- case r.Cosmos:
2008
- return `${n}/account/${t}`;
42
+ }, te = ({ chain: r, address: e }) => {
43
+ const t = Y[r];
44
+ switch (r) {
45
+ case a.Arbitrum:
46
+ case a.Avalanche:
47
+ case a.Binance:
48
+ case a.BinanceSmartChain:
49
+ case a.Bitcoin:
50
+ case a.BitcoinCash:
51
+ case a.Dogecoin:
52
+ case a.Ethereum:
53
+ case a.Kujira:
54
+ case a.Litecoin:
55
+ case a.Maya:
56
+ case a.Optimism:
57
+ case a.Polkadot:
58
+ case a.Polygon:
59
+ case a.THORChain:
60
+ return `${t}/address/${e}`;
61
+ case a.Cosmos:
62
+ return `${t}/account/${e}`;
2009
63
  default:
2010
- throw new Error(`Unsupported chain: ${e}`);
64
+ throw new Error(`Unsupported chain: ${r}`);
2011
65
  }
2012
66
  };
2013
- var gn = /* @__PURE__ */ ((e) => (e.Approve = "approve", e.CheckOnly = "checkOnly", e))(gn || {});
2014
- function Aa({
2015
- stagenet: e,
2016
- wallets: t,
2017
- plugins: n,
2018
- config: a = {},
2019
- apis: i,
2020
- rpcUrls: s
67
+ var Me = /* @__PURE__ */ ((r) => (r.Approve = "approve", r.CheckOnly = "checkOnly", r))(Me || {});
68
+ function ze({
69
+ stagenet: r,
70
+ wallets: e,
71
+ plugins: t,
72
+ config: n = {},
73
+ apis: p,
74
+ rpcUrls: i
2021
75
  }) {
2022
- const p = {}, u = {};
2023
- for (const c of n) {
2024
- const { name: h, methods: I } = c({ wallets: p, stagenet: e });
2025
- u[h] = I;
76
+ const o = {}, c = {};
77
+ for (const u of t) {
78
+ const { name: m, methods: _ } = u({ wallets: o, stagenet: r });
79
+ c[m] = _;
2026
80
  }
2027
- const y = t.reduce((c, h) => (c[h.connectMethodName] = h.connect({
2028
- addChain: l,
2029
- config: a,
2030
- apis: i,
2031
- rpcUrls: s
2032
- }), c), {});
2033
- function o(c) {
2034
- const h = u[c] || Object.values(u)[0];
2035
- if (!h)
2036
- throw new d("core_plugin_not_found", "Could not find the requested plugin");
2037
- return h;
81
+ const f = e.reduce((u, m) => (u[m.connectMethodName] = m.connect({
82
+ addChain: w,
83
+ config: n,
84
+ apis: p,
85
+ rpcUrls: i
86
+ }), u), {});
87
+ function b(u) {
88
+ const m = c[u] || Object.values(c)[0];
89
+ if (!m)
90
+ throw new s("core_plugin_not_found", "Could not find the requested plugin");
91
+ return m;
2038
92
  }
2039
- function l(c) {
2040
- p[c.chain] = c;
93
+ function w(u) {
94
+ o[u.chain] = u;
2041
95
  }
2042
- function b({
2043
- assetValue: c,
2044
- type: h = "checkOnly",
2045
- contractAddress: I
96
+ function T({
97
+ assetValue: u,
98
+ type: m = "checkOnly",
99
+ contractAddress: _
2046
100
  }) {
2047
- const { address: O, chain: D, isGasAsset: mt, isSynthetic: Tt } = c, De = [r.Ethereum, r.Avalanche, r.BinanceSmartChain].includes(D);
2048
- if (De && mt || !De || Tt)
2049
- return Promise.resolve(h === "checkOnly" ? !0 : "approved");
2050
- const X = p[D], Fe = h === "checkOnly" ? X == null ? void 0 : X.isApproved : X == null ? void 0 : X.approve;
2051
- if (!Fe)
2052
- throw new d("core_wallet_connection_not_found");
2053
- const Le = f(D);
2054
- if (!(O && Le))
2055
- throw new d("core_approve_asset_address_or_from_not_found");
2056
- const ct = I;
2057
- return Fe({
2058
- amount: c.getBaseValue("bigint"),
2059
- assetAddress: O,
2060
- from: Le,
2061
- spenderAddress: ct
101
+ const { address: x, chain: R, isGasAsset: ie, isSynthetic: pe } = u, G = [a.Ethereum, a.Avalanche, a.BinanceSmartChain].includes(R);
102
+ if (G && ie || !G || pe)
103
+ return Promise.resolve(m === "checkOnly" ? !0 : "approved");
104
+ const C = o[R], Q = m === "checkOnly" ? C == null ? void 0 : C.isApproved : C == null ? void 0 : C.approve;
105
+ if (!Q)
106
+ throw new s("core_wallet_connection_not_found");
107
+ const $ = l(R);
108
+ if (!(x && $))
109
+ throw new s("core_approve_asset_address_or_from_not_found");
110
+ const se = _;
111
+ return Q({
112
+ amount: u.getBaseValue("bigint"),
113
+ assetAddress: x,
114
+ from: $,
115
+ spenderAddress: se
2062
116
  });
2063
117
  }
2064
- function T(c) {
2065
- return p[c];
118
+ function d(u) {
119
+ return o[u];
2066
120
  }
2067
- function f(c) {
2068
- var h;
2069
- return ((h = T(c)) == null ? void 0 : h.address) || "";
121
+ function l(u) {
122
+ var m;
123
+ return ((m = d(u)) == null ? void 0 : m.address) || "";
2070
124
  }
2071
- function _(c) {
2072
- var h;
2073
- return ((h = T(c)) == null ? void 0 : h.balance) || [];
125
+ function A(u) {
126
+ var m;
127
+ return ((m = d(u)) == null ? void 0 : m.balance) || [];
2074
128
  }
2075
- function M(c, h) {
2076
- return yt({ chain: c, txHash: h });
129
+ function k(u, m) {
130
+ return ee({ chain: u, txHash: m });
2077
131
  }
2078
- function v(c, h) {
2079
- return ot({ chain: c, address: h });
132
+ function h(u, m) {
133
+ return te({ chain: u, address: m });
2080
134
  }
2081
- function C({ address: c, chain: h }) {
2082
- var I, O;
2083
- return (O = (I = T(h)) == null ? void 0 : I.validateAddress) == null ? void 0 : O.call(I, c);
135
+ function g({ address: u, chain: m }) {
136
+ var _, x;
137
+ return (x = (_ = d(m)) == null ? void 0 : _.validateAddress) == null ? void 0 : x.call(_, u);
2084
138
  }
2085
- async function R(c, h) {
2086
- const I = [k.fromChainOrSignature(c)], O = T(c);
139
+ async function I(u, m) {
140
+ const _ = [L.fromChainOrSignature(u)], x = d(u);
2087
141
  try {
2088
- if (!O)
2089
- throw new d("core_wallet_connection_not_found");
2090
- const D = await (O == null ? void 0 : O.getBalance(O.address, h));
2091
- return O.balance = D != null && D.length ? D : I, O;
2092
- } catch (D) {
2093
- throw new d("core_wallet_connection_not_found", D);
142
+ if (!x)
143
+ throw new s("core_wallet_connection_not_found");
144
+ const R = await (x == null ? void 0 : x.getBalance(x.address, m));
145
+ return x.balance = R != null && R.length ? R : _, x;
146
+ } catch (R) {
147
+ throw new s("core_wallet_connection_not_found", R);
2094
148
  }
2095
149
  }
2096
- function J(c, h) {
2097
- return b({
2098
- assetValue: c,
2099
- contractAddress: h,
150
+ function D(u, m) {
151
+ return T({
152
+ assetValue: u,
153
+ contractAddress: m,
2100
154
  type: "approve"
2101
155
  /* Approve */
2102
156
  });
2103
157
  }
2104
- function we(c, h) {
2105
- return b({
2106
- assetValue: c,
2107
- contractAddress: h,
158
+ function X(u, m) {
159
+ return T({
160
+ assetValue: u,
161
+ contractAddress: m,
2108
162
  type: "checkOnly"
2109
163
  /* CheckOnly */
2110
164
  });
2111
165
  }
2112
- function lt({ provider: c, ...h }) {
2113
- return o(c == null ? void 0 : c.name).swap({ provider: c, ...h });
166
+ function ae({ provider: u, ...m }) {
167
+ return b(u == null ? void 0 : u.name).swap({ provider: u, ...m });
2114
168
  }
2115
169
  return {
2116
- ...u,
2117
- ...y,
2118
- approveAssetValue: J,
2119
- getAddress: f,
2120
- getBalance: _,
2121
- getExplorerAddressUrl: v,
2122
- getExplorerTxUrl: M,
2123
- getWallet: T,
2124
- getWalletWithBalance: R,
2125
- isAssetValueApproved: we,
2126
- swap: lt,
2127
- validateAddress: C
170
+ ...c,
171
+ ...f,
172
+ approveAssetValue: D,
173
+ getAddress: l,
174
+ getBalance: A,
175
+ getExplorerAddressUrl: h,
176
+ getExplorerTxUrl: k,
177
+ getWallet: d,
178
+ getWalletWithBalance: I,
179
+ isAssetValueApproved: X,
180
+ swap: ae,
181
+ validateAddress: g
2128
182
  };
2129
183
  }
2130
- const _n = [
184
+ const Ae = [
2131
185
  {
2132
186
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
2133
187
  stateMutability: "nonpayable",
@@ -2218,7 +272,7 @@ const _n = [
2218
272
  type: "function"
2219
273
  },
2220
274
  { stateMutability: "payable", type: "receive" }
2221
- ], Mn = [
275
+ ], ve = [
2222
276
  {
2223
277
  inputs: [
2224
278
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2362,7 +416,7 @@ const _n = [
2362
416
  type: "function"
2363
417
  },
2364
418
  { stateMutability: "payable", type: "receive" }
2365
- ], vn = [
419
+ ], ke = [
2366
420
  {
2367
421
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
2368
422
  stateMutability: "nonpayable",
@@ -2467,7 +521,7 @@ const _n = [
2467
521
  type: "function"
2468
522
  },
2469
523
  { stateMutability: "payable", type: "receive" }
2470
- ], Cn = [
524
+ ], he = [
2471
525
  {
2472
526
  inputs: [{ internalType: "address", name: "_ttp", type: "address" }],
2473
527
  stateMutability: "nonpayable",
@@ -2558,7 +612,7 @@ const _n = [
2558
612
  type: "function"
2559
613
  },
2560
614
  { stateMutability: "payable", type: "receive" }
2561
- ], En = [
615
+ ], ge = [
2562
616
  {
2563
617
  inputs: [
2564
618
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2702,7 +756,7 @@ const _n = [
2702
756
  type: "function"
2703
757
  },
2704
758
  { stateMutability: "payable", type: "receive" }
2705
- ], On = [
759
+ ], xe = [
2706
760
  {
2707
761
  inputs: [
2708
762
  { internalType: "address", name: "_ttp", type: "address" },
@@ -2821,7 +875,7 @@ const _n = [
2821
875
  type: "function"
2822
876
  },
2823
877
  { stateMutability: "payable", type: "receive" }
2824
- ], $e = [
878
+ ], Z = [
2825
879
  {
2826
880
  inputs: [{ internalType: "address", name: "_WETH", type: "address" }],
2827
881
  stateMutability: "nonpayable",
@@ -3222,7 +1276,7 @@ const _n = [
3222
1276
  type: "function"
3223
1277
  },
3224
1278
  { stateMutability: "payable", type: "receive" }
3225
- ], Ue = [
1279
+ ], j = [
3226
1280
  {
3227
1281
  inputs: [
3228
1282
  {
@@ -5409,7 +3463,7 @@ const _n = [
5409
3463
  stateMutability: "payable",
5410
3464
  type: "receive"
5411
3465
  }
5412
- ], Xe = [
3466
+ ], z = [
5413
3467
  {
5414
3468
  inputs: [
5415
3469
  { internalType: "address", name: "_factory", type: "address" },
@@ -5748,7 +3802,7 @@ const _n = [
5748
3802
  type: "function"
5749
3803
  },
5750
3804
  { stateMutability: "payable", type: "receive" }
5751
- ], xn = [
3805
+ ], _e = [
5752
3806
  {
5753
3807
  inputs: [
5754
3808
  { internalType: "address", name: "_factory", type: "address" },
@@ -6087,7 +4141,7 @@ const _n = [
6087
4141
  type: "function"
6088
4142
  },
6089
4143
  { stateMutability: "payable", type: "receive" }
6090
- ], kn = [
4144
+ ], Oe = [
6091
4145
  {
6092
4146
  inputs: [
6093
4147
  { internalType: "address", name: "_factory", type: "address" },
@@ -6426,7 +4480,7 @@ const _n = [
6426
4480
  type: "function"
6427
4481
  },
6428
4482
  { stateMutability: "payable", type: "receive" }
6429
- ], Sn = [
4483
+ ], Ee = [
6430
4484
  {
6431
4485
  inputs: [
6432
4486
  { internalType: "address", name: "_factory", type: "address" },
@@ -6765,7 +4819,7 @@ const _n = [
6765
4819
  type: "function"
6766
4820
  },
6767
4821
  { stateMutability: "payable", type: "receive" }
6768
- ], Rn = [
4822
+ ], Re = [
6769
4823
  {
6770
4824
  inputs: [
6771
4825
  { internalType: "address", name: "_factory", type: "address" },
@@ -7104,7 +5158,7 @@ const _n = [
7104
5158
  type: "function"
7105
5159
  },
7106
5160
  { stateMutability: "payable", type: "receive" }
7107
- ], In = [
5161
+ ], Ie = [
7108
5162
  {
7109
5163
  inputs: [
7110
5164
  { internalType: "address", name: "_factory", type: "address" },
@@ -7357,7 +5411,7 @@ const _n = [
7357
5411
  type: "function"
7358
5412
  },
7359
5413
  { stateMutability: "payable", type: "receive" }
7360
- ], Bn = [
5414
+ ], Fe = [
7361
5415
  {
7362
5416
  inputs: [
7363
5417
  { internalType: "address", name: "_weth", type: "address" },
@@ -7527,23 +5581,23 @@ const _n = [
7527
5581
  type: "function"
7528
5582
  },
7529
5583
  { stateMutability: "payable", type: "receive" }
7530
- ], Pn = {
5584
+ ], Se = {
7531
5585
  // AVAX
7532
- ["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]: xn,
7533
- ["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]: Bn,
7534
- ["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]: Sn,
7535
- ["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]: Ue,
7536
- ["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: $e,
5586
+ ["0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106".toLowerCase()]: _e,
5587
+ ["0xC22FBb3133dF781E6C25ea6acebe2D2Bb8CeA2f9".toLowerCase()]: Fe,
5588
+ ["0x60aE616a2155Ee3d9A68541Ba4544862310933d4".toLowerCase()]: Ee,
5589
+ ["0x1111111254fb6c44bAC0beD2854e76F90643097d".toLowerCase()]: j,
5590
+ ["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: Z,
7537
5591
  // BSC
7538
- ["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]: Xe,
5592
+ ["0x10ED43C718714eb63d5aA57B78B54704E256024E".toLowerCase()]: z,
7539
5593
  // ETH
7540
- ["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: $e,
7541
- ["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]: kn,
7542
- ["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]: Xe,
7543
- ["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]: Rn,
7544
- ["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]: In,
7545
- ["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]: Ue
7546
- }, Hn = [
5594
+ ["0x6131B5fae19EA4f9D964eAc0408E4408b66337b5".toLowerCase()]: Z,
5595
+ ["0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f".toLowerCase()]: Oe,
5596
+ ["0xEfF92A263d31888d860bD50809A8D171709b7b1c".toLowerCase()]: z,
5597
+ ["0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D".toLowerCase()]: Re,
5598
+ ["0xE592427A0AEce92De3Edee1F18E0157C05861564".toLowerCase()]: Ie,
5599
+ ["0x1111111254fb6c44bac0bed2854e76f90643097d".toLowerCase()]: j
5600
+ }, Ce = [
7547
5601
  {
7548
5602
  inputs: [
7549
5603
  { internalType: "address", name: "_ttp", type: "address" },
@@ -7662,7 +5716,7 @@ const _n = [
7662
5716
  type: "function"
7663
5717
  },
7664
5718
  { stateMutability: "payable", type: "receive" }
7665
- ], Dn = [
5719
+ ], Be = [
7666
5720
  {
7667
5721
  inputs: [
7668
5722
  { internalType: "address", name: "_ttp", type: "address" },
@@ -7781,7 +5835,7 @@ const _n = [
7781
5835
  type: "function"
7782
5836
  },
7783
5837
  { stateMutability: "payable", type: "receive" }
7784
- ], Fn = [
5838
+ ], qe = [
7785
5839
  {
7786
5840
  inputs: [
7787
5841
  { internalType: "address", name: "_ttp", type: "address" },
@@ -7900,7 +5954,7 @@ const _n = [
7900
5954
  type: "function"
7901
5955
  },
7902
5956
  { stateMutability: "payable", type: "receive" }
7903
- ], Ln = [
5957
+ ], He = [
7904
5958
  {
7905
5959
  inputs: [
7906
5960
  { internalType: "address", name: "_ttp", type: "address" },
@@ -8027,7 +6081,7 @@ const _n = [
8027
6081
  type: "function"
8028
6082
  },
8029
6083
  { stateMutability: "payable", type: "receive" }
8030
- ], Vn = [
6084
+ ], Pe = [
8031
6085
  {
8032
6086
  inputs: [
8033
6087
  { internalType: "address", name: "_ttp", type: "address" },
@@ -8154,7 +6208,7 @@ const _n = [
8154
6208
  type: "function"
8155
6209
  },
8156
6210
  { stateMutability: "payable", type: "receive" }
8157
- ], Nn = [
6211
+ ], Le = [
8158
6212
  {
8159
6213
  inputs: [
8160
6214
  { internalType: "address", name: "_ttp", type: "address" },
@@ -8281,7 +6335,7 @@ const _n = [
8281
6335
  type: "function"
8282
6336
  },
8283
6337
  { stateMutability: "payable", type: "receive" }
8284
- ], qn = [
6338
+ ], We = [
8285
6339
  {
8286
6340
  inputs: [
8287
6341
  { internalType: "address", name: "_ttp", type: "address" },
@@ -8408,7 +6462,7 @@ const _n = [
8408
6462
  type: "function"
8409
6463
  },
8410
6464
  { stateMutability: "payable", type: "receive" }
8411
- ], Wn = [
6465
+ ], Ve = [
8412
6466
  {
8413
6467
  inputs: [
8414
6468
  { internalType: "address", name: "_ttp", type: "address" },
@@ -8535,696 +6589,627 @@ const _n = [
8535
6589
  type: "function"
8536
6590
  },
8537
6591
  { stateMutability: "payable", type: "receive" }
8538
- ], dt = {
8539
- ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: _n,
8540
- ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: vn,
8541
- ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: Cn
8542
- }, $n = {
8543
- ...Pn,
8544
- ...dt,
6592
+ ], ne = {
6593
+ ["0x7C38b8B2efF28511ECc14a621e263857Fb5771d3".toLowerCase()]: Ae,
6594
+ ["0xB6fA6f1DcD686F4A573Fd243a6FABb4ba36Ba98c".toLowerCase()]: ke,
6595
+ ["0xd31f7e39afECEc4855fecc51b693F9A0Cec49fd2".toLowerCase()]: he
6596
+ }, De = {
6597
+ ...Se,
6598
+ ...ne,
8545
6599
  // AVAX
8546
- ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: On,
8547
- ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: Mn,
8548
- ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Dn,
6600
+ ["0x942c6dA485FD6cEf255853ef83a149d43A73F18a".toLowerCase()]: xe,
6601
+ ["0x5505BE604dFA8A1ad402A71f8A357fba47F9bf5a".toLowerCase()]: ve,
6602
+ ["0x3b7DbdD635B99cEa39D3d95Dbd0217F05e55B212".toLowerCase()]: Be,
8549
6603
  // BSC
8550
- ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: En,
6604
+ ["0x30912B38618D3D37De3191A4FFE982C65a9aEC2E".toLowerCase()]: ge,
8551
6605
  // ETH
8552
- ["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Hn,
8553
- ["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: Fn,
8554
- ["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: Ln,
8555
- ["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: Vn,
8556
- ["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: Nn,
8557
- ["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: qn,
8558
- ["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Wn
8559
- }, Un = ({
8560
- streamSwap: e,
8561
- contractAddress: t,
8562
- recipient: n,
8563
- toChecksumAddress: a,
6606
+ ["0xbf365e79aA44A2164DA135100C57FDB6635ae870".toLowerCase()]: Ce,
6607
+ ["0x86904Eb2b3c743400D03f929F2246EfA80B91215".toLowerCase()]: qe,
6608
+ ["0x3660dE6C56cFD31998397652941ECe42118375DA".toLowerCase()]: He,
6609
+ ["0xBd68cBe6c247e2c3a0e36B8F0e24964914f26Ee8".toLowerCase()]: Pe,
6610
+ ["0xe4ddca21881bac219af7f217703db0475d2a9f02".toLowerCase()]: Le,
6611
+ ["0x11733abf0cdb43298f7e949c930188451a9a9ef2".toLowerCase()]: We,
6612
+ ["0xb33874810e5395eb49d8bd7e912631db115d5a03".toLowerCase()]: Ve
6613
+ }, Xe = ({
6614
+ streamSwap: r,
6615
+ contractAddress: e,
6616
+ recipient: t,
6617
+ toChecksumAddress: n,
8564
6618
  calldata: {
8565
- amount: i,
8566
- amountOutMin: s = "",
8567
- data: p = "",
8568
- deadline: u,
8569
- memo: y,
8570
- router: o,
8571
- memoStreamingSwap: l,
8572
- tcMemo: b,
8573
- tcRouter: T,
8574
- tcVault: f,
8575
- vault: _,
8576
- token: M
6619
+ amount: p,
6620
+ amountOutMin: i = "",
6621
+ data: o = "",
6622
+ deadline: c,
6623
+ memo: f,
6624
+ router: b,
6625
+ memoStreamingSwap: w,
6626
+ tcMemo: T,
6627
+ tcRouter: d,
6628
+ tcVault: l,
6629
+ vault: A,
6630
+ token: k
8577
6631
  }
8578
6632
  }) => {
8579
- const v = !!dt[t.toLowerCase()];
8580
- if (v && !o)
6633
+ const h = !!ne[e.toLowerCase()];
6634
+ if (h && !b)
8581
6635
  throw new Error("Router is required on calldata for swapIn with GenericContract");
8582
- const C = b || y, R = e && l || C;
8583
- if (!(f || _))
6636
+ const g = T || f, I = r && w || g;
6637
+ if (!(l || A))
8584
6638
  throw new Error("TC Vault is required on calldata");
8585
- if (!(T || o))
6639
+ if (!(d || b))
8586
6640
  throw new Error("TC Router is required on calldata");
8587
- if (!R)
6641
+ if (!I)
8588
6642
  throw new Error("TC Memo is required on calldata");
8589
- if (!M)
6643
+ if (!k)
8590
6644
  throw new Error("Token is required on calldata");
8591
- const J = [
6645
+ const D = [
8592
6646
  // v2 contracts don't have tcVault, tcRouter, tcMemo but vault, router, memo
8593
- a(T || o),
8594
- a(f || _),
8595
- R.replace("{recipientAddress}", n),
8596
- a(M),
8597
- i
8598
- ], we = v ? [a(o), p, u] : [s, u];
8599
- return [...J, ...we];
8600
- }, Xn = (e) => {
8601
- const t = e ? U.MayanodeStagenet : U.MayanodeMainnet;
8602
- return x.get(`${t}/mayachain/mimir`);
8603
- }, Gn = (e) => {
8604
- const t = e ? U.ThornodeStagenet : U.ThornodeMainnet;
8605
- return x.get(`${t}/thorchain/inbound_addresses`);
8606
- }, jn = (e) => {
8607
- const t = e ? U.ThornodeStagenet : U.ThornodeMainnet;
8608
- return x.get(`${t}/thorchain/mimir`);
8609
- }, Ge = () => Object.values(r).reduce(
8610
- (e, t) => (e[t] = null, e),
6647
+ n(d || b),
6648
+ n(l || A),
6649
+ I.replace("{recipientAddress}", t),
6650
+ n(k),
6651
+ p
6652
+ ], X = h ? [n(b), o, c] : [i, c];
6653
+ return [...D, ...X];
6654
+ }, Ue = (r) => {
6655
+ const e = r ? B.MayanodeStagenet : B.MayanodeMainnet;
6656
+ return N.get(`${e}/mayachain/mimir`);
6657
+ }, Ne = (r) => {
6658
+ const e = r ? B.ThornodeStagenet : B.ThornodeMainnet;
6659
+ return N.get(`${e}/thorchain/inbound_addresses`);
6660
+ }, Ge = (r) => {
6661
+ const e = r ? B.ThornodeStagenet : B.ThornodeMainnet;
6662
+ return N.get(`${e}/thorchain/mimir`);
6663
+ }, J = () => Object.values(a).reduce(
6664
+ (r, e) => (r[e] = null, r),
8611
6665
  {}
8612
- ), Kn = ({
8613
- chain: e,
8614
- address: t
6666
+ ), Qe = ({
6667
+ chain: r,
6668
+ address: e
8615
6669
  }) => {
8616
- if (!t)
6670
+ if (!e)
8617
6671
  return !1;
8618
- switch (e) {
8619
- case r.Bitcoin:
8620
- return !t.startsWith("bc1p");
6672
+ switch (r) {
6673
+ case a.Bitcoin:
6674
+ return !e.startsWith("bc1p");
8621
6675
  default:
8622
6676
  return !0;
8623
6677
  }
8624
6678
  };
8625
- var $, me, ae, H, ie, Te, se;
8626
- class ga {
8627
- constructor({ stagenet: t } = {}) {
8628
- m(this, "connectedChains", Ge());
8629
- m(this, "connectedWallets", Ge());
8630
- m(this, "stagenet", !1);
8631
- m(this, "getAddress", (t) => {
8632
- var n;
8633
- return ((n = this.connectedChains[t]) == null ? void 0 : n.address) || "";
6679
+ var S, W, q, E, H, V, P;
6680
+ class Je {
6681
+ constructor({ stagenet: e } = {}) {
6682
+ y(this, "connectedChains", J());
6683
+ y(this, "connectedWallets", J());
6684
+ y(this, "stagenet", !1);
6685
+ y(this, "getAddress", (e) => {
6686
+ var t;
6687
+ return ((t = this.connectedChains[e]) == null ? void 0 : t.address) || "";
8634
6688
  });
8635
- m(this, "getExplorerTxUrl", (t, n) => yt({ chain: t, txHash: n }));
8636
- m(this, "getWallet", (t) => this.connectedWallets[t]);
8637
- m(this, "getExplorerAddressUrl", (t, n) => ot({ chain: t, address: n }));
8638
- m(this, "getBalance", async (t, n) => {
8639
- const a = await this.getWalletByChain(t, n);
8640
- return (a == null ? void 0 : a.balance) || [];
6689
+ y(this, "getExplorerTxUrl", (e, t) => ee({ chain: e, txHash: t }));
6690
+ y(this, "getWallet", (e) => this.connectedWallets[e]);
6691
+ y(this, "getExplorerAddressUrl", (e, t) => te({ chain: e, address: t }));
6692
+ y(this, "getBalance", async (e, t) => {
6693
+ const n = await this.getWalletByChain(e, t);
6694
+ return (n == null ? void 0 : n.balance) || [];
8641
6695
  });
8642
- m(this, "swap", async ({
8643
- streamSwap: t,
8644
- recipient: n,
8645
- route: a,
8646
- feeOptionKey: i = Y.Average
6696
+ y(this, "swap", async ({
6697
+ streamSwap: e,
6698
+ recipient: t,
6699
+ route: n,
6700
+ feeOptionKey: p = K.Average
8647
6701
  // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
8648
6702
  }) => {
8649
- var u, y;
6703
+ var c, f;
8650
6704
  const {
8651
- meta: { quoteMode: s }
6705
+ meta: { quoteMode: i }
8652
6706
  // evmTransactionDetails: contractCallParams,
8653
- } = a, p = s.startsWith("ERC20-") ? r.Ethereum : s.startsWith("ARC20-") ? r.Avalanche : s.startsWith("BEP20-") ? r.BinanceSmartChain : void 0;
8654
- if (!a.complete)
8655
- throw new d("core_swap_route_not_complete");
8656
- if (Mt.includes(s) && p) {
8657
- const o = this.connectedWallets[p];
8658
- if (!(o != null && o.sendTransaction))
8659
- throw new d("core_wallet_connection_not_found");
8660
- if (!(t ? (u = a == null ? void 0 : a.streamingSwap) == null ? void 0 : u.transaction : a == null ? void 0 : a.transaction))
8661
- throw new d("core_swap_route_transaction_not_found");
8662
- const { data: b, from: T, to: f, value: _ } = a.transaction, M = {
8663
- data: b,
8664
- from: T,
8665
- to: f.toLowerCase(),
8666
- chainId: BigInt(Qe[p]),
8667
- value: _ ? BigInt(_) : 0n
6707
+ } = n, o = i.startsWith("ERC20-") ? a.Ethereum : i.startsWith("ARC20-") ? a.Avalanche : i.startsWith("BEP20-") ? a.BinanceSmartChain : void 0;
6708
+ if (!n.complete)
6709
+ throw new s("core_swap_route_not_complete");
6710
+ if (le.includes(i) && o) {
6711
+ const b = this.connectedWallets[o];
6712
+ if (!(b != null && b.sendTransaction))
6713
+ throw new s("core_wallet_connection_not_found");
6714
+ if (!(e ? (c = n == null ? void 0 : n.streamingSwap) == null ? void 0 : c.transaction : n == null ? void 0 : n.transaction))
6715
+ throw new s("core_swap_route_transaction_not_found");
6716
+ const { data: T, from: d, to: l, value: A } = n.transaction, k = {
6717
+ data: T,
6718
+ from: d,
6719
+ to: l.toLowerCase(),
6720
+ chainId: BigInt(me[o]),
6721
+ value: A ? BigInt(A) : 0n
8668
6722
  };
8669
- return o.sendTransaction(M, i);
6723
+ return b.sendTransaction(k, p);
8670
6724
  }
8671
- if (Ct.includes(s)) {
8672
- if (!a.calldata.fromAsset)
8673
- throw new d("core_swap_asset_not_recognized");
8674
- const o = await k.fromString(a.calldata.fromAsset);
8675
- if (!o)
8676
- throw new d("core_swap_asset_not_recognized");
8677
- const { address: l } = await A(this, $).call(this, o.chain), {
8678
- contract: b,
8679
- calldata: { expiration: T, amountIn: f, memo: _, memoStreamingSwap: M }
8680
- } = a, v = o.add(F.fromBigInt(BigInt(f), o.decimal)), C = t && M || _;
6725
+ if (Te.includes(i)) {
6726
+ if (!n.calldata.fromAsset)
6727
+ throw new s("core_swap_asset_not_recognized");
6728
+ const b = await L.fromString(n.calldata.fromAsset);
6729
+ if (!b)
6730
+ throw new s("core_swap_asset_not_recognized");
6731
+ const { address: w } = await M(this, S).call(this, b.chain), {
6732
+ contract: T,
6733
+ calldata: { expiration: d, amountIn: l, memo: A, memoStreamingSwap: k }
6734
+ } = n, h = b.add(oe.fromBigInt(BigInt(l), b.decimal)), g = e && k || A;
8681
6735
  return this.deposit({
8682
- expiration: T,
8683
- assetValue: v,
8684
- memo: C,
8685
- feeOptionKey: i,
8686
- router: b,
8687
- recipient: l
6736
+ expiration: d,
6737
+ assetValue: h,
6738
+ memo: g,
6739
+ feeOptionKey: p,
6740
+ router: T,
6741
+ recipient: w
8688
6742
  });
8689
6743
  }
8690
- if (vt.includes(s) && p) {
8691
- const { calldata: o, contract: l } = a;
8692
- if (!l)
8693
- throw new d("core_swap_contract_not_found");
8694
- const b = this.connectedWallets[p], T = this.getAddress(p);
8695
- if (!(b != null && b.sendTransaction && T))
8696
- throw new d("core_wallet_connection_not_found");
8697
- const { getProvider: f, toChecksumAddress: _ } = await import("@swapkit/toolbox-evm"), M = f(p), v = $n[l.toLowerCase()];
8698
- if (!v)
8699
- throw new d("core_swap_contract_not_supported", {
8700
- contractAddress: l
6744
+ if (ce.includes(i) && o) {
6745
+ const { calldata: b, contract: w } = n;
6746
+ if (!w)
6747
+ throw new s("core_swap_contract_not_found");
6748
+ const T = this.connectedWallets[o], d = this.getAddress(o);
6749
+ if (!(T != null && T.sendTransaction && d))
6750
+ throw new s("core_wallet_connection_not_found");
6751
+ const { getProvider: l, toChecksumAddress: A } = await import("@swapkit/toolbox-evm"), k = l(o), h = De[w.toLowerCase()];
6752
+ if (!h)
6753
+ throw new s("core_swap_contract_not_supported", {
6754
+ contractAddress: w
8701
6755
  });
8702
- const R = await (await ((y = b.createContract) == null ? void 0 : y.call(b, l, v, M))).getFunction("swapIn").populateTransaction(
8703
- ...Un({
8704
- streamSwap: t,
8705
- toChecksumAddress: _,
8706
- contractAddress: l,
8707
- recipient: n,
8708
- calldata: o
6756
+ const I = await (await ((f = T.createContract) == null ? void 0 : f.call(T, w, h, k))).getFunction("swapIn").populateTransaction(
6757
+ ...Xe({
6758
+ streamSwap: e,
6759
+ toChecksumAddress: A,
6760
+ contractAddress: w,
6761
+ recipient: t,
6762
+ calldata: b
8709
6763
  }),
8710
- { from: T }
6764
+ { from: d }
8711
6765
  );
8712
- return b.sendTransaction(R, i);
6766
+ return T.sendTransaction(I, p);
8713
6767
  }
8714
- throw new d("core_swap_quote_mode_not_supported", { quoteMode: s });
6768
+ throw new s("core_swap_quote_mode_not_supported", { quoteMode: i });
8715
6769
  });
8716
- m(this, "getWalletByChain", async (t, n) => {
8717
- var p, u;
8718
- const a = this.getAddress(t);
8719
- if (!a)
6770
+ y(this, "getWalletByChain", async (e, t) => {
6771
+ var o, c;
6772
+ const n = this.getAddress(e);
6773
+ if (!n)
8720
6774
  return null;
8721
- const i = [k.fromChainOrSignature(t)], s = (p = this.connectedChains[t]) == null ? void 0 : p.walletType;
6775
+ const p = [L.fromChainOrSignature(e)], i = (o = this.connectedChains[e]) == null ? void 0 : o.walletType;
8722
6776
  try {
8723
- const y = await ((u = this.getWallet(t)) == null ? void 0 : u.getBalance(a, n));
8724
- return this.connectedChains[t] = {
8725
- address: a,
8726
- balance: y != null && y.length ? y : i,
8727
- walletType: s
8728
- }, { ...this.connectedChains[t] };
8729
- } catch (y) {
8730
- return console.error(y), { address: a, balance: i, walletType: s };
6777
+ const f = await ((c = this.getWallet(e)) == null ? void 0 : c.getBalance(n, t));
6778
+ return this.connectedChains[e] = {
6779
+ address: n,
6780
+ balance: f != null && f.length ? f : p,
6781
+ walletType: i
6782
+ }, { ...this.connectedChains[e] };
6783
+ } catch (f) {
6784
+ return console.error(f), { address: n, balance: p, walletType: i };
8731
6785
  }
8732
6786
  });
8733
- m(this, "approveAssetValue", (t, n) => A(this, ae).call(this, { assetValue: t, type: "approve", contractAddress: n }));
8734
- m(this, "isAssetValueApproved", (t, n) => A(this, ae).call(this, { assetValue: t, contractAddress: n, type: "checkOnly" }));
8735
- m(this, "validateAddress", ({ address: t, chain: n }) => {
8736
- var a, i;
8737
- return (i = (a = this.getWallet(n)) == null ? void 0 : a.validateAddress) == null ? void 0 : i.call(a, t);
6787
+ y(this, "approveAssetValue", (e, t) => M(this, q).call(this, { assetValue: e, type: "approve", contractAddress: t }));
6788
+ y(this, "isAssetValueApproved", (e, t) => M(this, q).call(this, { assetValue: e, contractAddress: t, type: "checkOnly" }));
6789
+ y(this, "validateAddress", ({ address: e, chain: t }) => {
6790
+ var n, p;
6791
+ return (p = (n = this.getWallet(t)) == null ? void 0 : n.validateAddress) == null ? void 0 : p.call(n, e);
8738
6792
  });
8739
- m(this, "transfer", async (t) => {
8740
- const n = this.connectedWallets[t.assetValue.chain];
8741
- if (!n)
8742
- throw new d("core_wallet_connection_not_found");
6793
+ y(this, "transfer", async (e) => {
6794
+ const t = this.connectedWallets[e.assetValue.chain];
6795
+ if (!t)
6796
+ throw new s("core_wallet_connection_not_found");
8743
6797
  try {
8744
- return await n.transfer(A(this, se).call(this, t));
8745
- } catch (a) {
8746
- throw new d("core_swap_transaction_error", a);
6798
+ return await t.transfer(M(this, P).call(this, e));
6799
+ } catch (n) {
6800
+ throw new s("core_swap_transaction_error", n);
8747
6801
  }
8748
6802
  });
8749
- m(this, "deposit", async ({
8750
- assetValue: t,
8751
- recipient: n,
8752
- router: a,
8753
- ...i
6803
+ y(this, "deposit", async ({
6804
+ assetValue: e,
6805
+ recipient: t,
6806
+ router: n,
6807
+ ...p
8754
6808
  }) => {
8755
- const { chain: s, symbol: p, ticker: u } = t, y = this.connectedWallets[s], o = this.connectedChains[s];
8756
- if (!await Kn({
8757
- address: o == null ? void 0 : o.address,
8758
- chain: s
6809
+ const { chain: i, symbol: o, ticker: c } = e, f = this.connectedWallets[i], b = this.connectedChains[i];
6810
+ if (!await Qe({
6811
+ address: b == null ? void 0 : b.address,
6812
+ chain: i
8759
6813
  }))
8760
- throw new d("core_transaction_invalid_sender_address");
8761
- if (!y)
8762
- throw new d("core_wallet_connection_not_found");
8763
- const b = A(this, se).call(this, {
8764
- assetValue: t,
8765
- recipient: n,
8766
- router: a,
8767
- ...i
6814
+ throw new s("core_transaction_invalid_sender_address");
6815
+ if (!f)
6816
+ throw new s("core_wallet_connection_not_found");
6817
+ const T = M(this, P).call(this, {
6818
+ assetValue: e,
6819
+ recipient: t,
6820
+ router: n,
6821
+ ...p
8768
6822
  });
8769
6823
  try {
8770
- switch (s) {
8771
- case r.THORChain:
8772
- case r.Maya: {
8773
- const T = y;
8774
- return await (n === "" ? T.deposit(b) : T.transfer(b));
6824
+ switch (i) {
6825
+ case a.THORChain:
6826
+ case a.Maya: {
6827
+ const d = f;
6828
+ return await (t === "" ? d.deposit(T) : d.transfer(T));
8775
6829
  }
8776
- case r.Ethereum:
8777
- case r.BinanceSmartChain:
8778
- case r.Avalanche: {
8779
- const { getChecksumAddressFromAsset: T } = await import("@swapkit/toolbox-evm"), f = s === r.Avalanche ? At : s === r.BinanceSmartChain ? gt : wt;
8780
- return await y.call({
8781
- abi: f,
8782
- contractAddress: a || (await A(this, $).call(this, s)).router,
6830
+ case a.Ethereum:
6831
+ case a.BinanceSmartChain:
6832
+ case a.Avalanche: {
6833
+ const { getChecksumAddressFromAsset: d } = await import("@swapkit/toolbox-evm"), l = i === a.Avalanche ? be : i === a.BinanceSmartChain ? fe : we;
6834
+ return await f.call({
6835
+ abi: l,
6836
+ contractAddress: n || (await M(this, S).call(this, i)).router,
8783
6837
  funcName: "depositWithExpiry",
8784
6838
  funcParams: [
8785
- n,
8786
- T({ chain: s, symbol: p, ticker: u }, s),
8787
- t.getBaseValue("string"),
8788
- b.memo,
8789
- i.expiration || Number.parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
6839
+ t,
6840
+ d({ chain: i, symbol: o, ticker: c }, i),
6841
+ e.getBaseValue("string"),
6842
+ T.memo,
6843
+ p.expiration || Number.parseInt(`${((/* @__PURE__ */ new Date()).getTime() + 15 * 60 * 1e3) / 1e3}`)
8790
6844
  ],
8791
6845
  txOverrides: {
8792
- from: b.from,
8793
- value: t.isGasAsset ? t.getBaseValue("bigint") : void 0
6846
+ from: T.from,
6847
+ value: e.isGasAsset ? e.getBaseValue("bigint") : void 0
8794
6848
  }
8795
6849
  });
8796
6850
  }
8797
6851
  default:
8798
- return await y.transfer(b);
6852
+ return await f.transfer(T);
8799
6853
  }
8800
- } catch (T) {
8801
- const f = typeof T == "string" ? T.toLowerCase() : T == null ? void 0 : T.message.toLowerCase(), _ = f == null ? void 0 : f.includes("insufficient funds"), M = f == null ? void 0 : f.includes("gas"), v = f == null ? void 0 : f.includes("server"), C = f == null ? void 0 : f.includes("user rejected"), R = _ ? "core_transaction_deposit_insufficient_funds_error" : M ? "core_transaction_deposit_gas_error" : v ? "core_transaction_deposit_server_error" : C ? "core_transaction_user_rejected" : "core_transaction_deposit_error";
8802
- throw new d(R, T);
6854
+ } catch (d) {
6855
+ const l = typeof d == "string" ? d.toLowerCase() : d == null ? void 0 : d.message.toLowerCase(), A = l == null ? void 0 : l.includes("insufficient funds"), k = l == null ? void 0 : l.includes("gas"), h = l == null ? void 0 : l.includes("server"), g = l == null ? void 0 : l.includes("user rejected"), I = A ? "core_transaction_deposit_insufficient_funds_error" : k ? "core_transaction_deposit_gas_error" : h ? "core_transaction_deposit_server_error" : g ? "core_transaction_user_rejected" : "core_transaction_deposit_error";
6856
+ throw new s(I, d);
8803
6857
  }
8804
6858
  });
8805
6859
  /**
8806
6860
  * TC related Methods
8807
6861
  */
8808
- m(this, "createLiquidity", async ({
8809
- runeAssetValue: t,
8810
- assetValue: n
6862
+ y(this, "createLiquidity", async ({
6863
+ runeAssetValue: e,
6864
+ assetValue: t
8811
6865
  }) => {
8812
- if (t.lte(0) || n.lte(0))
8813
- throw new d("core_transaction_create_liquidity_invalid_params");
8814
- let a = "", i = "";
6866
+ if (e.lte(0) || t.lte(0))
6867
+ throw new s("core_transaction_create_liquidity_invalid_params");
6868
+ let n = "", p = "";
8815
6869
  try {
8816
- a = await A(this, H).call(this, {
8817
- assetValue: t,
8818
- memo: B(w.DEPOSIT, {
8819
- ...n,
8820
- address: this.getAddress(n.chain)
6870
+ n = await M(this, E).call(this, {
6871
+ assetValue: e,
6872
+ memo: O(v.DEPOSIT, {
6873
+ ...t,
6874
+ address: this.getAddress(t.chain)
8821
6875
  })
8822
6876
  });
8823
- } catch (s) {
8824
- throw new d("core_transaction_create_liquidity_rune_error", s);
6877
+ } catch (i) {
6878
+ throw new s("core_transaction_create_liquidity_rune_error", i);
8825
6879
  }
8826
6880
  try {
8827
- i = await A(this, H).call(this, {
8828
- assetValue: n,
8829
- memo: B(w.DEPOSIT, {
8830
- ...n,
8831
- address: this.getAddress(r.THORChain)
6881
+ p = await M(this, E).call(this, {
6882
+ assetValue: t,
6883
+ memo: O(v.DEPOSIT, {
6884
+ ...t,
6885
+ address: this.getAddress(a.THORChain)
8832
6886
  })
8833
6887
  });
8834
- } catch (s) {
8835
- throw new d("core_transaction_create_liquidity_asset_error", s);
6888
+ } catch (i) {
6889
+ throw new s("core_transaction_create_liquidity_asset_error", i);
8836
6890
  }
8837
- return { runeTx: a, assetTx: i };
6891
+ return { runeTx: n, assetTx: p };
8838
6892
  });
8839
- m(this, "addLiquidity", async ({
8840
- runeAssetValue: t,
8841
- assetValue: n,
8842
- runeAddr: a,
8843
- assetAddr: i,
8844
- isPendingSymmAsset: s,
8845
- mode: p = "sym"
6893
+ y(this, "addLiquidity", async ({
6894
+ runeAssetValue: e,
6895
+ assetValue: t,
6896
+ runeAddr: n,
6897
+ assetAddr: p,
6898
+ isPendingSymmAsset: i,
6899
+ mode: o = "sym"
8846
6900
  }) => {
8847
- const { chain: u, symbol: y } = n, o = p === "sym", l = (t == null ? void 0 : t.gt(0)) && (o || p === "rune"), b = (n == null ? void 0 : n.gt(0)) && (o || p === "asset"), T = s || l, f = T ? a || this.getAddress(r.THORChain) : "", _ = o || p === "asset" ? i || this.getAddress(u) : "";
8848
- if (!(l || b))
8849
- throw new d("core_transaction_add_liquidity_invalid_params");
8850
- if (T && !f)
8851
- throw new d("core_transaction_add_liquidity_no_rune_address");
8852
- let M, v;
8853
- if (l && t)
6901
+ const { chain: c, symbol: f } = t, b = o === "sym", w = (e == null ? void 0 : e.gt(0)) && (b || o === "rune"), T = (t == null ? void 0 : t.gt(0)) && (b || o === "asset"), d = i || w, l = d ? n || this.getAddress(a.THORChain) : "", A = b || o === "asset" ? p || this.getAddress(c) : "";
6902
+ if (!(w || T))
6903
+ throw new s("core_transaction_add_liquidity_invalid_params");
6904
+ if (d && !l)
6905
+ throw new s("core_transaction_add_liquidity_no_rune_address");
6906
+ let k, h;
6907
+ if (w && e)
8854
6908
  try {
8855
- M = await A(this, H).call(this, {
8856
- assetValue: t,
8857
- memo: B(w.DEPOSIT, {
8858
- chain: u,
8859
- symbol: y,
8860
- address: _
6909
+ k = await M(this, E).call(this, {
6910
+ assetValue: e,
6911
+ memo: O(v.DEPOSIT, {
6912
+ chain: c,
6913
+ symbol: f,
6914
+ address: A
8861
6915
  })
8862
6916
  });
8863
- } catch (C) {
8864
- throw new d("core_transaction_add_liquidity_rune_error", C);
6917
+ } catch (g) {
6918
+ throw new s("core_transaction_add_liquidity_rune_error", g);
8865
6919
  }
8866
- if (b && n)
6920
+ if (T && t)
8867
6921
  try {
8868
- v = await A(this, H).call(this, {
8869
- assetValue: n,
8870
- memo: B(w.DEPOSIT, {
8871
- chain: u,
8872
- symbol: y,
8873
- address: f
6922
+ h = await M(this, E).call(this, {
6923
+ assetValue: t,
6924
+ memo: O(v.DEPOSIT, {
6925
+ chain: c,
6926
+ symbol: f,
6927
+ address: l
8874
6928
  })
8875
6929
  });
8876
- } catch (C) {
8877
- throw new d("core_transaction_add_liquidity_asset_error", C);
6930
+ } catch (g) {
6931
+ throw new s("core_transaction_add_liquidity_asset_error", g);
8878
6932
  }
8879
- return { runeTx: M, assetTx: v };
6933
+ return { runeTx: k, assetTx: h };
8880
6934
  });
8881
- m(this, "addLiquidityPart", ({
8882
- assetValue: t,
8883
- poolAddress: n,
8884
- address: a,
8885
- symmetric: i
6935
+ y(this, "addLiquidityPart", ({
6936
+ assetValue: e,
6937
+ poolAddress: t,
6938
+ address: n,
6939
+ symmetric: p
8886
6940
  }) => {
8887
- if (i && !a)
8888
- throw new d("core_transaction_add_liquidity_invalid_params");
8889
- const s = B(w.DEPOSIT, {
8890
- chain: n.split(".")[0],
8891
- symbol: n.split(".")[1],
8892
- address: i ? a : ""
6941
+ if (p && !n)
6942
+ throw new s("core_transaction_add_liquidity_invalid_params");
6943
+ const i = O(v.DEPOSIT, {
6944
+ chain: t.split(".")[0],
6945
+ symbol: t.split(".")[1],
6946
+ address: p ? n : ""
8893
6947
  });
8894
- return A(this, H).call(this, { assetValue: t, memo: s });
6948
+ return M(this, E).call(this, { assetValue: e, memo: i });
8895
6949
  });
8896
- m(this, "withdraw", ({
8897
- memo: t,
8898
- assetValue: n,
8899
- percent: a,
8900
- from: i,
8901
- to: s
6950
+ y(this, "withdraw", ({
6951
+ memo: e,
6952
+ assetValue: t,
6953
+ percent: n,
6954
+ from: p,
6955
+ to: i
8902
6956
  }) => {
8903
- const p = s === "rune" && i !== "rune" ? k.fromChainOrSignature(r.THORChain) : i === "sym" && s === "sym" || i === "rune" || i === "asset" ? void 0 : n, u = _e(i === "asset" ? n.chain : r.THORChain), y = t || B(w.WITHDRAW, {
8904
- symbol: n.symbol,
8905
- chain: n.chain,
8906
- ticker: n.ticker,
8907
- basisPoints: Math.min(1e4, Math.round(a * 100)),
8908
- targetAssetString: p == null ? void 0 : p.toString(),
6957
+ const o = i === "rune" && p !== "rune" ? L.fromChainOrSignature(a.THORChain) : p === "sym" && i === "sym" || p === "rune" || p === "asset" ? void 0 : t, c = U(p === "asset" ? t.chain : a.THORChain), f = e || O(v.WITHDRAW, {
6958
+ symbol: t.symbol,
6959
+ chain: t.chain,
6960
+ ticker: t.ticker,
6961
+ basisPoints: Math.min(1e4, Math.round(n * 100)),
6962
+ targetAssetString: o == null ? void 0 : o.toString(),
8909
6963
  singleSide: !1
8910
6964
  });
8911
- return A(this, H).call(this, { assetValue: u, memo: y });
6965
+ return M(this, E).call(this, { assetValue: c, memo: f });
8912
6966
  });
8913
- m(this, "savings", ({
8914
- assetValue: t,
8915
- memo: n,
8916
- percent: a,
8917
- type: i
6967
+ y(this, "savings", ({
6968
+ assetValue: e,
6969
+ memo: t,
6970
+ percent: n,
6971
+ type: p
8918
6972
  }) => {
8919
- const s = i === "add" ? w.DEPOSIT : w.WITHDRAW, p = n || B(s, {
8920
- ticker: t.ticker,
8921
- symbol: t.symbol,
8922
- chain: t.chain,
6973
+ const i = p === "add" ? v.DEPOSIT : v.WITHDRAW, o = t || O(i, {
6974
+ ticker: e.ticker,
6975
+ symbol: e.symbol,
6976
+ chain: e.chain,
8923
6977
  singleSide: !0,
8924
- basisPoints: a ? Math.min(1e4, Math.round(a * 100)) : void 0
8925
- }), u = s === w.DEPOSIT ? t : _e(t.chain);
8926
- return A(this, H).call(this, { memo: p, assetValue: u });
6978
+ basisPoints: n ? Math.min(1e4, Math.round(n * 100)) : void 0
6979
+ }), c = i === v.DEPOSIT ? e : U(e.chain);
6980
+ return M(this, E).call(this, { memo: o, assetValue: c });
8927
6981
  });
8928
- m(this, "loan", ({
8929
- assetValue: t,
8930
- memo: n,
8931
- minAmount: a,
8932
- type: i
8933
- }) => A(this, H).call(this, {
8934
- assetValue: t,
8935
- memo: n || B(i === "open" ? w.OPEN_LOAN : w.CLOSE_LOAN, {
8936
- asset: t.toString(),
8937
- minAmount: a.toString(),
8938
- address: this.getAddress(t.chain)
6982
+ y(this, "loan", ({
6983
+ assetValue: e,
6984
+ memo: t,
6985
+ minAmount: n,
6986
+ type: p
6987
+ }) => M(this, E).call(this, {
6988
+ assetValue: e,
6989
+ memo: t || O(p === "open" ? v.OPEN_LOAN : v.CLOSE_LOAN, {
6990
+ asset: e.toString(),
6991
+ minAmount: n.toString(),
6992
+ address: this.getAddress(e.chain)
8939
6993
  })
8940
6994
  }));
8941
- m(this, "nodeAction", ({
8942
- type: t,
8943
- assetValue: n,
8944
- address: a
6995
+ y(this, "nodeAction", ({
6996
+ type: e,
6997
+ assetValue: t,
6998
+ address: n
8945
6999
  }) => {
8946
- const i = t === "bond" ? w.BOND : t === "unbond" ? w.UNBOND : w.LEAVE, s = B(i, {
8947
- address: a,
8948
- unbondAmount: t === "unbond" ? n.getBaseValue("number") : void 0
7000
+ const p = e === "bond" ? v.BOND : e === "unbond" ? v.UNBOND : v.LEAVE, i = O(p, {
7001
+ address: n,
7002
+ unbondAmount: e === "unbond" ? t.getBaseValue("number") : void 0
8949
7003
  });
8950
- return A(this, ie).call(this, {
8951
- memo: s,
8952
- assetValue: t === "bond" ? n : _e(r.THORChain)
7004
+ return M(this, H).call(this, {
7005
+ memo: i,
7006
+ assetValue: e === "bond" ? t : U(a.THORChain)
8953
7007
  });
8954
7008
  });
8955
- m(this, "registerThorname", ({
8956
- assetValue: t,
8957
- ...n
8958
- }) => A(this, ie).call(this, {
8959
- assetValue: t,
8960
- memo: B(w.THORNAME_REGISTER, n)
7009
+ y(this, "registerThorname", ({
7010
+ assetValue: e,
7011
+ ...t
7012
+ }) => M(this, H).call(this, {
7013
+ assetValue: e,
7014
+ memo: O(v.THORNAME_REGISTER, t)
8961
7015
  }));
8962
- m(this, "registerMayaname", ({
8963
- assetValue: t,
8964
- ...n
8965
- }) => A(this, Te).call(this, {
8966
- assetValue: t,
8967
- memo: B(w.THORNAME_REGISTER, n)
7016
+ y(this, "registerMayaname", ({
7017
+ assetValue: e,
7018
+ ...t
7019
+ }) => M(this, V).call(this, {
7020
+ assetValue: e,
7021
+ memo: O(v.THORNAME_REGISTER, t)
8968
7022
  }));
8969
- m(this, "extend", ({ wallets: t, config: n, apis: a = {}, rpcUrls: i = {} }) => {
7023
+ y(this, "extend", ({ wallets: e, config: t, apis: n = {}, rpcUrls: p = {} }) => {
8970
7024
  try {
8971
- for (const s of t)
8972
- this[s.connectMethodName] = s.connect({
8973
- addChain: A(this, me),
8974
- config: n || {},
8975
- apis: a,
8976
- rpcUrls: i
7025
+ for (const i of e)
7026
+ this[i.connectMethodName] = i.connect({
7027
+ addChain: M(this, W),
7028
+ config: t || {},
7029
+ apis: n,
7030
+ rpcUrls: p
8977
7031
  });
8978
- } catch (s) {
8979
- throw new d("core_extend_error", s);
7032
+ } catch (i) {
7033
+ throw new s("core_extend_error", i);
8980
7034
  }
8981
7035
  });
8982
- m(this, "estimateMaxSendableAmount", async ({
8983
- chain: t,
8984
- params: n
7036
+ y(this, "estimateMaxSendableAmount", async ({
7037
+ chain: e,
7038
+ params: t
8985
7039
  }) => {
8986
- const a = this.getWallet(t);
8987
- switch (t) {
8988
- case r.Arbitrum:
8989
- case r.Avalanche:
8990
- case r.BinanceSmartChain:
8991
- case r.Ethereum:
8992
- case r.Optimism:
8993
- case r.Polygon: {
8994
- const { estimateMaxSendableAmount: i } = await import("@swapkit/toolbox-evm");
8995
- return i({
8996
- ...n,
8997
- toolbox: a
7040
+ const n = this.getWallet(e);
7041
+ switch (e) {
7042
+ case a.Arbitrum:
7043
+ case a.Avalanche:
7044
+ case a.BinanceSmartChain:
7045
+ case a.Ethereum:
7046
+ case a.Optimism:
7047
+ case a.Polygon: {
7048
+ const { estimateMaxSendableAmount: p } = await import("@swapkit/toolbox-evm");
7049
+ return p({
7050
+ ...t,
7051
+ toolbox: n
8998
7052
  });
8999
7053
  }
9000
- case r.Bitcoin:
9001
- case r.BitcoinCash:
9002
- case r.Dogecoin:
9003
- case r.Litecoin:
9004
- return a.estimateMaxSendableAmount(n);
9005
- case r.Binance:
9006
- case r.THORChain:
9007
- case r.Cosmos: {
9008
- const { estimateMaxSendableAmount: i } = await import("@swapkit/toolbox-cosmos");
9009
- return i({
9010
- ...n,
9011
- toolbox: a
7054
+ case a.Bitcoin:
7055
+ case a.BitcoinCash:
7056
+ case a.Dogecoin:
7057
+ case a.Litecoin:
7058
+ return n.estimateMaxSendableAmount(t);
7059
+ case a.Binance:
7060
+ case a.THORChain:
7061
+ case a.Cosmos: {
7062
+ const { estimateMaxSendableAmount: p } = await import("@swapkit/toolbox-cosmos");
7063
+ return p({
7064
+ ...t,
7065
+ toolbox: n
9012
7066
  });
9013
7067
  }
9014
7068
  default:
9015
- throw new d("core_estimated_max_spendable_chain_not_supported");
7069
+ throw new s("core_estimated_max_spendable_chain_not_supported");
9016
7070
  }
9017
7071
  });
9018
7072
  /**
9019
7073
  * Wallet connection methods
9020
7074
  */
9021
7075
  // biome-ignore lint/suspicious/useAwait: Extended methods
9022
- m(this, "connectXDEFI", async (t) => {
9023
- throw new d("core_wallet_xdefi_not_installed");
7076
+ y(this, "connectXDEFI", async (e) => {
7077
+ throw new s("core_wallet_xdefi_not_installed");
9024
7078
  });
9025
7079
  // biome-ignore lint/suspicious/useAwait: Extended methods
9026
- m(this, "connectEVMWallet", async (t, n) => {
9027
- throw new d("core_wallet_evmwallet_not_installed");
7080
+ y(this, "connectEVMWallet", async (e, t) => {
7081
+ throw new s("core_wallet_evmwallet_not_installed");
9028
7082
  });
9029
7083
  // biome-ignore lint/suspicious/useAwait: Extended methods
9030
- m(this, "connectWalletconnect", async (t, n) => {
9031
- throw new d("core_wallet_walletconnect_not_installed");
7084
+ y(this, "connectWalletconnect", async (e, t) => {
7085
+ throw new s("core_wallet_walletconnect_not_installed");
9032
7086
  });
9033
7087
  // biome-ignore lint/suspicious/useAwait: Extended methods
9034
- m(this, "connectKeepkey", async (t, n) => {
9035
- throw new d("core_wallet_keepkey_not_installed");
7088
+ y(this, "connectKeepkey", async (e, t) => {
7089
+ throw new s("core_wallet_keepkey_not_installed");
9036
7090
  });
9037
7091
  // biome-ignore lint/suspicious/useAwait: Extended methods
9038
- m(this, "connectKeystore", async (t, n) => {
9039
- throw new d("core_wallet_keystore_not_installed");
7092
+ y(this, "connectKeystore", async (e, t) => {
7093
+ throw new s("core_wallet_keystore_not_installed");
9040
7094
  });
9041
7095
  // biome-ignore lint/suspicious/useAwait: Extended methods
9042
- m(this, "connectLedger", async (t, n) => {
9043
- throw new d("core_wallet_ledger_not_installed");
7096
+ y(this, "connectLedger", async (e, t) => {
7097
+ throw new s("core_wallet_ledger_not_installed");
9044
7098
  });
9045
7099
  // biome-ignore lint/suspicious/useAwait: Extended methods
9046
- m(this, "connectTrezor", async (t, n) => {
9047
- throw new d("core_wallet_trezor_not_installed");
7100
+ y(this, "connectTrezor", async (e, t) => {
7101
+ throw new s("core_wallet_trezor_not_installed");
9048
7102
  });
9049
7103
  // biome-ignore lint/suspicious/useAwait: Extended methods
9050
- m(this, "connectKeplr", async (t) => {
9051
- throw new d("core_wallet_keplr_not_installed");
7104
+ y(this, "connectKeplr", async (e) => {
7105
+ throw new s("core_wallet_keplr_not_installed");
9052
7106
  });
9053
7107
  // biome-ignore lint/suspicious/useAwait: Extended methods
9054
- m(this, "connectOkx", async (t) => {
9055
- throw new d("core_wallet_okx_not_installed");
7108
+ y(this, "connectOkx", async (e) => {
7109
+ throw new s("core_wallet_okx_not_installed");
9056
7110
  });
9057
- m(this, "disconnectChain", (t) => {
9058
- this.connectedChains[t] = null, this.connectedWallets[t] = null;
7111
+ y(this, "disconnectChain", (e) => {
7112
+ this.connectedChains[e] = null, this.connectedWallets[e] = null;
9059
7113
  });
9060
- V(this, $, async (t) => {
9061
- switch (t) {
9062
- case r.Maya:
9063
- case r.THORChain:
9064
- return { gas_rate: "0", router: "", address: "", halted: !1, chain: t };
7114
+ F(this, S, async (e) => {
7115
+ switch (e) {
7116
+ case a.Maya:
7117
+ case a.THORChain:
7118
+ return { gas_rate: "0", router: "", address: "", halted: !1, chain: e };
9065
7119
  default: {
9066
- const a = (await Gn(this.stagenet)).find((i) => i.chain === t);
9067
- if (!a)
9068
- throw new d("core_inbound_data_not_found");
9069
- if (a != null && a.halted)
9070
- throw new d("core_chain_halted");
9071
- return a;
7120
+ const n = (await Ne(this.stagenet)).find((p) => p.chain === e);
7121
+ if (!n)
7122
+ throw new s("core_inbound_data_not_found");
7123
+ if (n != null && n.halted)
7124
+ throw new s("core_chain_halted");
7125
+ return n;
9072
7126
  }
9073
7127
  }
9074
7128
  });
9075
- V(this, me, ({
9076
- chain: t,
9077
- address: n,
9078
- balance: a,
9079
- walletType: i,
9080
- ...s
7129
+ F(this, W, ({
7130
+ chain: e,
7131
+ address: t,
7132
+ balance: n,
7133
+ walletType: p,
7134
+ ...i
9081
7135
  }) => {
9082
- this.connectedChains[t] = {
9083
- address: n || "",
9084
- balance: a || [],
9085
- walletType: i || "unknown"
9086
- }, this.connectedWallets[t] = { ...s };
7136
+ this.connectedChains[e] = {
7137
+ address: t || "",
7138
+ balance: n || [],
7139
+ walletType: p || "unknown"
7140
+ }, this.connectedWallets[e] = { ...i };
9087
7141
  });
9088
- V(this, ae, async ({
9089
- assetValue: t,
9090
- type: n = "checkOnly",
9091
- contractAddress: a
7142
+ F(this, q, async ({
7143
+ assetValue: e,
7144
+ type: t = "checkOnly",
7145
+ contractAddress: n
9092
7146
  }) => {
9093
- const { address: i, chain: s, isGasAsset: p, isSynthetic: u } = t, y = [r.Ethereum, r.Avalanche, r.BinanceSmartChain].includes(s);
9094
- if (y && p || !y || u)
7147
+ const { address: p, chain: i, isGasAsset: o, isSynthetic: c } = e, f = [a.Ethereum, a.Avalanche, a.BinanceSmartChain].includes(i);
7148
+ if (f && o || !f || c)
9095
7149
  return !0;
9096
- const l = this.connectedWallets[s], b = n === "checkOnly" ? l == null ? void 0 : l.isApproved : l == null ? void 0 : l.approve;
9097
- if (!b)
9098
- throw new d("core_wallet_connection_not_found");
9099
- const T = this.getAddress(s);
9100
- if (!(i && T))
9101
- throw new d("core_approve_asset_address_or_from_not_found");
9102
- const f = a || (await A(this, $).call(this, s)).router;
9103
- return b({
9104
- amount: t.getBaseValue("bigint"),
9105
- assetAddress: i,
9106
- from: T,
9107
- spenderAddress: f
7150
+ const w = this.connectedWallets[i], T = t === "checkOnly" ? w == null ? void 0 : w.isApproved : w == null ? void 0 : w.approve;
7151
+ if (!T)
7152
+ throw new s("core_wallet_connection_not_found");
7153
+ const d = this.getAddress(i);
7154
+ if (!(p && d))
7155
+ throw new s("core_approve_asset_address_or_from_not_found");
7156
+ const l = n || (await M(this, S).call(this, i)).router;
7157
+ return T({
7158
+ amount: e.getBaseValue("bigint"),
7159
+ assetAddress: p,
7160
+ from: d,
7161
+ spenderAddress: l
9108
7162
  });
9109
7163
  });
9110
- V(this, H, async ({
9111
- assetValue: t,
9112
- memo: n,
9113
- feeOptionKey: a = Y.Fast
7164
+ F(this, E, async ({
7165
+ assetValue: e,
7166
+ memo: t,
7167
+ feeOptionKey: n = K.Fast
9114
7168
  }) => {
9115
7169
  const {
9116
- gas_rate: i,
9117
- router: s,
9118
- address: p
9119
- } = await A(this, $).call(this, t.chain), u = (Number.parseInt(i) || 0) * yn[a];
7170
+ gas_rate: p,
7171
+ router: i,
7172
+ address: o
7173
+ } = await M(this, S).call(this, e.chain), c = (Number.parseInt(p) || 0) * de[n];
9120
7174
  return this.deposit({
9121
- assetValue: t,
9122
- recipient: p,
9123
- memo: n,
9124
- router: s,
9125
- feeRate: u
7175
+ assetValue: e,
7176
+ recipient: o,
7177
+ memo: t,
7178
+ router: i,
7179
+ feeRate: c
9126
7180
  });
9127
7181
  });
9128
- V(this, ie, async ({
9129
- memo: t,
9130
- assetValue: n
7182
+ F(this, H, async ({
7183
+ memo: e,
7184
+ assetValue: t
9131
7185
  }) => {
9132
- const a = await jn(this.stagenet);
9133
- if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
9134
- throw new d("core_chain_halted");
9135
- return this.deposit({ assetValue: n, recipient: "", memo: t });
7186
+ const n = await Ge(this.stagenet);
7187
+ if (n.HALTCHAINGLOBAL >= 1 || n.HALTTHORCHAIN >= 1)
7188
+ throw new s("core_chain_halted");
7189
+ return this.deposit({ assetValue: t, recipient: "", memo: e });
9136
7190
  });
9137
- V(this, Te, async ({
9138
- memo: t,
9139
- assetValue: n
7191
+ F(this, V, async ({
7192
+ memo: e,
7193
+ assetValue: t
9140
7194
  }) => {
9141
- const a = await Xn(this.stagenet);
9142
- if (a.HALTCHAINGLOBAL >= 1 || a.HALTTHORCHAIN >= 1)
9143
- throw new d("core_chain_halted");
9144
- return this.deposit({ assetValue: n, recipient: "", memo: t });
7195
+ const n = await Ue(this.stagenet);
7196
+ if (n.HALTCHAINGLOBAL >= 1 || n.HALTTHORCHAIN >= 1)
7197
+ throw new s("core_chain_halted");
7198
+ return this.deposit({ assetValue: t, recipient: "", memo: e });
9145
7199
  });
9146
- V(this, se, ({ assetValue: t, ...n }) => ({
9147
- ...n,
9148
- memo: n.memo || "",
9149
- from: this.getAddress(t.chain),
9150
- assetValue: t
7200
+ F(this, P, ({ assetValue: e, ...t }) => ({
7201
+ ...t,
7202
+ memo: t.memo || "",
7203
+ from: this.getAddress(e.chain),
7204
+ assetValue: e
9151
7205
  }));
9152
- this.stagenet = !!t;
7206
+ this.stagenet = !!e;
9153
7207
  }
9154
7208
  }
9155
- $ = new WeakMap(), me = new WeakMap(), ae = new WeakMap(), H = new WeakMap(), ie = new WeakMap(), Te = new WeakMap(), se = new WeakMap();
7209
+ S = new WeakMap(), W = new WeakMap(), q = new WeakMap(), E = new WeakMap(), H = new WeakMap(), V = new WeakMap(), P = new WeakMap();
9156
7210
  export {
9157
- Mt as AGG_SWAP,
9158
- L as ApiEndpoints,
9159
- U as ApiUrl,
9160
- gn as ApproveMode,
9161
- k as AssetValue,
9162
- g as BaseDecimal,
9163
- ke as BigIntArithmetics,
9164
- r as Chain,
9165
- Re as ChainId,
9166
- sa as ChainIdToChain,
9167
- Qe as ChainToChainId,
9168
- Ye as ChainToExplorerUrl,
9169
- ia as ChainToHexChainId,
9170
- It as ChainToRPC,
9171
- Et as ContractAddress,
9172
- na as CosmosChainList,
9173
- kt as CosmosChains,
9174
- Ot as DerivationPath,
9175
- ea as EVMChainList,
9176
- je as EVMChains,
9177
- Y as FeeOption,
9178
- Pt as LedgerErrorCode,
9179
- w as MemoType,
9180
- Zn as NetworkDerivationPath,
9181
- _t as QuoteMode,
9182
- Ke as RPCUrl,
9183
- x as RequestClient,
9184
- vt as SWAP_IN,
9185
- Ct as SWAP_OUT,
9186
- nn as StreamingSwapProgressStatus,
9187
- zn as SubstrateChains,
9188
- Aa as SwapKit,
9189
- pa as SwapKitApi,
9190
- ga as SwapKitCore,
9191
- d as SwapKitError,
9192
- F as SwapKitNumber,
9193
- At as TCAvalancheDepositABI,
9194
- gt as TCBscDepositABI,
9195
- wt as TCEthereumVaultAbi,
9196
- aa as TCSupportedChainList,
9197
- St as TCSupportedChains,
9198
- en as TransactionType,
9199
- tn as TxStatus,
9200
- ta as UTXOChainList,
9201
- xt as UTXOChains,
9202
- Bt as WalletOption,
9203
- ua as assetFromString,
9204
- it as defaultRequestHeaders,
9205
- wa as derivationPathToString,
9206
- Jn as erc20ABI,
9207
- ya as filterAssets,
9208
- he as formatBigIntToSafeValue,
9209
- yn as gasFeeMultiplier,
9210
- dn as getAssetType,
9211
- cn as getAsymmetricAssetShare,
9212
- da as getAsymmetricAssetWithdrawAmount,
9213
- Tn as getAsymmetricRuneShare,
9214
- oa as getAsymmetricRuneWithdrawAmount,
9215
- on as getCommonAssetInfo,
9216
- un as getDecimal,
9217
- ma as getEstimatedPoolShare,
9218
- Ta as getLiquiditySlippage,
9219
- ba as getMAYANameCost,
9220
- B as getMemoFor,
9221
- _e as getMinAmountByChain,
9222
- bn as getSymmetricPoolShare,
9223
- la as getSymmetricWithdraw,
9224
- ca as getTHORNameCost,
9225
- rt as isGasAsset,
9226
- ra as setRequestClientConfig,
9227
- ha as validateMAYAName,
9228
- fa as validateTHORName
7211
+ Me as ApproveMode,
7212
+ ze as SwapKit,
7213
+ Je as SwapKitCore
9229
7214
  };
9230
7215
  //# sourceMappingURL=index.es.js.map