evm-contracts-tools 0.0.50 → 0.0.52

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.
Files changed (75) hide show
  1. package/dist/evm-contract-call/evm-contract-call.js +1 -2
  2. package/dist/evm-contract-call/fs-worker.js +1 -1
  3. package/dist/evm-contract-deployment-abi/evm-contract-deployment-abi.js +1 -2
  4. package/dist/evm-contract-deployment-abi/fs-worker.js +1 -1
  5. package/dist/evm-contract-deployment-address/evm-contract-deployment-address.js +1 -2
  6. package/dist/evm-contract-deployment-address/fs-worker.js +1 -1
  7. package/dist/evm-contract-deployment-bytecode/evm-contract-deployment-bytecode.js +1 -2
  8. package/dist/evm-contract-deployment-bytecode/fs-worker.js +1 -1
  9. package/dist/evm-contract-deployment-compiler-output/evm-contract-deployment-compiler-output.js +1 -2
  10. package/dist/evm-contract-deployment-compiler-output/fs-worker.js +1 -1
  11. package/dist/evm-contract-deployment-deployment-networks +1 -1
  12. package/dist/evm-contract-deployment-networks/evm-contract-deployment-networks.js +1 -2
  13. package/dist/evm-contract-deployment-versions/evm-contract-deployment-versions.js +1 -2
  14. package/dist/evm-contract-deployment-versions/fs-worker.js +1 -1
  15. package/dist/evm-contract-deployments-dir/evm-contract-deployments-dir.js +1 -2
  16. package/dist/evm-contract-deployments-dir/fs-worker.js +1 -1
  17. package/dist/evm-contracts-tools/evm-contracts-tools.js +1 -2
  18. package/dist/evm-contracts-tools/fs-worker.js +1 -1
  19. package/dist/libevm-contract-call/fs-worker.js +1 -1
  20. package/dist/libevm-contract-call/libevm-contract-call.js +1 -2
  21. package/dist/libevm-contract-deployment-abi/fs-worker.js +1 -1
  22. package/dist/libevm-contract-deployment-abi/libevm-contract-deployment-abi.js +1 -2
  23. package/dist/libevm-contract-deployment-address/fs-worker.js +1 -1
  24. package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +1 -1
  25. package/dist/libevm-contract-deployment-bytecode/fs-worker.js +1 -1
  26. package/dist/libevm-contract-deployment-bytecode/libevm-contract-deployment-bytecode.js +1 -2
  27. package/dist/libevm-contract-deployment-compiler-output/fs-worker.js +1 -1
  28. package/dist/libevm-contract-deployment-compiler-output/libevm-contract-deployment-compiler-output.js +1 -0
  29. package/dist/libevm-contract-deployment-deployment-networks +1 -1
  30. package/dist/libevm-contract-deployment-networks/libevm-contract-deployment-networks.js +1 -2
  31. package/dist/libevm-contract-deployment-versions/fs-worker.js +1 -1
  32. package/dist/libevm-contract-deployment-versions/libevm-contract-deployment-versions.js +1 -2
  33. package/dist/libevm-contract-deployments-dir/fs-worker.js +1 -1
  34. package/dist/libevm-contract-deployments-dir/libevm-contract-deployments-dir.js +1 -2
  35. package/dist/libevm-contracts-tools +1 -1
  36. package/eslint.config.mjs +131 -0
  37. package/evm-contract-call +348 -151
  38. package/evm-contract-call.webpack.config.cjs +159 -0
  39. package/evm-contract-deployment-abi +212 -87
  40. package/evm-contract-deployment-abi.webpack.config.cjs +159 -0
  41. package/evm-contract-deployment-address +209 -89
  42. package/evm-contract-deployment-address.webpack.config.cjs +159 -0
  43. package/evm-contract-deployment-bytecode +146 -61
  44. package/evm-contract-deployment-bytecode.webpack.config.cjs +159 -0
  45. package/evm-contract-deployment-compiler-output +168 -67
  46. package/evm-contract-deployment-compiler-output.webpack.config.cjs +159 -0
  47. package/evm-contract-deployment-networks +160 -68
  48. package/evm-contract-deployment-networks.webpack.config.cjs +159 -0
  49. package/evm-contract-deployment-versions +138 -66
  50. package/evm-contract-deployment-versions.webpack.config.cjs +159 -0
  51. package/evm-contract-deployments-dir +116 -47
  52. package/evm-contract-deployments-dir.webpack.config.cjs +159 -0
  53. package/evm-contracts-tools +41 -29
  54. package/fs-worker.webpack.config.cjs +82 -0
  55. package/lib/address-check +0 -0
  56. package/lib/evm-contract-call-dynamic +0 -0
  57. package/lib/evm-contract-call-static +0 -0
  58. package/libevm-contract-call +254 -58
  59. package/libevm-contract-call.webpack.config.cjs +159 -0
  60. package/libevm-contract-deployment +39 -41
  61. package/libevm-contract-deployment-abi +31 -18
  62. package/libevm-contract-deployment-abi.webpack.config.cjs +155 -0
  63. package/libevm-contract-deployment-address.webpack.config.cjs +155 -0
  64. package/libevm-contract-deployment-bytecode +31 -18
  65. package/libevm-contract-deployment-bytecode.webpack.config.cjs +155 -0
  66. package/libevm-contract-deployment-compiler-output +32 -19
  67. package/libevm-contract-deployment-compiler-output.webpack.config.cjs +155 -0
  68. package/libevm-contract-deployment-networks +20 -11
  69. package/libevm-contract-deployment-networks.webpack.config.cjs +159 -0
  70. package/libevm-contract-deployment-versions +16 -10
  71. package/libevm-contract-deployment-versions.webpack.config.cjs +159 -0
  72. package/libevm-contract-deployments-dir +12 -7
  73. package/libevm-contract-deployments-dir.webpack.config.cjs +159 -0
  74. package/package.json +49 -50
  75. package/webpack.config.cjs +155 -0
