evm-contracts-tools 0.0.51 → 0.0.54

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 (59) hide show
  1. package/Makefile +94 -24
  2. package/eslint.config.mjs +1 -20
  3. package/evm-contract-call +343 -146
  4. package/evm-contract-deployment-abi +212 -87
  5. package/evm-contract-deployment-address +209 -89
  6. package/evm-contract-deployment-bytecode +146 -61
  7. package/evm-contract-deployment-compiler-output +168 -67
  8. package/evm-contract-deployment-networks +160 -68
  9. package/evm-contract-deployment-versions +138 -66
  10. package/evm-contract-deployments-dir +116 -47
  11. package/evm-contracts-tools +41 -29
  12. package/lib/address-check +82 -34
  13. package/lib/bytecode-creation-get +135 -110
  14. package/lib/evm-contract-call-dynamic +0 -0
  15. package/lib/evm-contract-call-static +0 -0
  16. package/libevm-contract-call +254 -58
  17. package/libevm-contract-deployment +39 -41
  18. package/libevm-contract-deployment-abi +31 -18
  19. package/libevm-contract-deployment-bytecode +31 -18
  20. package/libevm-contract-deployment-compiler-output +32 -19
  21. package/libevm-contract-deployment-networks +20 -11
  22. package/libevm-contract-deployment-versions +16 -10
  23. package/libevm-contract-deployments-dir +12 -7
  24. package/package.json +15 -15
  25. package/dist/evm-contract-call/evm-contract-call.js +0 -2
  26. package/dist/evm-contract-call/fs-worker.js +0 -1
  27. package/dist/evm-contract-deployment-abi/evm-contract-deployment-abi.js +0 -2
  28. package/dist/evm-contract-deployment-abi/fs-worker.js +0 -1
  29. package/dist/evm-contract-deployment-address/evm-contract-deployment-address.js +0 -2
  30. package/dist/evm-contract-deployment-address/fs-worker.js +0 -1
  31. package/dist/evm-contract-deployment-bytecode/evm-contract-deployment-bytecode.js +0 -2
  32. package/dist/evm-contract-deployment-bytecode/fs-worker.js +0 -1
  33. package/dist/evm-contract-deployment-compiler-output/evm-contract-deployment-compiler-output.js +0 -2
  34. package/dist/evm-contract-deployment-compiler-output/fs-worker.js +0 -1
  35. package/dist/evm-contract-deployment-deployment-networks +0 -1
  36. package/dist/evm-contract-deployment-networks/evm-contract-deployment-networks.js +0 -2
  37. package/dist/evm-contract-deployment-versions/evm-contract-deployment-versions.js +0 -2
  38. package/dist/evm-contract-deployment-versions/fs-worker.js +0 -1
  39. package/dist/evm-contract-deployments-dir/evm-contract-deployments-dir.js +0 -2
  40. package/dist/evm-contract-deployments-dir/fs-worker.js +0 -1
  41. package/dist/evm-contracts-tools/evm-contracts-tools.js +0 -2
  42. package/dist/evm-contracts-tools/fs-worker.js +0 -1
  43. package/dist/libevm-contract-call/fs-worker.js +0 -1
  44. package/dist/libevm-contract-call/libevm-contract-call.js +0 -2
  45. package/dist/libevm-contract-deployment-abi/fs-worker.js +0 -1
  46. package/dist/libevm-contract-deployment-abi/libevm-contract-deployment-abi.js +0 -2
  47. package/dist/libevm-contract-deployment-address/fs-worker.js +0 -1
  48. package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +0 -2
  49. package/dist/libevm-contract-deployment-bytecode/fs-worker.js +0 -1
  50. package/dist/libevm-contract-deployment-bytecode/libevm-contract-deployment-bytecode.js +0 -2
  51. package/dist/libevm-contract-deployment-compiler-output/fs-worker.js +0 -1
  52. package/dist/libevm-contract-deployment-compiler-output/libevm-contract-deployment-compiler-output.js +0 -2
  53. package/dist/libevm-contract-deployment-deployment-networks +0 -1
  54. package/dist/libevm-contract-deployment-networks/libevm-contract-deployment-networks.js +0 -2
  55. package/dist/libevm-contract-deployment-versions/fs-worker.js +0 -1
  56. package/dist/libevm-contract-deployment-versions/libevm-contract-deployment-versions.js +0 -2
  57. package/dist/libevm-contract-deployments-dir/fs-worker.js +0 -1
  58. package/dist/libevm-contract-deployments-dir/libevm-contract-deployments-dir.js +0 -2
  59. package/dist/libevm-contracts-tools +0 -1
