evm-chains-info 0.0.5 → 0.0.6
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/evm-chains-info +11 -2
- package/libevm-chains-info +83 -35
- package/package.json +1 -1
package/evm-chains-info
CHANGED
|
@@ -521,6 +521,16 @@ function
|
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
|
|
524
|
+
function
|
|
525
|
+
_evm_chains_info_cmdline(
|
|
526
|
+
_app_opts) {
|
|
527
|
+
const
|
|
528
|
+
_results =
|
|
529
|
+
_evm_chains_info.apply(
|
|
530
|
+
null,
|
|
531
|
+
app_opts);
|
|
532
|
+
}
|
|
533
|
+
|
|
524
534
|
_global_variables();
|
|
525
535
|
if ( _cmdline_check(
|
|
526
536
|
"evm-chains-info.js") == true ) {
|
|
@@ -542,6 +552,5 @@ app_opts = [
|
|
|
542
552
|
target_chain,
|
|
543
553
|
db_paths
|
|
544
554
|
];
|
|
545
|
-
|
|
546
|
-
null,
|
|
555
|
+
_evm_chains_info_cmdline(
|
|
547
556
|
app_opts);
|
package/libevm-chains-info
CHANGED
|
@@ -87,6 +87,12 @@ _msg_error =
|
|
|
87
87
|
no-global-assign */
|
|
88
88
|
_path_join =
|
|
89
89
|
_libcrash_module._path_join;
|
|
90
|
+
/* global
|
|
91
|
+
_range */
|
|
92
|
+
/* eslint-disable-next-line
|
|
93
|
+
no-global-assign */
|
|
94
|
+
_range =
|
|
95
|
+
_libcrash_module._range;
|
|
90
96
|
|
|
91
97
|
const
|
|
92
98
|
_ethereum_data_module =
|
|
@@ -172,7 +178,7 @@ function
|
|
|
172
178
|
false;
|
|
173
179
|
}
|
|
174
180
|
}
|
|
175
|
-
if ( _user == false ) {
|
|
181
|
+
else if ( _user == false ) {
|
|
176
182
|
const
|
|
177
183
|
_lib =
|
|
178
184
|
_lib_get();
|
|
@@ -403,25 +409,33 @@ function
|
|
|
403
409
|
_filter_output_type =
|
|
404
410
|
"chainId";
|
|
405
411
|
}
|
|
412
|
+
else if ( _output_type == "rpc" ) {
|
|
413
|
+
_filter_output_type =
|
|
414
|
+
_output_type;
|
|
415
|
+
}
|
|
406
416
|
if ( _networks_all == "y" ) {
|
|
407
|
-
_msg =
|
|
408
|
-
"Showing results for all networks."
|
|
409
|
-
_msg_info(
|
|
410
|
-
_msg);
|
|
411
417
|
_filter =
|
|
412
418
|
_all_get(
|
|
413
419
|
_filter_output_type);
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
+
_msg =
|
|
421
|
+
"Showing results for all networks " +
|
|
422
|
+
`with filter '${_filter}'.`;
|
|
423
|
+
_msg_info(
|
|
424
|
+
_msg);
|
|
425
|
+
_db =
|
|
426
|
+
_json_read(
|
|
427
|
+
_db_path);
|
|
428
|
+
_msg =
|
|
429
|
+
"Found 'Showing results for all networks " +
|
|
430
|
+
`with filter '${_filter}'.`;
|
|
431
|
+
return _db;
|
|
420
432
|
}
|
|
421
433
|
else if ( _networks_all == "n" ) {
|
|
434
|
+
_results =
|
|
435
|
+
[];
|
|
422
436
|
_msg =
|
|
423
437
|
`Showing results for chain '${_target_chain}' in ` +
|
|
424
|
-
`database '${_db_path}'.`;
|
|
438
|
+
`database '${_db_path}' with filter '${_filter_output_type}'.`;
|
|
425
439
|
_msg_info(
|
|
426
440
|
_msg);
|
|
427
441
|
// this doesnt work the same in
|
|
@@ -431,19 +445,26 @@ function
|
|
|
431
445
|
// _filter_key,
|
|
432
446
|
// _filter_value,
|
|
433
447
|
// _filter_output_type);
|
|
434
|
-
_json_read(
|
|
435
|
-
|
|
448
|
+
// _json_read(
|
|
449
|
+
// _db_path);
|
|
436
450
|
const
|
|
437
451
|
_db =
|
|
438
452
|
_json_read(
|
|
439
453
|
_db_path);
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
454
|
+
_msg =
|
|
455
|
+
`Database '${_db_path}' ` +
|
|
456
|
+
`contains '${_db.length}' items.`;
|
|
457
|
+
_msg_info(
|
|
458
|
+
_msg);
|
|
459
|
+
for ( _entry of _db ) {
|
|
460
|
+
if ( _entry[
|
|
461
|
+
_filter_key] == _target_chain ) {
|
|
462
|
+
_results.push(
|
|
463
|
+
_entry);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return _results;
|
|
445
467
|
}
|
|
446
|
-
// return _db;
|
|
447
468
|
}
|
|
448
469
|
|
|
449
470
|
function
|
|
@@ -573,7 +594,8 @@ function
|
|
|
573
594
|
_db_path,
|
|
574
595
|
_entry,
|
|
575
596
|
_msg,
|
|
576
|
-
_networks_total
|
|
597
|
+
_networks_total,
|
|
598
|
+
_results;
|
|
577
599
|
_networks_total =
|
|
578
600
|
0;
|
|
579
601
|
if ( _retrieval_mode == "offline" ) {
|
|
@@ -619,13 +641,25 @@ function
|
|
|
619
641
|
_msg,
|
|
620
642
|
0);
|
|
621
643
|
}
|
|
644
|
+
const
|
|
645
|
+
_results =
|
|
646
|
+
[];
|
|
622
647
|
for ( _entry of _db ) {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
648
|
+
if ( _entry['chainId'] == _target_chain ) {
|
|
649
|
+
_results.push(
|
|
650
|
+
_entry[
|
|
651
|
+
_output_type]);
|
|
652
|
+
if ( _selection_method != "all" ) {
|
|
653
|
+
break;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
628
656
|
}
|
|
657
|
+
_db =
|
|
658
|
+
_results;
|
|
659
|
+
_msg =
|
|
660
|
+
`Found '${_networks_total}' networks.`;
|
|
661
|
+
_msg_info(
|
|
662
|
+
_msg);
|
|
629
663
|
}
|
|
630
664
|
else if ( _input_type == "amount" ) {
|
|
631
665
|
_msg =
|
|
@@ -642,6 +676,7 @@ function
|
|
|
642
676
|
_msg,
|
|
643
677
|
1);
|
|
644
678
|
}
|
|
679
|
+
return _db;
|
|
645
680
|
}
|
|
646
681
|
|
|
647
682
|
function
|
|
@@ -667,16 +702,29 @@ function
|
|
|
667
702
|
_networks_all,
|
|
668
703
|
_target_chain,
|
|
669
704
|
_db_paths) {
|
|
705
|
+
let
|
|
706
|
+
_result,
|
|
707
|
+
_rpc;
|
|
670
708
|
if ( _target_command == "get" ) {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
709
|
+
const
|
|
710
|
+
_results =
|
|
711
|
+
_evm_chains_info_get(
|
|
712
|
+
_target_chain,
|
|
713
|
+
_retrieval_mode,
|
|
714
|
+
_input_type,
|
|
715
|
+
_output_type,
|
|
716
|
+
_selection_method,
|
|
717
|
+
_networks_all,
|
|
718
|
+
_api_key,
|
|
719
|
+
_db_paths);
|
|
720
|
+
if ( _output_type == "rpc" ) {
|
|
721
|
+
for ( _result of _results ) {
|
|
722
|
+
for ( _rpc of _result) {
|
|
723
|
+
console.log(
|
|
724
|
+
_rpc);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
680
728
|
}
|
|
681
729
|
else if ( _target_command == "set" ) {
|
|
682
730
|
_evm_chains_info_set(
|