evm-contracts-tools 0.0.54 → 0.0.57

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/dist/evm-contract-call/evm-contract-call.js +1 -0
  2. package/dist/evm-contract-call/fs-worker.js +1 -0
  3. package/dist/evm-contract-deployment-abi/evm-contract-deployment-abi.js +1 -0
  4. package/dist/evm-contract-deployment-abi/fs-worker.js +1 -0
  5. package/dist/evm-contract-deployment-address/evm-contract-deployment-address.js +1 -0
  6. package/dist/evm-contract-deployment-address/fs-worker.js +1 -0
  7. package/dist/evm-contract-deployment-bytecode/evm-contract-deployment-bytecode.js +1 -0
  8. package/dist/evm-contract-deployment-bytecode/fs-worker.js +1 -0
  9. package/dist/evm-contract-deployment-compiler-output/evm-contract-deployment-compiler-output.js +1 -0
  10. package/dist/evm-contract-deployment-compiler-output/fs-worker.js +1 -0
  11. package/dist/evm-contract-deployment-deployment-networks +1 -0
  12. package/dist/evm-contract-deployment-networks/evm-contract-deployment-networks.js +1 -0
  13. package/dist/evm-contract-deployment-versions/evm-contract-deployment-versions.js +1 -0
  14. package/dist/evm-contract-deployment-versions/fs-worker.js +1 -0
  15. package/dist/evm-contract-deployments-dir/evm-contract-deployments-dir.js +1 -0
  16. package/dist/evm-contract-deployments-dir/fs-worker.js +1 -0
  17. package/dist/evm-contracts-tools/evm-contracts-tools.js +1 -0
  18. package/dist/evm-contracts-tools/fs-worker.js +1 -0
  19. package/dist/libevm-contract-call/fs-worker.js +1 -0
  20. package/dist/libevm-contract-call/libevm-contract-call.js +1 -0
  21. package/dist/libevm-contract-deployment-abi/fs-worker.js +1 -0
  22. package/dist/libevm-contract-deployment-abi/libevm-contract-deployment-abi.js +1 -0
  23. package/dist/libevm-contract-deployment-address/fs-worker.js +1 -0
  24. package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +1 -0
  25. package/dist/libevm-contract-deployment-bytecode/fs-worker.js +1 -0
  26. package/dist/libevm-contract-deployment-bytecode/libevm-contract-deployment-bytecode.js +1 -0
  27. package/dist/libevm-contract-deployment-compiler-output/fs-worker.js +1 -0
  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 -0
  30. package/dist/libevm-contract-deployment-networks/libevm-contract-deployment-networks.js +1 -0
  31. package/dist/libevm-contract-deployment-versions/fs-worker.js +1 -0
  32. package/dist/libevm-contract-deployment-versions/libevm-contract-deployment-versions.js +1 -0
  33. package/dist/libevm-contract-deployments-dir/fs-worker.js +1 -0
  34. package/dist/libevm-contract-deployments-dir/libevm-contract-deployments-dir.js +1 -0
  35. package/dist/libevm-contracts-tools +1 -0
  36. package/evm-contract-call +133 -6
  37. package/lib/address-check +0 -4
  38. package/lib/bytecode-creation-get +74 -32
  39. package/lib/bytecode-runtime-get +171 -69
  40. package/lib/contract-get +189 -93
  41. package/lib/deployer-get +145 -61
  42. package/lib/deployer-verify +226 -113
  43. package/lib/evm-contract-call-dynamic +331 -194
  44. package/lib/evm-contract-call-static +121 -44
  45. package/libevm-contract-call +405 -0
  46. package/libevm-contract-deployment +3 -3
  47. package/libevm-contract-deployment-address +31 -18
  48. package/package.json +9 -9
package/lib/contract-get CHANGED
@@ -2,32 +2,45 @@
2
2
 
3
3
  // SPDX-License-Identifier: AGPL-3.0-or-later
4
4
 
5
- /** ----------------------------------------------------------------------
5
+ /** ---------------------------------------------------------------
6
+ * contract-get
7
+ * ---------------------------------------------------------------
6
8
  * Copyright ©
7
9
  * Pellegrino Prevete
8
10
  * 2024, 2025, 2026
9
11
  *
10
12
  * All rights reserved
11
- * ----------------------------------------------------------------------
13
+ * ---------------------------------------------------------------
12
14
  *
13
- * This program is free software: you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation, either version 3 of the License, or
16
- * (at your option) any later version.
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.
17
19
  *
18
20
  * This program is distributed in the hope that it will be useful,
19
21
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
22
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
23
  * GNU General Public License for more details.
22
24
  *
23
- * You should have received a copy of the GNU General Public License
24
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
25
+ * You should have received a copy of the GNU General Public
26
+ * License along with this program.
27
+ * If not, see <https://www.gnu.org/licenses/>.
25
28
  */
26
29
 
27
30
  const
28
31
  _libcrash =
