evm-contracts-tools 0.0.37 → 0.0.39

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 (30) hide show
  1. package/Makefile +12 -0
  2. package/dist/evm-contract-call/fs-worker.js +1 -0
  3. package/dist/evm-contract-deployment-address/fs-worker.js +1 -0
  4. package/dist/evm-contract-deployment-address/index.html +31 -0
  5. package/dist/evm-contract-deployment-deployment-networks +1 -0
  6. package/dist/evm-contract-deployment-networks/index.html +31 -0
  7. package/dist/evm-contract-deployment-versions/fs-worker.js +1 -0
  8. package/dist/evm-contract-deployment-versions/index.html +33 -0
  9. package/dist/evm-contract-deployments-dir/fs-worker.js +1 -0
  10. package/dist/evm-contracts-tools/fs-worker.js +1 -0
  11. package/dist/libevm-contract-call/fs-worker.js +1 -1
  12. package/dist/libevm-contract-deployment-address/fs-worker.js +1 -0
  13. package/dist/libevm-contract-deployment-address/index.html +24 -0
  14. package/dist/libevm-contract-deployment-deployment-networks +1 -0
  15. package/dist/libevm-contract-deployment-networks/index.html +24 -0
  16. package/dist/libevm-contract-deployment-versions/fs-worker.js +1 -0
  17. package/dist/libevm-contract-deployment-versions/index.html +33 -0
  18. package/dist/libevm-contract-deployments-dir/fs-worker.js +1 -0
  19. package/dist/libevm-contracts-tools +1 -0
  20. package/evm-contract-deployment-address +453 -0
  21. package/evm-contract-deployment-networks +440 -0
  22. package/evm-contract-deployment-versions +392 -0
  23. package/lib/address-check +0 -0
  24. package/lib/evm-contract-call-dynamic +0 -0
  25. package/lib/evm-contract-call-static +0 -0
  26. package/libevm-contract-deployment-address +439 -0
  27. package/libevm-contract-deployment-networks +295 -0
  28. package/libevm-contract-deployment-versions +113 -0
  29. package/libevm-contract-deployments-dir +0 -81
  30. package/package.json +73 -23
