evm-chains-info 0.0.28 → 0.0.30

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
@@ -32,8 +32,8 @@
32
32
 
33
33
  const
34
34
  _libcrash =
35
- require(
36
- 'crash-js');
35
+ require(
36
+ 'crash-js');
37
37
  /* global
38
38
  _argv_get */
39
39
  const
@@ -65,10 +65,15 @@ const
65
65
  _msg_error =
66
66
  _libcrash._msg_error;
67
67
  /* global
68
- _process_exit */
68
+ _override_set */
69
+ const
70
+ _override_set =
71
+ _libcrash._override_set;
72
+ /* global
73
+ _exit */
69
74
  const
70
- _process_exit =
71
- _libcrash._process_exit;
75
+ _exit =
76
+ _libcrash._exit;
72
77
 
73
78
  const
74
79
  _libevm_chains_info =
@@ -201,44 +206,42 @@ function
201
206
 
202
207
  function
203
208
  _overrides_set() {
204
- if ( call_date == "" ) {
205
- call_date =
206
- _get_date_human();
207
- }
208
- if ( target_command == "" ) {
209
- target_command =
210
- "get";
211
- }
209
+ _override_set(
210
+ "call",
211
+ "date",
212
+ _get_date_human());
213
+ _override_set(
214
+ "target",
215
+ "command",
216
+ "get");
212
217
  _input_type_auto_detect();
213
- if ( output_type == "" ) {
214
- output_type =
215
- "name";
216
- }
217
- if ( retrieval_mode == "" ) {
218
- retrieval_mode =
219
- "offline";
220
- }
221
- if ( selection_method == "" ) {
222
- // TODO:
223
- // remove all references
224
- // to that monster
225
- selection_method =
226
- "kirsh";
227
- }
228
- if ( api_key == "" ) {
229
- api_key =
230
- "n";
231
- }
232
- if ( user_level == "" ) {
233
- user_level =
234
- "y";
235
- }
236
- if ( networks_all == "" ) {
237
- networks_all =
238
- "n";
239
- }
218
+ _override_set(
219
+ "output",
220
+ "type",
221
+ "name");
222
+ _override_set(
223
+ "retrieval",
224
+ "mode",
225
+ "offline");
226
+ _override_set(
227
+ "selection",
228
+ "method",
229
+ "kirsh");
230
+ _override_set(
231
+ "api",
232
+ "key",
233
+ "n");
234
+ _override_set(
235
+ "user",
236
+ "level",
237
+ "y");
238
+ _override_set(
239
+ "networks",
240
+ "all",
241
+ "n");
240
242
  _db_paths_auto_detect(
241
- target_chain);
243
+ target_chain,
244
+ user_level);
242
245
  _db_types_auto_detect();
243
246
  }
244
247
 
@@ -329,7 +332,7 @@ function
329
332
  console.log(
330
333
  _line);
331
334
  }
332
- _process_exit(
335
+ _exit(
333
336
  _exit_code);
334
337
  }
335
338
 
@@ -584,15 +587,15 @@ async function
584
587
  console.log(
585
588
  _result);
586
589
  }
587
- _process_exit(
590
+ _exit(
588
591
  0);
589
592
  }
590
593
 
591
594
  _global_variables();
592
595
  if ( _cmdline_check(
593
- "evm-chains-info.js") == true ||
596
+ "evm-chains-info.js") ||
594
597
  _cmdline_check(
595
- "evm-chains-info") == true ) {
598
+ "evm-chains-info") ) {
596
599
  _cmdline_parse();
597
600
  }
