evm-contracts-tools 0.0.46 → 0.0.48

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 (48) hide show
  1. package/Makefile +13 -0
  2. package/dist/evm-contract-call/evm-contract-call.js +1 -1
  3. package/dist/evm-contract-deployment-abi/evm-contract-deployment-abi.js +2 -0
  4. package/dist/evm-contract-deployment-abi/fs-worker.js +1 -0
  5. package/dist/evm-contract-deployment-abi/index.html +31 -0
  6. package/dist/evm-contract-deployment-address/evm-contract-deployment-address.js +1 -1
  7. package/dist/evm-contract-deployment-bytecode/evm-contract-deployment-bytecode.js +2 -0
  8. package/dist/evm-contract-deployment-bytecode/fs-worker.js +1 -0
  9. package/dist/evm-contract-deployment-bytecode/index.html +31 -0
  10. package/dist/evm-contract-deployment-compiler-output/evm-contract-deployment-compiler-output.js +2 -0
  11. package/dist/evm-contract-deployment-compiler-output/fs-worker.js +1 -0
  12. package/dist/evm-contract-deployment-compiler-output/index.html +31 -0
  13. package/dist/evm-contract-deployment-networks/evm-contract-deployment-networks.js +1 -1
  14. package/dist/evm-contract-deployment-versions/evm-contract-deployment-versions.js +1 -1
  15. package/dist/evm-contract-deployments-dir/evm-contract-deployments-dir.js +1 -1
  16. package/dist/evm-contracts-tools/evm-contracts-tools.js +1 -1
  17. package/dist/libevm-contract-call/libevm-contract-call.js +1 -1
  18. package/dist/libevm-contract-deployment-abi/fs-worker.js +1 -0
  19. package/dist/libevm-contract-deployment-abi/index.html +24 -0
  20. package/dist/libevm-contract-deployment-abi/libevm-contract-deployment-abi.js +2 -0
  21. package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +1 -1
  22. package/dist/libevm-contract-deployment-bytecode/fs-worker.js +1 -0
  23. package/dist/libevm-contract-deployment-bytecode/index.html +24 -0
  24. package/dist/libevm-contract-deployment-bytecode/libevm-contract-deployment-bytecode.js +2 -0
  25. package/dist/libevm-contract-deployment-compiler-output/fs-worker.js +1 -0
  26. package/dist/libevm-contract-deployment-compiler-output/index.html +24 -0
  27. package/dist/libevm-contract-deployment-networks/libevm-contract-deployment-networks.js +1 -1
  28. package/dist/libevm-contract-deployment-versions/libevm-contract-deployment-versions.js +1 -1
  29. package/dist/libevm-contract-deployments-dir/libevm-contract-deployments-dir.js +1 -1
  30. package/evm-contract-call +44 -40
  31. package/evm-contract-deployment-abi +538 -0
  32. package/evm-contract-deployment-address +34 -29
  33. package/evm-contract-deployment-bytecode +538 -0
  34. package/evm-contract-deployment-compiler-output +537 -0
  35. package/evm-contract-deployments-dir +24 -34
  36. package/lib/address-check +0 -0
  37. package/lib/evm-contract-call-dynamic +46 -17
  38. package/lib/evm-contract-call-static +0 -0
  39. package/libevm-contract-call +0 -18
  40. package/libevm-contract-deployment +650 -0
  41. package/libevm-contract-deployment-abi +446 -0
  42. package/libevm-contract-deployment-address +71 -402
  43. package/libevm-contract-deployment-bytecode +446 -0
  44. package/libevm-contract-deployment-compiler-output +446 -0
  45. package/libevm-contract-deployment-networks +28 -72
  46. package/libevm-contract-deployment-versions +26 -50
  47. package/libevm-contract-deployments-dir +13 -21
  48. package/package.json +54 -15
