evm-chains-info 0.0.28 → 0.0.31

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,111 +34,99 @@
34
34
  no-useless-assignment */
35
35
 
36
36
  /* global
37
- db_paths */
37
+ db_paths:
38
+ writable */
38
39
  /* global
39
- db_types */
40
+ db_types:
41
+ writable */
40
42
  /* global
41
43
  input_type:
42
44
  writable */
43
45
  /* global
44
- user_level */
46
+ user_level:
47
+ writable */
45
48
  /* global
46
- target_chain */
49
+ target_chain:
50
+ writable */
47
51
  /* global
48
52
  target_network:
49
53
  writable */
50
54
 
51
55
  const
52
- _libcrash_module =
53
- require(
56
+ _libcrash_module_import =
57
+ await import(
54
58
  "crash-js");
59
+ const
60
+ _libcrash_module =
61
+ _libcrash_module_import.default;
55
62
  /* global
56
63
  _homedir_get */
57
- /* eslint-disable-next-line
58
- no-global-assign */
59
64
  const
60
65
  _homedir_get =
61
66
  _libcrash_module._homedir_get;
62
67
  /* global
63
68
  _file_exists */
64
- /* eslint-disable-next-line
65
- no-global-assign */
66
69
  const
67
70
  _file_exists =
68
71
  _libcrash_module._file_exists;
69
72
  /* global
70
73
  _file_read */
71
- /* eslint-disable-next-line
72
- no-global-assign */
73
74
  const
74
75
  _file_read =
75
76
  _libcrash_module._file_read;
76
77
  /* global
77
78
  _file_write */
78
- /* eslint-disable-next-line
79
- no-global-assign */
80
79
  const
81
80
  _file_write =
82
81
  _libcrash_module._file_write;
83
82
  /* global
84
83
  _json_read */
85
- /* eslint-disable-next-line
86
- no-global-assign */
87
84
  const
88
85
  _json_read =
89
86
  _libcrash_module._json_read;
90
87
  /* global
91
88
  _lib_get */
92
- /* eslint-disable-next-line
93
- no-global-assign */
94
89
  const
95
90
  _lib_get =
96
91
  _libcrash_module._lib_get;
97
92
  /* global
98
93
  _mkdir */
99
- /* eslint-disable-next-line
100
- no-global-assign */
101
94
  const
102
95
  _mkdir =
103
96
  _libcrash_module._mkdir;
104
97
  /* global
105
98
  _msg_info */
106
- /* eslint-disable-next-line
107
- no-global-assign */
108
99
  const
109
100
  _msg_info =
110
101
  _libcrash_module._msg_info;
111
102
  /* global
112
103
  _msg_error */
113
- /* eslint-disable-next-line
114
- no-global-assign */
115
104
  const
116
105
  _msg_error =
117
106
  _libcrash_module._msg_error;
118
107
  /* global
119
108
  _path_join */
120
- /* eslint-disable-next-line
121
- no-global-assign */
122
109
  const
123
110
  _path_join =
124
111
  _libcrash_module._path_join;
125
112
  /* global
126
113
  _range */
127
- /* eslint-disable-next-line
128
- no-global-assign */
129
114
  const
130
115
  _range =
131
116
  _libcrash_module._range;
117
+ /* global
118
+ _require */
119
+ const
120
+ _require =
121
+ _libcrash_module._require;
132
122
  /* global
133
123
  _rm */
134
- /* eslint-disable-next-line
135
- no-global-assign */
136
124
  const
137
125
  _rm =
138
126
  _libcrash_module._rm;
139
127
  const
140
128
  _ethereum_data_module =
141
- require(
129
+ await _require(
142
130
  "ethereum-data");
143
131
  /* global
144
132
  _data_get */
@@ -272,7 +260,7 @@ async function
272
260
  _db_types == "" ) {
273
261
  _db_types = [
274
262
  "node",
275
- "system"
263
+ "system",
276
264
  ];
277
265
  }
278
266
  if ( typeof(
@@ -568,8 +556,10 @@ function
568
556
  _msg_info(
569
557
  _msg);
570
558
  for ( _entry of _db ) {
571
- if ( _entry[
572
- _filter_key] == _target_chain ) {
559
+ if ( Number(
560
+ _entry[
561
+ _filter_key]) == Number(
562
+ _target_chain) ) {
573
563
  _results.push(
574
564
  _entry);
575
565
  if ( _selection_method == "kirsh" ) {
@@ -630,19 +620,29 @@ function
630
620
  }
631
621
 
632
622
  async function
633
- _db_paths_auto_detect(
634
- _chain_id) {
623
+ _db_paths_get(
624
+ _chain_id,
625
+ _user_level) {
635
626
  let
636
627
  _type_primary,
637
628
  _type_fallback,
638
629
  _msg;
639
- if ( user_level == "y" ) {
630
+ if ( typeof(
631
+ _user_level) == "undefined" ||
632
+ _user_level == "" ) {
633
+ _user_level =
634
+ "n";
635
+ }
636
+ const
637
+ _db_paths =
638
+ [];
639
+ if ( _user_level == "y" ) {
640
640
  _type_primary =
641
641
  "y";
642
642
  _type_fallback =
643
643
  "n";
644
644
  }
645
- else if ( user_level == "n" ) {
645
+ else if ( _user_level == "n" ) {
646
646
  _type_primary =
647
647
  "n";
648
648
  _type_fallback =
@@ -674,7 +674,7 @@ async function
674
674
  "split");
675
675
  if ( _file_exists(
676
676
  _db_split) ) {
677
- db_paths.push(
677
+ _db_paths.push(
678
678
  _db_split);
679
679
  _msg =
680
680
  `Found database ` +
@@ -701,7 +701,7 @@ async function
701
701
  }
702
702
  if ( _file_exists(
703
703
  _db) ) {
704
- db_paths.push(
704
+ _db_paths.push(
705
705
  _db);
706
706
  _msg =
707
707
  `Found database ` +
@@ -720,7 +720,7 @@ async function
720
720
  }
721
721
  if ( _file_exists(
722
722
  _db_fallback_split) ) {
723
- db_paths.push(
723
+ _db_paths.push(
724
724
  _db_fallback_split);
725
725
  _msg =
726
726
  `Found database ` +
@@ -739,7 +739,7 @@ async function
739
739
  }
740
740
  if ( _file_exists(
741
741
  _db_fallback) ) {
742
- db_paths.push(
742
+ _db_paths.push(
743
743
  _db_fallback);
744
744
  _msg =
745
745
  `Found database ` +
@@ -757,15 +757,26 @@ async function
757
757
  _msg,
758
758
  0);
759
759
  }
760
- if ( db_paths.length == 0 ) {
760
+ if ( _db_paths.length == 0 ) {
761
761
  _msg =
762
762
  "Found no databases!";
763
763
  _msg_info(
764
764
  _msg);
765
765
  }
766
+ return _db_paths;
766
767
  }
767
768
 
768
- function
769
+ async function
770
+ _db_paths_auto_detect(
771
+ _chain_id,
772
+ _user_level) {
773
+ db_paths =
774
+ await _db_paths_get(
775
+ _chain_id,
776
+ _user_level);
777
+ }
778
+
779
+ async function
769
780
  _target_network_type_auto_detect() {
770
781
  let
771
782
  _info_get,
@@ -805,7 +816,7 @@ function
805
816
  if ( _info_get ) {
806
817
  const
807
818
  _libevm_module =
808
- require(
819
+ await _require(
809
820
  "libevm");
810
821
  const
811
822
  _rpc_get =
@@ -1065,8 +1076,8 @@ async function
1065
1076
  _msg;
1066
1077
  const
1067
1078
  _evm_wallet_module =
1068
- require(
1069
- "evm-wallet.js");
1079
+ await _require(
1080
+ "evm-wallet");
1070
1081
  const
1071
1082
  _block_number_get =
1072
1083
  _evm_wallet_module._block_number_get;
@@ -1182,11 +1193,24 @@ async function
1182
1193
  _api_key,
1183
1194
  _networks_all,
1184
1195
  _target_chain,
1185
- _db_paths) {
1196
+ _db_paths,
1197
+ _user_level) {
1186
1198
  let
1187
1199
  _explorer,
1188
1200
  _result,
1189
1201
  _rpc;
1202
+ if ( typeof(
1203
+ _db_paths) == "undefined" ||
1204
+ _db_paths == "" ) {
1205
+ _db_paths =
1206
+ [];
1207
+ }
1208
+ if ( _db_paths.length == 0 ) {
1209
+ _db_paths =
1210
+ await _db_paths_get(
1211
+ _target_chain,
1212
+ _user_level);
1213
+ }
1190
1214
  if ( _target_command == "get" ) {
1191
1215
  const
1192
1216
  _infos =
@@ -1275,6 +1299,8 @@ async function
1275
1299
  module.exports = {
1276
1300
  _data_get:
1277
1301
  _data_get,
1302
+ _db_paths_get:
1303
+ _db_paths_get,
1278
1304
  _db_paths_auto_detect:
1279
1305
  _db_paths_auto_detect,
1280
1306
  _db_types_auto_detect:
@@ -1292,5 +1318,7 @@ module.exports = {
1292
1318
  _rpc_backend_get:
1293
1319
  _rpc_backend_get,
1294
1320
  _rpc_backends_get:
1295
- _rpc_backends_get
1321
+ _rpc_backends_get,
1322
+ _target_network_type_auto_detect:
1323
+ _target_network_type_auto_detect
1296
1324
  };
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.31",
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.48",
62
62
  "flatted":
63
63
  "^3.2.9",
64
64
  "eslint":
@@ -68,34 +68,34 @@
68
68
  "@eslint/js":
69
69
  "^10.0.1",
70
70
  "safely-serve":
71
- "^0.0.9",
71
+ "^0.0.11",
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.1111111111.1111111111111111",
80
80
  "ethereum-data":
81
- "^0.0.5",
81
+ "^0.0.8",
82
82
  "yargs":
83
83
  "18.0.0"
84
84
  },
85
85
  "optionalDependencies": {
86
- "evm-wallet.js":
87
- "^0.0.70"
86
+ "evm-wallet":
87
+ "npm:evm-wallet.js@^0.0.75"
88
88
  },
89
89
  "overrides": {
90
90
  "evm-chains-info":
91
91
  "./libevm-chains-info",
92
92
  "evm-contracts-tools":
93
- "^0.0.45",
94
- "evm-wallet.js":
95
- "^0.0.70"
93
+ "^0.0.50",
94
+ "evm-wallet":
95
+ "npm:evm-wallet.js@^0.0.75"
96
96
  },
97
97
  "type":
98
- "commonjs",
98
+ "module",
99
99
  "main":
100
100
  "libevm-chains-info",
101
101
  "bin": {