598
601
  else{
@@ -610,7 +613,8 @@ app_opts = [
610
613
  api_key,
611
614
  networks_all,
612
615
  target_chain,
613
- db_paths
616
+ db_paths,
617
+ user_level
614
618
  ];
615
619
  _evm_chains_info_cmdline(
616
620
  app_opts);
@@ -34,7 +34,8 @@
34
34
  no-useless-assignment */
35
35
 
36
36
  /* global
37
- db_paths */
37
+ db_paths:
38
+ writable */
38
39
  /* global
39
40
  db_types */
40
41
  /* global
@@ -54,85 +55,61 @@ const
54
55
  "crash-js");
55
56
  /* global
56
57
  _homedir_get */
57
- /* eslint-disable-next-line
58
- no-global-assign */
59
58
  const
60
59
  _homedir_get =
61
60
  _libcrash_module._homedir_get;
62
61
  /* global
63
62
  _file_exists */
64
- /* eslint-disable-next-line
65
- no-global-assign */
66
63
  const
67
64
  _file_exists =
68
65
  _libcrash_module._file_exists;
69
66
  /* global
70
67
  _file_read */
71
- /* eslint-disable-next-line
72
- no-global-assign */
73
68
  const
74
69
  _file_read =
75
70
  _libcrash_module._file_read;
76
71
  /* global
77
72
  _file_write */
78
- /* eslint-disable-next-line
79
- no-global-assign */
80
73
  const
81
74
  _file_write =
82
75
  _libcrash_module._file_write;
83
76
  /* global
84
77
  _json_read */
85
- /* eslint-disable-next-line
86
- no-global-assign */
87
78
  const
88
79
  _json_read =
89
80
  _libcrash_module._json_read;
90
81
  /* global
91
82
  _lib_get */
92
- /* eslint-disable-next-line
93
- no-global-assign */
94
83
  const
95
84
  _lib_get =
96
85
  _libcrash_module._lib_get;
97
86
  /* global
98
87
  _mkdir */
99
- /* eslint-disable-next-line
100
- no-global-assign */
101
88
  const
102
89
  _mkdir =
103
90
  _libcrash_module._mkdir;
104
91
  /* global
105
92
  _msg_info */
106
- /* eslint-disable-next-line
107
- no-global-assign */
108
93
  const
109
94
  _msg_info =
110
95
  _libcrash_module._msg_info;
111
96
  /* global
112
97
  _msg_error */
113
- /* eslint-disable-next-line
114
- no-global-assign */
115
98
  const
116
99
  _msg_error =
117
100
  _libcrash_module._msg_error;
118
101
  /* global
119
102
  _path_join */
120
- /* eslint-disable-next-line
121
- no-global-assign */
122
103
  const
123
104
  _path_join =
124
105
  _libcrash_module._path_join;
125
106
  /* global
126
107
  _range */
127
- /* eslint-disable-next-line
128
- no-global-assign */
129
108
  const
130
109
  _range =
131
110
  _libcrash_module._range;
132
111
  /* global
133
112
  _rm */
134
- /* eslint-disable-next-line
135
- no-global-assign */
136
113
  const
137
114
  _rm =
138
115
  _libcrash_module._rm;
@@ -272,7 +249,7 @@ async function
272
249
  _db_types == "" ) {
273
250
  _db_types = [
274
251
  "node",
275
- "system"
252
+ "system",
276
253
  ];
277
254
  }