@@ -0,0 +1,537 @@
1
+ #!/usr/bin/env node
2
+
3
+ // SPDX-License-Identifier: AGPL-3.0-or-later
4
+
5
+ /** ----------------------------------------------------------------
6
+ * evm-contract-deployment-address.js
7
+ * ----------------------------------------------------------------
8
+ * Copyright ©
9
+ * Pellegrino Prevete
10
+ * 2024, 2025, 2026
11
+ *
12
+ * All rights reserved
13
+ * ----------------------------------------------------------------
14
+ *
15
+ * This program is free software: you can redistribute it and/or
16
+ * modify it under the terms of the GNU General Public License as
17
+ * published by the Free Software Foundation, either version 3 of
18
+ * the License, or (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program.
27
+ * If not, see <https://www.gnu.org/licenses/>.
28
+ */
29
+
30
+ /* eslint-disable
31
+ no-unused-vars */
32
+
33
+ /* Crash Javascript global variables */
34
+ /* global
35
+ quiet:
36
+ writable */
37
+
38
+ const
39
+ _libcrash =
40
+ require(
41
+ "crash-js");
42
+ /* global
43
+ _argv_get */
44
+ const
45
+ _argv_get =
46
+ _libcrash._argv_get;
47
+ /* global
48
+ _argv_url_get */
49
+ const
50
+ _argv_url_get =
51
+ _libcrash._argv_url_get;
52
+ /* global
53
+ _cmdline_check */
54
+ const
55
+ _cmdline_check =
56
+ _libcrash._cmdline_check;
57
+ /* global
58
+ _get_date_human */
59
+ const
60
+ _get_date_human =
61
+ _libcrash._get_date_human;
62
+ /* global
63
+ _msg_info */
64
+ const
65
+ _msg_info =
66
+ _libcrash._msg_info;
67
+ /* global
68
+ _msg_error */
69
+ const
70
+ _msg_error =
71
+ _libcrash._msg_error;
72
+ /* global
73
+ _override_set */
74
+ const
75
+ _override_set =
76
+ _libcrash._override_set;
77
+ /* global
78
+ _printf */
79
+ const
80
+ _printf =
81
+ _libcrash._printf;
82
+ /* global
83
+ _exit */
84
+ const
85
+ _exit =
86
+ _libcrash._exit;
87
+ const
88
+ _libevm_contract_deployment_compiler_output_module =
89
+ require(
90
+ "./libevm-contract-deployment-compiler-output");
91
+ /* global
92
+ _evm_contract_deployment_compiler_output */
93
+ const
94
+ _evm_contract_deployment_compiler_output =
95
+ _libevm_contract_deployment_compiler_output_module._evm_contract_deployment_compiler_output;
96
+ /* global
97
+ _contract_version_auto_detect */
98
+ const
99
+ _contract_version_auto_detect =
100
+ _libevm_contract_deployment_compiler_output_module._contract_version_auto_detect;
101
+ /* global
102
+ _deployments_dir_auto_detect */
103
+ const
104
+ _deployments_dir_auto_detect =
105
+ _libevm_contract_deployment_compiler_output_module._deployments_dir_auto_detect;
106
+ /* global
107
+ _networks_all_auto_detect */
108
+ const
109
+ _networks_all_auto_detect =
110
+ _libevm_contract_deployment_compiler_output_module._networks_all_auto_detect;
111
+ /* global
112
+ _target_app_auto_detect */
113
+ const
114
+ _target_app_auto_detect =
115
+ _libevm_contract_deployment_compiler_output_module._target_app_auto_detect;
116
+
117
+ function
118
+ _global_variables() {
119
+ /* global
120
+ app_name:
121
+ writable */
122
+ app_name =
123
+ "evm-contract-deployments-compiler-output.js";
124
+ /* global
125
+ app_opts:
126
+ writable */
127
+ app_opts =
128
+ [];
129
+ /* global
130
+ runtime_environment:
131
+ writable */
132
+ runtime_environment =
133
+ "";
134
+ /* global
135
+ resolve_date:
136
+ writable */
137
+ resolve_date =
138
+ "";
139
+ /* global
140
+ target_networks:
141
+ writable */
142
+ target_networks =
143
+ [];
144
+ /* global
145
+ network_ids:
146
+ writable */
147
+ network_ids =
148
+ [];
149
+ /* global
150
+ networks_all:
151
+ writable */
152
+ networks_all =
153
+ "";
154
+ /* global
155
+ target_app:
156
+ writable */
157
+ target_app =
158
+ "";
159
+ /* global
160
+ target_contract:
161
+ writable */
162
+ target_contract =
163
+ "";
164
+ /* global
165
+ contract_version:
166
+ writable */
167
+ contract_version =
168
+ "";
169
+ /* global
170
+ user_defined:
171
+ writable */
172
+ user_defined =
173
+ "";
174
+ /* global
175
+ configuration_format:
176
+ writable */
177
+ configuration_format =
178
+ "";
179
+ /* global
180
+ deployments_dir:
181
+ writable */
182
+ deployments_dir =
183
+ "";
184
+ quiet =
185
+ "";
186
+ /* global
187
+ verbose:
188
+ writable */
189
+ verbose =
190
+ "";
191
+ }
192
+
193
+ async function
194
+ _overrides_set(
195
+ _help_display) {
196
+ _override_set(
197
+ "resolve",
198
+ "date",
199
+ _get_date_human());
200
+ _override_set(
201
+ "configuration",
202
+ "format",
203
+ "bash");
204
+ _networks_all_auto_detect();
205
+ _override_set(
206
+ "user",
207
+ "defined",
208
+ "n");
209
+ await _target_app_auto_detect();
210
+ await _deployments_dir_auto_detect();
211
+ await _contract_version_auto_detect();
212
+ }
213
+
214
+ function
215
+ _config_show() {
216
+ let
217
+ _line;
218
+ const
219
+ _text = [
220
+ `${app_name} configuration:`,
221
+ ` Resolve date: ${resolve_date}`,
222
+ ` Runtime environment: ${runtime_environment}`,
223
+ ` Target networks: ${target_networks}`,
224
+ ` Network ID (chain ID): ${network_ids}`,
225
+ ` All networks: ${networks_all}`,
226
+ ` Target application: ${target_app}`,
227
+ ` User-defined address: ${user_defined}`,
228
+ ` Deployments path: ${deployments_dir}`,
229
+ ];
230
+ for ( _line of _text ) {
231
+ _msg_info(
232
+ _line);
233
+ }
234
+ }
235
+
236
+ function
237
+ _usage(
238
+ _exit_code) {
239
+ let
240
+ _line;
241
+ const
242
+ _text = [
243
+ "",
244
+ "Returns an EVM network's contract deployment address",
245
+ "",
246
+ "Usage:",
247
+ "",
248
+ ` ${app_name}`,
249
+ " [options]",
250
+ " <target-contract>",
251
+ "",
252
+ " networks:",
253
+ " All those supported",
254
+ " by 'evm-chains-info'.",
255
+ "",
256
+ " options:",
257
+ "",
258
+ " -n, --network <network> EVM network name.",
259
+ " -i, --chain-id <number> EVM network id (chain ID).",
260
+ " -a, --target-app <app> Application whose target",
261
+ " contract is part of.",
262
+ ` Default: '${target_app}`,
263
+ " -A, --networks-all Returns address for all",
264
+ " available networks.",
265
+ ` Default: '${networks_all}`,
266
+ " -V, --contract-version <version> Contract version.",
267
+ ` Default: '${contract_version}`,
268
+ " -u, --user-defined Returns contract address for",
269
+ " user-defined file system",
270
+ " deployment instead of the system",
271
+ " one.",
272
+ ` Default: '${user_defined}`,
273
+ " -d, --deployments-dir <dir> Specify contract deployments",
274
+ " directory path.",
275
+ ` Default: '${deployments_dir}`,
276
+ " -f, --configuration-format <format> Specify contract deployments",
277
+ " directory path.",
278
+ ` Default: '${configuration_format}`,
279
+ "",
280
+ " -h --help This message.",
281
+ " -v --verbose Enable verbose output.",
282
+ ""
283
+ ];
284
+ for ( _line of _text ) {
285
+ console.log(
286
+ _line);
287
+ }
288
+ _exit(
289
+ _exit_code);
290
+ }
291
+
292
+ async function
293
+ _cmdline_parse() {
294
+ let
295
+ _help_display,
296
+ _msg;
297
+ const
298
+ _argv_args = {
299
+ "booleans": [
300
+ "A",
301
+ "networks-all",
302
+ "u",
303
+ "user-defined",
304
+ "h",
305
+ "help",
306
+ "v",
307
+ "verbose"
308
+ ]
309
+ };
310
+ const
311
+ _argv =
312
+ _argv_get(
313
+ _argv_args);
314
+ const
315
+ _options =
316
+ _argv[
317
+ "_"];
318
+ quiet =
319
+ "y";
320
+ runtime_environment =
321
+ "node";
322
+ if ( _argv[
323
+ "h"] ) {
324
+ _help_display =
325
+ true;
326
+ }
327
+ if ( _argv[
328
+ "help"] ) {
329
+ _help_display =
330
+ true;
331
+ }
332
+ if ( ( _options.indexOf(
333
+ "--help") > -1 ||
334
+ _options.indexOf(
335
+ "-h") > -1) ) {
336
+ _help_display =
337
+ true;
338
+ }
339
+ if ( _help_display ) {
340
+ quiet =
341
+ "n";
342
+ await _overrides_set(
343
+ _help_display);
344
+ _usage(
345
+ 0);
346
+ }
347
+ if ( typeof(
348
+ _argv) == "undefined" ||
349
+ _argv[
350
+ "_"].length < 1 ) {
351
+ _msg =
352
+ "Target contract " +
353
+ "argument required.";
354
+ _msg_error(
355
+ _msg,
356
+ 0);
357
+ _usage(
358
+ 1);
359
+ }
360
+ target_contract =
361
+ _argv[
362
+ "_"][
363
+ 0];
364
+ if ( "n" in _argv ) {
365
+ target_networks.push(
366
+ _argv[
367
+ "n"].toString());
368
+ }
369
+ if ( "network" in _argv ) {
370
+ target_networks.push(
371
+ _argv[
372
+ "network"].toString());
373
+ }
374
+ if ( "i" in _argv ) {
375
+ network_ids.push(
376
+ _argv[
377
+ "i"].toString());
378
+ }
379
+ if ( "network-id" in _argv ) {
380
+ network_ids.push(
381
+ _argv[
382
+ "network-id"].toString());
383
+ }
384
+ if ( "a" in _argv ) {
385
+ target_app =
386
+ _argv[
387
+ "a"];
388
+ }
389
+ if ( "target-app" in _argv ) {
390
+ target_app =
391
+ _argv[
392
+ "target-app"];
393
+ }
394
+ if ( _argv[
395
+ "A"] ||
396
+ _argv[
397
+ "networks-all"] ) {
398
+ networks_all =
399
+ "y";
400
+ }
401
+ if ( _argv[
402
+ "u"] ||
403
+ _argv[
404
+ "user-defined"] ) {
405
+ user_defined =
406
+ "y";
407
+ }
408
+ if ( "f" in _argv ) {
409
+ configuration_format =
410
+ _argv[
411
+ "f"];
412
+ }
413
+ if ( "configuration-format" in _argv ) {
414
+ configuration_format =
415
+ _argv[
416
+ "configuration-format"];
417
+ }
418
+ if ( _argv[
419
+ "v"] ||
420
+ _argv[
421
+ "verbose"] ) {
422
+ quiet =
423
+ "n";
424
+ }
425
+ }
426
+
427
+ function
428
+ _url_parse() {
429
+ let
430
+ _method,
431
+ _network;
432
+ runtime_environment =
433
+ "browser";
434
+ target_networks =
435
+ _argv_url_get(
436
+ "network");
437
+ network_ids =
438
+ _argv_url_get(
439
+ "network_id");
440
+ networks_all =
441
+ _argv_url_get(
442
+ "networks_all")[
443
+ 0];
444
+ target_app =
445
+ _argv_url_get(
446
+ "target_app")[
447
+ 0];
448
+ target_contract =
449
+ _argv_url_get(
450
+ "target_contract")[
451
+ 0];
452
+ contract_version =
453
+ _argv_url_get(
454
+ "contract_version")[
455
+ 0];
456
+ user_defined =
457
+ _argv_url_get(
458
+ "user_defined")[
459
+ 0];
460
+ configuration_format =
461
+ _argv_url_get(
462
+ "configuration_format")[
463
+ 0];
464
+ deployments_dir =
465
+ _argv_url_get(
466
+ "deployments_dir")[
467
+ 0];
468
+ quiet =
469
+ _argv_url_get(
470
+ "quiet");
471
+ if ( quiet.length === 0 ) {
472
+ quiet =
473
+ "n";
474
+ }
475
+ }
476
+
477
+ async function
478
+ _evm_contract_deployment_compiler_output_cmdline(
479
+ _app_opts) {
480
+ let
481
+ _result;
482
+ const
483
+ _results =
484
+ await _evm_contract_deployment_compiler_output.apply(
485
+ null,
486
+ _app_opts);
487
+ const
488
+ _results_type =
489
+ typeof(
490
+ _results);
491
+ if ( _results_type == "object" ) {
492
+ for ( _result of _results ) {
493
+ console.log(
494
+ _result);
495
+ }
496
+ }
497
+ else if ( _results_type == "string" ) {
498
+ _printf(
499
+ _results);
500
+ }
501
+ }
502
+
503
+ async function
504
+ _main() {
505
+ const
506
+ _overrides_set_up =
507
+ await _overrides_set();
508
+ _config_show();
509
+ const
510
+ app_opts = [
511
+ target_networks,
512
+ network_ids,
513
+ networks_all,
514
+ target_app,
515
+ target_contract,
516
+ contract_version,
517
+ user_defined,
518
+ configuration_format,
519
+ deployments_dir,
520
+ ];
521
+ const
522
+ _address =
523
+ await _evm_contract_deployment_compiler_output_cmdline(
524
+ app_opts);
525
+ }
526
+
527
+ _global_variables();
528
+ if ( _cmdline_check(
529
+ "evm-contract-deployment-compiler-output.js") ||
530
+ _cmdline_check(
531
+ "evm-contract-deployment-compiler-output") ) {
532
+ _cmdline_parse();
533
+ }
534
+ else{
535
+ _url_parse();
536
+ }
537
+ _main();
@@ -72,13 +72,18 @@ const
72
72
  /* global
73
73
  _printf */