29
- require(
30
- "crash-js");
32
+ await import(
33
+ "libcrash-js");
34
+ /* global
35
+ _argv */
36
+ const
37
+ _argv =
38
+ _libcrash._argv;
39
+ /* global
40
+ _basename */
41
+ const
42
+ _basename =
43
+ _libcrash._basename;
31
44
  /* global
32
45
  _cmdline_check */
33
46
  const
@@ -38,6 +51,11 @@ const
38
51
  const
39
52
  _dirname =
40
53
  _libcrash._dirname;
54
+ /* global
55
+ _echo */
56
+ const
57
+ _echo =
58
+ _libcrash._echo;
41
59
  /* global
42
60
  _exit */
43
61
  const
@@ -53,6 +71,16 @@ const
53
71
  const
54
72
  _file_read =
55
73
  _libcrash._file_read;
74
+ /* global
75
+ _global_get */
76
+ const
77
+ _global_get =
78
+ _libcrash._global_get;
79
+ /* global
80
+ _get */
81
+ const
82
+ _get =
83
+ _libcrash._get;
56
84
  /* global
57
85
  _json_read */
58
86
  const
@@ -78,6 +106,11 @@ const
78
106
  const
79
107
  _require =
80
108
  _libcrash._require;
109
+ /* global
110
+ _set */
111
+ const
112
+ _set =
113
+ _libcrash._set;
81
114
  const
82
115
  _ethers_module =
83
116
  await _require(
@@ -117,52 +150,74 @@ function
117
150
  /* global
118
151
  app_name:
119
152
  writable */
120
- app_name =
121
- "contract-get"
153
+ _set(
154
+ "app",
155
+ "name",
156
+ "contract-get");
122
157
  /* global
123
158
  wallet_seed:
124
159
  writable */
125
- wallet_seed =
126
- "";
160
+ _set(
161
+ "wallet",
162
+ "seed",
163
+ "");
127
164
  /* global
128
165
  wallet_password_path:
129
166
  writable */
130
- wallet_password_path =
131
- "";
167
+ _set(
168
+ "wallet_password",
169
+ "path",
170
+ "");
132
171
  /* global
133
172
  contract_address:
134
173
  writable */
135
- contract_address =
136
- "";
174
+ _set(
175
+ "contract",
176
+ "address",
177
+ "");
137
178
  /* global
138
179
  contract_abi_path:
139
180
  writable */
140
- contract_abi_path =
141
- "";
181
+ _set(
182
+ "contract_abi",
183
+ "path",
184
+ "");
142
185
  /* global
143
186
  contract_bytecode_path:
144
187
  writable */
145
- contract_bytecode_path =
146
- "";
188
+ _set(
189
+ "contract_bytecode",
190
+ "path",
191
+ "");
147
192
  /* global
148
193
  contract_compiler_output_path:
149
194
  writable */
150
- contract_compiler_output_path =
151
- "";
195
+ _set(
196
+ "contract_compiler_output",
197
+ "path",
198
+ "");
152
199
  /* global
153
200
  target_network:
154
201
  writable */
155
- target_network =
156
- "";
202
+ _set(
203
+ "target",
204
+ "network",
205
+ "");
157
206
  /* global
158
207
  api_key_path:
159
208
  writable */
160
- api_key_path =
161
- "";
209
+ _set(
210
+ "api_key",
211
+ "path",
212
+ "");
162
213
  /* global
163
214
  quiet:
164
215
  writable */
165
- quiet =
216
+ const
217
+ _global =
218
+ _global_get();
219
+ _global[
220
+ "quiet"] =
166
221
  "";
167
222
  }
168
223
 