package/evm-contract-call CHANGED
@@ -66,8 +66,8 @@
66
66
 
67
67
  const
68
68
  _libcrash =
69
- require(
70
- "crash-js");
69
+ await import(
70
+ "libcrash-js");
71
71
  /* global
72
72
  _argv_get */
73
73
  const
@@ -83,16 +83,31 @@ const
83
83
  const
84
84
  _cmdline_check =
85
85
  _libcrash._cmdline_check;
86
+ /* global
87
+ _echo */
88
+ const
89
+ _echo =
90
+ _libcrash._echo;
86
91
  /* global
87
92
  _exit */
88
93
  const
89
94
  _exit =
90
95
  _libcrash._exit;
96
+ /* global
97
+ _get */
98
+ const
99
+ _get =
100
+ _libcrash._get;
91
101
  /* global
92
102
  _get_date_human */
93
103
  const
94
104
  _get_date_human =
95
105
  _libcrash._get_date_human;
106
+ /* global
107
+ _global_get */
108
+ const
109
+ _global_get =
110
+ _libcrash._global_get;
96
111
  /* global
97
112
  _msg_info */
98
113
  const
@@ -118,9 +133,14 @@ const
118
133
  const
119
134
  _require =
120
135
  _libcrash._require;
136
+ /* global
137
+ _set */
138
+ const
139
+ _set =
140
+ _libcrash._set;
121
141
  const
122
142
  _libevm_module =