74
74
  const
75
- _printf =
76
- _libcrash._printf;
75
+ _printf =
76
+ _libcrash._printf;
77
77
  /* global
78
- _process_exit */
78
+ _exit */
79
79
  const
80
- _process_exit =
81
- _libcrash._process_exit;
80
+ _exit =
81
+ _libcrash._exit;
82
+ /* global
83
+ _override_set */
84
+ const
85
+ _override_set =
86
+ _libcrash._override_set;
82
87
  const
83
88
  _libevm_contract_deployments_dir_module =
84
89
  require(
@@ -111,6 +116,11 @@ function
111
116
  writable */
112
117
  resolve_date =
113
118
  "";
119
+ /* global
120
+ target_app:
121
+ writable */
122
+ target_app =
123
+ "";
114
124
  /* global
115
125
  user_level:
116
126
  writable */
@@ -128,34 +138,14 @@ function
128
138
  async function
129
139
  _overrides_set(
130
140
  _help_display) {
131
- if ( ! _help_display &&
132
- typeof(_help_display) != "undefined" &&
133
- _help_display != "" ) {
134
- const
135
- _address_valid =
136
- _address_check(
137
- contract_address);
138
- if ( ! _address_valid ) {
139
- const
140
- _msg =
141
- "Contract address " +
142
- `'${contract_address}' is ` +
143
- `invalid.`;
144
- _msg_error(
145
- _msg,
146
- 1);
147
- }
148
- }
149
- if ( resolve_date == "" ||
150
- typeof(
151
- resolve_date) == "undefined" ) {
152
- resolve_date =
153
- _get_date_human();
154
- }
155
- if ( user_level == "" ) {
156
- user_level =
157
- "n";
158
- }
141
+ _override_set(
142
+ "resolve",
143
+ "date",
144
+ _get_date_human());
145
+ _override_set(
146
+ "user",
147
+ "level",
148
+ "n");
159
149
  }
160
150
 
161
151
  function
@@ -206,7 +196,7 @@ function
206
196
  console.log(
207
197
  _line);
208
198
  }
209
- _process_exit(
199
+ _exit(
210
200
  _exit_code);
211
201
  }
212
202
 
package/lib/address-check CHANGED
File without changes