@@ -456,90 +511,112 @@ function
456
511
  _usage(
457
512
  _exit_code) {
458
513
  let
459
- _line,
460
- _text;
461
- _text = [
462
- "Usage:",
463
- " contract-get",
464
- " <quiet>",
465
- " <wallet_seed>",
466
- " <wallet_password_path>",
467
- " <contract_address>",
468
- " <contract_abi_path>",
469
- " <contract_bytecode_path>",
470
- " <contract_compiler_output_path>",
471
- " <target_network>",
472
- " (<api_key_path>)",
473
- "",
474
- "Args:",
475
- " <quiet> Can be 'y' or 'n'",
476
- " Default: y",
477
- " <wallet_seed> Path of the seed phrase.",
478
- " <wallet_password_path> Wallet password path.",
479
- " <contract_address> Contract of the address one is",
480
- " getting the contract of.",
481
- " <contract_abi_path> Path of the contract ABI.",
482
- " <contract_bytecode_path> Path for the contract bytecode.",
483
- " <contract_compiler_output_path> Path for the contract compiler",
484
- " output path (the hardhat artifact).",
485
- " <target_network> Network on which the contract",
486
- " resides.",
487
- " <api_key_path> Path of the API key for the",
488
- " contract ABI provider service.",
489
- "",
490
- " Options:",
491
- " -h This help."
492
- ];
514
+ _line;
515
+ const
516
+ _text = [
517
+ "Usage:",
518
+ " contract-get",
519
+ " <quiet>",
520
+ " <wallet-seed>",
521
+ " <wallet-password-path>",
522
+ " <contract-address>",
523
+ " <contract-abi-path>",
524
+ " <contract-bytecode-path>",
525
+ " <contract-compiler-output-path>",
526
+ " <target-network>",
527
+ " (<api-key-path>)",
528
+ "",
529
+ "Args:",
530
+ " <quiet> Can be 'y' or 'n'",
531
+ " Default: y",
532
+ " <wallet-seed> Path of the seed phrase.",
533
+ " <wallet-password-path> Wallet password path.",
534
+ " <contract-address> Contract of the address one is",
535
+ " getting the contract of.",
536
+ " <contract-abi-path> Path of the contract ABI.",
537
+ " <contract-bytecode-path> Path for the contract bytecode.",
538
+ " <contract-compiler-output-path> Path for the contract compiler",
539
+ " output path (the hardhat artifact).",
540
+ " <target-network> Network on which the contract",
541
+ " resides.",
542
+ " <api-key-path> Path of the API key for the",
543
+ " contract ABI provider service.",
544
+ "",
545
+ " Options:",
546
+ " -h This help."
547
+ ];
493
548
  for ( _line of _text ) {
494
- _msg_info(
549
+ _echo(
495
550
  _line);
496
551
  }
497
552
  _exit(
498
553
  _exit_code);
499
554
  }
500
555
 
501
- function _cmdline_parse() {
502
- quiet = "y";
503
- process.argv.forEach(
556
+ function
557
+ _cmdline_parse() {
558
+ const
559
+ _global =
560
+ _global_get();
561
+ _global[
562
+ "quiet"] =
563
+ "y";
564
+ _argv.forEach(
504
565
  function (
505
566
  _value,
506
- _index,
507
- _array) {
567
+ _index) {
508
568
  if ( _index == 2 ) {
509
- quiet =
569
+ _global[
570
+ "quiet"] =
510
571
  _value;
511
572
  }
512
573
  if ( _index == 3 ) {
513
- wallet_seed =
514
- _value;
574
+ _set(
575
+ "wallet",
576
+ "seed",
577
+ _value);
515
578
  }
516
579
  if ( _index == 4 ) {
517
- wallet_password_path =
518
- _value;
580
+ _set(
581
+ "wallet_password",
582
+ "path",
583
+ _value);
519
584
  }
520
585
  if ( _index == 5 ) {
521
- contract_address =
522
- _value;
586
+ _set(
587
+ "contract",
588
+ "address",
589
+ _value);
523
590
  }
524
591
  if ( _index == 6 ) {
525
- contract_abi_path =
526
- _value;
592
+ _set(
593
+ "contract_abi",
594
+ "path",
595
+ _value);
527
596
  }
528
597
  if ( _index == 7 ) {
529
- contract_bytecode_path =
530
- _value;
598
+ _set(
599
+ "contract_bytecode",
600
+ "path",
601
+ _value);
531
602
  }
532
603
  if ( _index == 8 ) {
533
- contract_compiler_output_path =
534
- _value;
604
+ _set(
605
+ "contract_compiler_output",
606
+ "path",
607
+ _value);
535
608
  }
536
609
  if ( _index == 9 ) {
537
- target_network =
538
- _value;
610
+ _set(
611
+ "target",
612
+ "network",
613
+ _value);
539
614
  }
540
615
  if ( _index == 10 ) {
541
- api_key_path =
542
- _value;
616
+ _set(
617
+ "api_key",
618
+ "path",
619
+ _value);
543
620
  }
544
621
  if ( _value == "-h" ||
545
622
  _value == "--help" ) {
@@ -547,14 +624,29 @@ function _cmdline_parse() {
547
624
  }
548
625
  }
549
626
  );
550
- if ( contract_abi_path == "" &&
551
- contract_bytecode_path == "" &&
552
- contract_compiler_output_path == "" ) {
627
+ const
628
+ _contract_abi_path =
629
+ _get(
630
+ "contract_abi",
631
+ "path");
632
+ const
633
+ _contract_bytecode_path =
634
+ _get(
635
+ "contract_bytecode",
636
+ "path");
637
+ const
638
+ _contract_compiler_output_path =
639
+ _get(
640
+ "contract_compiler_output",
641
+ "path");
642
+ if ( _contract_abi_path == "" &&
643
+ _contract_bytecode_path == "" &&
644
+ _contract_compiler_output_path == "" ) {
553
645
  _usage();
554
646
  }
555
647
  }
556
648
 
557
- if ( _cmdline_check(
649
+ if ( await _cmdline_check(
558
650
  "contract-get") ) {
559
651
  _global_variables();
560
652
  _cmdline_parse();
@@ -574,7 +666,11 @@ if ( _cmdline_check(
574
666
  app_opts);
575
667
  }
576
668
 
577
- module.exports = {
578
- _contract_get:
579
- _contract_get
669
+ export {
670
+ _contract_get
580
671
  };
672
+
673
+ // module.exports = {
674
+ // _contract_get:
675
+ // _contract_get
676
+ // };