@@ -63,8 +63,8 @@
63
63
 
64
64
  const
65
65
  _libcrash_module =
66
- require(
67
- "crash-js");
66
+ await import(
67
+ "libcrash-js");
68
68
  /* global
69
69
  _dirname */
70
70
  const
@@ -75,6 +75,11 @@ const
75
75
  const
76
76
  _file_exists =
77
77
  _libcrash_module._file_exists;
78
+ /* global
79
+ _get */
80
+ const
81
+ _get =
82
+ _libcrash_module._get;
78
83
  /* global
79
84
  _homedir_get */
80
85
  const
@@ -115,18 +120,28 @@ const
115
120
  const
116
121
  _range =
117
122
  _libcrash_module._range;
123
+ /* global
124
+ _require */
125
+ const
126
+ _require =
127
+ _libcrash_module._require;
128
+ /* global
129
+ _set */
130
+ const
131
+ _set =
132
+ _libcrash_module._set;
118
133
  const
119
134
  _evm_contracts_tools_module =
120
- require("./evm-contracts-tools");
135
+ await import(
136
+ "./evm-contracts-tools");
121
137
  /* global
122
138
  _address_check */
123
139
  const
124
140
  _address_check =
125
141
  _evm_contracts_tools_module._address_check;
126
-
127
142
  const
128
143
  _ethereum_data_module =
