evm-chains-info 0.0.31 → 0.0.33

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.
@@ -53,12 +53,19 @@
53
53
  writable */
54
54
 
55
55
  const
56
- _libcrash_module_import =
56
+ _libcrash_module =
57
57
  await import(
58
- "crash-js");
58
+ "libcrash-js");
59
+ /* global
60
+ _get */
59
61
  const
60
- _libcrash_module =
61
- _libcrash_module_import.default;
62
+ _get =
63
+ _libcrash_module._get;
64
+ /* global
65
+ _global_get */
66
+ const
67
+ _global_get =
68
+ _libcrash_module._global_get;
62
69
  /* global
63
70
  _homedir_get */
64
71
  const
@@ -124,6 +131,11 @@ const
124
131
  const
125
132
  _rm =
126
133
  _libcrash_module._rm;
134
+ /* global
135
+ _set */
136
+ const
137
+ _set =
138
+ _libcrash_module._set;
127
139
  const
128
140
  _ethereum_data_module =
129
141
  await _require(
@@ -578,45 +590,103 @@ function
578
590
 
579
591
  function
580
592
  _input_type_auto_detect() {
593
+ const
594
+ _target_chain =
595
+ _get(
596
+ "target",
597
+ "chain");
581
598
  const
582
599
  _target_chain_type =
583
600
  typeof(
584
- target_chain);
601
+ _target_chain);
585
602
  if ( _target_chain_type == "number" ) {
586
- input_type =
587
- "id";
603
+ _set(
604
+ "input",
605
+ "type",
606
+ "id");
588
607
  }
589
608
  else if ( _target_chain_type == "string" ) {
590
- if ( target_chain.startsWith(
609
+ if ( _target_chain.startsWith(
591
610
  "https://") ) {
592
- input_type =
593
- "rpc";
611
+ _set(
612
+ "input",
613
+ "type",
614
+ "rpc");
594
615
  }
595
616
  }
596
617
  if ( input_type == "" ) {
597
618
  if ( isNaN(
598
619
  target_chain) ) {
599
- input_type =
600
- "name";
620
+ _set(
621
+ "input",
622
+ "type",
623
+ "name");
601
624
  }
602
625
  else {
603
- input_type =
604
- "id";
626
+ _set(
627
+ "input",
628
+ "type",
629
+ "id");
605
630
  }
606
631
  }
607
632
  }
608
633
 
609
634
  function
610
- _db_types_auto_detect(
611
- _chain_id) {
612
- if ( db_types.length == 0 ) {
613
- db_types.push(
635
+ _db_types_get(
636
+ _chain_id,
637
+ _db_types) {
638
+ let
639
+ _db_paths;
640
+ const
641
+ _db_types_type =
642
+ typeof(
643
+ _db_types);
644
+ if ( _db_types_type == "undefined" ) {
645
+ _db_types =
646
+ [];
647
+ }
648
+ _db_paths =
649
+ _get(
650
+ "db",
651
+ "paths");
652
+ if ( _db_types.length == 0 ) {
653
+ _db_types.push(
614
654
  "node");
615
655
  }
616
- if ( db_paths.length > 0 ) {
617
- db_types.push(
656
+ const
657
+ _db_paths_type =
658
+ typeof(
659
+ _db_paths);
660
+ if ( _db_paths_type == "undefined" ||
661
+ _db_paths_type == "string" ) {
662
+ _db_paths =
663
+ [];
664
+ }
665
+ if ( _db_paths.length > 0 ) {
666
+ _db_types.push(
618
667
  "system");
619
668
  }
669
+ return _db_types;
670
+ }
671
+
672
+ function
673
+ _db_types_auto_detect(
674
+ _chain_id) {
675
+ let
676
+ _db_types;
677
+ _db_types =
678
+ _get(
679
+ "db",
680
+ "types");
681
+ _db_types =
682
+ _db_types_get(
683
+ _db_types);
684
+ if ( 0 < _db_types.length ) {
685
+ _set(
686
+ "db",
687
+ "types",
688
+ _db_types);
689
+ }
620
690
  }
621
691
 
622
692
  async function
@@ -1217,7 +1287,7 @@ async function
1217
1287
  [];
1218
1288
  const
1219
1289
  _results =
1220
- _evm_chains_info_get(
1290
+ await _evm_chains_info_get(
1221
1291
  _target_chain,
1222
1292
  _retrieval_mode,
1223
1293
  _db_types,
@@ -1295,30 +1365,49 @@ async function
1295
1365
  1);
1296
1366
  }
1297
1367
  }
1298
-
1299
- module.exports = {
1300
- _data_get:
1301
- _data_get,
1302
- _db_paths_get:
1303
- _db_paths_get,
1304
- _db_paths_auto_detect:
1305
- _db_paths_auto_detect,
1306
- _db_types_auto_detect:
1307
- _db_types_auto_detect,
1308
- _evm_chains_db_path_get:
1309
- _evm_chains_db_path_get,
1310
- _evm_chains_info:
1311
- _evm_chains_info,
1312
- _evm_chains_info_get:
1313
- _evm_chains_info_get,
1314
- _evm_chains_info_set:
1315
- _evm_chains_info_set,
1316
- _input_type_auto_detect:
1317
- _input_type_auto_detect,
1318
- _rpc_backend_get:
1319
- _rpc_backend_get,
1320
- _rpc_backends_get:
1321
- _rpc_backends_get,
1322
- _target_network_type_auto_detect:
1323
- _target_network_type_auto_detect
1368
+
1369
+ // ES6 module exports
1370
+
1371
+ export {
1372
+ _data_get,
1373
+ _db_paths_get,
1374
+ _db_paths_auto_detect,
1375
+ _db_types_auto_detect,
1376
+ _evm_chains_db_path_get,
1377
+ _evm_chains_info,
1378
+ _evm_chains_info_get,
1379
+ _evm_chains_info_set,
1380
+ _input_type_auto_detect,
1381
+ _rpc_backend_get,
1382
+ _rpc_backends_get,
1383
+ _target_network_type_auto_detect
1324
1384
  };
1385
+
1386
+ // Common Javascript exports
1387
+
1388
+ // module.exports = {
1389
+ // _data_get:
1390
+ // _data_get,
1391
+ // _db_paths_get:
1392
+ // _db_paths_get,
1393
+ // _db_paths_auto_detect:
1394
+ // _db_paths_auto_detect,
1395
+ // _db_types_auto_detect:
1396
+ // _db_types_auto_detect,
1397
+ // _evm_chains_db_path_get:
1398
+ // _evm_chains_db_path_get,
1399
+ // _evm_chains_info:
1400
+ // _evm_chains_info,
1401
+ // _evm_chains_info_get:
1402
+ // _evm_chains_info_get,
1403
+ // _evm_chains_info_set:
1404
+ // _evm_chains_info_set,
1405
+ // _input_type_auto_detect:
1406
+ // _input_type_auto_detect,
1407
+ // _rpc_backend_get:
1408
+ // _rpc_backend_get,
1409
+ // _rpc_backends_get:
1410
+ // _rpc_backends_get,
1411
+ // _target_network_type_auto_detect:
1412
+ // _target_network_type_auto_detect
1413
+ // };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name":
3
3
  "evm-chains-info",
4
4
  "version":
5
- "0.0.31",
5
+ "0.0.33",
6
6
  "description":
7
7
  "Returns information about Ethereum Virtual Machine (EVM) blockchains.",
8
8
  "funding": {
@@ -21,11 +21,10 @@
21
21
  "dist",
22
22
  "evm-chains-info",
23
23
  "libevm-chains-info",
24
- "fs-worker.webpack.config.js",
25
- "index.html",
24
+ "fs-worker.webpack.config.cjs",
26
25
  "package.json",
27
26
  "serve.json",
28
- "webpack.config.js"
27
+ "webpack.config.cjs"
29
28
  ],
30
29
  "keywords": [
31
30
  "ur",
@@ -58,33 +57,33 @@
58
57
  },
59
58
  "devDependencies": {
60
59
  "crash-js-webpack":
61
- "^0.0.48",
60
+ "^0.0.62",
62
61
  "flatted":
63
- "^3.2.9",
62
+ "^3.4.4",
64
63
  "eslint":
65
- "^10.0.3",
64
+ "^10.9.0",
66
65
  "globals":
67
66
  "^17.3.0",
68
67
  "@eslint/js":
69
68
  "^10.0.1",
70
69
  "safely-serve":
71
- "^0.0.11",
70
+ "^0.0.16",
72
71
  "webpack":
73
72
  "^5.109.2",
74
73
  "webpack-cli":
75
74
  "^7.2.2"
76
75
  },
77
76
  "dependencies": {
78
- "crash-js":
79
- "^0.1111111111.1111111111111111",
77
+ "libcrash-js":
78
+ "npm:crash-js@^100000001.1000000000000001.1000000000000001",
80
79
  "ethereum-data":
81
- "^0.0.8",
80
+ "^0.0.11",
82
81
  "yargs":
83
82
  "18.0.0"
84
83
  },
85
84
  "optionalDependencies": {
86
85
  "evm-wallet":
87
- "npm:evm-wallet.js@^0.0.75"
86
+ "npm:evm-wallet.js@^0.0.77"
88
87
  },
89
88
  "overrides": {
90
89
  "evm-chains-info":
@@ -92,7 +91,7 @@
92
91
  "evm-contracts-tools":
93
92
  "^0.0.50",
94
93
  "evm-wallet":
95
- "npm:evm-wallet.js@^0.0.75"
94
+ "npm:evm-wallet.js@^0.0.77"
96
95
  },
97
96
  "type":
98
97
  "module",
@@ -0,0 +1,155 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-or-later
2
+
3
+ /** ---------------------------------------------------------
4
+ * webpack.config.cjs
5
+ * ---------------------------------------------------------
6
+ * Copyright ©
7
+ * Pellegrino Prevete
8
+ * 2024, 2025, 2026
9
+ *
10
+ * All rights reserved
11
+ * ---------------------------------------------------------
12
+ *
13
+ * This program is free software: you can redistribute it and/or
14
+ * modify it under the terms of the GNU General Public License
15
+ * as published by the Free Software Foundation, either
16
+ * version 3 of the License, or (at your option) any later
17
+ * version.
18
+ *
19
+ * This program is distributed in the hope that it will be
20
+ * useful, but WITHOUT ANY WARRANTY; without even the implied
21
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
22
+ * PURPOSE.
23
+ * See the GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the
26
+ * GNU General Public License along with this program.
27
+ * If not, see <https://www.gnu.org/licenses/>.
28
+ */
29
+
30
+ const
31
+ _path =
32
+ require(
33
+ 'path');
34
+ const
35
+ _output_dir =
36
+ _path.resolve(
37
+ __dirname);
38
+ const
39
+ _input_file_name =
40
+ `evm-chains-info`;
41
+ const
42
+ _input_file_path =
43
+ `./${_input_file_name}`;
44
+ const
45
+ _output_file_name =
46
+ `${_input_file_name}.js`;
47
+ const
48
+ _output = {
49
+ path:
50
+ _output_dir,
51
+ filename:
52
+ _output_file_name
53
+ };
54
+ const
55
+ _node_fs_ignore =
56
+ { resourceRegExp:
57
+ /^node:fs$/ };
58
+ const
59
+ _yargs_ignore =
60
+ { resourceRegExp:
61
+ /^yargs$/ };
62
+ const
63
+ _yargs_helpers_ignore =
64
+ { resourceRegExp:
65
+ /^yargs\/helpers$/ };
66
+ const
67
+ _webpack =
68
+ require(
69
+ "webpack");
70
+ const
71
+ _ignore_plugin =
72
+ _webpack.IgnorePlugin;
73
+ const
74
+ _node_fs_ignore_plugin =
75
+ new _ignore_plugin(
76
+ _node_fs_ignore);
77
+ const
78
+ _yargs_ignore_plugin =
79
+ new _ignore_plugin(
80
+ _yargs_ignore);
81
+ const
82
+ _yargs_helpers_ignore_plugin =
83
+ new _ignore_plugin(
84
+ _yargs_helpers_ignore);
85
+ module.exports = {
86
+ entry:
87
+ _input_file_path,
88
+ output:
89
+ _output,
90
+ optimization: {
91
+ moduleIds: 'deterministic',
92
+ },
93
+ resolve: {
94
+ alias: {
95
+ "node:fs":
96
+ _path.resolve(
97
+ __dirname,
98
+ 'node_modules/opfs/opfs'),
99
+ "evm-chains-info":
100
+ _path.resolve(
101
+ __dirname,
102
+ './libevm-chains-info'),
103
+ "evm-contracts-tools":
104
+ _path.resolve(
105
+ __dirname,
106
+ 'node_modules/evm-contracts-tools/evm-contracts-tools'),
107
+ "evm-wallet":
108
+ _path.resolve(
109
+ __dirname,
110
+ 'node_modules/evm-wallet/libevm-wallet'),
111
+ "fs":
112
+ _path.resolve(
113
+ __dirname,
114
+ "node_modules/fs/fs"),
115
+ "path":
116
+ _path.resolve(
117
+ __dirname,
118
+ 'node_modules/path/mod.js'),
119
+ "web-worker":
120
+ _path.resolve(
121
+ __dirname,
122
+ 'node_modules/web-worker/mod.js'),
123
+ "yargs":
124
+ _path.resolve(
125
+ __dirname,
126
+ 'node_modules/yargs/browser.mjs'),
127
+ "yargs/helpers":
128
+ _path.resolve(
129
+ __dirname,
130
+ 'node_modules/yargs/helpers/helpers.mjs'),
131
+ "yargs-parser":
132
+ _path.resolve(
133
+ __dirname,
134
+ 'node_modules/yargs-parser/browser.mjs'),
135
+ },
136
+ fallback: {
137
+ "utils":
138
+ false,
139
+ "web-worker":
140
+ false,
141
+ "yargs":
142
+ false,
143
+ "yargs/helpers":
144
+ false,
145
+ }
146
+ },
147
+ externals:
148
+ { yargs:
149
+ 'yargs' },
150
+ plugins: [
151
+ _node_fs_ignore_plugin,
152
+ _yargs_ignore_plugin,
153
+ _yargs_helpers_ignore_plugin
154
+ ]
155
+ };