123
- _require(
143
+ await _require(
124
144
  "libevm");
125
145
  /* global
126
146
  _libevm_cmdline_parse */
@@ -144,7 +164,7 @@ const
144
164
  _libevm_module._wallet_overrides_set;
145
165
  const
146
166
  _libevm_contract_call_module =
147
- require(
167
+ await import(
148
168
  "./libevm-contract-call");
149
169
  /* global
150
170
  _artifact_local_auto_detect */
@@ -182,94 +202,133 @@ function
182
202
  /* global
183
203
  app_name:
184
204
  writable */
185
- app_name =
186
- "evm-contract-call.js";
205
+ _set(
206
+ "app",
207
+ "name",
208
+ "evm-contract-call.js");
187
209
  /* global
188
210
  app_opts:
189
211
  writable */
190
- app_opts =
191
- [];
212
+ _set(
213
+ "app",
214
+ "opts",
215
+ []);
192
216
  /* global
193
217
  runtime_environment:
194
218
  writable */
195
- runtime_environment =
196
- "";
219
+ _set(
220
+ "runtime",
221
+ "environment",
222
+ "");
197
223
  /* global
198
224
  call_date:
199
225
  writable */
200
- call_date =
201
- "";
226
+ _set(
227
+ "call",
228
+ "date",
229
+ "");
202
230
  /* global
203
231
  wallet_name:
204
232
  writable */
205
- wallet_name =
206
- "";
233
+ _set(
234
+ "wallet",
235
+ "name",
236
+ "");
207
237
  /* global
208
238
  retries_max:
209
239
  writable */
210
- retries_max =
211
- "";
240
+ _set(
241
+ "retries",
242
+ "max",
243
+ "");
212
244
  /* global
213
245
  rpc_selection:
214
246
  writable */
215
- rpc_selection =
216
- "";
247
+ _set(
248
+ "rpc",
249
+ "selection",
250
+ "");
217
251
  /* global
218
252
  call_type:
219
253
  writable */
220
- call_type =
221
- "";
254
+ _set(
255
+ "call",
256
+ "type",
257
+ "");
222
258
  /* global
223
259
  index_retrieve:
224
260
  writable */
225
- index_retrieve =
226
- "";
261
+ _set(
262
+ "index",
263
+ "retrieve",
264
+ "");
227
265
  /* global
228
266
  contract_address:
229
267
  writable */
230
- contract_address =
231
- "";
268
+ _set(
269
+ "contract",
270
+ "address",
271
+ "");
232
272
  /* global
233
273
  contract_bytecode:
234
274
  writable */
235
- contract_bytecode =
236
- "";
275
+ _set(
276
+ "contract",
277
+ "bytecode",
278
+ "");
237
279
  /* global
238
280
  contract_compiler_output:
239
281
  writable */
240
- contract_compiler_output =
241
- "";
282
+ _set(
283
+ "contract",
284
+ "compiler_output",
285
+ "");
242
286
  /* global
243
287
  contract_abi:
244
288
  writable */
245
- contract_abi =
246
- "";
289
+ _set(
290
+ "contract",
291
+ "abi",
292
+ "");
247
293
  /* global
248
294
  contract_method:
249
295
  writable */
250
- contract_method =
251
- "";
296
+ _set(
297
+ "contract",
298
+ "method",
299
+ "");
252
300
  /* global
253
301
  method_args:
254
302
  writable */
255
- method_args =
256
- [];
303
+ _set(
304
+ "method",
305
+ "args",
306
+ []);
257
307
  /* global
258
308
  price_gas:
259
309
  writable */
260
- price_gas =
261
- "";
310
+ _set(
311
+ "price",
312
+ "gas",
313
+ "");
262
314
  /* global
263
315
  measure_unit:
264
316
  writable */
265
- measure_unit =
266
- "";
267
- quiet =
317
+ _set(
318
+ "measure",
319
+ "unit",
320
+ "");
321
+ const
322
+ _global =
323
+ _global_get();
324
+ _global[
325
+ "quiet"] =
268
326
  "";
269
327
  /* global
270
328
  verbose:
271
329
  writable */
272
- verbose =
330
+ _global[
331
+ "verbose"] =
273
332
  "";
274
333
  }
275
334
 
@@ -358,9 +417,14 @@ function
358
417
  _config_show() {
359
418
  let
360
419
  _line;
420
+ const
421
+ _app_name =
422
+ _get(
423
+ "app",
424
+ "name");
361
425
  const
362
426
  _text = [
363
- `${app_name} configuration:`,
427
+ `${_app_name} configuration:`,
364
428
  ` Call date: ${call_date}`,
365
429
  ` Runtime environment: ${runtime_environment}`,
366
430
  ` Call type: ${call_type}`,
@@ -401,13 +465,19 @@ function
401
465
  _exit_code) {
402
466
  let
403
467
  _line;
468
+ const
469
+ _app_name =
470
+ _get(
471
+ "app",
472
+ "name");
404
473
  const
405
474
  _text = [
475
+ "",
406
476
  "Runs a smart contract function.",
407
477
  "",
408
478
  "Usage:",
409
479
  "",
410
- ` ${app_name}`,
480
+ ` ${_app_name}`,
411
481
  " [options]",
412
482
  " <contract-address>",
413
483
  " <contract-method>",
@@ -492,10 +562,11 @@ function
492
562
  ` Default: '${rpc_selection}'.`,
493
563
  "",
494
564
  " -h --help This message.",
495
- " -v --verbose Enable verbose output."
565
+ " -v --verbose Enable verbose output.",
566
+ ""
496
567
  ];
497
568
  for ( _line of _text ) {
498
- console.log(
569
+ _echo(
499
570
  _line);
500
571
  }
501
572
  _exit(
@@ -522,16 +593,22 @@ async function
522
593
  };
523
594
  const
524
595
  _argv =
525
- _argv_get(
596
+ await _argv_get(
526
597
  _argv_args);
527
598
  const
528
599
  _options =
529
600
  _argv[
530
601
  "_"];
531
- quiet =
602
+ const
603
+ _global =
604
+ _global_get();
605
+ _global[
606
+ "quiet"] =
532
607
  "y";
533
- runtime_environment =
534
- "node";
608
+ _set(
609
+ "runtime",
610
+ "environment",
611
+ "node");
535
612
  if ( _argv["h"] == true ) {
536
613
  _help_display =
537
614
  true;
@@ -548,7 +625,8 @@ async function
548
625
  true;
549
626
  }
550
627
  if ( _help_display ) {
551
- quiet =
628
+ _global[
629
+ "quiet"] =
552
630
  "n";
553
631
  await _overrides_set(
554
632
  _help_display);
@@ -567,10 +645,12 @@ async function
567
645
  _usage(
568
646
  1);
569
647
  }
570
- contract_address =
648
+ _set(
649
+ "contract",
650
+ "address",
571
651
  _argv[
572
652
  "_"][
573
- 0];
653
+ 0]);
574
654
  if ( typeof(
575
655
  _argv) == "undefined" ||
576
656
  _argv[
@@ -583,152 +663,213 @@ async function
583
663
  _usage(
584
664
  1);
585
665
  }
586
- contract_method =
666
+ _set(
667
+ "contract",
668
+ "method",
587
669
  _argv[
588
670
  "_"][
589
- 0];
590
- const
591
- method_args =
671
+ 0]);
672
+ _set(
673
+ "method",
674
+ "args",
675
+ _argv[
676
+ "_"].slice(
677
+ 2,
592
678
  _argv[
593
- "_"].slice(
594
- 2,
595
- _argv[
596
- "_"].length - 2);
679
+ "_"].length - 2));
597
680
  if ( "t" in _argv ) {
598
- call_type =
681
+ _set(
682
+ "call",
683
+ "type",
599
684
  _argv[
600
- "t"];
685
+ "t"]);
601
686
  }
602
687
  if ( "call-type" in _argv ) {
603
- call_type =
688
+ _set(
689
+ "call",
690
+ "type",
604
691
  _argv[
605
- "call-type"];
692
+ "call-type"]);
606
693
  }
607
694
  if ( "T" in _argv ) {
608
- call_timeout =
695
+ _set(
696
+ "call",
697
+ "timeout",
609
698
  _argv[
610
- "t"];
699
+ "t"]);
611
700
  }