@@ -0,0 +1,440 @@
1
+ #!/usr/bin/env node
2
+
3
+ // SPDX-License-Identifier: AGPL-3.0-or-later
4
+
5
+ /** ----------------------------------------------------------------
6
+ * evm-contract-deployment-networks.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
+ _printf */
74
+ const
75
+ _printf =
76
+ _libcrash._printf;
77
+ /* global
78
+ _process_exit */
79
+ const
80
+ _process_exit =
81
+ _libcrash._process_exit;
82
+ /* global
83
+ _stat */
84
+ const
85
+ _stat =
86
+ _libcrash._stat;
87
+ const
88
+ _libevm_contract_deployment_networks_module =
89
+ require(
90
+ "./libevm-contract-deployment-networks");
91
+ /* global
92
+ _evm_contract_deployment_networks */
93
+ const
94
+ _evm_contract_deployment_networks =
95
+ _libevm_contract_deployment_networks_module._evm_contract_deployment_networks;
96
+
97
+ function
98
+ _global_variables() {
99
+ /* global
100
+ app_name:
101
+ writable */
102
+ app_name =
103
+ "evm-contract-deployments-networks.js";
104
+ /* global
105
+ app_opts:
106
+ writable */
107
+ app_opts =
108
+ [];
109
+ /* global
110
+ runtime_environment:
111
+ writable */
112
+ runtime_environment =
113
+ "";
114
+ /* global
115
+ resolve_date:
116
+ writable */
117
+ resolve_date =
118
+ "";
119
+ /* global
120
+ deployments_dir:
121
+ writable */
122
+ deployments_dir =
123
+ "";
124
+ /* global
125
+ display_all:
126
+ writable */
127
+ display_all =
128
+ "";
129
+ /* global
130
+ display_safest:
131
+ writable */
132
+ display_safest =
133
+ "";
134
+ /* global
135
+ display_cheapest:
136
+ writable */
137
+ display_cheapest =
138
+ "";
139
+ quiet =
140
+ "";
141
+ /* global
142
+ verbose:
143
+ writable */
144
+ verbose =
145
+ "";
146
+ }
147
+
148
+ async function
149
+ _overrides_set(
150
+ _help_display) {
151
+ if ( resolve_date == "" ||
152
+ typeof(
153
+ resolve_date) == "undefined" ) {
154
+ resolve_date =
155
+ _get_date_human();
156
+ }
157
+ if ( display_all == "" ) {
158
+ display_all =
159
+ "y";
160
+ }
161
+ if ( display_cheapest == "" ) {
162
+ display_cheapest =
163
+ "n";
164
+ }
165
+ if ( display_safest == "" ) {
166
+ display_safest =
167
+ "n";
168
+ }
169
+ }
170
+
171
+ function
172
+ _config_show() {
173
+ let
174
+ _line;
175
+ const
176
+ _text = [
177
+ `${app_name} configuration:`,
178
+ ` Resolve date: ${resolve_date}`,
179
+ ` Runtime environment: ${runtime_environment}`,
180
+ ` Display all: ${display_all}`,
181
+ ` Display safest: ${display_safest}`,
182
+ ` Display cheapest: ${display_cheapest}`,
183
+ ` Deployments directory: ${deployments_dir}`,
184
+ ];
185
+ for ( _line of _text ) {
186
+ _msg_info(
187
+ _line);
188
+ }
189
+ }
190
+
191
+ function
192
+ _usage(
193
+ _exit_code) {
194
+ let
195
+ _line;
196
+ const
197
+ _text = [
198
+ "",
199
+ "Returns a contract's deployment available networks",
200
+ "",
201
+ "Usage:",
202
+ "",
203
+ ` ${app_name}`,
204
+ " [options]",
205
+ " <deployment-dir>",
206
+ "",
207
+ " options:",
208
+ "",
209
+ " -A --display-all Display all available networks",
210
+ " for the deployment.",
211
+ ` Default: '${display_all}`,
212
+ "",
213
+ " -S --display-safest Display safest network",
214
+ " for the deployment.",
215
+ ` Default: '${display_safest}`,
216
+ "",
217
+ " -C --display-cheapest Display cheapest network",
218
+ " for the deployment.",
219
+ ` Default: '${display_cheapest}`,
220
+ "",
221
+ " -h --help This message.",
222
+ " -v --verbose Enable verbose output.",
223
+ ""
224
+ ];
225
+ for ( _line of _text ) {
226
+ console.log(
227
+ _line);
228
+ }
229
+ _process_exit(
230
+ _exit_code);
231
+ }
232
+
233
+ async function
234
+ _cmdline_parse() {
235
+ let
236
+ _help_display,
237
+ _msg;
238
+ const
239
+ _argv_args = {
240
+ "booleans": [
241
+ "A",
242
+ "display-all",
243
+ "S",
244
+ "display-safest",
245
+ "C",
246
+ "display-cheapest",
247
+ "h",
248
+ "help",
249
+ "v",
250
+ "verbose"
251
+ ]
252
+ };
253
+ const
254
+ _argv =
255
+ _argv_get(
256
+ _argv_args);
257
+ const
258
+ _options =
259
+ _argv[
260
+ "_"];
261
+ quiet =
262
+ "y";
263
+ runtime_environment =
264
+ "node";
265
+ if ( _argv[
266
+ "h"] ) {
267
+ _help_display =
268
+ true;
269
+ }
270
+ if ( _argv[
271
+ "help"] ) {
272
+ _help_display =
273
+ true;
274
+ }
275
+ if ( ( _options.indexOf(
276
+ "--help") > -1 ||
277
+ _options.indexOf(
278
+ "-h") > -1) ) {
279
+ _help_display =
280
+ true;
281
+ }
282
+ if ( _help_display ) {
283
+ quiet =
284
+ "n";
285
+ await _overrides_set(
286
+ _help_display);
287
+ _usage(
288
+ 0);
289
+ }
290
+ if ( typeof(
291
+ _argv) == "undefined" ||
292
+ _argv[
293
+ "_"].length < 1 ) {
294
+ _msg =
295
+ "A deployment directory " +
296
+ "must be specified.";
297
+ _msg_error(
298
+ _msg,
299
+ 0);
300
+ _usage(
301
+ 1);
302
+ }
303
+ deployments_dir =
304
+ _argv[
305
+ "_"][
306
+ 0];
307
+ if ( _argv[
308
+ "A"] ) {
309
+ display_all =
310
+ _argv[
311
+ "A"];
312
+ }
313
+ if ( _argv[
314
+ "display-all"] ) {
315
+ display_all =
316
+ _argv[
317
+ "display-all"];
318
+ }
319
+ if ( _argv[
320
+ "S"] ) {
321
+ display_safest =
322
+ _argv[
323
+ "S"];
324
+ }
325
+ if ( _argv[
326
+ "display-safest"] ) {
327
+ display_safest =
328
+ _argv[
329
+ "display-safest"];
330
+ }
331
+ if ( _argv[
332
+ "C"] ) {
333
+ display_cheapest =
334
+ _argv[
335
+ "C"];
336
+ }
337
+ if ( _argv[
338
+ "display-cheapest"] ) {
339
+ display_cheapest =
340
+ _argv[
341
+ "display-cheapest"];
342
+ }
343
+ if ( _argv[
344
+ "v"] ||
345
+ _argv[
346
+ "verbose"] ) {
347
+ quiet =
348
+ "n";
349
+ }
350
+ }
351
+
352
+ function
353
+ _url_parse() {
354
+ let
355
+ _method,
356
+ _network;
357
+ runtime_environment =
358
+ "browser";
359
+ display_all =
360
+ _argv_url_get(
361
+ "display_all")[
362
+ 0];
363
+ display_safest =
364
+ _argv_url_get(
365
+ "display_safest")[
366
+ 0];
367
+ display_cheapest =
368
+ _argv_url_get(
369
+ "display_cheapest")[
370
+ 0];
371
+ deployments_dir =
372
+ _argv_url_get(
373
+ "deployments_dir")[
374
+ 0];
375
+ quiet =
376
+ _argv_url_get(
377
+ "quiet");
378
+ if ( quiet.length === 0 ) {
379
+ quiet =
380
+ "n";
381
+ }
382
+ }
383
+
384
+ async function
385
+ _evm_contract_deployment_networks_cmdline(
386
+ _app_opts) {
387
+ let
388
+ _result;
389
+ const
390
+ _results =
391
+ await _evm_contract_deployment_networks.apply(
392
+ null,
393
+ app_opts);
394
+ const
395
+ _results_type =
396
+ typeof(
397
+ _results);
398
+ if ( _results_type == "object" ) {
399
+ for ( _result of _results ) {
400
+ console.log(
401
+ _result);
402
+ }
403
+ }
404
+ else if ( _results_type == "string" ) {
405
+ _printf(
406
+ _results);
407
+ }
408
+ }
409
+
410
+ async function
411
+ _main() {
412
+ const
413
+ _overrides_set_up =
414
+ await _overrides_set();
415
+ _config_show();
416
+ const
417
+ app_opts = [
418
+ deployments_dir,
419
+ display_all,
420
+ display_safest,
421
+ display_cheapest
422
+ ];
423
+ const
424
+ _networks =
425
+ await _evm_contract_deployment_networks.apply(
426
+ null,
427
+ app_opts);
428
+ }
429
+
430
+ _global_variables();
431
+ if ( _cmdline_check(
432
+ "evm-contract-deployment-networks.js") == true ||
433
+ _cmdline_check(
434
+ "evm-contract-deployment-networks") == true ) {
435
+ _cmdline_parse();
436
+ }
437
+ else{
438
+ _url_parse();
439
+ }
440
+ _main();