129
- require(
144
+ await _require(
130
145
  "ethereum-data");
131
146
  /* global
132
147
  _data_get */
@@ -135,21 +150,59 @@ const
135
150
  _ethereum_data_module._data_get;
136
151
 
137
152
  function
138
- _target_networks_auto_detect() {
153
+ _target_networks_get(
154
+ _target_networks) {
139
155
  // TODO:
140
- // _evm_wallet_module.balance-discovery
141
- if ( target_networks == "" ||
142
- target_networks == [] ) {
156
+ // _evm_wallet_module._balance_discovery
157
+ const
158
+ _target_networks_type =
159
+ typeof(
160
+ _target_networks);
161
+ if ( _target_networks_type == "undefined" ) {
162
+ _target_networks =
163
+ _get(
164
+ "target",
165
+ "networks");
166
+ }
167
+ if ( _target_networks == "" ||
168
+ _target_networks == [] ) {
143
169
  // to be auto-detected
144
- target_networks = [
145
- "1"
146
- ];
170
+ _target_networks = [
171
+ "1"
172
+ ];
147
173
  }
148
- // to be auto-detected
174
+ const
175
+ _target_network =
176
+ _target_network[0];
177
+ return [ _target_networks,
178
+ _target_network ];
179
+ }
180
+
181
+ function
182
+ _target_networks_auto_detect() {
183
+ // TODO:
184
+ // _evm_wallet_module._balance_discovery
185
+ let
186
+ _target_network,
187
+ _target_networks;
188
+ _target_networks =
189
+ _get(
190
+ "target",
191
+ "networks");
192
+ [ _target_networks,
193
+ /* eslint-disable-next-line
194
+ prefer-const */
195
+ _target_network ] =
196
+ _target_networks_auto_detect(
197
+ _target_networks);
198
+ _set(
199
+ "target",
200
+ "networks",
201
+ _target_networks);
149
202
  _override_set(
150
203
  "target",
151
204
  "network",
152
- "1");
205
+ _target_network);
153
206
  }
154
207
 
155
208
  function
@@ -202,26 +255,66 @@ function
202
255
  }
203
256
 
204
257
  function
205
- _contract_abi_auto_detect() {
258
+ _contract_abi_get(
259
+ _network,
260
+ _address,
261
+ _api_key,
262
+ _compiler_output,
263
+ _abi) {
206
264
  let
207
- _abi,
208
265
  _abi_target;
209
266
  const
267
+ _abi_type =
268
+ typeof(
269
+ _abi);
270
+ if ( _abi_type == "undefined" ) {
271
+ _abi =
272
+ _get(
273
+ "contract",
274
+ "abi");
275
+ }
276
+ const
277
+ _network_type =
278
+ typeof(
279
+ _network);
280
+ if ( _network_type == "undefined" ) {
210
281
  _network =
211
- target_network;
282
+ _get(
283
+ "target",
284
+ "network");
285
+ }
212
286
  const
287
+ _address_type =
288
+ typeof(
289
+ _address);
290
+ if ( _address_type == "undefined" ) {
213
291
  _address =
214
- contract_address;
292
+ _get(
293
+ "contract",
294
+ "address");
295
+ }
215
296
  const
216
- _key =
217
- api_key;
297
+ _api_key_type =
298
+ typeof(
299
+ _api_key);
300
+ if ( _api_key_type == "undefined" ) {
301
+ _api_key =
302
+ _get(
303
+ "api",
304
+ "key");
305
+ }
218
306
  const
307
+ _compiler_output_type =
308
+ typeof(
309
+ _compiler_output);
310
+ if ( _compiler_output_type == "undefined" ) {
219
311
  _compiler_output =
220
- contract_compiler_output;
221
- _abi =
222
- contract_abi;
223
- _abi_target =
224
- _abi;
312
+ _get(
313
+ "contract",
314
+ "compiler_output");
315
+ }
316
+ _abi_target =
317
+ _abi;
225
318
  if ( typeof(
226
319
  _abi_target) == "undefined" ||
227
320
  _abi_target == "" ) {
@@ -247,16 +340,71 @@ function
247
340
  _abi_dir);
248
341
  }
249
342
  }
343
+ return _abi;
250
344
  }
251
345
 
252
346
  function