612
701
  if ( "call-timeout" in _argv ) {
613
- call_timeout =
702
+ _set(
703
+ "call",
704
+ "timeout",
614
705
  _argv[
615
- "call-timeout"];
706
+ "call-timeout"]);
616
707
  }
617
708
  if ( "I" in _argv ) {
618
- index_retrieve =
709
+ _set(
710
+ "index",
711
+ "retrieve",
619
712
  _argv[
620
- "I"];
713
+ "I"]);
621
714
  }
622
715
  if ( "index_retrieve" in _argv ) {
623
- index_retrieve =
716
+ _set(
717
+ "index",
718
+ "retrieve",
624
719
  _argv[
625
- "index-retrieve"];
720
+ "index-retrieve"]);
626
721
  }
627
722
  if ( "P" in _argv ) {
628
- price_gas =
723
+ _set(
724
+ "price",
725
+ "gas",
629
726
  _argv[
630
- "P"];
727
+ "P"]);
631
728
  }
632
729
  if ( "price-gas" in _argv ) {
633
- price_gas =
730
+ _set(
731
+ "price",
732
+ "gas",
634
733
  _argv[
635
- "price-gas"];
734
+ "price-gas"]);
636
735
  }
637
736
  if ( "u" in _argv ) {
638
- measure_unit =
737
+ _set(
738
+ "measure",
739
+ "unit",
639
740
  _argv[
640
- "u"];
741
+ "u"]);
641
742
  }
642
743
  if ( "measure-unit" in _argv ) {
643
- measure_unit =
744
+ _set(
745
+ "measure",
746
+ "unit",
644
747
  _argv[
645
- "measure-unit"];
748
+ "measure-unit"]);
646
749
  }
647
750
  if ( "V" in _argv ) {
648
- msg_value =
751
+ _set(
752
+ "msg",
753
+ "value",
649
754
  _argv[
650
- "V"];
755
+ "V"]);
651
756
  }
652
757
  if ( "msg-value" in _argv ) {
653
- msg_value =
758
+ _set(
759
+ "msg",
760
+ "value",
654
761
  _argv[
655
- "msg-value"];
762
+ "msg-value"]);
656
763
  }
657
764
  if ( "r" in _argv ) {
658
- retries_max =
765
+ _set(
766
+ "retries",
767
+ "max",
659
768
  _argv[
660
- "r"];
769
+ "r"]);
661
770
  }
