evm-contracts-tools 0.0.55 → 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.
@@ -2,26 +2,29 @@
2
2
 
3
3
  // SPDX-License-Identifier: AGPL-3.0-or-later
4
4
 
5
- /** ----------------------------------------------------------------------
5
+ /** ---------------------------------------------------------------
6
+ * evmt-contract-call-static
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
  /* Crash Javascript global variables */
@@ -38,13 +41,28 @@
38
41
 
39
42
  const
40
43
  _libcrash =
41
- require(
42
- "crash-js");
44
+ await import(
45
+ "libcrash-js");
46
+ /* global
47
+ _argv */
48
+ const
49
+ _argv =
50
+ _libcrash._argv;
51
+ /* global
52
+ _basename */
53
+ const
54
+ _basename =
55
+ _libcrash._basename;
43
56
  /* global
44
57
  _cmdline_check */
45
58
  const
46
59
  _cmdline_check =
47
60
  _libcrash._cmdline_check;
61
+ /* global
62
+ _echo */
63
+ const
64
+ _echo =
65
+ _libcrash._echo;
48
66
  /* global
49
67
  _error_display */
50
68
  const
@@ -55,6 +73,16 @@ const
55
73
  const
56
74
  _exit =
57
75
  _libcrash._exit;
76
+ /* global
77
+ _get */
78
+ const
79
+ _get =
80
+ _libcrash._get;
81
+ /* global
82
+ _global_get */
83
+ const
84
+ _global_get =
85
+ _libcrash._global_get;
58
86
  /* global
59
87
  _msg_info */
60
88
  const
@@ -75,6 +103,11 @@ const
75
103
  const
76
104
  _printf =
77
105
  _libcrash._printf;
106
+ /* global
107
+ _set */
108
+ const
109
+ _set =
110
+ _libcrash._set;
78
111
  /* global
79
112
  _sleep */
80
113
  const
@@ -82,7 +115,7 @@ const
82
115
  _libcrash._sleep;
83
116
  const
84
117
  _contract_get_module =
85
- require(
118
+ await import(
86
119
  './contract-get');
87
120
  /* global
88
121
  _contract_get */
@@ -92,66 +125,96 @@ const
92
125
 
93
126
  function
94
127
  _global_variables() {
95
- app_name =
96
- "evm-contract-call-static";
97
- app_opts =
98
- [];
128
+ _set(
129
+ "app",
130
+ "name",
131
+ "evm-contract-call-static");
132
+ _set(
133
+ "app",
134
+ "opts",
135
+ []);
99
136
  /* global
100
137
  wallet_seed:
101
138
  writable */
102
- wallet_seed =
103
- "";
139
+ _set(
140
+ "wallet",
141
+ "seed",
142
+ "");
104
143
  /* global
105
144
  retries_max:
106
145
  writable */
107
- retries_max =
108
- "";
146
+ _set(
147
+ "retries",
148
+ "max",
149
+ "");
109
150
  /* global
110
151
  api_key_path:
111
152
  writable */
112
- api_key_path =
113
- "";
153
+ _set(
154
+ "api_key",
155
+ "path",
156
+ "");
114
157
  /* global
115
158
  target_network:
116
159
  writable */
117
- target_network =
118
- "";
160
+ _set(
161
+ "target",
162
+ "network",
163
+ "");
119
164
  /* global
120
165
  contract_address:
121
166
  writable */
122
- contract_address =
123
- "";
167
+ _set(
168
+ "contract",
169
+ "address",
170
+ "");
124
171
  /* global
125
172
  contract_abi_path:
126
173
  writable */
127
- contract_abi_path =
128
- "";
174
+ _set(
175
+ "contract_abi",
176
+ "path",
177
+ "");
129
178
  /* global
130
179
  contract_bytecode_path:
131
180
  writable */
132
- contract_bytecode_path =
133
- "";
181
+ _set(
182
+ "contract_bytecode",
183
+ "path",
184
+ "");
134
185
  /* global
135
186
  contract_compiler_output_path:
136
187
  writable */
137
- contract_compiler_output_path =
138
- "";
188
+ _set(
189
+ "contract_compiler_output",
190
+ "path",
191
+ "");
139
192
  /* global
140
193
  method_object:
141
194
  writable */
142
- method_object =
143
- "";
195
+ _set(
196
+ "method",
197
+ "object",
198
+ "");
144
199
  /* global
145
200
  contract_method:
146
201
  writable */
147
- contract_method =
148
- "";
202
+ _set(
203
+ "contract",
204
+ "method",
205
+ "");
149
206
  /* global
150
207
  method_args:
151
208
  writable */
152
- method_args =
153
- [];
154
- quiet =
209
+ _set(
210
+ "method",
211
+ "args",
212
+ []);
213
+ const
214
+ _global =
215
+ _global_get();
216
+ _global[
217
+ "quiet"] =
155
218
  "";
156
219
  }
157
220
 
@@ -311,9 +374,14 @@ function
311
374
  _method_args =
312
375
  method_args.join(
313
376
  " ");
377
+ const
378
+ _program =
379
+ _basename(
380
+ _argv[
381
+ 0]);
314
382
  const
315
383
  _text = [
316
- ` ${app_name} configuration:`,
384
+ ` ${_program} configuration:`,
317
385
  ` Wallet seed: ${wallet_seed}`,
318
386
  ` Max retries: ${retries_max}`,
319
387
  ` API Key path: ${api_key_path}`,
@@ -336,12 +404,17 @@ function
336
404
  _exit_code) {
337
405
  let
338
406
  _line;
407
+ const
408
+ _program =
409
+ _basename(
410
+ _argv[
411
+ 0]);
339
412
  const
340
413
  _text = [
341
414
  "Execute a static call to an EVM network's contract method",
342
415
  "",
343
416
  "Usage:",
344
- " evm-contract-call-static",
417
+ ` ${_program}`,
345
418
  " <quiet>",
346
419
  " <wallet-seed>",
347
420
  " <retries-max>",
@@ -495,7 +568,7 @@ async function
495
568
  }
496
569
 
497
570
 
498
- if ( _cmdline_check(
571
+ if ( await _cmdline_check(
499
572
  "evm-contract-call-static") ) {
500
573
  _global_variables();
501
574
  _cmdline_parse();
@@ -518,8 +591,12 @@ if ( _cmdline_check(
518
591
  app_opts);
519
592
  }
520
593
 
521
- module.exports = {
522
- _contract_call_static:
523
- _contract_call_static
594
+ export {
595
+ _contract_call_static
524
596
  };
525
597
 
598
+ // module.exports = {
599
+ // _contract_call_static:
600
+ // _contract_call_static
601
+ // };
602
+