evm-chains-info 0.0.21 → 0.0.25
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
CHANGED
|
@@ -286,7 +286,8 @@ function
|
|
|
286
286
|
"",
|
|
287
287
|
" options:",
|
|
288
288
|
"",
|
|
289
|
-
" -C --command Target command. Can be 'get' or 'set'
|
|
289
|
+
" -C --command Target command. Can be 'get' or 'set'",
|
|
290
|
+
" or 'check'.",
|
|
290
291
|
` <target-command> Default: '${target_command}`,
|
|
291
292
|
"",
|
|
292
293
|
" -i --input-type Input type. It can be 'id' or 'name'.",
|
|
@@ -569,20 +570,22 @@ function
|
|
|
569
570
|
}
|
|
570
571
|
}
|
|
571
572
|
|
|
572
|
-
function
|
|
573
|
+
async function
|
|
573
574
|
_evm_chains_info_cmdline(
|
|
574
575
|
_app_opts) {
|
|
575
576
|
let
|
|
576
577
|
_result;
|
|
577
578
|
const
|
|
578
579
|
_results =
|
|
579
|
-
_evm_chains_info.apply(
|
|
580
|
+
await _evm_chains_info.apply(
|
|
580
581
|
null,
|
|
581
582
|
app_opts);
|
|
582
583
|
for ( _result of _results ) {
|
|
583
584
|
console.log(
|
|
584
585
|
_result);
|
|
585
586
|
}
|
|
587
|
+
_process_exit(
|
|
588
|
+
0);
|
|
586
589
|
}
|
|
587
590
|
|
|
588
591
|
_global_variables();
|
package/libevm-chains-info
CHANGED
|
@@ -44,6 +44,9 @@
|
|
|
44
44
|
user_level */
|
|
45
45
|
/* global
|
|
46
46
|
target_chain */
|
|
47
|
+
/* global
|
|
48
|
+
target_network:
|
|
49
|
+
writable */
|
|
47
50
|
|
|
48
51
|
const
|
|
49
52
|
_libcrash_module =
|
|
@@ -53,51 +56,86 @@ const
|
|
|
53
56
|
_homedir_get */
|
|
54
57
|
/* eslint-disable-next-line
|
|
55
58
|
no-global-assign */
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
const
|
|
60
|
+
_homedir_get =
|
|
61
|
+
_libcrash_module._homedir_get;
|
|
58
62
|
/* global
|
|
59
63
|
_file_exists */
|
|
60
64
|
/* eslint-disable-next-line
|
|
61
65
|
no-global-assign */
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
const
|
|
67
|
+
_file_exists =
|
|
68
|
+
_libcrash_module._file_exists;
|
|
69
|
+
/* global
|
|
70
|
+
_file_read */
|
|
71
|
+
/* eslint-disable-next-line
|
|
72
|
+
no-global-assign */
|
|
73
|
+
const
|
|
74
|
+
_file_read =
|
|
75
|
+
_libcrash_module._file_read;
|
|
76
|
+
/* global
|
|
77
|
+
_file_write */
|
|
78
|
+
/* eslint-disable-next-line
|
|
79
|
+
no-global-assign */
|
|
80
|
+
const
|
|
81
|
+
_file_write =
|
|
82
|
+
_libcrash_module._file_write;
|
|
64
83
|
/* global
|
|
65
84
|
_json_read */
|
|
66
85
|
/* eslint-disable-next-line
|
|
67
86
|
no-global-assign */
|
|
68
|
-
|
|
69
|
-
|
|
87
|
+
const
|
|
88
|
+
_json_read =
|
|
89
|
+
_libcrash_module._json_read;
|
|
70
90
|
/* global
|
|
71
91
|
_lib_get */
|
|
72
92
|
/* eslint-disable-next-line
|
|
73
93
|
no-global-assign */
|
|
74
|
-
|
|
75
|
-
|
|
94
|
+
const
|
|
95
|
+
_lib_get =
|
|
96
|
+
_libcrash_module._lib_get;
|
|
97
|
+
/* global
|
|
98
|
+
_mkdir */
|
|
99
|
+
/* eslint-disable-next-line
|
|
100
|
+
no-global-assign */
|
|
101
|
+
const
|
|
102
|
+
_mkdir =
|
|
103
|
+
_libcrash_module._mkdir;
|
|
76
104
|
/* global
|
|
77
105
|
_msg_info */
|
|
78
106
|
/* eslint-disable-next-line
|
|
79
107
|
no-global-assign */
|
|
80
|
-
|
|
81
|
-
|
|
108
|
+
const
|
|
109
|
+
_msg_info =
|
|
110
|
+
_libcrash_module._msg_info;
|
|
82
111
|
/* global
|
|
83
112
|
_msg_error */
|
|
84
113
|
/* eslint-disable-next-line
|
|
85
114
|
no-global-assign */
|
|
86
|
-
|
|
87
|
-
|
|
115
|
+
const
|
|
116
|
+
_msg_error =
|
|
117
|
+
_libcrash_module._msg_error;
|
|
88
118
|
/* global
|
|
89
119
|
_path_join */
|
|
90
120
|
/* eslint-disable-next-line
|
|
91
121
|
no-global-assign */
|
|
92
|
-
|
|
93
|
-
|
|
122
|
+
const
|
|
123
|
+
_path_join =
|
|
124
|
+
_libcrash_module._path_join;
|
|
94
125
|
/* global
|
|
95
126
|
_range */
|
|
96
127
|
/* eslint-disable-next-line
|
|
97
128
|
no-global-assign */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
129
|
+
const
|
|
130
|
+
_range =
|
|
131
|
+
_libcrash_module._range;
|
|
132
|
+
/* global
|
|
133
|
+
_rm */
|
|
134
|
+
/* eslint-disable-next-line
|
|
135
|
+
no-global-assign */
|
|
136
|
+
const
|
|
137
|
+
_rm =
|
|
138
|
+
_libcrash_module._rm;
|
|
101
139
|
const
|
|
102
140
|
_ethereum_data_module =
|
|
103
141
|
require(
|
|
@@ -108,7 +146,7 @@ const
|
|
|
108
146
|
_data_get =
|
|
109
147
|
_ethereum_data_module._data_get;
|
|
110
148
|
|
|
111
|
-
function
|
|
149
|
+
async function
|
|
112
150
|
_evm_chains_db_path_get(
|
|
113
151
|
_user,
|
|
114
152
|
_chain_id,
|
|
@@ -195,7 +233,7 @@ function
|
|
|
195
233
|
else if ( _user == "n" ) {
|
|
196
234
|
const
|
|
197
235
|
_lib =
|
|
198
|
-
|
|
236
|
+
await _lib_get();
|
|
199
237
|
_msg =
|
|
200
238
|
`Found system libraries directory ` +
|
|
201
239
|
`'${_lib}'.`;
|
|
@@ -215,8 +253,8 @@ function
|
|
|
215
253
|
}
|
|
216
254
|
return _db_path;
|
|
217
255
|
}
|
|
218
|
-
|
|
219
|
-
function
|
|
256
|
+
|
|
257
|
+
async function
|
|
220
258
|
_evm_chain_info_get(
|
|
221
259
|
_chain_id,
|
|
222
260
|
_db_path,
|
|
@@ -253,7 +291,7 @@ function
|
|
|
253
291
|
_db_path) == "undefined" ||
|
|
254
292
|
_db_path == "" ) {
|
|
255
293
|
_db_path =
|
|
256
|
-
_evm_chains_db_path_get(
|
|
294
|
+
await _evm_chains_db_path_get(
|
|
257
295
|
_user_level,
|
|
258
296
|
_chain_id,
|
|
259
297
|
_format);
|
|
@@ -308,7 +346,7 @@ function
|
|
|
308
346
|
}
|
|
309
347
|
}
|
|
310
348
|
|
|
311
|
-
function
|
|
349
|
+
async function
|
|
312
350
|
_rpc_backend_get(
|
|
313
351
|
_network_chain_id,
|
|
314
352
|
_selection_method,
|
|
@@ -337,7 +375,7 @@ function
|
|
|
337
375
|
_db_path) == "undefined" ||
|
|
338
376
|
_db_path == "" ) {
|
|
339
377
|
_db_path =
|
|
340
|
-
_evm_chains_db_path_get(
|
|
378
|
+
await _evm_chains_db_path_get(
|
|
341
379
|
"n");
|
|
342
380
|
}
|
|
343
381
|
if ( typeof(
|
|
@@ -359,7 +397,7 @@ function
|
|
|
359
397
|
_network_chain_id);
|
|
360
398
|
const
|
|
361
399
|
_chain_info =
|
|
362
|
-
_evm_chain_info_get(
|
|
400
|
+
await _evm_chain_info_get(
|
|
363
401
|
_chain_id,
|
|
364
402
|
_db_path,
|
|
365
403
|
_user_level,
|
|
@@ -378,7 +416,8 @@ function
|
|
|
378
416
|
}
|
|
379
417
|
}
|
|
380
418
|
|
|
381
|
-
function
|
|
419
|
+
async function
|
|
420
|
+
_rpc_backends_get(
|
|
382
421
|
_networks_chain_ids,
|
|
383
422
|
_selection_method,
|
|
384
423
|
_db_path) {
|
|
@@ -392,7 +431,7 @@ function _rpc_backends_get(
|
|
|
392
431
|
}
|
|
393
432
|
if ( _db_path == undefined ) {
|
|
394
433
|
_db_path =
|
|
395
|
-
_evm_chains_db_path_get(
|
|
434
|
+
await _evm_chains_db_path_get(
|
|
396
435
|
"n");
|
|
397
436
|
}
|
|
398
437
|
const
|
|
@@ -405,7 +444,7 @@ function _rpc_backends_get(
|
|
|
405
444
|
_db_path
|
|
406
445
|
];
|
|
407
446
|
_rpc_backend =
|
|
408
|
-
_rpc_backend_get.apply(
|
|
447
|
+
await _rpc_backend_get.apply(
|
|
409
448
|
null,
|
|
410
449
|
_rpc_backend_get_opts);
|
|
411
450
|
_rpcs.push(
|
|
@@ -549,8 +588,24 @@ function
|
|
|
549
588
|
|
|
550
589
|
function
|
|
551
590
|
_input_type_auto_detect() {
|
|
591
|
+
const
|
|
592
|
+
_target_chain_type =
|
|
593
|
+
typeof(
|
|
594
|
+
target_chain);
|
|
595
|
+
if ( _target_chain_type == "number" ) {
|
|
596
|
+
input_type =
|
|
597
|
+
"id";
|
|
598
|
+
}
|
|
599
|
+
else if ( _target_chain_type == "string" ) {
|
|
600
|
+
if ( target_chain.startsWith(
|
|
601
|
+
"https://") ) {
|
|
602
|
+
input_type =
|
|
603
|
+
"rpc";
|
|
604
|
+
}
|
|
605
|
+
}
|
|
552
606
|
if ( input_type == "" ) {
|
|
553
|
-
if ( isNaN(
|
|
607
|
+
if ( isNaN(
|
|
608
|
+
target_chain) ) {
|
|
554
609
|
input_type =
|
|
555
610
|
"name";
|
|
556
611
|
}
|
|
@@ -573,8 +628,8 @@ function
|
|
|
573
628
|
"system");
|
|
574
629
|
}
|
|
575
630
|
}
|
|
576
|
-
|
|
577
|
-
function
|
|
631
|
+
|
|
632
|
+
async function
|
|
578
633
|
_db_paths_auto_detect(
|
|
579
634
|
_chain_id) {
|
|
580
635
|
let
|
|
@@ -595,25 +650,25 @@ function
|
|
|
595
650
|
}
|
|
596
651
|
const
|
|
597
652
|
_db =
|
|
598
|
-
_evm_chains_db_path_get(
|
|
653
|
+
await _evm_chains_db_path_get(
|
|
599
654
|
_type_primary,
|
|
600
655
|
"",
|
|
601
656
|
"unified");
|
|
602
657
|
const
|
|
603
658
|
_db_split =
|
|
604
|
-
_evm_chains_db_path_get(
|
|
659
|
+
await _evm_chains_db_path_get(
|
|
605
660
|
_type_primary,
|
|
606
661
|
_chain_id,
|
|
607
662
|
"split");
|
|
608
663
|
const
|
|
609
664
|
_db_fallback =
|
|
610
|
-
_evm_chains_db_path_get(
|
|
665
|
+
await _evm_chains_db_path_get(
|
|
611
666
|
_type_fallback,
|
|
612
667
|
"",
|
|
613
668
|
"unified");
|
|
614
669
|
const
|
|
615
670
|
_db_fallback_split =
|
|
616
|
-
_evm_chains_db_path_get(
|
|
671
|
+
await _evm_chains_db_path_get(
|
|
617
672
|
_type_fallback,
|
|
618
673
|
_chain_id,
|
|
619
674
|
"split");
|
|
@@ -710,6 +765,58 @@ function
|
|
|
710
765
|
}
|
|
711
766
|
}
|
|
712
767
|
|
|
768
|
+
function
|
|
769
|
+
_target_network_type_auto_detect() {
|
|
770
|
+
let
|
|
771
|
+
_info_get,
|
|
772
|
+
_target_network_type;
|
|
773
|
+
_info_get =
|
|
774
|
+
false;
|
|
775
|
+
_target_network_type =
|
|
776
|
+
typeof(
|
|
777
|
+
target_network);
|
|
778
|
+
if ( _target_network_type == "undefined" ||
|
|
779
|
+
target_network == "" ) {
|
|
780
|
+
target_network = 100;
|
|
781
|
+
_target_network_type =
|
|
782
|
+
typeof(
|
|
783
|
+
target_network);
|
|
784
|
+
}
|
|
785
|
+
if ( _target_network_type == "number" ) {
|
|
786
|
+
_info_get =
|
|
787
|
+
true;
|
|
788
|
+
}
|
|
789
|
+
else if ( _target_network_type == "string" ) {
|
|
790
|
+
if ( ! target_network.startsWith(
|
|
791
|
+
"https://") ) {
|
|
792
|
+
_info_get =
|
|
793
|
+
true;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
else {
|
|
797
|
+
const
|
|
798
|
+
_msg =
|
|
799
|
+
`Unknown type '${_target_network_type}' ` +
|
|
800
|
+
`for network variable.`;
|
|
801
|
+
_msg_error(
|
|
802
|
+
_msg,
|
|
803
|
+
1);
|
|
804
|
+
}
|
|
805
|
+
if ( _info_get ) {
|
|
806
|
+
const
|
|
807
|
+
_libevm_module =
|
|
808
|
+
require(
|
|
809
|
+
"libevm");
|
|
810
|
+
const
|
|
811
|
+
_rpc_get =
|
|
812
|
+
_libevm_module._rpc_get;
|
|
813
|
+
target_network =
|
|
814
|
+
_rpc_get(
|
|
815
|
+
[ target_network ])[
|
|
816
|
+
target_network];
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
713
820
|
function
|
|
714
821
|
_evm_chains_info_get(
|
|
715
822
|
_target_chain,
|
|
@@ -740,7 +847,8 @@ function
|
|
|
740
847
|
_data_get(
|
|
741
848
|
_target_chain);
|
|
742
849
|
for ( _entry of _results) {
|
|
743
|
-
if ( _entry[
|
|
850
|
+
if ( _entry[
|
|
851
|
+
"chainId"] == _target_chain ) {
|
|
744
852
|
_db.push(
|
|
745
853
|
_entry);
|
|
746
854
|
if ( _selection_method == "kirsh" ) {
|
|
@@ -808,7 +916,8 @@ function
|
|
|
808
916
|
_results =
|
|
809
917
|
[];
|
|
810
918
|
for ( _entry of _db ) {
|
|
811
|
-
if ( _entry[
|
|
919
|
+
if ( _entry[
|
|
920
|
+
'chainId'] == _target_chain ) {
|
|
812
921
|
_results.push(
|
|
813
922
|
_entry[
|
|
814
923
|
_output_type]);
|
|
@@ -850,6 +959,219 @@ function
|
|
|
850
959
|
}
|
|
851
960
|
|
|
852
961
|
function
|
|
962
|
+
_rpc_report_online(
|
|
963
|
+
_target_chain,
|
|
964
|
+
_rpc) {
|
|
965
|
+
let
|
|
966
|
+
_score;
|
|
967
|
+
const
|
|
968
|
+
_target_chain_type =
|
|
969
|
+
typeof(
|
|
970
|
+
_target_chain);
|
|
971
|
+
if ( _target_chain_type == "number" ) {
|
|
972
|
+
_target_chain =
|
|
973
|
+
_target_chain.toFixed(
|
|
974
|
+
0);
|
|
975
|
+
}
|
|
976
|
+
const
|
|
977
|
+
_home_dir =
|
|
978
|
+
_homedir_get();
|
|
979
|
+
const
|
|
980
|
+
_score_dir =
|
|
981
|
+
_path_join(
|
|
982
|
+
[ _home_dir,
|
|
983
|
+
".cache",
|
|
984
|
+
"evm-chains",
|
|
985
|
+
_target_chain,
|
|
986
|
+
"rpc",
|
|
987
|
+
_rpc ]);
|
|
988
|
+
const
|
|
989
|
+
_score_path =
|
|
990
|
+
_path_join( [
|
|
991
|
+
_score_dir,
|
|
992
|
+
"offline" ]);
|
|
993
|
+
if ( _file_exists(
|
|
994
|
+
_score_path) ) {
|
|
995
|
+
_rm(
|
|
996
|
+
_score_path);
|
|
997
|
+
const
|
|
998
|
+
_msg =
|
|
999
|
+
`Deleting offline score for RPC '${_rpc}'`;
|
|
1000
|
+
_msg_info(
|
|
1001
|
+
_msg);
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
function
|
|
1006
|
+
_rpc_report_offline(
|
|
1007
|
+
_target_chain,
|
|
1008
|
+
_rpc) {
|
|
1009
|
+
let
|
|
1010
|
+
_score;
|
|
1011
|
+
const
|
|
1012
|
+
_home_dir =
|
|
1013
|
+
_homedir_get();
|
|
1014
|
+
const
|
|
1015
|
+
_score_dir =
|
|
1016
|
+
_path_join(
|
|
1017
|
+
[ _home_dir,
|
|
1018
|
+
".cache",
|
|
1019
|
+
"evm-chains",
|
|
1020
|
+
_target_chain,
|
|
1021
|
+
"rpc",
|
|
1022
|
+
_rpc ]);
|
|
1023
|
+
const
|
|
1024
|
+
_score_path =
|
|
1025
|
+
_path_join( [
|
|
1026
|
+
_score_dir,
|
|
1027
|
+
"offline" ]);
|
|
1028
|
+
console.log(
|
|
1029
|
+
_score_dir);
|
|
1030
|
+
if ( ! _file_exists(
|
|
1031
|
+
_score_dir) ) {
|
|
1032
|
+
_mkdir(
|
|
1033
|
+
_score_dir);
|
|
1034
|
+
const
|
|
1035
|
+
_msg =
|
|
1036
|
+
`Creating directory +` +
|
|
1037
|
+
`'${_score_dir}'.`;
|
|
1038
|
+
_msg_info(
|
|
1039
|
+
_msg);
|
|
1040
|
+
}
|
|
1041
|
+
else if ( _file_exists(
|
|
1042
|
+
_score_path) ) {
|
|
1043
|
+
_score =
|
|
1044
|
+
_file_read(
|
|
1045
|
+
_score_path);
|
|
1046
|
+
}
|
|
1047
|
+
else {
|
|
1048
|
+
_score =
|
|
1049
|
+
0;
|
|
1050
|
+
}
|
|
1051
|
+
_score =
|
|
1052
|
+
_score + 1;
|
|
1053
|
+
_file_write(
|
|
1054
|
+
_score_path,
|
|
1055
|
+
_score);
|
|
1056
|
+
// TODO: write
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
async function
|
|
1060
|
+
_rpc_check(
|
|
1061
|
+
_target_chain,
|
|
1062
|
+
_rpc) {
|
|
1063
|
+
let
|
|
1064
|
+
_block_number,
|
|
1065
|
+
_msg;
|
|
1066
|
+
const
|
|
1067
|
+
_evm_wallet_module =
|
|
1068
|
+
require(
|
|
1069
|
+
"evm-wallet.js");
|
|
1070
|
+
const
|
|
1071
|
+
_block_number_get =
|
|
1072
|
+
_evm_wallet_module._block_number_get;
|
|
1073
|
+
const
|
|
1074
|
+
_block_number_get_args = [
|
|
1075
|
+
_rpc,
|
|
1076
|
+
"", // _api key
|
|
1077
|
+
"", // output file
|
|
1078
|
+
"3", // max retries
|
|
1079
|
+
"10000" // call timeout
|
|
1080
|
+
];
|
|
1081
|
+
try {
|
|
1082
|
+
_msg =
|
|
1083
|
+
"Testing connectivity for " +
|
|
1084
|
+
`RPC '${_rpc}' for network '${_target_chain}'.`;
|
|
1085
|
+
_msg_info(
|
|
1086
|
+
_msg);
|
|
1087
|
+
_block_number =
|
|
1088
|
+
await _block_number_get.apply(
|
|
1089
|
+
null,
|
|
1090
|
+
_block_number_get_args);
|
|
1091
|
+
console.log(_block_number);
|
|
1092
|
+
if ( 0 < _block_number ) {
|
|
1093
|
+
_msg =
|
|
1094
|
+
`RPC '${_rpc}' for network ` +
|
|
1095
|
+
`'${_target_chain}' online.`;
|
|
1096
|
+
_msg_info(
|
|
1097
|
+
_msg);
|
|
1098
|
+
_rpc_report_online(
|
|
1099
|
+
_target_chain,
|
|
1100
|
+
_rpc);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
catch(
|
|
1104
|
+
_error) {
|
|
1105
|
+
console.error(
|
|
1106
|
+
_error);
|
|
1107
|
+
_msg =
|
|
1108
|
+
`RPC '${_rpc}' for network ` +
|
|
1109
|
+
`'${_target_chain}' offline.`;
|
|
1110
|
+
_msg_error(
|
|
1111
|
+
_msg,
|
|
1112
|
+
0);
|
|
1113
|
+
_rpc_report_offline(
|
|
1114
|
+
_target_chain,
|
|
1115
|
+
_rpc);
|
|
1116
|
+
_block_number =
|
|
1117
|
+
0;
|
|
1118
|
+
return _block_number;
|
|
1119
|
+
}
|
|
1120
|
+
return _block_number;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
async function
|
|
1124
|
+
_chain_check(
|
|
1125
|
+
_target_chain,
|
|
1126
|
+
_retrieval_mode,
|
|
1127
|
+
_db_types,
|
|
1128
|
+
_input_type,
|
|
1129
|
+
_api_key,
|
|
1130
|
+
_db_paths) {
|
|
1131
|
+
let
|
|
1132
|
+
_result,
|
|
1133
|
+
_rpc,
|
|
1134
|
+
_online;
|
|
1135
|
+
const
|
|
1136
|
+
_status =
|
|
1137
|
+
{};
|
|
1138
|
+
const
|
|
1139
|
+
_results =
|
|
1140
|
+
await _evm_chains_info_get(
|
|
1141
|
+
_target_chain,
|
|
1142
|
+
_retrieval_mode,
|
|
1143
|
+
_db_types,
|
|
1144
|
+
_input_type,
|
|
1145
|
+
"rpc",
|
|
1146
|
+
"all",
|
|
1147
|
+
"n", // all networks
|
|
1148
|
+
_api_key,
|
|
1149
|
+
_db_paths);
|
|
1150
|
+
for ( _result of _results ) {
|
|
1151
|
+
for ( _rpc of _result ) {
|
|
1152
|
+
try {
|
|
1153
|
+
_online =
|
|
1154
|
+
await _rpc_check(
|
|
1155
|
+
_target_chain,
|
|
1156
|
+
_rpc);
|
|
1157
|
+
_status[
|
|
1158
|
+
_rpc] =
|
|
1159
|
+
true;
|
|
1160
|
+
}
|
|
1161
|
+
catch(
|
|
1162
|
+
_error) {
|
|
1163
|
+
_online =
|
|
1164
|
+
0;
|
|
1165
|
+
_status[
|
|
1166
|
+
_rpc] =
|
|
1167
|
+
false;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
return _status;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
async function
|
|
853
1175
|
_evm_chains_info(
|
|
854
1176
|
_target_command,
|
|
855
1177
|
_input_type,
|
|
@@ -884,8 +1206,17 @@ function
|
|
|
884
1206
|
if ( _output_type == "rpc" ) {
|
|
885
1207
|
for ( _result of _results ) {
|
|
886
1208
|
for ( _rpc of _result) {
|
|
887
|
-
|
|
888
|
-
|
|
1209
|
+
if ( _api_key == "y" ) {
|
|
1210
|
+
_infos.push(
|
|
1211
|
+
_rpc);
|
|
1212
|
+
}
|
|
1213
|
+
else if ( _api_key == "n" ) {
|
|
1214
|
+
if ( ! _rpc.includes(
|
|
1215
|
+
"API_KEY") ) {
|
|
1216
|
+
_infos.push(
|
|
1217
|
+
_rpc);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
889
1220
|
if ( _selection_method == "kirsh" ) {
|
|
890
1221
|
break;
|
|
891
1222
|
}
|
|
@@ -917,6 +1248,19 @@ function
|
|
|
917
1248
|
_evm_chains_info_set(
|
|
918
1249
|
_input_type);
|
|
919
1250
|
}
|
|
1251
|
+
else if ( _target_command == "check" ) {
|
|
1252
|
+
const
|
|
1253
|
+
_status =
|
|
1254
|
+
await _chain_check(
|
|
1255
|
+
_target_chain,
|
|
1256
|
+
_retrieval_mode,
|
|
1257
|
+
_db_types,
|
|
1258
|
+
_input_type,
|
|
1259
|
+
_api_key,
|
|
1260
|
+
_db_paths);
|
|
1261
|
+
console.log(_status);
|
|
1262
|
+
return _status;
|
|
1263
|
+
}
|
|
920
1264
|
else {
|
|
921
1265
|
const
|
|
922
1266
|
_msg =
|
|
@@ -927,7 +1271,7 @@ function
|
|
|
927
1271
|
1);
|
|
928
1272
|
}
|
|
929
1273
|
}
|
|
930
|
-
|
|
1274
|
+
|
|
931
1275
|
module.exports = {
|
|
932
1276
|
_data_get:
|
|
933
1277
|
_data_get,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name":
|
|
3
3
|
"evm-chains-info",
|
|
4
4
|
"version":
|
|
5
|
-
"0.0.
|
|
5
|
+
"0.0.25",
|
|
6
6
|
"description":
|
|
7
7
|
"Returns information about Ethereum Virtual Machine (EVM) blockchains.",
|
|
8
8
|
"funding": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"crash-js-webpack":
|
|
61
|
-
"^0.0.
|
|
61
|
+
"^0.0.31",
|
|
62
62
|
"flatted":
|
|
63
63
|
"^3.2.9",
|
|
64
64
|
"eslint":
|
|
@@ -76,12 +76,24 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"crash-js":
|
|
79
|
-
"^0.1
|
|
79
|
+
"^0.11.1",
|
|
80
80
|
"ethereum-data":
|
|
81
81
|
"^0.0.4",
|
|
82
82
|
"yargs":
|
|
83
83
|
"18.0.0"
|
|
84
84
|
},
|
|
85
|
+
"optionalDependencies": {
|
|
86
|
+
"evm-wallet.js":
|
|
87
|
+
"^0.0.51"
|
|
88
|
+
},
|
|
89
|
+
"overrides": {
|
|
90
|
+
"evm-chains-info":
|
|
91
|
+
"^0.0.22",
|
|
92
|
+
"evm-contracts-tools":
|
|
93
|
+
"^0.0.32",
|
|
94
|
+
"evm-wallet.js":
|
|
95
|
+
"^0.0.51"
|
|
96
|
+
},
|
|
85
97
|
"type":
|
|
86
98
|
"commonjs",
|
|
87
99
|
"main":
|
|
@@ -89,8 +101,8 @@
|
|
|
89
101
|
"bin": {
|
|
90
102
|
"evm-chain-info":
|
|
91
103
|
"evm-chains-info",
|
|
92
|
-
|
|
93
|
-
|
|
104
|
+
"evm-chains-info.js":
|
|
105
|
+
"evm-chains-info"
|
|
94
106
|
},
|
|
95
107
|
"scripts": {
|
|
96
108
|
"build-fs-worker":
|