662
771
  if ( "retries-max" in _argv ) {
663
- retries_max =
772
+ _set(
773
+ "retries",
774
+ "max",
664
775
  _argv[
665
- "retries-max"];
776
+ "retries-max"]);
666
777
  }
667
778
  if ( "S" in _argv ) {
668
- rpc_selection =
779
+ _set(
780
+ "rpc",
781
+ "selection",
669
782
  _argv[
670
- "S"];
783
+ "S"]);
671
784
  }
672
785
  if ( "rpc-selection" in _argv ) {
673
- rpc_selection =
786
+ _set(
787
+ "rpc",
788
+ "selection",
674
789
  _argv[
675
- "rpc-selection"];
790
+ "rpc-selection"]);
676
791
  }
677
792
  if ( "A" in _argv ) {
678
- contract_abi =
793
+ _set(
794
+ "contract",
795
+ "abi",
679
796
  _argv[
680
- "A"];
797
+ "A"]);
681
798
  }
682
799
  if ( "abi" in _argv ) {
683
- contract_abi =
800
+ _set(
801
+ "contract",
802
+ "abi",
684
803
  _argv[
685
- "abi"];
804
+ "abi"]);
686
805
  }
687
806
  if ( "B" in _argv ) {
688
- contract_bytecode =
807
+ _set(
808
+ "contract",
809
+ "bytecode",
689
810
  _argv[
690
- "B"];
811
+ "B"]);
691
812
  }
692
813
  if ( "bytecode" in _argv ) {
693
- contract_bytecode =
814
+ _set(
815
+ "contract",
816
+ "bytecode",
694
817
  _argv[
695
- "bytecode"];
818
+ "bytecode"]);
696
819
  }
697
820
  if ( "C" in _argv ) {
698
- contract_compiler_output =
821
+ _set(
822
+ "contract",
823
+ "compiler_output",
699
824
  _argv[
700
- "C"];
825
+ "C"]);
701
826
  }
702
827
  if ( "compiler-output" in _argv ) {
703
- contract_compiler_output =
828
+ _set(
829
+ "contract",
830
+ "compiler_output",
704
831
  _argv[
705
- "compiler-output"];
832
+ "compiler-output"]);
706
833
  }
707
834
  if ( "a" in _argv ) {
708
- call_auth =
709
- "y";
835
+ _set(
836
+ "call",
837
+ "auth",
838
+ "y");
710
839
  }
711
840
  if ( "auth" in _argv ) {
712
- call_auth =
713
- "y";
841
+ _set(
842
+ "call",
843
+ "auth",
844
+ "y");
714
845
  }
