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