253
- _call_auth_auto_detect() {
254
- if ( call_type == "static" ) {
255
- call_auth =
347
+ _contract_abi_auto_detect() {
348
+ let
349
+ _abi;
350
+ const
351
+ _network =
352
+ _get(
353
+ "target",
354
+ "network");
355
+ const
356
+ _address =
357
+ _get(
358
+ "contract",
359
+ "address");
360
+ const
361
+ _api_key =
362
+ _get(
363
+ "api",
364
+ "key");
365
+ const
366
+ _compiler_output =
367
+ _get(
368
+ "contract",
369
+ "compiler_output");
370
+ _abi =
371
+ _get(
372
+ "contract",
373
+ "abi");
374
+ _abi =
375
+ _contract_abi_get(
376
+ _network,
377
+ _address,
378
+ _api_key,
379
+ _compiler_output,
380
+ _abi);
381
+ _override_set(
382
+ "contract",
383
+ "abi",
384
+ _abi);
385
+ }
386
+
387
+ function
388
+ _call_auth_get(
389
+ _call_type) {
390
+ let
391
+ _call_auth;
392
+ const
393
+ _call_type_type =
394
+ typeof(
395
+ _call_type);
396
+ if ( _call_type_type == "undefined" ) {
397
+ _call_type =
398
+ _get(
399
+ "call",
400
+ "type");
401
+ }
402
+ if ( _call_type == "static" ) {
403
+ _call_auth =
256
404
  "n";
257
405
  }
258
406
  else if ( call_type == "dynamic" ) {
259
- call_auth =
407
+ _call_auth =
260
408
  "y";
261
409
  }
262
410
  else {
@@ -265,11 +413,30 @@ function
265
413
  `Unknown call type '${call_type}'.`;
266
414
  _msg_error(
267
415
  _msg,
268
- 1);
416
+ 0);
417
+ throw _msg;
269
418
  }
419
+ return _call_auth;
270
420
  }
271
421
 
272
422
  function
423
+ _call_auth_auto_detect() {
424
+ const
425
+ _call_type =
426
+ _get(
427
+ "call",
428
+ "type");
429
+ const
430
+ _call_auth =
431
+ _call_auth_get(
432
+ _call_type);
433
+ _override_set(
434
+ "call",
435
+ "type",
436
+ _call_type);
437
+ }
438
+
439
+ async function
273
440
  _evm_contract_call(
274
441
  _call_type,
275
442
  _call_timeout,
@@ -301,7 +468,6 @@ function
301
468
  [];
302
469
  _out =
303
470
  "";
304
-
305
471
  }
306
472
  else if ( _call_type == "dynamic" ) {
307
473
  _out =
@@ -314,45 +480,75 @@ function
314
480
  `'${_call_type}'.`;
315
481
  _msg_error(
316
482
  _msg,
317
- 1);
483
+ 0);
484
+ throw _msg;
318
485
  }
319
486
  return _out;
320
487
  }
321
488
 
322
489
  function