846
+ const
847
+ _target_networks =
848
+ _get(
849
+ "target",
850
+ "networks");
715
851
  if ( "n" in _argv ) {
716
- target_networks.push(
852
+ _target_networks.push(
717
853
  _argv[
718
854
  "n"]);
719
855
  }
720
856
  if ( "network" in _argv ) {
721
- target_networks.push(
857
+ _target_networks.push(
722
858
  _argv[
723
859
  "network"]);
724
860
  }
861
+ _set(
862
+ "target",
863
+ "networks",
864
+ _target_networks);
725
865
  _libevm_cmdline_parse(
726
866
  _argv);
727
867
  if ( _argv[
728
868
  "v"] ||
729
869
  _argv[
730
870
  "verbose"] ) {
731
- quiet =
871
+ _global[
872
+ "quiet"] =
732
873
  "n";
733
874
  }
734
875
  }
@@ -738,71 +879,121 @@ function
738
879
  let
739
880
  _method,
740
881
  _network;
741
- runtime_environment =
742
- "browser";
743
- call_type =
882
+ _set(
883
+ "runtime",
884
+ "environment",
885
+ "browser");
886
+ _set(
887
+ "call",
888
+ "type",
744
889
  _argv_url_get(
745
890
  "call_type")[
746
- 0];
747
- call_timeout =
891
+ 0]);
892
+ _set(
893
+ "call",
894
+ "timeout",
748
895
  _argv_url_get(
749
896
  "call_timeout")[
750
- 0];
751
- index_retrieve =
897
+ 0]);
898
+ _set(
899
+ "index",
900
+ "retrieve",
752
901
  _argv_url_get(
753
902
  "index_retrieve")[
754
- 0];
755
- price_gas =
903
+ 0]);
904
+ _set(
905
+ "price",
906
+ "gas",
756
907
  _argv_url_get(
757
908
  "price_gas")[
758
- 0];
759
- measure_unit =
909
+ 0]);
910
+ _set(
911
+ "measure",
912
+ "unit",
760
913
  _argv_url_get(
761
914
  "measure_unit")[
762
- 0];
763
- msg_value =
915
+ 0]);
916
+ _set(
917
+ "msg",
918
+ "value",
764
919
  _argv_url_get(
765
920
  "msg_value")[
766
- 0];
767
- retries_max =
921
+ 0]);
922
+ _set(
923
+ "retries",
924
+ "max",
768
925
  _argv_url_get(
769
926
  "retries_max")[
770
- 0];
771
- rpc_selection =
927
+ 0]);
928
+ _set(
929
+ "rpc",
930
+ "selection",
772
931
  _argv_url_get(
773
932
  "rpc_selection")[
774
- 0];
775
- contract_abi =
933
+ 0]);
934
+ _set(
935
+ "contract",
936
+ "abi",
776
937
  _argv_url_get(
777
938
  "abi")[
778
- 0];
779
- contract_bytecode =
939
+ 0]);
940
+ _set(
941
+ "contract",
942
+ "bytecode",
780
943
  _argv_url_get(
781
944
  "bytecode")[
782
- 0];
783
- contract_compiler_output =
945
+ 0]);
946
+ _set(
947
+ "contract",
948
+ "compiler_output",
784
949
  _argv_url_get(
785
950
  "compiler_output")[
786
- 0];
787
- rpc_selection =
951
+ 0]);
952
+ _set(
953
+ "rpc",
954
+ "selection",
788
955
  _argv_url_get(
789
956
  "rpc_selection")[
790
- 0];
957
+ 0]);
958
+ const
959
+ _target_networks =
960
+ _get(
961
+ "target",
962
+ "networks");
791
963
  for ( _network of _argv_url_get(
792
964
  "network") ) {
793
- target_networks.push(
965
+ _target_networks.push(
794
966
  _network);
795
967
  }
968
+ _set(
969
+ "target",
970
+ "networks",
971
+ _target_networks);
972
+ const
973
+ _method_args =
974
+ _get(
975
+ "method",
976
+ "args");
796
977
  for ( _method of _argv_url_get(
797
978
  "method_args") ) {
798
- method_args.push(
979
+ _method_args.push(
799
980
  _method);
800
981
  }
801
- quiet =
982
+ _set(
983
+ "method",
984
+ "args",
985
+ _method_args);
986
+ const
987
+ _global =
988
+ _global_get();
989
+ _global[
990
+ "quiet"] =
802
991
  _argv_url_get(
803
992
  "quiet");
804
- if ( quiet.length === 0 ) {
805
- quiet =
993
+ if ( _global[
994
+ "quiet"].length === 0 ) {
995
+ _global[
996
+ "quiet"] =
806
997
  "n";
807
998
  }
808
999
  }
@@ -823,7 +1014,7 @@ async function
823
1014
  _results);
824
1015
  if ( _results_type == "object" ) {
825
1016
  for ( _result of _results ) {
826
- console.log(
1017
+ _echo(
827
1018
  _result);
828
1019
  }
829
1020
  }
@@ -866,16 +1057,22 @@ async function
866
1057
 
867
1058
  _global_variables();
868
1059
  _libevm_global_variables();
869
- if ( _cmdline_check(
1060
+ if ( await _cmdline_check(
870
1061
  "evm-contract-call.js") ||
871
- _cmdline_check(
1062
+ await _cmdline_check(
872
1063
  "evm-contract-call") ||
873
- _cmdline_check(
1064
+ await _cmdline_check(
874
1065
  "./evm-contract-call") ) {
875
- _cmdline_parse();
1066
+ await _cmdline_parse();
876
1067
  }
877
1068
  else{
878
1069
  _url_parse();
879
1070
  _libevm_url_parse();
880
1071
  }
1072
+ _echo(
1073
+ contract_address);
881
1074
  _main();
1075
+
1076
+ export {
1077
+ _evm_contract_call
1078
+ };