278
255
  if ( typeof(
@@ -568,8 +545,10 @@ function
568
545
  _msg_info(
569
546
  _msg);
570
547
  for ( _entry of _db ) {
571
- if ( _entry[
572
- _filter_key] == _target_chain ) {
548
+ if ( Number(
549
+ _entry[
550
+ _filter_key]) == Number(
551
+ _target_chain) ) {
573
552
  _results.push(
574
553
  _entry);
575
554
  if ( _selection_method == "kirsh" ) {
@@ -630,19 +609,29 @@ function
630
609
  }
631
610
 
632
611
  async function
633
- _db_paths_auto_detect(
634
- _chain_id) {
612
+ _db_paths_get(
613
+ _chain_id,
614
+ _user_level) {
635
615
  let
636
616
  _type_primary,
637
617
  _type_fallback,
638
618
  _msg;
639
- if ( user_level == "y" ) {
619
+ if ( typeof(
620
+ _user_level) == "undefined" ||
621
+ _user_level == "" ) {
622
+ _user_level =
623
+ "n";
624
+ }
625
+ const
626
+ _db_paths =
627
+ [];
628
+ if ( _user_level == "y" ) {
640
629
  _type_primary =
641
630
  "y";
642
631
  _type_fallback =
643
632
  "n";
644
633
  }
645
- else if ( user_level == "n" ) {
634
+ else if ( _user_level == "n" ) {
646
635
  _type_primary =
647
636
  "n";
648
637
  _type_fallback =
@@ -674,7 +663,7 @@ async function
674
663
  "split");
675
664
  if ( _file_exists(
676
665
  _db_split) ) {
677
- db_paths.push(
666
+ _db_paths.push(
678
667
  _db_split);
679
668
  _msg =
680
669
  `Found database ` +
@@ -701,7 +690,7 @@ async function
701
690
  }
702
691
  if ( _file_exists(
703
692
  _db) ) {
704
- db_paths.push(
693
+ _db_paths.push(
705
694
  _db);
706
695
  _msg =
707
696
  `Found database ` +
@@ -720,7 +709,7 @@ async function
720
709
  }
721
710
  if ( _file_exists(
722
711
  _db_fallback_split) ) {
723
- db_paths.push(
712
+ _db_paths.push(
724
713
  _db_fallback_split);
725
714
  _msg =
726
715
  `Found database ` +
@@ -739,7 +728,7 @@ async function
739
728
  }
740
729
  if ( _file_exists(
741
730
  _db_fallback) ) {
742
- db_paths.push(
731
+ _db_paths.push(
743
732
  _db_fallback);
744
733
  _msg =
745
734
  `Found database ` +
@@ -757,12 +746,23 @@ async function
757
746
  _msg,
758
747
  0);
759
748
  }
760
- if ( db_paths.length == 0 ) {
749
+ if ( _db_paths.length == 0 ) {
761
750
  _msg =
762
751
  "Found no databases!";
763
752
  _msg_info(
764
753
  _msg);
765
754
  }
755
+ return _db_paths;
756
+ }
757
+
758
+ async function
759
+ _db_paths_auto_detect(
760
+ _chain_id,
761
+ _user_level) {
762
+ db_paths =
763
+ await _db_paths_get(
764
+ _chain_id,
765
+ _user_level);
766
766
  }
767
767
 
768
768
  function
@@ -1182,11 +1182,24 @@ async function
1182
1182
  _api_key,
1183
1183
  _networks_all,
1184
1184
  _target_chain,
1185
- _db_paths) {
1185
+ _db_paths,
1186
+ _user_level) {
1186
1187
  let
1187
1188
  _explorer,
1188
1189
  _result,
1189
1190
  _rpc;
1191
+ if ( typeof(
1192
+ _db_paths) == "undefined" ||
1193
+ _db_paths == "" ) {
1194
+ _db_paths =
1195
+ [];
1196
+ }
1197
+ if ( _db_paths.length == 0 ) {
1198
+ _db_paths =
1199
+ await _db_paths_get(
1200
+ _target_chain,
1201
+ _user_level);
1202
+ }
1190
1203
  if ( _target_command == "get" ) {
1191
1204
  const
1192
1205
  _infos =
@@ -1275,6 +1288,8 @@ async function
1275
1288
  module.exports = {
1276
1289
  _data_get:
1277
1290
  _data_get,
1291
+ _db_paths_get:
1292
+ _db_paths_get,
1278
1293
  _db_paths_auto_detect:
1279
1294
  _db_paths_auto_detect,
1280
1295
  _db_types_auto_detect:
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name":
3
3
  "evm-chains-info",
4
4
  "version":
5
- "0.0.28",
5
+ "0.0.30",
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.41",
61
+ "^0.0.45",
62
62
  "flatted":
63
63
  "^3.2.9",
64
64
  "eslint":
@@ -70,15 +70,15 @@
70
70
  "safely-serve":
71
71
  "^0.0.9",
72
72
  "webpack":
73
- "^5.102.1",
73
+ "^5.109.2",
74
74
  "webpack-cli":
75
- "^6.0.1"
75
+ "^7.2.2"
76
76
  },
77
77
  "dependencies": {
78
78
  "crash-js":
79
- "^0.11.111111111111",
79
+ "^0.1111.1111111111111111",
80
80
  "ethereum-data":
81
- "^0.0.5",
81
+ "^0.0.6",
82
82
  "yargs":
83
83
  "18.0.0"
84
84
  },