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
|
@@ -83,6 +83,16 @@ const
|
|
|
83
83
|
const
|
|
84
84
|
_dir_exists =
|
|
85
85
|
_libcrash_module._dir_exists;
|
|
86
|
+
/* global
|
|
87
|
+
_echo */
|
|
88
|
+
const
|
|
89
|
+
_echo =
|
|
90
|
+
_libcrash_module._echo;
|
|
91
|
+
/* global
|
|
92
|
+
_echo2 */
|
|
93
|
+
const
|
|
94
|
+
_echo2 =
|
|
95
|
+
_libcrash_module._echo2;
|
|
86
96
|
/* global
|
|
87
97
|
_file_exists */
|
|
88
98
|
const
|
|
@@ -98,6 +108,11 @@ const
|
|
|
98
108
|
const
|
|
99
109
|
_from_bash_ass_array =
|
|
100
110
|
_libcrash_module._from_bash_ass_array;
|
|
111
|
+
/* global
|
|
112
|
+
_global_get */
|
|
113
|
+
const
|
|
114
|
+
_global_get =
|
|
115
|
+
_libcrash_module._global_get;
|
|
101
116
|
/* global
|
|
102
117
|
_homedir_get */
|
|
103
118
|
const
|
|
@@ -149,27 +164,19 @@ const
|
|
|
149
164
|
_require =
|
|
150
165
|
_libcrash_module._require;
|
|
151
166
|
const
|
|
152
|
-
|
|
153
|
-
await _require(
|
|
154
|
-
"evm-chains-info");
|
|
155
|
-
/* global
|
|
156
|
-
_evm_chains_info */
|
|
157
|
-
const
|
|
158
|
-
_evm_chains_info =
|
|
159
|
-
_evm_chains_info_module._evm_chains_info;
|
|
160
|
-
const
|
|
161
|
-
_libevm_contract_deployments_dir_module =
|
|
167
|
+
_libevm_contract_deployment_module =
|
|
162
168
|
await import(
|
|
163
|
-
"./libevm-contract-
|
|
169
|
+
"./libevm-contract-deployment");
|
|
164
170
|
/* global
|
|
165
|
-
|
|
171
|
+
_config_file_path_check */
|
|
166
172
|
const
|
|
167
|
-
|
|
168
|
-
|
|
173
|
+
_config_file_path_check =
|
|
174
|
+
_libevm_contract_deployment_module._config_file_path_check;
|
|
175
|
+
/* global
|
|
176
|
+
_configuration_format_check */
|
|
169
177
|
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
"./libevm-contract-deployment");
|
|
178
|
+
_configuration_format_check =
|
|
179
|
+
_libevm_contract_deployment_module._configuration_format_check;
|
|
173
180
|
/* global
|
|
174
181
|
_contract_version_auto_detect */
|
|
175
182
|
const
|
|
@@ -209,17 +216,8 @@ const
|
|
|
209
216
|
const
|
|
210
217
|
_evm_contract_deployment_networks =
|
|
211
218
|
_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
219
|
|
|
222
|
-
function
|
|
220
|
+
async function
|
|
223
221
|
_contract_address_get(
|
|
224
222
|
_deployments,
|
|
225
223
|
_contract,
|
|
@@ -231,16 +229,31 @@ function
|
|
|
231
229
|
_config,
|
|
232
230
|
_config_file_ext,
|
|
233
231
|
_config_path,
|
|
232
|
+
_evm_contract_deployment_versions_args,
|
|
233
|
+
_libevm_contract_deployment_versions_module,
|
|
234
234
|
_found,
|
|
235
235
|
_key_name,
|
|
236
236
|
_msg,
|
|
237
237
|
_net;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
238
|
+
const
|
|
239
|
+
_global =
|
|
240
|
+
_global_get();
|
|
241
|
+
const
|
|
242
|
+
_quiet =
|
|
243
|
+
_global[
|
|
244
|
+
"quiet"];
|
|
245
|
+
_msg =
|
|
246
|
+
"Reading address from " +
|
|
247
|
+
"configuration file.";
|
|
248
|
+
_msg_info(
|
|
249
|
+
_msg);
|
|
250
|
+
const
|
|
251
|
+
_version_type =
|
|
252
|
+
typeof(
|
|
253
|
+
_version);
|
|
254
|
+
_configuration_format =
|
|
255
|
+
_configuration_format_check(
|
|
256
|
+
_configuration_format);
|
|
244
257
|
if ( _configuration_format == "bash" ) {
|
|
245
258
|
_config_file_ext =
|
|
246
259
|
"sh";
|
|
@@ -304,13 +317,78 @@ function
|
|
|
304
317
|
_key_name =
|
|
305
318
|
"contract_address";
|
|
306
319
|
}
|
|
320
|
+
else {
|
|
321
|
+
_msg =
|
|
322
|
+
"Unknown configuration format " +
|
|
323
|
+
`'${_configuration_format}'.`;
|
|
324
|
+
_msg_error(
|
|
325
|
+
_msg,
|
|
326
|
+
0);
|
|
327
|
+
throw _msg;
|
|
328
|
+
}
|
|
329
|
+
if ( _version_type === "undefined" ||
|
|
330
|
+
_version == "" ) {
|
|
331
|
+
_msg =
|
|
332
|
+
"No version selected, " +
|
|
333
|
+
"retrieving.";
|
|
334
|
+
_msg_info(
|
|
335
|
+
_msg);
|
|
336
|
+
_libevm_contract_deployment_versions_module =
|
|
337
|
+
await import(
|
|
338
|
+
"./libevm-contract-deployment-versions");
|
|
339
|
+
const
|
|
340
|
+
_evm_contract_deployment_versions =
|
|
341
|
+
_libevm_contract_deployment_versions_module._evm_contract_deployment_versions;
|
|
342
|
+
_evm_contract_deployment_versions_args = [
|
|
343
|
+
_config_path,
|
|
344
|
+
"y", // display highest
|
|
345
|
+
"n", // display lowest
|
|
346
|
+
_configuration_format
|
|
347
|
+
];
|
|
348
|
+
try {
|
|
349
|
+
_msg =
|
|
350
|
+
"Running '_evm_contract_deployment_versions' " +
|
|
351
|
+
"with arguments:";
|
|
352
|
+
_msg_info(
|
|
353
|
+
_msg);
|
|
354
|
+
if ( _quiet == "n" ) {
|
|
355
|
+
_echo(
|
|
356
|
+
_evm_contract_deployment_versions_args);
|
|
357
|
+
}
|
|
358
|
+
_version =
|
|
359
|
+
await _evm_contract_deployment_versions.apply(
|
|
360
|
+
null,
|
|
361
|
+
_evm_contract_deployment_versions_args);
|
|
362
|
+
_msg =
|
|
363
|
+
"Got contract version " +
|
|
364
|
+
`'${_version}'.`;
|
|
365
|
+
_msg_info(
|
|
366
|
+
_msg);
|
|
367
|
+
}
|
|
368
|
+
catch(
|
|
369
|
+
_error) {
|
|
370
|
+
_msg =
|
|
371
|
+
"Error while running " +
|
|
372
|
+
"'_evm_contract_deployment_versions' with arguments:";
|
|
373
|
+
_msg_error(
|
|
374
|
+
_msg,
|
|
375
|
+
0);
|
|
376
|
+
_echo2(
|
|
377
|
+
_evm_contract_deployment_versions_args);
|
|
378
|
+
throw _error;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
307
381
|
const
|
|
308
382
|
_contract_address =
|
|
309
383
|
_config[
|
|
310
384
|
_key_name][
|
|
311
385
|
_version];
|
|
312
|
-
|
|
313
|
-
|
|
386
|
+
const
|
|
387
|
+
_contract_address_type =
|
|
388
|
+
typeof(
|
|
389
|
+
_contract_address);
|
|
390
|
+
if ( _contract_address_type === "undefined" ||
|
|
391
|
+
_contract_address == "" ) {
|
|
314
392
|
_msg =
|
|
315
393
|
`No '${_contract}' version '${_version}' ` +
|
|
316
394
|
`contract deployment specified for network ` +
|
|
@@ -321,6 +399,12 @@ function
|
|
|
321
399
|
0);
|
|
322
400
|
throw _msg;
|
|
323
401
|
}
|
|
402
|
+
else if ( _contract_address_type == "string" ) {
|
|
403
|
+
_msg =
|
|
404
|
+
`Got contract address '${_contract_address}'`;
|
|
405
|
+
_msg_info(
|
|
406
|
+
_msg);
|
|
407
|
+
}
|
|
324
408
|
return _contract_address;
|
|
325
409
|
}
|
|
326
410
|
|
|
@@ -336,23 +420,81 @@ async function
|
|
|
336
420
|
_configuration_format,
|
|
337
421
|
_deployments_dir) {
|
|
338
422
|
let
|
|
423
|
+
_address,
|
|
339
424
|
_args,
|
|
340
425
|
_contract_address,
|
|
426
|
+
_msg,
|
|
341
427
|
_network,
|
|
342
428
|
_network_check_args,
|
|
343
429
|
_target_network,
|
|
344
430
|
_target_network_id,
|
|
345
431
|
_user_deployments_dir,
|
|
346
|
-
_system_deployments_dir
|
|
347
|
-
|
|
432
|
+
_system_deployments_dir;
|
|
433
|
+
_configuration_format =
|
|
434
|
+
_configuration_format_check(
|
|
435
|
+
_configuration_format);
|
|
436
|
+
const
|
|
437
|
+
_global =
|
|
438
|
+
_global_get();
|
|
439
|
+
const
|
|
440
|
+
_quiet =
|
|
441
|
+
_global[
|
|
442
|
+
"quiet"];
|
|
443
|
+
const
|
|
444
|
+
_libevm_contract_deployments_dir_module =
|
|
445
|
+
await import(
|
|
446
|
+
"./libevm-contract-deployments-dir");
|
|
447
|
+
const
|
|
448
|
+
_evm_contract_deployments_dir =
|
|
449
|
+
_libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
|
|
348
450
|
const
|
|
349
451
|
_contracts_addresses =
|
|
350
452
|
[];
|
|
351
453
|
const
|
|
352
454
|
_contract_address_get_args =
|
|
353
455
|
[];
|
|
456
|
+
const
|
|
457
|
+
_user_defined_type =
|
|
458
|
+
typeof(
|
|
459
|
+
_user_defined);
|
|
460
|
+
const
|
|
461
|
+
_deployments_dir_type =
|
|
462
|
+
typeof(
|
|
463
|
+
_deployments_dir);
|
|
464
|
+
if ( _user_defined_type === "undefined" ||
|
|
465
|
+
_user_defined === "" ) {
|
|
466
|
+
_msg =
|
|
467
|
+
"User defined not specified, setting " +
|
|
468
|
+
"default (n).";
|
|
469
|
+
_msg_info(
|
|
470
|
+
_msg);
|
|
471
|
+
_user_defined =
|
|
472
|
+
"n";
|
|
473
|
+
}
|
|
474
|
+
if ( _deployments_dir_type === "undefined" ||
|
|
475
|
+
_deployments_dir === "" ) {
|
|
476
|
+
try {
|
|
477
|
+
_deployments_dir =
|
|
478
|
+
await _evm_contract_deployments_dir(
|
|
479
|
+
_target_app,
|
|
480
|
+
_user_defined);
|
|
481
|
+
}
|
|
482
|
+
catch(
|
|
483
|
+
_error) {
|
|
484
|
+
_msg =
|
|
485
|
+
"Error while retrieving system deployments " +
|
|
486
|
+
"directory location for auto-detection.";
|
|
487
|
+
_msg_error(
|
|
488
|
+
_msg,
|
|
489
|
+
0);
|
|
490
|
+
_msg_error(
|
|
491
|
+
_error,
|
|
492
|
+
0);
|
|
493
|
+
throw _error;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
354
496
|
if ( _user_defined == "n" ) {
|
|
355
|
-
if ( _target_app
|
|
497
|
+
if ( _target_app === "" ) {
|
|
356
498
|
_msg =
|
|
357
499
|
"A target application needs to " +
|
|
358
500
|
"be specified with option '-a' " +
|
|
@@ -365,10 +507,25 @@ async function
|
|
|
365
507
|
0);
|
|
366
508
|
throw _msg;
|
|
367
509
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
510
|
+
try {
|
|
511
|
+
_system_deployments_dir =
|
|
512
|
+
await _evm_contract_deployments_dir(
|
|
513
|
+
_target_app,
|
|
514
|
+
_user_defined);
|
|
515
|
+
}
|
|
516
|
+
catch(
|
|
517
|
+
_error) {
|
|
518
|
+
_msg =
|
|
519
|
+
"Error while retrieving system deployments " +
|
|
520
|
+
"directory location.";
|
|
521
|
+
_msg_error(
|
|
522
|
+
_msg,
|
|
523
|
+
0);
|
|
524
|
+
_msg_error(
|
|
525
|
+
_error,
|
|
526
|
+
0);
|
|
527
|
+
throw _error;
|
|
528
|
+
}
|
|
372
529
|
if ( _deployments_dir != _system_deployments_dir ) {
|
|
373
530
|
_msg =
|
|
374
531
|
"To set a custom deployments directory path " +
|
|
@@ -382,10 +539,25 @@ async function
|
|
|
382
539
|
}
|
|
383
540
|
else if ( _user_defined == "y" ) {
|
|
384
541
|
if ( _target_app != "" ) {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
542
|
+
try {
|
|
543
|
+
_user_deployments_dir =
|
|
544
|
+
await _evm_contract_deployments_dir(
|
|
545
|
+
_target_app,
|
|
546
|
+
_user_defined);
|
|
547
|
+
}
|
|
548
|
+
catch(
|
|
549
|
+
_error) {
|
|
550
|
+
_msg =
|
|
551
|
+
"Error while retrieving user deployments " +
|
|
552
|
+
"directory location.";
|
|
553
|
+
_msg_error(
|
|
554
|
+
_msg,
|
|
555
|
+
0);
|
|
556
|
+
_msg_error(
|
|
557
|
+
_error,
|
|
558
|
+
0);
|
|
559
|
+
throw _error;
|
|
560
|
+
}
|
|
389
561
|
}
|
|
390
562
|
if ( _deployments_dir != _user_deployments_dir ) {
|
|
391
563
|
_msg =
|
|
@@ -407,18 +579,46 @@ async function
|
|
|
407
579
|
_msg_error(
|
|
408
580
|
_msg,
|
|
409
581
|
0);
|
|
410
|
-
|
|
582
|
+
const
|
|
583
|
+
_exception = {
|
|
584
|
+
"msg":
|
|
585
|
+
_msg
|
|
586
|
+
};
|
|
587
|
+
throw _exception;
|
|
411
588
|
}
|
|
412
589
|
if ( _networks_all == "y" ) {
|
|
413
590
|
_msg =
|
|
414
591
|
"Selecting all networks.";
|
|
415
592
|
_msg_info(
|
|
416
593
|
_msg);
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
594
|
+
try {
|
|
595
|
+
_target_networks =
|
|
596
|
+
await _evm_contract_deployment_networks(
|
|
597
|
+
`${_deployments_dir}/${_target_contract}`,
|
|
598
|
+
_networks_all);
|
|
599
|
+
}
|
|
600
|
+
catch(
|
|
601
|
+
_error) {
|
|
602
|
+
_msg =
|
|
603
|
+
"Error while retrieving networks " +
|
|
604
|
+
`for contract '${_target_contract}'.`;
|
|
605
|
+
_msg_error(
|
|
606
|
+
_msg,
|
|
607
|
+
0);
|
|
608
|
+
_echo2(
|
|
609
|
+
_error);
|
|
610
|
+
throw _error;
|
|
611
|
+
}
|
|
421
612
|
}
|
|
613
|
+
_msg =
|
|
614
|
+
`Getting '${_target_contract}' contract address for ` +
|
|
615
|
+
`libEVM app '${_target_app}' ` +
|
|
616
|
+
`for networks with RPCs '${_target_networks}' ` +
|
|
617
|
+
`and chain ID '${_network_ids}', (user-defined contracts: ` +
|
|
618
|
+
`'${_user_defined}'), by looking for configuration files ` +
|
|
619
|
+
`of type '${_configuration_format}'.`;
|
|
620
|
+
_msg_info(
|
|
621
|
+
_msg);
|
|
422
622
|
for ( _network of _target_networks ) {
|
|
423
623
|
// _msg =
|
|
424
624
|
// "Info arguments for " +
|
|
@@ -461,20 +661,56 @@ async function
|
|
|
461
661
|
_deployments_dir,
|
|
462
662
|
_target_contract,
|
|
463
663
|
_target_network,
|
|
464
|
-
|
|
664
|
+
_network,
|
|
465
665
|
_contract_version,
|
|
466
666
|
_configuration_format
|
|
467
667
|
] );
|
|
468
668
|
}
|
|
469
669
|
for ( _args of _contract_address_get_args ) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
670
|
+
try {
|
|
671
|
+
_msg =
|
|
672
|
+
"Running " +
|
|
673
|
+
"_contract_address_get " +
|
|
674
|
+
`with parameters:`;
|
|
675
|
+
_msg_info(
|
|
676
|
+
_msg);
|
|
677
|
+
if ( _quiet == "n" ) {
|
|
678
|
+
_echo2(
|
|
679
|
+
_args);
|
|
680
|
+
}
|
|
681
|
+
_contract_address =
|
|
682
|
+
await _contract_address_get.apply(
|
|
683
|
+
null,
|
|
684
|
+
_args);
|
|
685
|
+
}
|
|
686
|
+
catch(
|
|
687
|
+
_error) {
|
|
688
|
+
_msg =
|
|
689
|
+
"Error while running " +
|
|
690
|
+
"_contract_address_get " +
|
|
691
|
+
`with parameters:`;
|
|
692
|
+
_msg_error(
|
|
693
|
+
_msg,
|
|
694
|
+
0);
|
|
695
|
+
_echo2(
|
|
473
696
|
_args);
|
|
697
|
+
_echo2(
|
|
698
|
+
_error);
|
|
699
|
+
throw _msg;
|
|
700
|
+
}
|
|
474
701
|
_contracts_addresses.push(
|
|
475
702
|
_contract_address);
|
|
476
703
|
}
|
|
477
|
-
|
|
704
|
+
const
|
|
705
|
+
_contracts_addresses_set =
|
|
706
|
+
{};
|
|
707
|
+
for ( _address of _contracts_addresses ) {
|
|
708
|
+
_contracts_addresses_set[
|
|
709
|
+
_address] =
|
|
710
|
+
1;
|
|
711
|
+
}
|
|
712
|
+
return Object.keys(
|
|
713
|
+
_contracts_addresses_set);
|
|
478
714
|
}
|
|
479
715
|
|
|
480
716
|
export {
|