@bgd-labs/toolbox 0.0.0

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.mjs ADDED
@@ -0,0 +1,931 @@
1
+ // src/math/binary.ts
2
+ function bitmapToIndexes(bitmap) {
3
+ const indexes = [];
4
+ for (let i = 0; bitmap != 0n; i++) {
5
+ if (bitmap & 0x1n) indexes.push(i);
6
+ bitmap = bitmap >> 1n;
7
+ }
8
+ return indexes;
9
+ }
10
+ function getBits(uint256, startBit, _endBit) {
11
+ let endBit = _endBit;
12
+ if (startBit > endBit) {
13
+ throw new Error(
14
+ "Invalid bit range: startBit must be less than or equal to endBit"
15
+ );
16
+ }
17
+ const bitLength = BigInt(uint256.toString(2)).toString().length;
18
+ if (endBit >= bitLength) {
19
+ endBit = BigInt(bitLength - 1);
20
+ }
21
+ const mask = (1n << endBit - startBit + 1n) - 1n;
22
+ return uint256 >> startBit & mask;
23
+ }
24
+
25
+ // src/aave/user.ts
26
+ function decodeUserConfiguration(userConfiguration) {
27
+ const indexes = bitmapToIndexes(userConfiguration);
28
+ const borrowedAssetIds = [];
29
+ const collateralAssetIds = [];
30
+ for (const index of indexes) {
31
+ if (index % 2 == 0) borrowedAssetIds.push(index / 2);
32
+ else collateralAssetIds.push((index - 1) / 2);
33
+ }
34
+ return { borrowedAssetIds, collateralAssetIds };
35
+ }
36
+
37
+ // src/ecosystem/generated/etherscanExplorers.ts
38
+ var etherscanExplorers = {
39
+ 1: {
40
+ api: "https://api.etherscan.io/v2/api",
41
+ explorer: "https://etherscan.io"
42
+ },
43
+ 10: {
44
+ api: "https://api.etherscan.io/v2/api",
45
+ explorer: "https://optimistic.etherscan.io/"
46
+ },
47
+ 25: {
48
+ api: "https://api.etherscan.io/v2/api",
49
+ explorer: "https://cronoscan.com"
50
+ },
51
+ 50: {
52
+ api: "https://api.etherscan.io/v2/api",
53
+ explorer: "https://xdcscan.com/"
54
+ },
55
+ 51: {
56
+ api: "https://api.etherscan.io/v2/api",
57
+ explorer: "https://testnet.xdcscan.com/"
58
+ },
59
+ 56: {
60
+ api: "https://api.etherscan.io/v2/api",
61
+ explorer: "https://bscscan.com"
62
+ },
63
+ 97: {
64
+ api: "https://api.etherscan.io/v2/api",
65
+ explorer: "https://testnet.bscscan.com"
66
+ },
67
+ 100: {
68
+ api: "https://api.etherscan.io/v2/api",
69
+ explorer: "https://gnosisscan.io/"
70
+ },
71
+ 130: {
72
+ api: "https://api.etherscan.io/v2/api",
73
+ explorer: "https://uniscan.xyz/"
74
+ },
75
+ 137: {
76
+ api: "https://api.etherscan.io/v2/api",
77
+ explorer: "https://polygonscan.com"
78
+ },
79
+ 146: {
80
+ api: "https://api.etherscan.io/v2/api",
81
+ explorer: "https://sonicscan.org/"
82
+ },
83
+ 199: {
84
+ api: "https://api.etherscan.io/v2/api",
85
+ explorer: "https://bttcscan.com/"
86
+ },
87
+ 204: {
88
+ api: "https://api.etherscan.io/v2/api",
89
+ explorer: "https://opbnb.bscscan.com/"
90
+ },
91
+ 250: {
92
+ api: "https://api.etherscan.io/v2/api",
93
+ explorer: "https://ftmscan.com"
94
+ },
95
+ 252: {
96
+ api: "https://api.etherscan.io/v2/api",
97
+ explorer: "https://fraxscan.com/"
98
+ },
99
+ 255: {
100
+ api: "https://api.etherscan.io/v2/api",
101
+ explorer: "https://kromascan.com/"
102
+ },
103
+ 300: {
104
+ api: "https://api.etherscan.io/v2/api",
105
+ explorer: "https://sepolia-era.zksync.network/"
106
+ },
107
+ 324: {
108
+ api: "https://api.etherscan.io/v2/api",
109
+ explorer: "https://era.zksync.network/"
110
+ },
111
+ 480: {
112
+ api: "https://api.etherscan.io/v2/api",
113
+ explorer: "https://worldscan.org/"
114
+ },
115
+ 1028: {
116
+ api: "https://api.etherscan.io/v2/api",
117
+ explorer: "https://testnet.bttcscan.com/"
118
+ },
119
+ 1101: {
120
+ api: "https://api.etherscan.io/v2/api",
121
+ explorer: "https://zkevm.polygonscan.com/"
122
+ },
123
+ 1111: {
124
+ api: "https://api.etherscan.io/v2/api",
125
+ explorer: "https://wemixscan.com/"
126
+ },
127
+ 1112: {
128
+ api: "https://api.etherscan.io/v2/api",
129
+ explorer: "https://testnet.wemixscan.com/"
130
+ },
131
+ 1284: {
132
+ api: "https://api.etherscan.io/v2/api",
133
+ explorer: "https://moonbeam.moonscan.io/"
134
+ },
135
+ 1285: {
136
+ api: "https://api.etherscan.io/v2/api",
137
+ explorer: "https://moonriver.moonscan.io/"
138
+ },
139
+ 1287: {
140
+ api: "https://api.etherscan.io/v2/api",
141
+ explorer: "https://moonbase.moonscan.io/"
142
+ },
143
+ 1301: {
144
+ api: "https://api.etherscan.io/v2/api",
145
+ explorer: "https://sepolia.uniscan.xyz/"
146
+ },
147
+ 2358: {
148
+ api: "https://api.etherscan.io/v2/api",
149
+ explorer: "https://sepolia.kromascan.com/"
150
+ },
151
+ 2442: {
152
+ api: "https://api.etherscan.io/v2/api",
153
+ explorer: "https://cardona-zkevm.polygonscan.com/"
154
+ },
155
+ 2522: {
156
+ api: "https://api.etherscan.io/v2/api",
157
+ explorer: "https://holesky.fraxscan.com/"
158
+ },
159
+ 2741: {
160
+ api: "https://api.etherscan.io/v2/api",
161
+ explorer: "https://abscan.org/"
162
+ },
163
+ 4002: {
164
+ api: "https://api.etherscan.io/v2/api",
165
+ explorer: "https://testnet.ftmscan.com/"
166
+ },
167
+ 4801: {
168
+ api: "https://api.etherscan.io/v2/api",
169
+ explorer: "https://sepolia.worldscan.org/"
170
+ },
171
+ 5e3: {
172
+ api: "https://api.etherscan.io/v2/api",
173
+ explorer: "https://mantlescan.xyz/"
174
+ },
175
+ 5003: {
176
+ api: "https://api.etherscan.io/v2/api",
177
+ explorer: "https://sepolia.mantlescan.xyz/"
178
+ },
179
+ 5611: {
180
+ api: "https://api.etherscan.io/v2/api",
181
+ explorer: "https://opbnb-testnet.bscscan.com/"
182
+ },
183
+ 8453: {
184
+ api: "https://api.etherscan.io/v2/api",
185
+ explorer: "https://basescan.org"
186
+ },
187
+ 11124: {
188
+ api: "https://api.etherscan.io/v2/api",
189
+ explorer: "https://sepolia.abscan.org/"
190
+ },
191
+ 17e3: {
192
+ api: "https://api.etherscan.io/v2/api",
193
+ explorer: "https://sepolia.etherscan.io"
194
+ },
195
+ 33111: {
196
+ api: "https://api.etherscan.io/v2/api",
197
+ explorer: "https://curtis.apescan.io/"
198
+ },
199
+ 33139: {
200
+ api: "https://api.etherscan.io/v2/api",
201
+ explorer: "https://apescan.io/"
202
+ },
203
+ 42161: {
204
+ api: "https://api.etherscan.io/v2/api",
205
+ explorer: "https://arbiscan.io"
206
+ },
207
+ 42170: {
208
+ api: "https://api.etherscan.io/v2/api",
209
+ explorer: "https://nova.arbiscan.io/"
210
+ },
211
+ 42220: {
212
+ api: "https://api.etherscan.io/v2/api",
213
+ explorer: "https://celoscan.io"
214
+ },
215
+ 43113: {
216
+ api: "https://api.etherscan.io/v2/api",
217
+ explorer: "https://testnet.snowscan.xyz/"
218
+ },
219
+ 43114: {
220
+ api: "https://api.etherscan.io/v2/api",
221
+ explorer: "https://snowscan.xyz/"
222
+ },
223
+ 44787: {
224
+ api: "https://api.etherscan.io/v2/api",
225
+ explorer: "https://alfajores.celoscan.io/"
226
+ },
227
+ 50104: {
228
+ api: "https://api.etherscan.io/v2/api",
229
+ explorer: "https://sophscan.xyz/"
230
+ },
231
+ 57054: {
232
+ api: "https://api.etherscan.io/v2/api",
233
+ explorer: "https://testnet.sonicscan.org/"
234
+ },
235
+ 59141: {
236
+ api: "https://api.etherscan.io/v2/api",
237
+ explorer: "https://sepolia.lineascan.build/"
238
+ },
239
+ 59144: {
240
+ api: "https://api.etherscan.io/v2/api",
241
+ explorer: "https://lineascan.build/"
242
+ },
243
+ 80002: {
244
+ api: "https://api.etherscan.io/v2/api",
245
+ explorer: "https://amoy.polygonscan.com/"
246
+ },
247
+ 80094: {
248
+ api: "https://api.etherscan.io/v2/api",
249
+ explorer: "https://berascan.com/"
250
+ },
251
+ 81457: {
252
+ api: "https://api.etherscan.io/v2/api",
253
+ explorer: "https://blastscan.io/"
254
+ },
255
+ 84532: {
256
+ api: "https://api.etherscan.io/v2/api",
257
+ explorer: "https://sepolia.basescan.org/"
258
+ },
259
+ 167e3: {
260
+ api: "https://api.etherscan.io/v2/api",
261
+ explorer: "https://taikoscan.io/"
262
+ },
263
+ 167009: {
264
+ api: "https://api.etherscan.io/v2/api",
265
+ explorer: "https://hekla.taikoscan.io/"
266
+ },
267
+ 421614: {
268
+ api: "https://api.etherscan.io/v2/api",
269
+ explorer: "https://sepolia.arbiscan.io/"
270
+ },
271
+ 534351: {
272
+ api: "https://api.etherscan.io/v2/api",
273
+ explorer: "https://sepolia.scrollscan.com/"
274
+ },
275
+ 534352: {
276
+ api: "https://api.etherscan.io/v2/api",
277
+ explorer: "https://scrollscan.com/"
278
+ },
279
+ 660279: {
280
+ api: "https://api.etherscan.io/v2/api",
281
+ explorer: "https://xaiscan.io/"
282
+ },
283
+ 11155111: {
284
+ api: "https://api.etherscan.io/v2/api",
285
+ explorer: "https://sepolia.etherscan.io"
286
+ },
287
+ 11155420: {
288
+ api: "https://api.etherscan.io/v2/api",
289
+ explorer: "https://sepolia-optimism.etherscan.io/"
290
+ },
291
+ 168587773: {
292
+ api: "https://api.etherscan.io/v2/api",
293
+ explorer: "https://sepolia.blastscan.io/"
294
+ },
295
+ 531050104: {
296
+ api: "https://api.etherscan.io/v2/api",
297
+ explorer: "https://testnet.sophscan.xyz/"
298
+ },
299
+ 37714555429: {
300
+ api: "https://api.etherscan.io/v2/api",
301
+ explorer: "https://sepolia.xaiscan.io/"
302
+ }
303
+ };
304
+
305
+ // src/ecosystem/generated/routescanExplorers.ts
306
+ var routescanExplorers = {
307
+ 1: {
308
+ api: "https://api.routescan.io/v2/network/mainnet/evm/1/etherscan",
309
+ explorer: "1.routescan.io"
310
+ },
311
+ 10: {
312
+ api: "https://api.routescan.io/v2/network/mainnet/evm/10/etherscan",
313
+ explorer: "10.routescan.io"
314
+ },
315
+ 14: {
316
+ api: "https://api.routescan.io/v2/network/mainnet/evm/14/etherscan",
317
+ explorer: "14.routescan.io"
318
+ },
319
+ 16: {
320
+ api: "https://api.routescan.io/v2/network/testnet/evm/16/etherscan",
321
+ explorer: "16.routescan.io"
322
+ },
323
+ 19: {
324
+ api: "https://api.routescan.io/v2/network/mainnet/evm/19/etherscan",
325
+ explorer: "19.routescan.io"
326
+ },
327
+ 56: {
328
+ api: "https://api.routescan.io/v2/network/mainnet/evm/56/etherscan",
329
+ explorer: "56.routescan.io"
330
+ },
331
+ 97: {
332
+ api: "https://api.routescan.io/v2/network/testnet/evm/97/etherscan",
333
+ explorer: "97.routescan.io"
334
+ },
335
+ 114: {
336
+ api: "https://api.routescan.io/v2/network/testnet/evm/114/etherscan",
337
+ explorer: "114.routescan.io"
338
+ },
339
+ 146: {
340
+ api: "https://api.routescan.io/v2/network/mainnet/evm/146/etherscan",
341
+ explorer: "146.routescan.io"
342
+ },
343
+ 151: {
344
+ api: "https://api.routescan.io/v2/network/mainnet/evm/151/etherscan",
345
+ explorer: "151.routescan.io"
346
+ },
347
+ 166: {
348
+ api: "https://api.routescan.io/v2/network/mainnet/evm/166/etherscan",
349
+ explorer: "166.routescan.io"
350
+ },
351
+ 169: {
352
+ api: "https://api.routescan.io/v2/network/mainnet/evm/169/etherscan",
353
+ explorer: "169.routescan.io"
354
+ },
355
+ 183: {
356
+ api: "https://api.routescan.io/v2/network/mainnet/evm/183/etherscan",
357
+ explorer: "183.routescan.io"
358
+ },
359
+ 185: {
360
+ api: "https://api.routescan.io/v2/network/mainnet/evm/185/etherscan",
361
+ explorer: "185.routescan.io"
362
+ },
363
+ 233: {
364
+ api: "https://api.routescan.io/v2/network/testnet/evm/233/etherscan",
365
+ explorer: "233.routescan.io"
366
+ },
367
+ 252: {
368
+ api: "https://api.routescan.io/v2/network/mainnet/evm/252/etherscan",
369
+ explorer: "252.routescan.io"
370
+ },
371
+ 254: {
372
+ api: "https://api.routescan.io/v2/network/mainnet/evm/254/etherscan",
373
+ explorer: "254.routescan.io"
374
+ },
375
+ 255: {
376
+ api: "https://api.routescan.io/v2/network/mainnet/evm/255/etherscan",
377
+ explorer: "255.routescan.io"
378
+ },
379
+ 288: {
380
+ api: "https://api.routescan.io/v2/network/mainnet/evm/288/etherscan",
381
+ explorer: "288.routescan.io"
382
+ },
383
+ 291: {
384
+ api: "https://api.routescan.io/v2/network/mainnet/evm/291/etherscan",
385
+ explorer: "291.routescan.io"
386
+ },
387
+ 301: {
388
+ api: "https://api.routescan.io/v2/network/mainnet/evm/301/etherscan",
389
+ explorer: "301.routescan.io"
390
+ },
391
+ 303: {
392
+ api: "https://api.routescan.io/v2/network/mainnet/evm/303/etherscan",
393
+ explorer: "303.routescan.io"
394
+ },
395
+ 324: {
396
+ api: "https://api.routescan.io/v2/network/mainnet/evm/324/etherscan",
397
+ explorer: "324.routescan.io"
398
+ },
399
+ 335: {
400
+ api: "https://api.routescan.io/v2/network/testnet/evm/335/etherscan",
401
+ explorer: "335.routescan.io"
402
+ },
403
+ 357: {
404
+ api: "https://api.routescan.io/v2/network/mainnet/evm/357/etherscan",
405
+ explorer: "357.routescan.io"
406
+ },
407
+ 480: {
408
+ api: "https://api.routescan.io/v2/network/mainnet/evm/480/etherscan",
409
+ explorer: "480.routescan.io"
410
+ },
411
+ 719: {
412
+ api: "https://api.routescan.io/v2/network/mainnet/evm/719/etherscan",
413
+ explorer: "719.routescan.io"
414
+ },
415
+ 749: {
416
+ api: "https://api.routescan.io/v2/network/testnet/evm/749/etherscan",
417
+ explorer: "749.routescan.io"
418
+ },
419
+ 919: {
420
+ api: "https://api.routescan.io/v2/network/testnet/evm/919/etherscan",
421
+ explorer: "919.routescan.io"
422
+ },
423
+ 1010: {
424
+ api: "https://api.routescan.io/v2/network/mainnet/evm/1010/etherscan",
425
+ explorer: "1010.routescan.io"
426
+ },
427
+ 1088: {
428
+ api: "https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan",
429
+ explorer: "1088.routescan.io"
430
+ },
431
+ 1135: {
432
+ api: "https://api.routescan.io/v2/network/mainnet/evm/1135/etherscan",
433
+ explorer: "1135.routescan.io"
434
+ },
435
+ 1234: {
436
+ api: "https://api.routescan.io/v2/network/mainnet/evm/1234/etherscan",
437
+ explorer: "1234.routescan.io"
438
+ },
439
+ 1294: {
440
+ api: "https://api.routescan.io/v2/network/mainnet/evm/1294/etherscan",
441
+ explorer: "1294.routescan.io"
442
+ },
443
+ 1301: {
444
+ api: "https://api.routescan.io/v2/network/testnet/evm/1301/etherscan",
445
+ explorer: "1301.routescan.io"
446
+ },
447
+ 1687: {
448
+ api: "https://api.routescan.io/v2/network/testnet/evm/1687/etherscan",
449
+ explorer: "1687.routescan.io"
450
+ },
451
+ 1853: {
452
+ api: "https://api.routescan.io/v2/network/mainnet/evm/1853/etherscan",
453
+ explorer: "1853.routescan.io"
454
+ },
455
+ 1923: {
456
+ api: "https://api.routescan.io/v2/network/mainnet/evm/1923/etherscan",
457
+ explorer: "1923.routescan.io"
458
+ },
459
+ 1946: {
460
+ api: "https://api.routescan.io/v2/network/testnet/evm/1946/etherscan",
461
+ explorer: "1946.routescan.io"
462
+ },
463
+ 2037: {
464
+ api: "https://api.routescan.io/v2/network/testnet/evm/2037/etherscan",
465
+ explorer: "2037.routescan.io"
466
+ },
467
+ 2044: {
468
+ api: "https://api.routescan.io/v2/network/mainnet/evm/2044/etherscan",
469
+ explorer: "2044.routescan.io"
470
+ },
471
+ 2233: {
472
+ api: "https://api.routescan.io/v2/network/testnet/evm/2233/etherscan",
473
+ explorer: "2233.routescan.io"
474
+ },
475
+ 2358: {
476
+ api: "https://api.routescan.io/v2/network/testnet/evm/2358/etherscan",
477
+ explorer: "2358.routescan.io"
478
+ },
479
+ 2522: {
480
+ api: "https://api.routescan.io/v2/network/testnet/evm/2522/etherscan",
481
+ explorer: "2522.routescan.io"
482
+ },
483
+ 2818: {
484
+ api: "https://api.routescan.io/v2/network/mainnet/evm/2818/etherscan",
485
+ explorer: "2818.routescan.io"
486
+ },
487
+ 3011: {
488
+ api: "https://api.routescan.io/v2/network/mainnet/evm/3011/etherscan",
489
+ explorer: "3011.routescan.io"
490
+ },
491
+ 3012: {
492
+ api: "https://api.routescan.io/v2/network/testnet/evm/3012/etherscan",
493
+ explorer: "3012.routescan.io"
494
+ },
495
+ 3636: {
496
+ api: "https://api.routescan.io/v2/network/testnet/evm/3636/etherscan",
497
+ explorer: "3636.routescan.io"
498
+ },
499
+ 3939: {
500
+ api: "https://api.routescan.io/v2/network/testnet/evm/3939/etherscan",
501
+ explorer: "3939.routescan.io"
502
+ },
503
+ 4202: {
504
+ api: "https://api.routescan.io/v2/network/testnet/evm/4202/etherscan",
505
+ explorer: "4202.routescan.io"
506
+ },
507
+ 4337: {
508
+ api: "https://api.routescan.io/v2/network/mainnet/evm/4337/etherscan",
509
+ explorer: "4337.routescan.io"
510
+ },
511
+ 4460: {
512
+ api: "https://api.routescan.io/v2/network/testnet/evm/4460/etherscan",
513
+ explorer: "4460.routescan.io"
514
+ },
515
+ 4801: {
516
+ api: "https://api.routescan.io/v2/network/testnet/evm/4801/etherscan",
517
+ explorer: "4801.routescan.io"
518
+ },
519
+ 5e3: {
520
+ api: "https://api.routescan.io/v2/network/mainnet/evm/5000/etherscan",
521
+ explorer: "5000.routescan.io"
522
+ },
523
+ 5330: {
524
+ api: "https://api.routescan.io/v2/network/mainnet/evm/5330/etherscan",
525
+ explorer: "5330.routescan.io"
526
+ },
527
+ 5566: {
528
+ api: "https://api.routescan.io/v2/network/mainnet/evm/5566/etherscan",
529
+ explorer: "5566.routescan.io"
530
+ },
531
+ 6119: {
532
+ api: "https://api.routescan.io/v2/network/mainnet/evm/6119/etherscan",
533
+ explorer: "6119.routescan.io"
534
+ },
535
+ 6900: {
536
+ api: "https://api.routescan.io/v2/network/mainnet/evm/6900/etherscan",
537
+ explorer: "6900.routescan.io"
538
+ },
539
+ 6911: {
540
+ api: "https://api.routescan.io/v2/network/testnet/evm/6911/etherscan",
541
+ explorer: "6911.routescan.io"
542
+ },
543
+ 7171: {
544
+ api: "https://api.routescan.io/v2/network/mainnet/evm/7171/etherscan",
545
+ explorer: "7171.routescan.io"
546
+ },
547
+ 7210: {
548
+ api: "https://api.routescan.io/v2/network/testnet/evm/7210/etherscan",
549
+ explorer: "7210.routescan.io"
550
+ },
551
+ 7222: {
552
+ api: "https://api.routescan.io/v2/network/testnet/evm/7222/etherscan",
553
+ explorer: "7222.routescan.io"
554
+ },
555
+ 7560: {
556
+ api: "https://api.routescan.io/v2/network/mainnet/evm/7560/etherscan",
557
+ explorer: "7560.routescan.io"
558
+ },
559
+ 7700: {
560
+ api: "https://api.routescan.io/v2/network/mainnet/evm/7700/etherscan",
561
+ explorer: "7700.routescan.io"
562
+ },
563
+ 7887: {
564
+ api: "https://api.routescan.io/v2/network/mainnet/evm/7887/etherscan",
565
+ explorer: "7887.routescan.io"
566
+ },
567
+ 7979: {
568
+ api: "https://api.routescan.io/v2/network/mainnet/evm/7979/etherscan",
569
+ explorer: "7979.routescan.io"
570
+ },
571
+ 8008: {
572
+ api: "https://api.routescan.io/v2/network/mainnet/evm/8008/etherscan",
573
+ explorer: "8008.routescan.io"
574
+ },
575
+ 8082: {
576
+ api: "https://api.routescan.io/v2/network/testnet/evm/8082/etherscan",
577
+ explorer: "8082.routescan.io"
578
+ },
579
+ 8453: {
580
+ api: "https://api.routescan.io/v2/network/mainnet/evm/8453/etherscan",
581
+ explorer: "8453.routescan.io"
582
+ },
583
+ 8888: {
584
+ api: "https://api.routescan.io/v2/network/mainnet/evm/8888/etherscan",
585
+ explorer: "8888.routescan.io"
586
+ },
587
+ 9728: {
588
+ api: "https://api.routescan.io/v2/network/testnet/evm/9728/etherscan",
589
+ explorer: "9728.routescan.io"
590
+ },
591
+ 10507: {
592
+ api: "https://api.routescan.io/v2/network/mainnet/evm/10507/etherscan",
593
+ explorer: "10507.routescan.io"
594
+ },
595
+ 10849: {
596
+ api: "https://api.routescan.io/v2/network/mainnet/evm/10849/etherscan",
597
+ explorer: "10849.routescan.io"
598
+ },
599
+ 10880: {
600
+ api: "https://api.routescan.io/v2/network/testnet/evm/10880/etherscan",
601
+ explorer: "10880.routescan.io"
602
+ },
603
+ 10888: {
604
+ api: "https://api.routescan.io/v2/network/testnet/evm/10888/etherscan",
605
+ explorer: "10888.routescan.io"
606
+ },
607
+ 11124: {
608
+ api: "https://api.routescan.io/v2/network/testnet/evm/11124/etherscan",
609
+ explorer: "11124.routescan.io"
610
+ },
611
+ 17e3: {
612
+ api: "https://api.routescan.io/v2/network/testnet/evm/17000/etherscan",
613
+ explorer: "17000.routescan.io"
614
+ },
615
+ 26659: {
616
+ api: "https://api.routescan.io/v2/network/testnet/evm/26659/etherscan",
617
+ explorer: "26659.routescan.io"
618
+ },
619
+ 28882: {
620
+ api: "https://api.routescan.io/v2/network/testnet/evm/28882/etherscan",
621
+ explorer: "28882.routescan.io"
622
+ },
623
+ 31335: {
624
+ api: "https://api.routescan.io/v2/network/testnet/evm/31335/etherscan",
625
+ explorer: "31335.routescan.io"
626
+ },
627
+ 34443: {
628
+ api: "https://api.routescan.io/v2/network/mainnet/evm/34443/etherscan",
629
+ explorer: "34443.routescan.io"
630
+ },
631
+ 42026: {
632
+ api: "https://api.routescan.io/v2/network/mainnet/evm/42026/etherscan",
633
+ explorer: "42026.routescan.io"
634
+ },
635
+ 42069: {
636
+ api: "https://api.routescan.io/v2/network/testnet/evm/42069/etherscan",
637
+ explorer: "42069.routescan.io"
638
+ },
639
+ 42161: {
640
+ api: "https://api.routescan.io/v2/network/mainnet/evm/42161/etherscan",
641
+ explorer: "42161.routescan.io"
642
+ },
643
+ 43113: {
644
+ api: "https://api.routescan.io/v2/network/testnet/evm/43113/etherscan",
645
+ explorer: "43113.routescan.io"
646
+ },
647
+ 43114: {
648
+ api: "https://api.routescan.io/v2/network/mainnet/evm/43114/etherscan",
649
+ explorer: "43114.routescan.io"
650
+ },
651
+ 43288: {
652
+ api: "https://api.routescan.io/v2/network/mainnet/evm/43288/etherscan",
653
+ explorer: "43288.routescan.io"
654
+ },
655
+ 48795: {
656
+ api: "https://api.routescan.io/v2/network/testnet/evm/48795/etherscan",
657
+ explorer: "48795.routescan.io"
658
+ },
659
+ 49321: {
660
+ api: "https://api.routescan.io/v2/network/testnet/evm/49321/etherscan",
661
+ explorer: "49321.routescan.io"
662
+ },
663
+ 53123: {
664
+ api: "https://api.routescan.io/v2/network/testnet/evm/53123/etherscan",
665
+ explorer: "53123.routescan.io"
666
+ },
667
+ 53302: {
668
+ api: "https://api.routescan.io/v2/network/testnet/evm/53302/etherscan",
669
+ explorer: "53302.routescan.io"
670
+ },
671
+ 53935: {
672
+ api: "https://api.routescan.io/v2/network/mainnet/evm/53935/etherscan",
673
+ explorer: "53935.routescan.io"
674
+ },
675
+ 55551: {
676
+ api: "https://api.routescan.io/v2/network/testnet/evm/55551/etherscan",
677
+ explorer: "55551.routescan.io"
678
+ },
679
+ 56288: {
680
+ api: "https://api.routescan.io/v2/network/mainnet/evm/56288/etherscan",
681
+ explorer: "56288.routescan.io"
682
+ },
683
+ 57054: {
684
+ api: "https://api.routescan.io/v2/network/testnet/evm/57054/etherscan",
685
+ explorer: "57054.routescan.io"
686
+ },
687
+ 57073: {
688
+ api: "https://api.routescan.io/v2/network/mainnet/evm/57073/etherscan",
689
+ explorer: "57073.routescan.io"
690
+ },
691
+ 60118: {
692
+ api: "https://api.routescan.io/v2/network/testnet/evm/60118/etherscan",
693
+ explorer: "60118.routescan.io"
694
+ },
695
+ 62707: {
696
+ api: "https://api.routescan.io/v2/network/mainnet/evm/62707/etherscan",
697
+ explorer: "62707.routescan.io"
698
+ },
699
+ 70800: {
700
+ api: "https://api.routescan.io/v2/network/testnet/evm/70800/etherscan",
701
+ explorer: "70800.routescan.io"
702
+ },
703
+ 70953: {
704
+ api: "https://api.routescan.io/v2/network/mainnet/evm/70953/etherscan",
705
+ explorer: "70953.routescan.io"
706
+ },
707
+ 78170: {
708
+ api: "https://api.routescan.io/v2/network/testnet/evm/78170/etherscan",
709
+ explorer: "78170.routescan.io"
710
+ },
711
+ 8e4: {
712
+ api: "https://api.routescan.io/v2/network/testnet/evm/80000/etherscan",
713
+ explorer: "80000.routescan.io"
714
+ },
715
+ 80002: {
716
+ api: "https://api.routescan.io/v2/network/testnet/evm/80002/etherscan",
717
+ explorer: "80002.routescan.io"
718
+ },
719
+ 80008: {
720
+ api: "https://api.routescan.io/v2/network/testnet/evm/80008/etherscan",
721
+ explorer: "80008.routescan.io"
722
+ },
723
+ 80084: {
724
+ api: "https://api.routescan.io/v2/network/testnet/evm/80084/etherscan",
725
+ explorer: "80084.routescan.io"
726
+ },
727
+ 80085: {
728
+ api: "https://api.routescan.io/v2/network/testnet/evm/80085/etherscan",
729
+ explorer: "80085.routescan.io"
730
+ },
731
+ 80094: {
732
+ api: "https://api.routescan.io/v2/network/mainnet/evm/80094/etherscan",
733
+ explorer: "80094.routescan.io"
734
+ },
735
+ 81457: {
736
+ api: "https://api.routescan.io/v2/network/mainnet/evm/81457/etherscan",
737
+ explorer: "81457.routescan.io"
738
+ },
739
+ 84532: {
740
+ api: "https://api.routescan.io/v2/network/testnet/evm/84532/etherscan",
741
+ explorer: "84532.routescan.io"
742
+ },
743
+ 88882: {
744
+ api: "https://api.routescan.io/v2/network/testnet/evm/88882/etherscan",
745
+ explorer: "88882.routescan.io"
746
+ },
747
+ 88888: {
748
+ api: "https://api.routescan.io/v2/network/mainnet/evm/88888/etherscan",
749
+ explorer: "88888.routescan.io"
750
+ },
751
+ 124832: {
752
+ api: "https://api.routescan.io/v2/network/testnet/evm/124832/etherscan",
753
+ explorer: "124832.routescan.io"
754
+ },
755
+ 167e3: {
756
+ api: "https://api.routescan.io/v2/network/mainnet/evm/167000/etherscan",
757
+ explorer: "167000.routescan.io"
758
+ },
759
+ 167008: {
760
+ api: "https://api.routescan.io/v2/network/testnet/evm/167008/etherscan",
761
+ explorer: "167008.routescan.io"
762
+ },
763
+ 167009: {
764
+ api: "https://api.routescan.io/v2/network/testnet/evm/167009/etherscan",
765
+ explorer: "167009.routescan.io"
766
+ },
767
+ 173750: {
768
+ api: "https://api.routescan.io/v2/network/testnet/evm/173750/etherscan",
769
+ explorer: "173750.routescan.io"
770
+ },
771
+ 421614: {
772
+ api: "https://api.routescan.io/v2/network/testnet/evm/421614/etherscan",
773
+ explorer: "421614.routescan.io"
774
+ },
775
+ 432201: {
776
+ api: "https://api.routescan.io/v2/network/testnet/evm/432201/etherscan",
777
+ explorer: "432201.routescan.io"
778
+ },
779
+ 432204: {
780
+ api: "https://api.routescan.io/v2/network/mainnet/evm/432204/etherscan",
781
+ explorer: "432204.routescan.io"
782
+ },
783
+ 504441: {
784
+ api: "https://api.routescan.io/v2/network/mainnet/evm/504441/etherscan",
785
+ explorer: "504441.routescan.io"
786
+ },
787
+ 555666: {
788
+ api: "https://api.routescan.io/v2/network/testnet/evm/555666/etherscan",
789
+ explorer: "555666.routescan.io"
790
+ },
791
+ 710420: {
792
+ api: "https://api.routescan.io/v2/network/mainnet/evm/710420/etherscan",
793
+ explorer: "710420.routescan.io"
794
+ },
795
+ 763373: {
796
+ api: "https://api.routescan.io/v2/network/testnet/evm/763373/etherscan",
797
+ explorer: "763373.routescan.io"
798
+ },
799
+ 779672: {
800
+ api: "https://api.routescan.io/v2/network/testnet/evm/779672/etherscan",
801
+ explorer: "779672.routescan.io"
802
+ },
803
+ 999999: {
804
+ api: "https://api.routescan.io/v2/network/mainnet/evm/999999/etherscan",
805
+ explorer: "999999.routescan.io"
806
+ },
807
+ 1398243: {
808
+ api: "https://api.routescan.io/v2/network/testnet/evm/1398243/etherscan",
809
+ explorer: "1398243.routescan.io"
810
+ },
811
+ 3397901: {
812
+ api: "https://api.routescan.io/v2/network/testnet/evm/3397901/etherscan",
813
+ explorer: "3397901.routescan.io"
814
+ },
815
+ 7777777: {
816
+ api: "https://api.routescan.io/v2/network/mainnet/evm/7777777/etherscan",
817
+ explorer: "7777777.routescan.io"
818
+ },
819
+ 11155111: {
820
+ api: "https://api.routescan.io/v2/network/testnet/evm/11155111/etherscan",
821
+ explorer: "11155111.routescan.io"
822
+ },
823
+ 11155420: {
824
+ api: "https://api.routescan.io/v2/network/testnet/evm/11155420/etherscan",
825
+ explorer: "11155420.routescan.io"
826
+ },
827
+ 11155931: {
828
+ api: "https://api.routescan.io/v2/network/testnet/evm/11155931/etherscan",
829
+ explorer: "11155931.routescan.io"
830
+ },
831
+ 12345678: {
832
+ api: "https://api.routescan.io/v2/network/mainnet/evm/12345678/etherscan",
833
+ explorer: "12345678.routescan.io"
834
+ },
835
+ 13068200: {
836
+ api: "https://api.routescan.io/v2/network/testnet/evm/13068200/etherscan",
837
+ explorer: "13068200.routescan.io"
838
+ },
839
+ 20240603: {
840
+ api: "https://api.routescan.io/v2/network/mainnet/evm/20240603/etherscan",
841
+ explorer: "20240603.routescan.io"
842
+ },
843
+ 20241133: {
844
+ api: "https://api.routescan.io/v2/network/testnet/evm/20241133/etherscan",
845
+ explorer: "20241133.routescan.io"
846
+ },
847
+ 21e6: {
848
+ api: "https://api.routescan.io/v2/network/mainnet/evm/21000000/etherscan",
849
+ explorer: "21000000.routescan.io"
850
+ },
851
+ 21000001: {
852
+ api: "https://api.routescan.io/v2/network/testnet/evm/21000001/etherscan",
853
+ explorer: "21000001.routescan.io"
854
+ },
855
+ 28122024: {
856
+ api: "https://api.routescan.io/v2/network/testnet/evm/28122024/etherscan",
857
+ explorer: "28122024.routescan.io"
858
+ },
859
+ 111557560: {
860
+ api: "https://api.routescan.io/v2/network/testnet/evm/111557560/etherscan",
861
+ explorer: "111557560.routescan.io"
862
+ },
863
+ 168587773: {
864
+ api: "https://api.routescan.io/v2/network/testnet/evm/168587773/etherscan",
865
+ explorer: "168587773.routescan.io"
866
+ },
867
+ 333000333: {
868
+ api: "https://api.routescan.io/v2/network/mainnet/evm/333000333/etherscan",
869
+ explorer: "333000333.routescan.io"
870
+ },
871
+ 42012e4: {
872
+ api: "https://api.routescan.io/v2/network/testnet/evm/420120000/etherscan",
873
+ explorer: "420120000.routescan.io"
874
+ },
875
+ 420120001: {
876
+ api: "https://api.routescan.io/v2/network/testnet/evm/420120001/etherscan",
877
+ explorer: "420120001.routescan.io"
878
+ },
879
+ 686669576: {
880
+ api: "https://api.routescan.io/v2/network/testnet/evm/686669576/etherscan",
881
+ explorer: "686669576.routescan.io"
882
+ },
883
+ 888888888: {
884
+ api: "https://api.routescan.io/v2/network/mainnet/evm/888888888/etherscan",
885
+ explorer: "888888888.routescan.io"
886
+ },
887
+ 999999999: {
888
+ api: "https://api.routescan.io/v2/network/testnet/evm/999999999/etherscan",
889
+ explorer: "999999999.routescan.io"
890
+ },
891
+ 920637907288165: {
892
+ api: "https://api.routescan.io/v2/network/testnet/evm/920637907288165/etherscan",
893
+ explorer: "920637907288165.routescan.io"
894
+ }
895
+ };
896
+
897
+ // src/ecosystem/explorers.ts
898
+ function getExplorer(chainId) {
899
+ const etherscan = etherscanExplorers[chainId];
900
+ if (etherscan) return etherscan;
901
+ const routescan = routescanExplorers[chainId];
902
+ if (routescan) return routescan;
903
+ throw new Error(`No explorer found for chainId: ${chainId}`);
904
+ }
905
+ async function getSourceCode(params) {
906
+ const payload = {
907
+ chainid: String(params.chainId),
908
+ address: params.address,
909
+ module: "contract",
910
+ action: "getsourcecode"
911
+ };
912
+ if (params.apiKey) payload.apikey = params.apiKey;
913
+ const formattedPayload = new URLSearchParams(payload).toString();
914
+ const url = `${params.apiUrl ? params.apiUrl : getExplorer(params.chainId).api}?${formattedPayload}`;
915
+ const request = await fetch(url);
916
+ return await request.json();
917
+ }
918
+ function parseApiSourceCode(sourceCode) {
919
+ if (sourceCode.startsWith("{{") && sourceCode.endsWith("}}")) {
920
+ sourceCode = sourceCode.substring(1, sourceCode.length - 1);
921
+ }
922
+ return JSON.parse(sourceCode);
923
+ }
924
+ export {
925
+ bitmapToIndexes,
926
+ decodeUserConfiguration,
927
+ getBits,
928
+ getExplorer,
929
+ getSourceCode,
930
+ parseApiSourceCode
931
+ };