evm-contracts-tools 0.0.57 → 0.0.64
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.
- package/Makefile +9 -1
- package/dist/evm-contract-call/evm-contract-call.js +1 -1
- package/dist/evm-contract-call/fs-worker.js +1 -1
- package/dist/evm-contract-deployment-abi/evm-contract-deployment-abi.js +1 -1
- package/dist/evm-contract-deployment-abi/fs-worker.js +1 -1
- package/dist/evm-contract-deployment-address/evm-contract-deployment-address.js +1 -1
- package/dist/evm-contract-deployment-address/fs-worker.js +1 -1
- package/dist/evm-contract-deployment-bytecode/evm-contract-deployment-bytecode.js +1 -1
- package/dist/evm-contract-deployment-bytecode/fs-worker.js +1 -1
- package/dist/evm-contract-deployment-compiler-output/evm-contract-deployment-compiler-output.js +1 -1
- package/dist/evm-contract-deployment-compiler-output/fs-worker.js +1 -1
- package/dist/evm-contract-deployment-deployment-networks +1 -1
- package/dist/evm-contract-deployment-networks/evm-contract-deployment-networks.js +1 -1
- package/dist/evm-contract-deployment-versions/evm-contract-deployment-versions.js +1 -1
- package/dist/evm-contract-deployment-versions/fs-worker.js +1 -1
- package/dist/evm-contract-deployments-dir/evm-contract-deployments-dir.js +1 -1
- package/dist/evm-contract-deployments-dir/fs-worker.js +1 -1
- package/dist/evm-contracts-tools/evm-contracts-tools.js +1 -1
- package/dist/evm-contracts-tools/fs-worker.js +1 -1
- package/dist/libevm-contract-call/fs-worker.js +1 -1
- package/dist/libevm-contract-call/libevm-contract-call.js +1 -1
- package/dist/libevm-contract-deployment-abi/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-abi/libevm-contract-deployment-abi.js +1 -1
- package/dist/libevm-contract-deployment-address/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +1 -1
- package/dist/libevm-contract-deployment-bytecode/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-bytecode/libevm-contract-deployment-bytecode.js +1 -1
- package/dist/libevm-contract-deployment-compiler-output/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-compiler-output/libevm-contract-deployment-compiler-output.js +1 -1
- package/dist/libevm-contract-deployment-deployment-networks +1 -1
- package/dist/libevm-contract-deployment-networks/libevm-contract-deployment-networks.js +1 -1
- package/dist/libevm-contract-deployment-versions/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-versions/libevm-contract-deployment-versions.js +1 -1
- package/dist/libevm-contract-deployments-dir/fs-worker.js +1 -1
- package/dist/libevm-contract-deployments-dir/libevm-contract-deployments-dir.js +1 -1
- package/dist/libevm-contracts-tools +1 -1
- package/eslint.config.mjs +1 -1
- package/evm-contract-call +707 -131
- package/evm-contract-deployment-abi +16 -12
- package/evm-contract-deployment-address +15 -12
- package/evm-contract-deployment-bytecode +15 -12
- package/evm-contract-deployment-compiler-output +16 -13
- package/evm-contract-deployment-networks +15 -12
- package/evm-contract-deployment-versions +15 -12
- package/evm-contract-deployments-dir +16 -13
- package/evm-contracts-tools +14 -12
- package/lib/contract-get +169 -39
- package/lib/evm-contract-call-dynamic +1112 -361
- package/lib/evm-contract-call-static +463 -73
- package/libevm-contract-call +651 -303
- package/libevm-contract-deployment +4408 -383
- package/libevm-contract-deployment-abi +287 -91
- package/libevm-contract-deployment-address +292 -56
- package/libevm-contract-deployment-bytecode +275 -80
- package/libevm-contract-deployment-compiler-output +341 -93
- package/libevm-contract-deployments-dir +53 -49
- package/package.json +14 -12
|
@@ -2,25 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
|
|
5
|
-
/**
|
|
5
|
+
/** ----------------------------------------------------------
|
|
6
6
|
* libevm-contract-deployment-compiler-output
|
|
7
|
-
*
|
|
7
|
+
* ----------------------------------------------------------
|
|
8
8
|
* Copyright ©
|
|
9
9
|
* Pellegrino Prevete
|
|
10
10
|
* 2025, 2026
|
|
11
11
|
*
|
|
12
12
|
* All rights reserved
|
|
13
|
-
*
|
|
13
|
+
* ----------------------------------------------------------
|
|
14
14
|
*
|
|
15
|
-
* This program is free software: you can redistribute it
|
|
16
|
-
* modify it under the terms of the GNU General
|
|
17
|
-
* published by the Free Software
|
|
18
|
-
*
|
|
15
|
+
* This program is free software: you can redistribute it
|
|
16
|
+
* and/or modify it under the terms of the GNU General
|
|
17
|
+
* Public License as published by the Free Software
|
|
18
|
+
* Foundation, either version 3 of the License, or
|
|
19
|
+
* (at your option) any later version.
|
|
19
20
|
*
|
|
20
|
-
* This program is distributed in the hope that it will
|
|
21
|
-
* but WITHOUT ANY WARRANTY; without even the
|
|
22
|
-
* MERCHANTABILITY or FITNESS FOR A
|
|
23
|
-
*
|
|
21
|
+
* This program is distributed in the hope that it will
|
|
22
|
+
* be useful, but WITHOUT ANY WARRANTY; without even the
|
|
23
|
+
* implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
24
|
+
* PARTICULAR PURPOSE.
|
|
25
|
+
* See the GNU General Public License for more details.
|
|
24
26
|
*
|
|
25
27
|
* You should have received a copy of the
|
|
26
28
|
* GNU General Public License
|
|
@@ -83,6 +85,11 @@ const
|
|
|
83
85
|
const
|
|
84
86
|
_dir_exists =
|
|
85
87
|
_libcrash_module._dir_exists;
|
|
88
|
+
/* global
|
|
89
|
+
_echo2 */
|
|
90
|
+
const
|
|
91
|
+
_echo2 =
|
|
92
|
+
_libcrash_module._echo2;
|
|
86
93
|
/* global
|
|
87
94
|
_file_exists */
|
|
88
95
|
const
|
|
@@ -98,6 +105,11 @@ const
|
|
|
98
105
|
const
|
|
99
106
|
_from_bash_ass_array =
|
|
100
107
|
_libcrash_module._from_bash_ass_array;
|
|
108
|
+
/* global
|
|
109
|
+
_get */
|
|
110
|
+
const
|
|
111
|
+
_get =
|
|
112
|
+
_libcrash_module._get;
|
|
101
113
|
/* global
|
|
102
114
|
_homedir_get */
|
|
103
115
|
const
|
|
@@ -157,15 +169,6 @@ const
|
|
|
157
169
|
const
|
|
158
170
|
_evm_chains_info =
|
|
159
171
|
_evm_chains_info_module._evm_chains_info;
|
|
160
|
-
const
|
|
161
|
-
_libevm_contract_deployments_dir_module =
|
|
162
|
-
await import(
|
|
163
|
-
"./libevm-contract-deployments-dir");
|
|
164
|
-
/* global
|
|
165
|
-
_evm_contract_deployments_dir */
|
|
166
|
-
const
|
|
167
|
-
_evm_contract_deployments_dir =
|
|
168
|
-
_libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
|
|
169
172
|
const
|
|
170
173
|
_libevm_contract_deployment_module =
|
|
171
174
|
await import(
|
|
@@ -200,6 +203,25 @@ const
|
|
|
200
203
|
const
|
|
201
204
|
_user_deployments_check =
|
|
202
205
|
_libevm_contract_deployment_module._user_deployments_check;
|
|
206
|
+
/* global
|
|
207
|
+
_user_defined_check */
|
|
208
|
+
const
|
|
209
|
+
_user_defined_check =
|
|
210
|
+
_libevm_contract_deployment_module._user_defined_check;
|
|
211
|
+
/* global
|
|
212
|
+
_version_check */
|
|
213
|
+
const
|
|
214
|
+
_version_check =
|
|
215
|
+
_libevm_contract_deployment_module._version_check;
|
|
216
|
+
const
|
|
217
|
+
_libevm_contract_deployments_dir_module =
|
|
218
|
+
await import(
|
|
219
|
+
"./libevm-contract-deployments-dir");
|
|
220
|
+
/* global
|
|
221
|
+
_evm_contract_deployments_dir */
|
|
222
|
+
const
|
|
223
|
+
_evm_contract_deployments_dir =
|
|
224
|
+
_libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
|
|
203
225
|
const
|
|
204
226
|
_libevm_contract_deployment_networks_module =
|
|
205
227
|
await import(
|
|
@@ -209,68 +231,200 @@ const
|
|
|
209
231
|
const
|
|
210
232
|
_evm_contract_deployment_networks =
|
|
211
233
|
_libevm_contract_deployment_networks_module._evm_contract_deployment_networks;
|
|
212
|
-
const
|
|
213
|
-
_libevm_contract_deployment_versions_module =
|
|
214
|
-
await import(
|
|
215
|
-
"./libevm-contract-deployment-versions");
|
|
216
|
-
/* global
|
|
217
|
-
_evm_contract_deployment_versions */
|
|
218
|
-
const
|
|
219
|
-
_evm_contract_deployment_versions =
|
|
220
|
-
_libevm_contract_deployment_versions_module._evm_contract_deployment_versions;
|
|
221
234
|
|
|
222
|
-
function
|
|
235
|
+
async function
|
|
223
236
|
_contract_compiler_output_get(
|
|
224
237
|
_deployments,
|
|
238
|
+
_app,
|
|
225
239
|
_contract,
|
|
226
240
|
_network,
|
|
227
241
|
_network_id,
|
|
228
242
|
_version,
|
|
229
|
-
_configuration_format
|
|
243
|
+
_configuration_format,
|
|
244
|
+
_user_defined) {
|
|
230
245
|
let
|
|
246
|
+
_break,
|
|
231
247
|
_compiler_output,
|
|
232
248
|
_compiler_output_path,
|
|
249
|
+
_compiler_output_retrieve,
|
|
233
250
|
_found,
|
|
234
251
|
_msg,
|
|
235
|
-
_net
|
|
252
|
+
_net,
|
|
253
|
+
_non_empty_networks;
|
|
236
254
|
const
|
|
237
255
|
_networks = [
|
|
238
256
|
_network,
|
|
239
257
|
_network_id
|
|
240
258
|
];
|
|
259
|
+
_non_empty_networks =
|
|
260
|
+
false;
|
|
241
261
|
_found =
|
|
242
262
|
false;
|
|
243
263
|
for ( _net of _networks ) {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
264
|
+
_compiler_output_retrieve =
|
|
265
|
+
false;
|
|
266
|
+
_break =
|
|
267
|
+
false;
|
|
268
|
+
if ( _net.length < 1 ) {
|
|
269
|
+
_msg =
|
|
270
|
+
`Empty value network '${_net}', ` +
|
|
271
|
+
"skipping.";
|
|
272
|
+
_msg_info(
|
|
273
|
+
_msg);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
_compiler_output_retrieve =
|
|
277
|
+
true;
|
|
278
|
+
}
|
|
279
|
+
if ( _compiler_output_retrieve ) {
|
|
280
|
+
_non_empty_networks =
|
|
254
281
|
true;
|
|
282
|
+
_msg =
|
|
283
|
+
"Getting compiler output for network " +
|
|
284
|
+
`'${_net}'.`;
|
|
285
|
+
_msg_info(
|
|
286
|
+
_msg);
|
|
287
|
+
const
|
|
288
|
+
_version_check_args = [
|
|
289
|
+
_version,
|
|
290
|
+
_app, // app
|
|
291
|
+
_contract,
|
|
292
|
+
"", // address
|
|
293
|
+
_net,
|
|
294
|
+
_user_defined,
|
|
295
|
+
_deployments,
|
|
296
|
+
"", // config file
|
|
297
|
+
_configuration_format
|
|
298
|
+
];
|
|
299
|
+
try {
|
|
300
|
+
_version =
|
|
301
|
+
await _version_check.apply(
|
|
302
|
+
null,
|
|
303
|
+
_version_check_args);
|
|
304
|
+
}
|
|
305
|
+
catch(
|
|
306
|
+
_error) {
|
|
307
|
+
_msg =
|
|
308
|
+
"Error running '_version_check' " +
|
|
309
|
+
"with arguments:";
|
|
310
|
+
_msg_error(
|
|
311
|
+
_msg,
|
|
312
|
+
0);
|
|
313
|
+
_echo2(
|
|
314
|
+
_version_check_args);
|
|
315
|
+
_echo2(
|
|
316
|
+
_error);
|
|
317
|
+
throw _error;
|
|
318
|
+
}
|
|
319
|
+
_msg =
|
|
320
|
+
`Checked version '${_version}'.`;
|
|
321
|
+
_msg_info(
|
|
322
|
+
_msg);
|
|
323
|
+
_compiler_output_path =
|
|
324
|
+
_path_join( [
|
|
325
|
+
_deployments,
|
|
326
|
+
_contract,
|
|
327
|
+
_net,
|
|
328
|
+
_version,
|
|
329
|
+
`${_contract}.json`
|
|
330
|
+
]);
|
|
331
|
+
_msg =
|
|
332
|
+
`Checking file '${_compiler_output_path}'.`;
|
|
333
|
+
_msg_info(
|
|
334
|
+
_msg);
|
|
335
|
+
if ( _file_exists(
|
|
336
|
+
_compiler_output_path) ) {
|
|
337
|
+
_found =
|
|
338
|
+
true;
|
|
339
|
+
_break =
|
|
340
|
+
true;
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
_msg =
|
|
344
|
+
`Compiler output at path '${_compiler_output_path}' ` +
|
|
345
|
+
`not found.`;
|
|
346
|
+
_msg_info(
|
|
347
|
+
_msg);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if ( _break ) {
|
|
351
|
+
_msg =
|
|
352
|
+
"File found, breaking loop.";
|
|
353
|
+
_msg_info(
|
|
354
|
+
_msg);
|
|
255
355
|
break;
|
|
256
356
|
}
|
|
257
357
|
}
|
|
258
|
-
if ( ! _found
|
|
358
|
+
if ( ! _found &&
|
|
359
|
+
_non_empty_networks ) {
|
|
360
|
+
let
|
|
361
|
+
_error_info;
|
|
259
362
|
_msg =
|
|
260
363
|
`No network '${_network}' deployment ` +
|
|
261
|
-
`configuration
|
|
364
|
+
`configuration (hardhat compiler output) ` +
|
|
365
|
+
`for contract '${_contract}' ` +
|
|
262
366
|
`found at path '${_deployments}'.`;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
367
|
+
_error_info =
|
|
368
|
+
false;
|
|
369
|
+
const
|
|
370
|
+
_contract_abi =
|
|
371
|
+
_get(
|
|
372
|
+
"contract",
|
|
373
|
+
"abi");
|
|
374
|
+
const
|
|
375
|
+
_contract_bytecode =
|
|
376
|
+
_get(
|
|
377
|
+
"contract",
|
|
378
|
+
"bytecode");
|
|
379
|
+
const
|
|
380
|
+
_contract_abi_type =
|
|
381
|
+
typeof(
|
|
382
|
+
_contract_abi);
|
|
383
|
+
const
|
|
384
|
+
_contract_bytecode_type =
|
|
385
|
+
typeof(
|
|
386
|
+
_contract_bytecode);
|
|
387
|
+
if ( _contract_abi_type == "string" &&
|
|
388
|
+
_contract_bytecode_type == "string" ) {
|
|
389
|
+
if ( 0 < _contract_abi.length &&
|
|
390
|
+
0 < _contract_bytecode.length ) {
|
|
391
|
+
if ( _file_exists(
|
|
392
|
+
_contract_abi) &&
|
|
393
|
+
_file_exists(
|
|
394
|
+
_contract_bytecode) ) {
|
|
395
|
+
_error_info =
|
|
396
|
+
true;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
_msg =
|
|
400
|
+
`Either contract abi '${_contract_abi}' ` +
|
|
401
|
+
`or contract bytecode '${_contract_bytecode}' ` +
|
|
402
|
+
`do not exist, so a missing compiler output ` +
|
|
403
|
+
`will trigger an error.`;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if ( _error_info ) {
|
|
408
|
+
_msg_info(
|
|
409
|
+
_msg);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
_msg_error(
|
|
413
|
+
_msg,
|
|
414
|
+
0);
|
|
415
|
+
}
|
|
416
|
+
throw _msg;
|
|
266
417
|
}
|
|
267
418
|
const
|
|
268
419
|
_contract_compiler_output =
|
|
269
420
|
_compiler_output_path;
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
421
|
+
const
|
|
422
|
+
_contract_compiler_output_type =
|
|
423
|
+
typeof(
|
|
424
|
+
_contract_compiler_output);
|
|
425
|
+
if ( _contract_compiler_output === "" ||
|
|
426
|
+
_contract_compiler_output_type === "undefined" ||
|
|
427
|
+
_contract_compiler_output === null ) {
|
|
274
428
|
_msg =
|
|
275
429
|
`No '${_contract}' version '${_version}' ` +
|
|
276
430
|
`contract deployment compiler output for network ` +
|
|
@@ -281,6 +435,10 @@ function
|
|
|
281
435
|
0);
|
|
282
436
|
throw _msg;
|
|
283
437
|
}
|
|
438
|
+
_msg =
|
|
439
|
+
`Got compiler output: '${_contract_compiler_output}'.`;
|
|
440
|
+
_msg_info(
|
|
441
|
+
_msg);
|
|
284
442
|
return _contract_compiler_output;
|
|
285
443
|
}
|
|
286
444
|
|
|
@@ -298,6 +456,7 @@ async function
|
|
|
298
456
|
let
|
|
299
457
|
_args,
|
|
300
458
|
_contract_compiler_output,
|
|
459
|
+
_deployments_dir_get,
|
|
301
460
|
_network,
|
|
302
461
|
_network_check_args,
|
|
303
462
|
_target_network,
|
|
@@ -311,6 +470,59 @@ async function
|
|
|
311
470
|
const
|
|
312
471
|
_contract_compiler_output_get_args =
|
|
313
472
|
[];
|
|
473
|
+
_user_defined =
|
|
474
|
+
_user_defined_check(
|
|
475
|
+
_user_defined);
|
|
476
|
+
const
|
|
477
|
+
_deployments_dir_type =
|
|
478
|
+
typeof(
|
|
479
|
+
_deployments_dir);
|
|
480
|
+
_deployments_dir_get =
|
|
481
|
+
false;
|
|
482
|
+
if ( _deployments_dir_type === "undefined" ) {
|
|
483
|
+
_msg =
|
|
484
|
+
"Deployments directory undefined, getting.";
|
|
485
|
+
_msg_info(
|
|
486
|
+
_msg);
|
|
487
|
+
_deployments_dir_get =
|
|
488
|
+
true;
|
|
489
|
+
}
|
|
490
|
+
else if ( _deployments_dir_type === "string" ) {
|
|
491
|
+
if ( _deployments_dir.length < 1 ) {
|
|
492
|
+
_msg =
|
|
493
|
+
"Deployments directory not set, getting.";
|
|
494
|
+
_msg_info(
|
|
495
|
+
_msg);
|
|
496
|
+
_deployments_dir_get =
|
|
497
|
+
true;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if ( _deployments_dir_get ) {
|
|
501
|
+
const
|
|
502
|
+
_evm_contract_deployments_dir_args = [
|
|
503
|
+
_target_app,
|
|
504
|
+
_user_defined
|
|
505
|
+
];
|
|
506
|
+
try {
|
|
507
|
+
_deployments_dir =
|
|
508
|
+
await _evm_contract_deployments_dir.apply(
|
|
509
|
+
null,
|
|
510
|
+
_evm_contract_deployments_dir_args);
|
|
511
|
+
}
|
|
512
|
+
catch(
|
|
513
|
+
_error) {
|
|
514
|
+
_msg =
|
|
515
|
+
"Error while retrieving system deployments " +
|
|
516
|
+
"directory location for auto-detection.";
|
|
517
|
+
_msg_error(
|
|
518
|
+
_msg,
|
|
519
|
+
0);
|
|
520
|
+
_msg_error(
|
|
521
|
+
_error,
|
|
522
|
+
0);
|
|
523
|
+
throw _error;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
314
526
|
if ( _user_defined == "n" ) {
|
|
315
527
|
if ( _target_app == "" ) {
|
|
316
528
|
_msg =
|
|
@@ -385,52 +597,88 @@ async function
|
|
|
385
597
|
// `network '${_network}'.`;
|
|
386
598
|
// _msg_info(
|
|
387
599
|
// _msg);
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
600
|
+
if ( _network.length < 1 ) {
|
|
601
|
+
_msg =
|
|
602
|
+
"Empty network, skipping.";
|
|
603
|
+
_msg_info(
|
|
604
|
+
_msg);
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
_target_network_id =
|
|
608
|
+
"";
|
|
609
|
+
_network_check_args = [
|
|
610
|
+
_deployments_dir,
|
|
611
|
+
_target_contract,
|
|
612
|
+
_network,
|
|
613
|
+
_target_network_id
|
|
614
|
+
];
|
|
615
|
+
await _network_check.apply(
|
|
616
|
+
null,
|
|
617
|
+
_network_check_args);
|
|
618
|
+
_contract_compiler_output_get_args.push( [
|
|
619
|
+
_deployments_dir,
|
|
620
|
+
_target_app,
|
|
621
|
+
_target_contract,
|
|
622
|
+
_network,
|
|
623
|
+
_target_network_id,
|
|
624
|
+
_contract_version,
|
|
625
|
+
_configuration_format,
|
|
626
|
+
_user_defined
|
|
627
|
+
] );
|
|
628
|
+
}
|
|
407
629
|
}
|
|
408
|
-
for ( _network of
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
630
|
+
for ( _network of _network_ids ) {
|
|
631
|
+
if ( _network.length < 1 ) {
|
|
632
|
+
_msg =
|
|
633
|
+
"Empty network, skipping.";
|
|
634
|
+
_msg_info(
|
|
635
|
+
_msg);
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
_target_network =
|
|
639
|
+
"";
|
|
640
|
+
_network_check_args = [
|
|
641
|
+
_deployments_dir,
|
|
642
|
+
_target_contract,
|
|
643
|
+
_target_network,
|
|
644
|
+
_network
|
|
645
|
+
];
|
|
646
|
+
await _network_check.apply(
|
|
647
|
+
null,
|
|
648
|
+
_network_check_args);
|
|
649
|
+
_contract_compiler_output_get_args.push( [
|
|
650
|
+
_deployments_dir,
|
|
651
|
+
_target_app,
|
|
652
|
+
_target_contract,
|
|
653
|
+
_target_network,
|
|
654
|
+
_network,
|
|
655
|
+
_contract_version,
|
|
656
|
+
_configuration_format,
|
|
657
|
+
_user_defined
|
|
658
|
+
] );
|
|
659
|
+
}
|
|
428
660
|
}
|
|
429
661
|
for ( _args of _contract_compiler_output_get_args ) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
662
|
+
try {
|
|
663
|
+
_contract_compiler_output =
|
|
664
|
+
await _contract_compiler_output_get.apply(
|
|
665
|
+
null,
|
|
666
|
+
_args);
|
|
667
|
+
}
|
|
668
|
+
catch(
|
|
669
|
+
_error) {
|
|
670
|
+
_msg =
|
|
671
|
+
"Error running '_contract_compiler_output_get' " +
|
|
672
|
+
"with parameters:";
|
|
673
|
+
_msg_error(
|
|
674
|
+
_msg,
|
|
675
|
+
0);
|
|
676
|
+
_echo2(
|
|
433
677
|
_args);
|
|
678
|
+
_echo2(
|
|
679
|
+
_error);
|
|
680
|
+
throw _error;
|
|
681
|
+
}
|
|
434
682
|
_contracts_compiler_outputs.push(
|
|
435
683
|
_contract_compiler_output);
|
|
436
684
|
}
|
|
@@ -2,25 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
|
|
5
|
-
/**
|
|
5
|
+
/** ----------------------------------------------------------
|
|
6
6
|
* libevm-contract-deployments-dir
|
|
7
|
-
*
|
|
7
|
+
* ----------------------------------------------------------
|
|
8
8
|
* Copyright ©
|
|
9
9
|
* Pellegrino Prevete
|
|
10
|
-
* 2025, 2026
|
|
10
|
+
* 2024, 2025, 2026
|
|
11
11
|
*
|
|
12
12
|
* All rights reserved
|
|
13
|
-
*
|
|
13
|
+
* ----------------------------------------------------------
|
|
14
14
|
*
|
|
15
|
-
* This program is free software: you can redistribute it
|
|
16
|
-
* modify it under the terms of the GNU General
|
|
17
|
-
* published by the Free Software
|
|
18
|
-
*
|
|
15
|
+
* This program is free software: you can redistribute it
|
|
16
|
+
* and/or modify it under the terms of the GNU General
|
|
17
|
+
* Public License as published by the Free Software
|
|
18
|
+
* Foundation, either version 3 of the License, or
|
|
19
|
+
* (at your option) any later version.
|
|
19
20
|
*
|
|
20
|
-
* This program is distributed in the hope that it will
|
|
21
|
-
* but WITHOUT ANY WARRANTY; without even the
|
|
22
|
-
* MERCHANTABILITY or FITNESS FOR A
|
|
23
|
-
*
|
|
21
|
+
* This program is distributed in the hope that it will
|
|
22
|
+
* be useful, but WITHOUT ANY WARRANTY; without even the
|
|
23
|
+
* implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
24
|
+
* PARTICULAR PURPOSE.
|
|
25
|
+
* See the GNU General Public License for more details.
|
|
24
26
|
*
|
|
25
27
|
* You should have received a copy of the
|
|
26
28
|
* GNU General Public License
|
|
@@ -55,44 +57,28 @@ const
|
|
|
55
57
|
const
|
|
56
58
|
_msg_error =
|
|
57
59
|
_libcrash_module._msg_error;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"No application specified.";
|
|
73
|
-
_error_flag =
|
|
74
|
-
true;
|
|
75
|
-
}
|
|
76
|
-
if ( _app_type != "string" ) {
|
|
77
|
-
_msg =
|
|
78
|
-
"Application argument must be of " +
|
|
79
|
-
"type string.";
|
|
80
|
-
_error_flag =
|
|
81
|
-
true;
|
|
82
|
-
}
|
|
83
|
-
if ( _error_flag ) {
|
|
84
|
-
_msg_error(
|
|
85
|
-
_msg,
|
|
86
|
-
1);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
60
|
+
const
|
|
61
|
+
_libevm_contract_deployment_module =
|
|
62
|
+
await import(
|
|
63
|
+
"./libevm-contract-deployment");
|
|
64
|
+
/* global
|
|
65
|
+
_app_check */
|
|
66
|
+
const
|
|
67
|
+
_app_check =
|
|
68
|
+
_libevm_contract_deployment_module._app_check;
|
|
69
|
+
/* global
|
|
70
|
+
_user_level_check */
|
|
71
|
+
const
|
|
72
|
+
_user_level_check =
|
|
73
|
+
_libevm_contract_deployment_module._user_level_check;
|
|
89
74
|
|
|
90
75
|
async function
|
|
91
76
|
_default_deployments_dir_get(
|
|
92
77
|
_app,
|
|
93
78
|
_type) {
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
_app =
|
|
80
|
+
_app_check(
|
|
81
|
+
_app);
|
|
96
82
|
if ( typeof(
|
|
97
83
|
_type) == "undefined" ||
|
|
98
84
|
_type == "" ) {
|
|
@@ -120,9 +106,16 @@ async function
|
|
|
120
106
|
_app,
|
|
121
107
|
_user_level) {
|
|
122
108
|
let
|
|
123
|
-
_deployment_type
|
|
124
|
-
|
|
125
|
-
|
|
109
|
+
_deployment_type,
|
|
110
|
+
_deployments,
|
|
111
|
+
_msg;
|
|
112
|
+
_app =
|
|
113
|
+
_app_check(
|
|
114
|
+
_app,
|
|
115
|
+
false);
|
|
116
|
+
_user_level =
|
|
117
|
+
_user_level_check(
|
|
118
|
+
_user_level);
|
|
126
119
|
if ( _user_level == "n" ) {
|
|
127
120
|
_deployment_type =
|
|
128
121
|
"system";
|
|
@@ -141,11 +134,22 @@ async function
|
|
|
141
134
|
0);
|
|
142
135
|
throw _msg;
|
|
143
136
|
}
|
|
144
|
-
|
|
137
|
+
try {
|
|
145
138
|
_deployments =
|
|
146
139
|
await _default_deployments_dir_get(
|
|
147
140
|
_app,
|
|
148
141
|
_deployment_type);
|
|
142
|
+
}
|
|
143
|
+
catch(
|
|
144
|
+
_error) {
|
|
145
|
+
_msg =
|
|
146
|
+
"Error running '_default_deployments_dir_get' " +
|
|
147
|
+
"with arguments:";
|
|
148
|
+
_msg_error(
|
|
149
|
+
_msg,
|
|
150
|
+
0);
|
|
151
|
+
throw _error;
|
|
152
|
+
}
|
|
149
153
|
return _deployments;
|
|
150
154
|
}
|
|
151
155
|
|