@swapkit/helpers 1.0.0-rc.85 → 1.0.0-rc.87

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.js CHANGED
@@ -6,12 +6,972 @@ var __require = ((x) => typeof require !== "undefined" ? require : typeof Proxy
6
6
  throw Error('Dynamic require of "' + x + '" is not supported');
7
7
  });
8
8
 
9
- // src/index.ts
10
- export * from "@swapkit/api";
9
+ // src/types/abis/erc20.ts
10
+ var erc20ABI = [
11
+ { inputs: [], stateMutability: "nonpayable", type: "constructor" },
12
+ {
13
+ anonymous: false,
14
+ inputs: [
15
+ { indexed: true, internalType: "address", name: "owner", type: "address" },
16
+ { indexed: true, internalType: "address", name: "spender", type: "address" },
17
+ { indexed: false, internalType: "uint256", name: "value", type: "uint256" }
18
+ ],
19
+ name: "Approval",
20
+ type: "event"
21
+ },
22
+ {
23
+ anonymous: false,
24
+ inputs: [
25
+ { indexed: true, internalType: "address", name: "from", type: "address" },
26
+ { indexed: true, internalType: "address", name: "to", type: "address" },
27
+ { indexed: false, internalType: "uint256", name: "value", type: "uint256" }
28
+ ],
29
+ name: "Transfer",
30
+ type: "event"
31
+ },
32
+ {
33
+ inputs: [
34
+ { internalType: "address", name: "", type: "address" },
35
+ { internalType: "address", name: "", type: "address" }
36
+ ],
37
+ name: "allowance",
38
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
39
+ stateMutability: "view",
40
+ type: "function"
41
+ },
42
+ {
43
+ inputs: [
44
+ { internalType: "address", name: "spender", type: "address" },
45
+ { internalType: "uint256", name: "value", type: "uint256" }
46
+ ],
47
+ name: "approve",
48
+ outputs: [{ internalType: "bool", name: "success", type: "bool" }],
49
+ stateMutability: "nonpayable",
50
+ type: "function"
51
+ },
52
+ {
53
+ inputs: [{ internalType: "address", name: "", type: "address" }],
54
+ name: "balanceOf",
55
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
56
+ stateMutability: "view",
57
+ type: "function"
58
+ },
59
+ {
60
+ inputs: [],
61
+ name: "decimals",
62
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
63
+ stateMutability: "view",
64
+ type: "function"
65
+ },
66
+ {
67
+ inputs: [],
68
+ name: "name",
69
+ outputs: [{ internalType: "string", name: "", type: "string" }],
70
+ stateMutability: "view",
71
+ type: "function"
72
+ },
73
+ {
74
+ inputs: [],
75
+ name: "symbol",
76
+ outputs: [{ internalType: "string", name: "", type: "string" }],
77
+ stateMutability: "view",
78
+ type: "function"
79
+ },
80
+ {
81
+ inputs: [],
82
+ name: "totalSupply",
83
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
84
+ stateMutability: "view",
85
+ type: "function"
86
+ },
87
+ {
88
+ inputs: [
89
+ { internalType: "address", name: "to", type: "address" },
90
+ { internalType: "uint256", name: "value", type: "uint256" }
91
+ ],
92
+ name: "transfer",
93
+ outputs: [{ internalType: "bool", name: "success", type: "bool" }],
94
+ stateMutability: "nonpayable",
95
+ type: "function"
96
+ },
97
+ {
98
+ inputs: [
99
+ { internalType: "address", name: "from", type: "address" },
100
+ { internalType: "address", name: "to", type: "address" },
101
+ { internalType: "uint256", name: "value", type: "uint256" }
102
+ ],
103
+ name: "transferFrom",
104
+ outputs: [{ internalType: "bool", name: "success", type: "bool" }],
105
+ stateMutability: "nonpayable",
106
+ type: "function"
107
+ }
108
+ ];
109
+ // src/types/abis/tcEthVault.ts
110
+ var TCEthereumVaultAbi = [
111
+ {
112
+ inputs: [{ internalType: "address", name: "rune", type: "address" }],
113
+ stateMutability: "nonpayable",
114
+ type: "constructor"
115
+ },
116
+ {
117
+ anonymous: false,
118
+ inputs: [
119
+ { indexed: true, internalType: "address", name: "to", type: "address" },
120
+ { indexed: true, internalType: "address", name: "asset", type: "address" },
121
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
122
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
123
+ ],
124
+ name: "Deposit",
125
+ type: "event"
126
+ },
127
+ {
128
+ anonymous: false,
129
+ inputs: [
130
+ { indexed: true, internalType: "address", name: "oldVault", type: "address" },
131
+ { indexed: true, internalType: "address", name: "newVault", type: "address" },
132
+ { indexed: false, internalType: "address", name: "asset", type: "address" },
133
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
134
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
135
+ ],
136
+ name: "TransferAllowance",
137
+ type: "event"
138
+ },
139
+ {
140
+ anonymous: false,
141
+ inputs: [
142
+ { indexed: true, internalType: "address", name: "vault", type: "address" },
143
+ { indexed: true, internalType: "address", name: "to", type: "address" },
144
+ { indexed: false, internalType: "address", name: "asset", type: "address" },
145
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
146
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
147
+ ],
148
+ name: "TransferOut",
149
+ type: "event"
150
+ },
151
+ {
152
+ anonymous: false,
153
+ inputs: [
154
+ { indexed: true, internalType: "address", name: "vault", type: "address" },
155
+ { indexed: false, internalType: "address", name: "target", type: "address" },
156
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
157
+ { indexed: false, internalType: "address", name: "finalAsset", type: "address" },
158
+ { indexed: false, internalType: "address", name: "to", type: "address" },
159
+ { indexed: false, internalType: "uint256", name: "amountOutMin", type: "uint256" },
160
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
161
+ ],
162
+ name: "TransferOutAndCall",
163
+ type: "event"
164
+ },
165
+ {
166
+ anonymous: false,
167
+ inputs: [
168
+ { indexed: true, internalType: "address", name: "oldVault", type: "address" },
169
+ { indexed: true, 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: false,
176
+ internalType: "struct THORChain_Router.Coin[]",
177
+ name: "coins",
178
+ type: "tuple[]"
179
+ },
180
+ { indexed: false, 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
+ ];
286
+ var TCAvalancheDepositABI = [
287
+ { inputs: [], stateMutability: "nonpayable", type: "constructor" },
288
+ {
289
+ anonymous: false,
290
+ inputs: [
291
+ { indexed: true, internalType: "address", name: "to", type: "address" },
292
+ { indexed: true, internalType: "address", name: "asset", type: "address" },
293
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
294
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
295
+ ],
296
+ name: "Deposit",
297
+ type: "event"
298
+ },
299
+ {
300
+ anonymous: false,
301
+ inputs: [
302
+ { indexed: true, internalType: "address", name: "oldVault", type: "address" },
303
+ { indexed: true, internalType: "address", name: "newVault", type: "address" },
304
+ { indexed: false, internalType: "address", name: "asset", type: "address" },
305
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
306
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
307
+ ],
308
+ name: "TransferAllowance",
309
+ type: "event"
310
+ },
311
+ {
312
+ anonymous: false,
313
+ inputs: [
314
+ { indexed: true, internalType: "address", name: "vault", type: "address" },
315
+ { indexed: true, internalType: "address", name: "to", type: "address" },
316
+ { indexed: false, internalType: "address", name: "asset", type: "address" },
317
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
318
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
319
+ ],
320
+ name: "TransferOut",
321
+ type: "event"
322
+ },
323
+ {
324
+ anonymous: false,
325
+ inputs: [
326
+ { indexed: true, internalType: "address", name: "vault", type: "address" },
327
+ { indexed: false, internalType: "address", name: "target", type: "address" },
328
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
329
+ { indexed: false, internalType: "address", name: "finalAsset", type: "address" },
330
+ { indexed: false, internalType: "address", name: "to", type: "address" },
331
+ { indexed: false, internalType: "uint256", name: "amountOutMin", type: "uint256" },
332
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
333
+ ],
334
+ name: "TransferOutAndCall",
335
+ type: "event"
336
+ },
337
+ {
338
+ anonymous: false,
339
+ inputs: [
340
+ { indexed: true, internalType: "address", name: "oldVault", type: "address" },
341
+ { indexed: true, internalType: "address", name: "newVault", type: "address" },
342
+ {
343
+ components: [
344
+ { internalType: "address", name: "asset", type: "address" },
345
+ { internalType: "uint256", name: "amount", type: "uint256" }
346
+ ],
347
+ indexed: false,
348
+ internalType: "struct AvaxRouter.Coin[]",
349
+ name: "coins",
350
+ type: "tuple[]"
351
+ },
352
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
353
+ ],
354
+ name: "VaultTransfer",
355
+ type: "event"
356
+ },
357
+ {
358
+ inputs: [
359
+ { internalType: "address payable", name: "vault", type: "address" },
360
+ { internalType: "address", name: "asset", type: "address" },
361
+ { internalType: "uint256", name: "amount", type: "uint256" },
362
+ { internalType: "string", name: "memo", type: "string" }
363
+ ],
364
+ name: "deposit",
365
+ outputs: [],
366
+ stateMutability: "payable",
367
+ type: "function"
368
+ },
369
+ {
370
+ inputs: [
371
+ { internalType: "address payable", name: "vault", type: "address" },
372
+ { internalType: "address", name: "asset", type: "address" },
373
+ { internalType: "uint256", name: "amount", type: "uint256" },
374
+ { internalType: "string", name: "memo", type: "string" },
375
+ { internalType: "uint256", name: "expiration", type: "uint256" }
376
+ ],
377
+ name: "depositWithExpiry",
378
+ outputs: [],
379
+ stateMutability: "payable",
380
+ type: "function"
381
+ },
382
+ {
383
+ inputs: [
384
+ { internalType: "address", name: "router", type: "address" },
385
+ { internalType: "address payable", name: "asgard", type: "address" },
386
+ {
387
+ components: [
388
+ { internalType: "address", name: "asset", type: "address" },
389
+ { internalType: "uint256", name: "amount", type: "uint256" }
390
+ ],
391
+ internalType: "struct AvaxRouter.Coin[]",
392
+ name: "coins",
393
+ type: "tuple[]"
394
+ },
395
+ { internalType: "string", name: "memo", type: "string" }
396
+ ],
397
+ name: "returnVaultAssets",
398
+ outputs: [],
399
+ stateMutability: "payable",
400
+ type: "function"
401
+ },
402
+ {
403
+ inputs: [
404
+ { internalType: "address", name: "router", type: "address" },
405
+ { internalType: "address", name: "newVault", type: "address" },
406
+ { internalType: "address", name: "asset", type: "address" },
407
+ { internalType: "uint256", name: "amount", type: "uint256" },
408
+ { internalType: "string", name: "memo", type: "string" }
409
+ ],
410
+ name: "transferAllowance",
411
+ outputs: [],
412
+ stateMutability: "nonpayable",
413
+ type: "function"
414
+ },
415
+ {
416
+ inputs: [
417
+ { internalType: "address payable", name: "to", type: "address" },
418
+ { internalType: "address", name: "asset", type: "address" },
419
+ { internalType: "uint256", name: "amount", type: "uint256" },
420
+ { internalType: "string", name: "memo", type: "string" }
421
+ ],
422
+ name: "transferOut",
423
+ outputs: [],
424
+ stateMutability: "payable",
425
+ type: "function"
426
+ },
427
+ {
428
+ inputs: [
429
+ { internalType: "address payable", name: "target", type: "address" },
430
+ { internalType: "address", name: "finalToken", type: "address" },
431
+ { internalType: "address", name: "to", type: "address" },
432
+ { internalType: "uint256", name: "amountOutMin", type: "uint256" },
433
+ { internalType: "string", name: "memo", type: "string" }
434
+ ],
435
+ name: "transferOutAndCall",
436
+ outputs: [],
437
+ stateMutability: "payable",
438
+ type: "function"
439
+ },
440
+ {
441
+ inputs: [
442
+ { internalType: "address", name: "vault", type: "address" },
443
+ { internalType: "address", name: "token", type: "address" }
444
+ ],
445
+ name: "vaultAllowance",
446
+ outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
447
+ stateMutability: "view",
448
+ type: "function"
449
+ }
450
+ ];
451
+ var TCBscDepositABI = [
452
+ { inputs: [], stateMutability: "nonpayable", type: "constructor" },
453
+ {
454
+ anonymous: false,
455
+ inputs: [
456
+ { indexed: true, internalType: "address", name: "to", type: "address" },
457
+ { indexed: true, internalType: "address", name: "asset", type: "address" },
458
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
459
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
460
+ ],
461
+ name: "Deposit",
462
+ type: "event"
463
+ },
464
+ {
465
+ anonymous: false,
466
+ inputs: [
467
+ { indexed: true, internalType: "address", name: "oldVault", type: "address" },
468
+ { indexed: true, internalType: "address", name: "newVault", type: "address" },
469
+ { indexed: false, internalType: "address", name: "asset", type: "address" },
470
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
471
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
472
+ ],
473
+ name: "TransferAllowance",
474
+ type: "event"
475
+ },
476
+ {
477
+ anonymous: false,
478
+ inputs: [
479
+ { indexed: true, internalType: "address", name: "vault", type: "address" },
480
+ { indexed: true, internalType: "address", name: "to", type: "address" },
481
+ { indexed: false, internalType: "address", name: "asset", type: "address" },
482
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
483
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
484
+ ],
485
+ name: "TransferOut",
486
+ type: "event"
487
+ },
488
+ {
489
+ anonymous: false,
490
+ inputs: [
491
+ { indexed: true, internalType: "address", name: "vault", type: "address" },
492
+ { indexed: false, internalType: "address", name: "target", type: "address" },
493
+ { indexed: false, internalType: "uint256", name: "amount", type: "uint256" },
494
+ { indexed: false, internalType: "address", name: "finalAsset", type: "address" },
495
+ { indexed: false, internalType: "address", name: "to", type: "address" },
496
+ { indexed: false, internalType: "uint256", name: "amountOutMin", type: "uint256" },
497
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
498
+ ],
499
+ name: "TransferOutAndCall",
500
+ type: "event"
501
+ },
502
+ {
503
+ anonymous: false,
504
+ inputs: [
505
+ { indexed: true, internalType: "address", name: "oldVault", type: "address" },
506
+ { indexed: true, internalType: "address", name: "newVault", type: "address" },
507
+ {
508
+ components: [
509
+ { internalType: "address", name: "asset", type: "address" },
510
+ { internalType: "uint256", name: "amount", type: "uint256" }
511
+ ],
512
+ indexed: false,
513
+ internalType: "struct THORChain_Router.Coin[]",
514
+ name: "coins",
515
+ type: "tuple[]"
516
+ },
517
+ { indexed: false, internalType: "string", name: "memo", type: "string" }
518
+ ],
519
+ name: "VaultTransfer",
520
+ type: "event"
521
+ },
522
+ {
523
+ inputs: [
524
+ { internalType: "address payable", name: "vault", type: "address" },
525
+ { internalType: "address", name: "asset", type: "address" },
526
+ { internalType: "uint256", name: "amount", type: "uint256" },
527
+ { internalType: "string", name: "memo", type: "string" },
528
+ { internalType: "uint256", name: "expiration", type: "uint256" }
529
+ ],
530
+ name: "depositWithExpiry",
531
+ outputs: [],
532
+ stateMutability: "payable",
533
+ type: "function"
534
+ },
535
+ {
536
+ inputs: [
537
+ { internalType: "address", name: "router", type: "address" },
538
+ { internalType: "address payable", name: "asgard", type: "address" },
539
+ {
540
+ components: [
541
+ { internalType: "address", name: "asset", type: "address" },
542
+ { internalType: "uint256", name: "amount", type: "uint256" }
543
+ ],
544
+ internalType: "struct THORChain_Router.Coin[]",
545
+ name: "coins",
546
+ type: "tuple[]"
547
+ },
548
+ { internalType: "string", name: "memo", type: "string" }
549
+ ],
550
+ name: "returnVaultAssets",
551
+ outputs: [],
552
+ stateMutability: "payable",
553
+ type: "function"
554
+ },
555
+ {
556
+ inputs: [
557
+ { internalType: "address", name: "router", type: "address" },
558
+ { internalType: "address", name: "newVault", type: "address" },
559
+ { internalType: "address", name: "asset", type: "address" },
560
+ { internalType: "uint256", name: "amount", type: "uint256" },
561
+ { internalType: "string", name: "memo", type: "string" }
562
+ ],
563
+ name: "transferAllowance",
564
+ outputs: [],
565
+ stateMutability: "nonpayable",
566
+ type: "function"
567
+ },
568
+ {
569
+ inputs: [
570
+ { internalType: "address payable", name: "to", type: "address" },
571
+ { internalType: "address", name: "asset", type: "address" },
572
+ { internalType: "uint256", name: "amount", type: "uint256" },
573
+ { internalType: "string", name: "memo", type: "string" }
574
+ ],
575
+ name: "transferOut",
576
+ outputs: [],
577
+ stateMutability: "payable",
578
+ type: "function"
579
+ },
580
+ {
581
+ inputs: [
582
+ { internalType: "address payable", name: "target", type: "address" },
583
+ { internalType: "address", name: "finalToken", type: "address" },
584
+ { internalType: "address", name: "to", type: "address" },
585
+ { internalType: "uint256", name: "amountOutMin", type: "uint256" },
586
+ { internalType: "string", name: "memo", type: "string" }
587
+ ],
588
+ name: "transferOutAndCall",
589
+ outputs: [],
590
+ stateMutability: "payable",
591
+ type: "function"
592
+ },
593
+ {
594
+ inputs: [
595
+ { internalType: "address", name: "vault", type: "address" },
596
+ { internalType: "address", name: "token", type: "address" }
597
+ ],
598
+ name: "vaultAllowance",
599
+ outputs: [{ internalType: "uint256", name: "amount", type: "uint256" }],
600
+ stateMutability: "view",
601
+ type: "function"
602
+ }
603
+ ];
604
+ // src/types/network.ts
605
+ var RPCUrl;
606
+ (function(RPCUrl2) {
607
+ RPCUrl2["Arbitrum"] = "https://arb1.arbitrum.io/rpc";
608
+ RPCUrl2["Avalanche"] = "https://node-router.thorswap.net/avalanche-c";
609
+ RPCUrl2["Binance"] = "";
610
+ RPCUrl2["BinanceSmartChain"] = "https://bsc-dataseed.binance.org";
611
+ RPCUrl2["Bitcoin"] = "https://node-router.thorswap.net/bitcoin";
612
+ RPCUrl2["BitcoinCash"] = "https://node-router.thorswap.net/bitcoin-cash";
613
+ RPCUrl2["Chainflip"] = "wss://mainnet-archive.chainflip.io";
614
+ RPCUrl2["Cosmos"] = "https://node-router.thorswap.net/cosmos/rpc";
615
+ RPCUrl2["Dash"] = "https://node-router.thorswap.net/dash";
616
+ RPCUrl2["Dogecoin"] = "https://node-router.thorswap.net/dogecoin";
617
+ RPCUrl2["Ethereum"] = "https://node-router.thorswap.net/ethereum";
618
+ RPCUrl2["Kujira"] = "https://rpc-kujira.synergynodes.com/";
619
+ RPCUrl2["Litecoin"] = "https://node-router.thorswap.net/litecoin";
620
+ RPCUrl2["Maya"] = "https://tendermint.mayachain.info";
621
+ RPCUrl2["MayaStagenet"] = "https://stagenet.tendermint.mayachain.info";
622
+ RPCUrl2["Optimism"] = "https://mainnet.optimism.io";
623
+ RPCUrl2["Polkadot"] = "wss://rpc.polkadot.io";
624
+ RPCUrl2["Polygon"] = "https://polygon-rpc.com";
625
+ RPCUrl2["THORChain"] = "https://rpc.thorswap.net";
626
+ RPCUrl2["THORChainStagenet"] = "https://stagenet-rpc.ninerealms.com";
627
+ })(RPCUrl || (RPCUrl = {}));
628
+ var ExplorerUrl;
629
+ (function(ExplorerUrl2) {
630
+ ExplorerUrl2["Arbitrum"] = "https://arbiscan.io";
631
+ ExplorerUrl2["Avalanche"] = "https://snowtrace.io";
632
+ ExplorerUrl2["Binance"] = "https://explorer.binance.org";
633
+ ExplorerUrl2["BinanceSmartChain"] = "https://bscscan.com";
634
+ ExplorerUrl2["Bitcoin"] = "https://blockchair.com/bitcoin";
635
+ ExplorerUrl2["BitcoinCash"] = "https://www.blockchair.com/bitcoin-cash";
636
+ ExplorerUrl2["Chainflip"] = "https://explorer.polkascan.io/polkadot";
637
+ ExplorerUrl2["Cosmos"] = "https://www.mintscan.io/cosmos";
638
+ ExplorerUrl2["Dash"] = "https://blockchair.com/dash";
639
+ ExplorerUrl2["Dogecoin"] = "https://blockchair.com/dogecoin";
640
+ ExplorerUrl2["Ethereum"] = "https://etherscan.io";
641
+ ExplorerUrl2["Kujira"] = "https://finder.kujira.network/kaiyo-1";
642
+ ExplorerUrl2["Litecoin"] = "https://blockchair.com/litecoin";
643
+ ExplorerUrl2["Maya"] = "https://www.mayascan.org";
644
+ ExplorerUrl2["Optimism"] = "https://optimistic.etherscan.io";
645
+ ExplorerUrl2["Polkadot"] = "https://polkadot.subscan.io/";
646
+ ExplorerUrl2["Polygon"] = "https://polygonscan.com";
647
+ ExplorerUrl2["THORChain"] = "https://runescan.io";
648
+ })(ExplorerUrl || (ExplorerUrl = {}));
649
+
650
+ // src/types/chains.ts
651
+ var Chain;
652
+ (function(Chain2) {
653
+ Chain2["Arbitrum"] = "ARB";
654
+ Chain2["Avalanche"] = "AVAX";
655
+ Chain2["Binance"] = "BNB";
656
+ Chain2["BinanceSmartChain"] = "BSC";
657
+ Chain2["Bitcoin"] = "BTC";
658
+ Chain2["BitcoinCash"] = "BCH";
659
+ Chain2["Cosmos"] = "GAIA";
660
+ Chain2["Dash"] = "DASH";
661
+ Chain2["Dogecoin"] = "DOGE";
662
+ Chain2["Ethereum"] = "ETH";
663
+ Chain2["Kujira"] = "KUJI";
664
+ Chain2["Litecoin"] = "LTC";
665
+ Chain2["Maya"] = "MAYA";
666
+ Chain2["Optimism"] = "OP";
667
+ Chain2["Polkadot"] = "DOT";
668
+ Chain2["Chainflip"] = "FLIP";
669
+ Chain2["Polygon"] = "MATIC";
670
+ Chain2["THORChain"] = "THOR";
671
+ })(Chain || (Chain = {}));
672
+ var ChainId;
673
+ (function(ChainId2) {
674
+ ChainId2["Arbitrum"] = "42161";
675
+ ChainId2["ArbitrumHex"] = "0xa4b1";
676
+ ChainId2["Avalanche"] = "43114";
677
+ ChainId2["AvalancheHex"] = "0xa86a";
678
+ ChainId2["Binance"] = "Binance-Chain-Tigris";
679
+ ChainId2["BinanceSmartChain"] = "56";
680
+ ChainId2["BinanceSmartChainHex"] = "0x38";
681
+ ChainId2["Bitcoin"] = "bitcoin";
682
+ ChainId2["BitcoinCash"] = "bitcoincash";
683
+ ChainId2["Chainflip"] = "chainflip";
684
+ ChainId2["Cosmos"] = "cosmoshub-4";
685
+ ChainId2["Dash"] = "dash";
686
+ ChainId2["Dogecoin"] = "dogecoin";
687
+ ChainId2["Kujira"] = "kaiyo-1";
688
+ ChainId2["Ethereum"] = "1";
689
+ ChainId2["EthereumHex"] = "0x1";
690
+ ChainId2["Litecoin"] = "litecoin";
691
+ ChainId2["Maya"] = "mayachain-mainnet-v1";
692
+ ChainId2["MayaStagenet"] = "mayachain-stagenet-v1";
693
+ ChainId2["Optimism"] = "10";
694
+ ChainId2["OptimismHex"] = "0xa";
695
+ ChainId2["Polkadot"] = "polkadot";
696
+ ChainId2["Polygon"] = "137";
697
+ ChainId2["PolygonHex"] = "0x89";
698
+ ChainId2["THORChain"] = "thorchain-mainnet-v1";
699
+ ChainId2["THORChainStagenet"] = "thorchain-stagenet-v2";
700
+ })(ChainId || (ChainId = {}));
701
+ var ChainIdToChain = {
702
+ [ChainId.ArbitrumHex]: Chain.Arbitrum,
703
+ [ChainId.Arbitrum]: Chain.Arbitrum,
704
+ [ChainId.AvalancheHex]: Chain.Avalanche,
705
+ [ChainId.Avalanche]: Chain.Avalanche,
706
+ [ChainId.BinanceSmartChainHex]: Chain.BinanceSmartChain,
707
+ [ChainId.BinanceSmartChain]: Chain.BinanceSmartChain,
708
+ [ChainId.Binance]: Chain.Binance,
709
+ [ChainId.BitcoinCash]: Chain.BitcoinCash,
710
+ [ChainId.Bitcoin]: Chain.Bitcoin,
711
+ [ChainId.Chainflip]: Chain.Chainflip,
712
+ [ChainId.Cosmos]: Chain.Cosmos,
713
+ [ChainId.Dash]: Chain.Dash,
714
+ [ChainId.Dogecoin]: Chain.Dogecoin,
715
+ [ChainId.EthereumHex]: Chain.Ethereum,
716
+ [ChainId.Kujira]: Chain.Kujira,
717
+ [ChainId.Ethereum]: Chain.Ethereum,
718
+ [ChainId.Litecoin]: Chain.Litecoin,
719
+ [ChainId.MayaStagenet]: Chain.Maya,
720
+ [ChainId.Maya]: Chain.Maya,
721
+ [ChainId.OptimismHex]: Chain.Optimism,
722
+ [ChainId.Optimism]: Chain.Optimism,
723
+ [ChainId.Polkadot]: Chain.Polkadot,
724
+ [ChainId.PolygonHex]: Chain.Polygon,
725
+ [ChainId.Polygon]: Chain.Polygon,
726
+ [ChainId.THORChainStagenet]: Chain.THORChain,
727
+ [ChainId.THORChain]: Chain.THORChain
728
+ };
729
+ var chainNames = Object.keys(Chain);
730
+ var chains = Object.values(Chain);
731
+ var BaseDecimal;
732
+ (function(BaseDecimal2) {
733
+ BaseDecimal2[BaseDecimal2["ARB"] = 18] = "ARB";
734
+ BaseDecimal2[BaseDecimal2["AVAX"] = 18] = "AVAX";
735
+ BaseDecimal2[BaseDecimal2["BCH"] = 8] = "BCH";
736
+ BaseDecimal2[BaseDecimal2["BNB"] = 8] = "BNB";
737
+ BaseDecimal2[BaseDecimal2["BSC"] = 18] = "BSC";
738
+ BaseDecimal2[BaseDecimal2["BTC"] = 8] = "BTC";
739
+ BaseDecimal2[BaseDecimal2["DASH"] = 8] = "DASH";
740
+ BaseDecimal2[BaseDecimal2["DOGE"] = 8] = "DOGE";
741
+ BaseDecimal2[BaseDecimal2["DOT"] = 10] = "DOT";
742
+ BaseDecimal2[BaseDecimal2["ETH"] = 18] = "ETH";
743
+ BaseDecimal2[BaseDecimal2["FLIP"] = 18] = "FLIP";
744
+ BaseDecimal2[BaseDecimal2["GAIA"] = 6] = "GAIA";
745
+ BaseDecimal2[BaseDecimal2["KUJI"] = 6] = "KUJI";
746
+ BaseDecimal2[BaseDecimal2["LTC"] = 8] = "LTC";
747
+ BaseDecimal2[BaseDecimal2["MATIC"] = 18] = "MATIC";
748
+ BaseDecimal2[BaseDecimal2["MAYA"] = 10] = "MAYA";
749
+ BaseDecimal2[BaseDecimal2["OP"] = 18] = "OP";
750
+ BaseDecimal2[BaseDecimal2["THOR"] = 8] = "THOR";
751
+ BaseDecimal2[BaseDecimal2["ZEC"] = 8] = "ZEC";
752
+ })(BaseDecimal || (BaseDecimal = {}));
753
+ var SubstrateChains = [Chain.Polkadot, Chain.Chainflip];
754
+ var EVMChains = [
755
+ Chain.Ethereum,
756
+ Chain.Avalanche,
757
+ Chain.BinanceSmartChain,
758
+ Chain.Arbitrum,
759
+ Chain.Optimism,
760
+ Chain.Polygon
761
+ ];
762
+ var UTXOChains = [
763
+ Chain.Bitcoin,
764
+ Chain.BitcoinCash,
765
+ Chain.Dash,
766
+ Chain.Dogecoin,
767
+ Chain.Litecoin
768
+ ];
769
+ var CosmosChains = [
770
+ Chain.Cosmos,
771
+ Chain.THORChain,
772
+ Chain.Binance,
773
+ Chain.Maya,
774
+ Chain.Kujira
775
+ ];
776
+ var TCSupportedChains = [
777
+ Chain.Avalanche,
778
+ Chain.Binance,
779
+ Chain.BinanceSmartChain,
780
+ Chain.Bitcoin,
781
+ Chain.BitcoinCash,
782
+ Chain.Cosmos,
783
+ Chain.Dogecoin,
784
+ Chain.Ethereum,
785
+ Chain.Litecoin,
786
+ Chain.THORChain
787
+ ];
788
+ var MAYASupportedChains = [
789
+ Chain.Dash,
790
+ Chain.Ethereum,
791
+ Chain.Kujira,
792
+ Chain.Maya,
793
+ Chain.THORChain
794
+ ];
795
+ var ChainToChainName = chains.reduce((acc, chain) => {
796
+ const chainName = chainNames.find((key) => Chain[key] === chain);
797
+ if (chainName)
798
+ acc[chain] = chainName;
799
+ return acc;
800
+ }, {});
801
+ var ChainToChainId = chains.reduce((acc, chain) => {
802
+ acc[chain] = ChainId[ChainToChainName[chain]];
803
+ return acc;
804
+ }, {});
805
+ var ChainToRPC = chains.reduce((acc, chain) => {
806
+ acc[chain] = RPCUrl[ChainToChainName[chain]];
807
+ return acc;
808
+ }, {});
809
+ var ChainToHexChainId = chains.reduce((acc, chain) => {
810
+ const chainString = `${ChainToChainName[chain]}Hex`;
811
+ acc[chain] = ChainId[chainString];
812
+ return acc;
813
+ }, {});
814
+ var ChainToExplorerUrl = chains.reduce((acc, chain) => {
815
+ acc[chain] = ExplorerUrl[ChainToChainName[chain]];
816
+ return acc;
817
+ }, {});
818
+ // src/types/commonTypes.ts
819
+ var QuoteMode;
820
+ (function(QuoteMode2) {
821
+ QuoteMode2["TC_SUPPORTED_TO_TC_SUPPORTED"] = "TC-TC";
822
+ QuoteMode2["TC_SUPPORTED_TO_ETH"] = "TC-ERC20";
823
+ QuoteMode2["TC_SUPPORTED_TO_AVAX"] = "TC-ARC20";
824
+ QuoteMode2["TC_SUPPORTED_TO_BSC"] = "TC-BEP20";
825
+ QuoteMode2["ETH_TO_TC_SUPPORTED"] = "ERC20-TC";
826
+ QuoteMode2["ETH_TO_ETH"] = "ERC20-ERC20";
827
+ QuoteMode2["ETH_TO_AVAX"] = "ERC20-ARC20";
828
+ QuoteMode2["ETH_TO_BSC"] = "ERC20-BEP20";
829
+ QuoteMode2["AVAX_TO_TC_SUPPORTED"] = "ARC20-TC";
830
+ QuoteMode2["AVAX_TO_ETH"] = "ARC20-ERC20";
831
+ QuoteMode2["AVAX_TO_AVAX"] = "ARC20-ARC20";
832
+ QuoteMode2["AVAX_TO_BSC"] = "ARC20-BEP20";
833
+ QuoteMode2["BSC_TO_TC_SUPPORTED"] = "BEP20-TC";
834
+ QuoteMode2["BSC_TO_ETH"] = "BEP20-ERC20";
835
+ QuoteMode2["BSC_TO_AVAX"] = "BEP20-ARC20";
836
+ QuoteMode2["BSC_TO_BSC"] = "BEP20-BEP20";
837
+ })(QuoteMode || (QuoteMode = {}));
838
+ var AGG_SWAP = [QuoteMode.ETH_TO_ETH, QuoteMode.AVAX_TO_AVAX, QuoteMode.BSC_TO_BSC];
839
+ var SWAP_IN = [
840
+ QuoteMode.ETH_TO_TC_SUPPORTED,
841
+ QuoteMode.ETH_TO_AVAX,
842
+ QuoteMode.ETH_TO_BSC,
843
+ QuoteMode.AVAX_TO_TC_SUPPORTED,
844
+ QuoteMode.AVAX_TO_ETH,
845
+ QuoteMode.AVAX_TO_BSC,
846
+ QuoteMode.BSC_TO_TC_SUPPORTED,
847
+ QuoteMode.BSC_TO_ETH,
848
+ QuoteMode.BSC_TO_AVAX
849
+ ];
850
+ var SWAP_OUT = [
851
+ QuoteMode.TC_SUPPORTED_TO_TC_SUPPORTED,
852
+ QuoteMode.TC_SUPPORTED_TO_ETH,
853
+ QuoteMode.TC_SUPPORTED_TO_AVAX,
854
+ QuoteMode.TC_SUPPORTED_TO_BSC
855
+ ];
856
+ // src/types/derivationPath.ts
857
+ var ContractAddress;
858
+ (function(ContractAddress2) {
859
+ ContractAddress2["ARB"] = "0x0000000000000000000000000000000000000000";
860
+ ContractAddress2["AVAX"] = "0x0000000000000000000000000000000000000000";
861
+ ContractAddress2["ETH"] = "0x0000000000000000000000000000000000000000";
862
+ ContractAddress2["BSC"] = "0x0000000000000000000000000000000000000000";
863
+ ContractAddress2["MATIC"] = "0x0000000000000000000000000000000000001010";
864
+ ContractAddress2["OP"] = "0x4200000000000000000000000000000000000042";
865
+ })(ContractAddress || (ContractAddress = {}));
866
+ var DerivationPath;
867
+ (function(DerivationPath2) {
868
+ DerivationPath2["ARB"] = "m/44'/60'/0'/0";
869
+ DerivationPath2["AVAX"] = "m/44'/60'/0'/0";
870
+ DerivationPath2["BCH"] = "m/44'/145'/0'/0";
871
+ DerivationPath2["BNB"] = "m/44'/714'/0'/0";
872
+ DerivationPath2["BSC"] = "m/44'/60'/0'/0";
873
+ DerivationPath2["BTC"] = "m/84'/0'/0'/0";
874
+ DerivationPath2["DASH"] = "m/44'/5'/0'/0";
875
+ DerivationPath2["DOGE"] = "m/44'/3'/0'/0";
876
+ DerivationPath2["DOT"] = "////";
877
+ DerivationPath2["ETH"] = "m/44'/60'/0'/0";
878
+ DerivationPath2["FLIP"] = "////";
879
+ DerivationPath2["GAIA"] = "m/44'/118'/0'/0";
880
+ DerivationPath2["KUJI"] = "m/44'/118'/0'/0";
881
+ DerivationPath2["LTC"] = "m/84'/2'/0'/0";
882
+ DerivationPath2["MATIC"] = "m/44'/60'/0'/0";
883
+ DerivationPath2["MAYA"] = "m/44'/931'/0'/0";
884
+ DerivationPath2["OP"] = "m/44'/60'/0'/0";
885
+ DerivationPath2["THOR"] = "m/44'/931'/0'/0";
886
+ })(DerivationPath || (DerivationPath = {}));
887
+ var NetworkDerivationPath = {
888
+ ARB: [44, 60, 0, 0, 0],
889
+ AVAX: [44, 60, 0, 0, 0],
890
+ BCH: [44, 145, 0, 0, 0],
891
+ BNB: [44, 714, 0, 0, 0],
892
+ BSC: [44, 60, 0, 0, 0],
893
+ BTC: [84, 0, 0, 0, 0],
894
+ DASH: [44, 5, 0, 0, 0],
895
+ DOGE: [44, 3, 0, 0, 0],
896
+ ETH: [44, 60, 0, 0, 0],
897
+ GAIA: [44, 118, 0, 0, 0],
898
+ KUJI: [44, 118, 0, 0, 0],
899
+ LTC: [84, 2, 0, 0, 0],
900
+ MATIC: [44, 60, 0, 0, 0],
901
+ MAYA: [44, 931, 0, 0, 0],
902
+ OP: [44, 60, 0, 0, 0],
903
+ THOR: [44, 931, 0, 0, 0],
904
+ DOT: [0, 0, 0, 0, 0],
905
+ FLIP: [0, 0, 0, 0, 0]
906
+ };
907
+ // src/types/transactions.ts
908
+ var FeeOption;
909
+ (function(FeeOption2) {
910
+ FeeOption2["Average"] = "average";
911
+ FeeOption2["Fast"] = "fast";
912
+ FeeOption2["Fastest"] = "fastest";
913
+ })(FeeOption || (FeeOption = {}));
914
+ var ApproveMode;
915
+ (function(ApproveMode2) {
916
+ ApproveMode2["Approve"] = "approve";
917
+ ApproveMode2["CheckOnly"] = "checkOnly";
918
+ })(ApproveMode || (ApproveMode = {}));
919
+ var MemoType;
920
+ (function(MemoType2) {
921
+ MemoType2["BOND"] = "BOND";
922
+ MemoType2["DEPOSIT"] = "+";
923
+ MemoType2["LEAVE"] = "LEAVE";
924
+ MemoType2["THORNAME_REGISTER"] = "~";
925
+ MemoType2["UNBOND"] = "UNBOND";
926
+ MemoType2["WITHDRAW"] = "-";
927
+ MemoType2["OPEN_LOAN"] = "$+";
928
+ MemoType2["CLOSE_LOAN"] = "$-";
929
+ })(MemoType || (MemoType = {}));
930
+ // src/types/wallet.ts
931
+ var WalletOption;
932
+ (function(WalletOption2) {
933
+ WalletOption2["KEYSTORE"] = "KEYSTORE";
934
+ WalletOption2["KEEPKEY"] = "KEEPKEY";
935
+ WalletOption2["XDEFI"] = "XDEFI";
936
+ WalletOption2["METAMASK"] = "METAMASK";
937
+ WalletOption2["COINBASE_WEB"] = "COINBASE_WEB";
938
+ WalletOption2["TREZOR"] = "TREZOR";
939
+ WalletOption2["TRUSTWALLET_WEB"] = "TRUSTWALLET_WEB";
940
+ WalletOption2["LEDGER"] = "LEDGER";
941
+ WalletOption2["KEPLR"] = "KEPLR";
942
+ WalletOption2["OKX"] = "OKX";
943
+ WalletOption2["OKX_MOBILE"] = "OKX_MOBILE";
944
+ WalletOption2["BRAVE"] = "BRAVE";
945
+ WalletOption2["WALLETCONNECT"] = "WALLETCONNECT";
946
+ })(WalletOption || (WalletOption = {}));
947
+ var LedgerErrorCode;
948
+ (function(LedgerErrorCode2) {
949
+ LedgerErrorCode2[LedgerErrorCode2["NoError"] = 36864] = "NoError";
950
+ LedgerErrorCode2[LedgerErrorCode2["LockedDevice"] = 21781] = "LockedDevice";
951
+ LedgerErrorCode2[LedgerErrorCode2["TC_NotFound"] = 65535] = "TC_NotFound";
952
+ })(LedgerErrorCode || (LedgerErrorCode = {}));
953
+ // src/modules/requestClient.ts
954
+ import ky from "ky";
955
+ function setRequestClientConfig({ apiKey, ...config }) {
956
+ kyClient = ky.create({
957
+ ...config,
958
+ headers: { ...defaultRequestHeaders, ...config.headers, "x-api-key": apiKey }
959
+ });
960
+ }
961
+ var getKyClient = function() {
962
+ if (kyClient)
963
+ return kyClient;
964
+ kyClient = ky.create({ headers: defaultRequestHeaders });
965
+ return kyClient;
966
+ };
967
+ var kyClient;
968
+ var defaultRequestHeaders = typeof window !== "undefined" ? {} : { referrer: "https://sk.thorswap.net", referer: "https://sk.thorswap.net" };
969
+ var RequestClient = {
970
+ get: (url, options) => getKyClient().get(url, options).json(),
971
+ post: (url, options) => getKyClient().post(url, options).json()
972
+ };
11
973
 
12
974
  // src/helpers/asset.ts
13
- import {RequestClient} from "@swapkit/api";
14
- import {BaseDecimal, Chain, ChainToRPC, EVMChains, FeeOption} from "@swapkit/types";
15
975
  async function findAssetBy(params) {
16
976
  const tokenPackages = await import("@swapkit/tokens");
17
977
  for (const tokenList of Object.values(tokenPackages)) {
@@ -163,12 +1123,11 @@ var evmAssetHasAddress = (assetString) => {
163
1123
  const [, address] = symbol.split("-");
164
1124
  return isGasAsset({ chain, symbol }) || !!address;
165
1125
  };
166
- var filterAssets = (tokens) => tokens.filter(({ chain, value, symbol }) => {
1126
+ var filterAssets = (tokens2) => tokens2.filter(({ chain, value, symbol }) => {
167
1127
  const assetString = `${chain}.${symbol}`;
168
1128
  return !potentialScamRegex.test(assetString) && evmAssetHasAddress(assetString) && value !== "0";
169
1129
  });
170
1130
  // src/helpers/liquidity.ts
171
- import {BaseDecimal as BaseDecimal2} from "@swapkit/types";
172
1131
  function getAsymmetricRuneShare({
173
1132
  liquidityUnits,
174
1133
  poolUnits,
@@ -218,7 +1177,7 @@ function getAsymmetricAssetWithdrawAmount({
218
1177
  return getAsymmetricAssetShare({ assetDepth, liquidityUnits, poolUnits }).mul(percent);
219
1178
  }
220
1179
  var toTCSwapKitNumber = function(value) {
221
- return SwapKitNumber.fromBigInt(BigInt(value), BaseDecimal2.THOR);
1180
+ return SwapKitNumber.fromBigInt(BigInt(value), BaseDecimal.THOR);
222
1181
  };
223
1182
  function getSymmetricPoolShare({
224
1183
  liquidityUnits,
@@ -284,7 +1243,6 @@ function getLiquiditySlippage({
284
1243
  return Math.abs(numerator.div(denominator).getBaseValue("number"));
285
1244
  }
286
1245
  // src/helpers/memo.ts
287
- import {Chain as Chain2, MemoType} from "@swapkit/types";
288
1246
  var getMemoFor = (memoType, options) => {
289
1247
  switch (memoType) {
290
1248
  case MemoType.LEAVE:
@@ -304,11 +1262,11 @@ var getMemoFor = (memoType, options) => {
304
1262
  const { chain, symbol, address, singleSide } = options;
305
1263
  const getPoolIdentifier = (chain2, symbol2) => {
306
1264
  switch (chain2) {
307
- case Chain2.Litecoin:
1265
+ case Chain.Litecoin:
308
1266
  return "l";
309
- case Chain2.Dogecoin:
1267
+ case Chain.Dogecoin:
310
1268
  return "d";
311
- case Chain2.BitcoinCash:
1269
+ case Chain.BitcoinCash:
312
1270
  return "c";
313
1271
  default:
314
1272
  return `${chain2}.${symbol2}`;
@@ -409,9 +1367,9 @@ function getMAYANameCost(year) {
409
1367
  throw new Error("Invalid number of year");
410
1368
  return Math.round((10 + year * 1.0512) * 10000000000) / 10000000000;
411
1369
  }
412
- function derivationPathToString([network, chainId, account, change, index]) {
1370
+ function derivationPathToString([network3, chainId, account, change, index]) {
413
1371
  const shortPath = typeof index !== "number";
414
- return `m/${network}'/${chainId}'/${account}'/${change}${shortPath ? "" : `/${index}`}`;
1372
+ return `m/${network3}'/${chainId}'/${account}'/${change}${shortPath ? "" : `/${index}`}`;
415
1373
  }
416
1374
  function wrapWithThrow(fn, errorKey) {
417
1375
  try {
@@ -423,11 +1381,7 @@ function wrapWithThrow(fn, errorKey) {
423
1381
  return console.error(error);
424
1382
  }
425
1383
  }
426
- // src/modules/assetValue.ts
427
- import {BaseDecimal as BaseDecimal4, Chain as Chain4, ChainToChainId} from "@swapkit/types";
428
-
429
1384
  // src/helpers/validators.ts
430
- import {Chain as Chain3} from "@swapkit/types";
431
1385
  function validateIdentifier(identifier = "") {
432
1386
  const uppercasedIdentifier = identifier.toUpperCase();
433
1387
  const [chain] = uppercasedIdentifier.split(".");
@@ -438,10 +1392,14 @@ function validateIdentifier(identifier = "") {
438
1392
  return true;
439
1393
  throw new Error(`Invalid identifier: ${identifier}. Expected format: <Chain>.<Ticker> or <Chain>.<Ticker>-<ContractAddress>`);
440
1394
  }
441
- var supportedChains = [...Object.values(Chain3), "TERRA"];
442
-
1395
+ function validateTNS(name) {
1396
+ if (name.length > 30)
1397
+ return false;
1398
+ const regex = /^[a-zA-Z0-9+_-]+$/g;
1399
+ return !!name.match(regex);
1400
+ }
1401
+ var supportedChains = [...Object.values(Chain), "TERRA"];
443
1402
  // src/modules/bigIntArithmetics.ts
444
- import {BaseDecimal as BaseDecimal3} from "@swapkit/types";
445
1403
  function formatBigIntToSafeValue({
446
1404
  value,
447
1405
  bigIntDecimal = DEFAULT_DECIMAL,
@@ -546,7 +1504,7 @@ class BigIntArithmetics {
546
1504
  }
547
1505
  }
548
1506
  getBaseValue(type) {
549
- const divisor = this.decimalMultiplier / toMultiplier(this.decimal || BaseDecimal3.THOR);
1507
+ const divisor = this.decimalMultiplier / toMultiplier(this.decimal || BaseDecimal.THOR);
550
1508
  const baseValue = this.bigIntValue / divisor;
551
1509
  switch (type) {
552
1510
  case "number":
@@ -729,19 +1687,19 @@ class SwapKitNumber extends BigIntArithmetics {
729
1687
  function getMinAmountByChain(chain) {
730
1688
  const asset2 = AssetValue.fromChainOrSignature(chain);
731
1689
  switch (chain) {
732
- case Chain4.Bitcoin:
733
- case Chain4.Litecoin:
734
- case Chain4.BitcoinCash:
1690
+ case Chain.Bitcoin:
1691
+ case Chain.Litecoin:
1692
+ case Chain.BitcoinCash:
735
1693
  return asset2.set(0.00010001);
736
- case Chain4.Dogecoin:
1694
+ case Chain.Dogecoin:
737
1695
  return asset2.set(1.00000001);
738
- case Chain4.Avalanche:
739
- case Chain4.Ethereum:
1696
+ case Chain.Avalanche:
1697
+ case Chain.Ethereum:
740
1698
  return asset2.set(0.00000001);
741
- case Chain4.THORChain:
742
- case Chain4.Maya:
1699
+ case Chain.THORChain:
1700
+ case Chain.Maya:
743
1701
  return asset2.set(0);
744
- case Chain4.Cosmos:
1702
+ case Chain.Cosmos:
745
1703
  return asset2.set(0.000001);
746
1704
  default:
747
1705
  return asset2.set(0.00000001);
@@ -757,13 +1715,13 @@ async function createAssetValue(identifier, value = 0) {
757
1715
  return new AssetValue({ decimal, value: safeValue(value, decimal), identifier });
758
1716
  }
759
1717
  var createSyntheticAssetValue = function(identifier, value = 0) {
760
- const [synthChain, symbol] = identifier.split(".")?.[0]?.toUpperCase() === Chain4.THORChain ? identifier.split(".").slice(1).join().split("/") : identifier.split("/");
1718
+ const [synthChain, symbol] = identifier.split(".")?.[0]?.toUpperCase() === Chain.THORChain ? identifier.split(".").slice(1).join().split("/") : identifier.split("/");
761
1719
  if (!(synthChain && symbol))
762
1720
  throw new Error("Invalid asset identifier");
763
1721
  return new AssetValue({
764
1722
  decimal: 8,
765
1723
  value: safeValue(value, 8),
766
- identifier: `${Chain4.THORChain}.${synthChain}/${symbol}`
1724
+ identifier: `${Chain.THORChain}.${synthChain}/${symbol}`
767
1725
  });
768
1726
  };
769
1727
  var safeValue = function(value, decimal) {
@@ -771,10 +1729,10 @@ var safeValue = function(value, decimal) {
771
1729
  };
772
1730
  var getAssetInfo = function(identifier) {
773
1731
  const isSynthetic = identifier.slice(0, 14).includes("/");
774
- const [synthChain, synthSymbol = ""] = identifier.split(".")?.[0]?.toUpperCase() === Chain4.THORChain ? identifier.split(".").slice(1).join().split("/") : identifier.split("/");
1732
+ const [synthChain, synthSymbol = ""] = identifier.split(".")?.[0]?.toUpperCase() === Chain.THORChain ? identifier.split(".").slice(1).join().split("/") : identifier.split("/");
775
1733
  if (isSynthetic && !(synthChain && synthSymbol))
776
1734
  throw new Error("Invalid asset identifier");
777
- const adjustedIdentifier = identifier.includes(".") && !isSynthetic ? identifier : `${Chain4.THORChain}.${synthSymbol}`;
1735
+ const adjustedIdentifier = identifier.includes(".") && !isSynthetic ? identifier : `${Chain.THORChain}.${synthSymbol}`;
778
1736
  const [chain, ...rest] = adjustedIdentifier.split(".");
779
1737
  const [ticker, address] = (isSynthetic ? synthSymbol : rest.join(".")).split("-");
780
1738
  const symbol = isSynthetic ? synthSymbol : rest.join(".");
@@ -798,6 +1756,7 @@ class AssetValue extends BigIntArithmetics {
798
1756
  tax;
799
1757
  ticker;
800
1758
  type;
1759
+ chainId;
801
1760
  constructor({
802
1761
  value,
803
1762
  decimal,
@@ -816,6 +1775,7 @@ class AssetValue extends BigIntArithmetics {
816
1775
  this.address = assetInfo.address;
817
1776
  this.isSynthetic = assetInfo.isSynthetic;
818
1777
  this.isGasAsset = assetInfo.isGasAsset;
1778
+ this.chainId = ChainToChainId[assetInfo.chain];
819
1779
  }
820
1780
  toString() {
821
1781
  return this.isSynthetic ? this.symbol : `${this.chain}.${this.symbol}`;
@@ -826,14 +1786,11 @@ class AssetValue extends BigIntArithmetics {
826
1786
  eq({ chain, symbol }) {
827
1787
  return this.chain === chain && this.symbol === symbol;
828
1788
  }
829
- chainId() {
830
- return ChainToChainId[this.chain];
831
- }
832
1789
  static fromUrl(urlAsset, value = 0) {
833
1790
  const [chain, ticker, symbol] = urlAsset.split(".");
834
1791
  if (!(chain && ticker))
835
1792
  throw new Error("Invalid asset url");
836
- const assetString = chain === Chain4.THORChain && symbol ? `${chain}.${ticker}/${symbol}` : urlAsset;
1793
+ const assetString = chain === Chain.THORChain && symbol ? `${chain}.${ticker}/${symbol}` : urlAsset;
837
1794
  return createAssetValue(assetString, value);
838
1795
  }
839
1796
  static fromString(assetString, value = 0) {
@@ -848,7 +1805,7 @@ class AssetValue extends BigIntArithmetics {
848
1805
  if (isSynthetic)
849
1806
  return createSyntheticAssetValue(assetString, value);
850
1807
  const { tax, decimal, identifier } = tokenInfo || {
851
- decimal: BaseDecimal4[chain],
1808
+ decimal: BaseDecimal[chain],
852
1809
  identifier: assetString
853
1810
  };
854
1811
  return new AssetValue({
@@ -858,7 +1815,7 @@ class AssetValue extends BigIntArithmetics {
858
1815
  decimal: isSynthetic ? 8 : decimal
859
1816
  });
860
1817
  }
861
- static async fromStringWithBase(assetString, value = 0, baseDecimal = BaseDecimal4.THOR) {
1818
+ static async fromStringWithBase(assetString, value = 0, baseDecimal = BaseDecimal.THOR) {
862
1819
  const shiftedAmount = BigIntArithmetics.shiftDecimals({
863
1820
  value: SwapKitNumber.fromBigInt(BigInt(value)),
864
1821
  from: 0,
@@ -867,13 +1824,13 @@ class AssetValue extends BigIntArithmetics {
867
1824
  const assetValue = await AssetValue.fromString(assetString, value);
868
1825
  return assetValue.set(shiftedAmount);
869
1826
  }
870
- static fromStringWithBaseSync(assetString, value = 0, baseDecimal = BaseDecimal4.THOR) {
1827
+ static fromStringWithBaseSync(assetString, value = 0, baseDecimal = BaseDecimal.THOR) {
871
1828
  const { chain, isSynthetic } = getAssetInfo(assetString);
872
1829
  const tokenInfo = staticTokensMap.get(assetString.toUpperCase());
873
1830
  if (isSynthetic)
874
1831
  return createSyntheticAssetValue(assetString, value);
875
1832
  const { tax, decimal, identifier } = tokenInfo || {
876
- decimal: BaseDecimal4[chain],
1833
+ decimal: BaseDecimal[chain],
877
1834
  identifier: assetString
878
1835
  };
879
1836
  return new AssetValue({
@@ -889,7 +1846,7 @@ class AssetValue extends BigIntArithmetics {
889
1846
  if (isSynthetic)
890
1847
  return createSyntheticAssetValue(assetString, value);
891
1848
  const { tax, decimal, identifier } = tokenInfo || {
892
- decimal: BaseDecimal4[chain],
1849
+ decimal: BaseDecimal[chain],
893
1850
  identifier: assetString
894
1851
  };
895
1852
  return new AssetValue({ tax, decimal, identifier, value: safeValue(value, decimal) });
@@ -906,7 +1863,7 @@ class AssetValue extends BigIntArithmetics {
906
1863
  for (const { identifier, chain, ...rest } of tokenList.tokens) {
907
1864
  staticTokensMap.set(identifier.toUpperCase(), {
908
1865
  identifier,
909
- decimal: "decimals" in rest ? rest.decimals : BaseDecimal4[chain]
1866
+ decimal: "decimals" in rest ? rest.decimals : BaseDecimal[chain]
910
1867
  });
911
1868
  }
912
1869
  }
@@ -925,6 +1882,9 @@ class AssetValue extends BigIntArithmetics {
925
1882
  }
926
1883
  export {
927
1884
  wrapWithThrow,
1885
+ validateTNS,
1886
+ validateIdentifier,
1887
+ setRequestClientConfig,
928
1888
  isGasAsset,
929
1889
  getTHORNameCost,
930
1890
  getSymmetricWithdraw,
@@ -945,12 +1905,46 @@ export {
945
1905
  formatBigIntToSafeValue,
946
1906
  findAssetBy,
947
1907
  filterAssets,
1908
+ erc20ABI,
948
1909
  derivationPathToString,
1910
+ defaultRequestHeaders,
949
1911
  assetFromString,
1912
+ WalletOption,
1913
+ UTXOChains,
1914
+ TCSupportedChains,
1915
+ TCEthereumVaultAbi,
1916
+ TCBscDepositABI,
1917
+ TCAvalancheDepositABI,
950
1918
  SwapKitNumber,
951
1919
  SwapKitError,
1920
+ SubstrateChains,
1921
+ SWAP_OUT,
1922
+ SWAP_IN,
1923
+ RequestClient,
1924
+ RPCUrl,
1925
+ QuoteMode,
1926
+ NetworkDerivationPath,
1927
+ MemoType,
1928
+ MAYASupportedChains,
1929
+ LedgerErrorCode,
1930
+ FeeOption,
1931
+ ExplorerUrl,
1932
+ EVMChains,
1933
+ DerivationPath,
1934
+ CosmosChains,
1935
+ ContractAddress,
1936
+ ChainToRPC,
1937
+ ChainToHexChainId,
1938
+ ChainToExplorerUrl,
1939
+ ChainToChainId,
1940
+ ChainIdToChain,
1941
+ ChainId,
1942
+ Chain,
952
1943
  BigIntArithmetics,
953
- AssetValue
1944
+ BaseDecimal,
1945
+ AssetValue,
1946
+ ApproveMode,
1947
+ AGG_SWAP
954
1948
  };
955
1949
 
956
- //# debugId=73252CC82EFDBB7564756e2164756e21
1950
+ //# debugId=D7CB5E3A413745AD64756e2164756e21