323
490
  _artifact_local_auto_detect(
324
- _type) {
491
+ _artifact_type) {
325
492
  const
326
493
  _artifact =
327
494
  _default_artifact_path_get(
328
- _type);
329
- if ( _type == "abi" ) {
330
- contract_abi =
331
- _artifact;
495
+ _artifact_type);
496
+ if ( _artifact_type == "abi" ) {
497
+ _override_set(
498
+ "contract",
499
+ "abi",
500
+ _artifact);
332
501
  }
333
- else if ( _type == "bytecode" ) {
334
- contract_bytecode =
335
- _artifact;
502
+ else if ( _artifact_type == "bytecode" ) {
503
+ _override_set(
504
+ "contract",
505
+ "bytecode",
506
+ _artifact);
336
507
  }
337
- else if ( _type == "compiler_output" ) {
338
- contract_compiler_output =
339
- _artifact;
508
+ else if ( _artifact_type == "compiler_output" ) {
509
+ _override_set(
510
+ "contract",
511
+ "compiler_output",
512
+ _artifact);
340
513
  }
341
514
  }
342
515
 
343
- module.exports = {
344
- _address_check:
345
- _address_check,
346
- _artifact_local_auto_detect:
347
- _artifact_local_auto_detect,
348
- _call_auth_auto_detect:
349
- _call_auth_auto_detect,
350
- _contract_abi_auto_detect:
351
- _contract_abi_auto_detect,
352
- _default_artifact_path_get:
353
- _default_artifact_path_get,
354
- _evm_contract_call:
355
- _evm_contract_call,
356
- _target_networks_auto_detect:
357
- _target_networks_auto_detect
516
+ // ES6 module exports
517
+
518
+ export {
519
+ _address_check,
520
+ _artifact_local_auto_detect,
521
+ _call_auth_auto_detect,
522
+ _call_auth_get,
523
+ _contract_abi_auto_detect,
524
+ _contract_abi_get,
525
+ _default_artifact_path_get,
526
+ _evm_contract_call,
527
+ _target_networks_auto_detect,
528
+ _target_networks_get
358
529
  };
530
+
531
+ // Common Javascript exports
532
+
533
+ // module.exports = {
534
+ // _address_check:
535
+ // _address_check,
536
+ // _artifact_local_auto_detect:
537
+ // _artifact_local_auto_detect,
538
+ // _call_auth_auto_detect:
539
+ // _call_auth_auto_detect,
540
+ // _call_auth_get:
541
+ // _call_auth_get,
542
+ // _contract_abi_auto_detect:
543
+ // _contract_abi_auto_detect,
544
+ // _contract_abi_get:
545
+ // _contract_abi_get,
546
+ // _default_artifact_path_get:
547
+ // _default_artifact_path_get,
548
+ // _evm_contract_call:
549
+ // _evm_contract_call,
550
+ // _target_networks_auto_detect:
551
+ // _target_networks_auto_detect,
552
+ // _target_networks_get:
553
+ // _target_networks_get
554
+ // };
@@ -0,0 +1,159 @@
1
+ /** ---------------------------------------------------------
2
+ * libevm-contract-call.webpack.config.cjs
3
+ * ---------------------------------------------------------
4
+ * Copyright ©
5
+ * Pellegrino Prevete
6
+ * 2024, 2025, 2026
7
+ *
8
+ * All rights reserved
9
+ * ---------------------------------------------------------
10
+ *
11
+ * This program is free software: you can redistribute it and/or
12
+ * modify it under the terms of the GNU General Public License
13
+ * as published by the Free Software Foundation, either
14
+ * version 3 of the License, or (at your option) any later
15
+ * version.
16
+ *
17
+ * This program is distributed in the hope that it will be
18
+ * useful, but WITHOUT ANY WARRANTY; without even the implied
19
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20
+ * PURPOSE.
21
+ * See the GNU General Public License for more details.
22
+ *
23
+ * You should have received a copy of the
24
+ * GNU General Public License along with this program.
25
+ * If not, see <https://www.gnu.org/licenses/>.
26
+ */
27
+
28
+ const
29
+ _path =
30
+ require(
31
+ 'path');
32
+ const
33
+ _output_dir =
34
+ _path.resolve(
35
+ __dirname);
36
+ const
37
+ _input_file_name =
38
+ `libevm-contract-call`;
39
+ const
40
+ _input_file_path =
41
+ `./${_input_file_name}`;
42
+ const
43
+ _output_file_name =
44
+ `${_input_file_name}.js`;
45
+ const
46
+ _output = {
47
+ path:
48
+ _output_dir,
49
+ filename:
50
+ _output_file_name
51
+ };
52
+ const
53
+ _node_fs_ignore = {
54
+ resourceRegExp:
55
+ /^node:fs$/
56
+ };
57
+ const
58
+ _yargs_ignore =
59
+ { resourceRegExp:
60
+ /^yargs$/ };
61
+ const
62
+ _yargs_helpers_ignore = {
63
+ resourceRegExp:
64
+ /^yargs\/helpers$/
65
+ };
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
+ "fs":
100
+ _path.resolve(
101
+ __dirname,
102
+ "node_modules/fs/fs"),
103
+ "evm-contracts-tools":
104
+ _path.resolve(
105
+ __dirname,
106
+ "evm-contracts-tools"),
107
+ "evm-transactions-tools":
108
+ _path.resolve(
109
+ __dirname,
110
+ "node_modules/evm-transactions-tools/evm-transactions-tools"),
111
+ "evm-wallet":
112
+ _path.resolve(
113
+ __dirname,
114
+ 'node_modules/evm-wallet/libevm-wallet'),
115
+ "libevm":
116
+ _path.resolve(
117
+ __dirname,
118
+ 'node_modules/libevm/libevm'),
119
+ "path":
120
+ _path.resolve(
121
+ __dirname,
122
+ 'node_modules/path/mod.js'),
123
+ "web-worker":
124
+ _path.resolve(
125
+ __dirname,
126
+ 'node_modules/web-worker/mod.js'),
127
+ "yargs":
128
+ _path.resolve(
129
+ __dirname,
130
+ 'node_modules/yargs/browser.mjs'),
131
+ "yargs/helpers":
132
+ _path.resolve(
133
+ __dirname,
134
+ 'node_modules/yargs/helpers/helpers.mjs'),
135
+ "yargs-parser":
136
+ _path.resolve(
137
+ __dirname,
138
+ 'node_modules/yargs-parser/browser.mjs'),
139
+ },
140
+ fallback: {
141
+ "utils":
142
+ false,
143
+ "web-worker":
144
+ false,
145
+ "yargs":
146
+ false,
147
+ "yargs/helpers":
148
+ false,
149
+ }
150
+ },
151
+ externals:
152
+ { yargs:
153
+ 'yargs' },
154
+ plugins: [
155
+ _node_fs_ignore_plugin,
156
+ _yargs_ignore_plugin,
157
+ _yargs_helpers_ignore_plugin
158
+ ]
159
+ };