evm-contracts-tools 0.0.57 → 0.0.62
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/libevm-contract-call/libevm-contract-call.js +1 -1
- package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +1 -1
- package/evm-contract-call +341 -107
- package/libevm-contract-call +206 -48
- package/libevm-contract-deployment +153 -35
- package/libevm-contract-deployment-address +278 -53
- package/libevm-contract-deployments-dir +2 -1
- 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
|
|
@@ -148,24 +163,6 @@ const
|
|
|
148
163
|
const
|
|
149
164
|
_require =
|
|
150
165
|
_libcrash_module._require;
|
|
151
|
-
const
|
|
152
|
-
_evm_chains_info_module =
|
|
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 =
|
|
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
166
|
const
|
|
170
167
|
_libevm_contract_deployment_module =
|
|
171
168
|
await import(
|
|
@@ -209,17 +206,8 @@ const
|
|
|
209
206
|
const
|
|
210
207
|
_evm_contract_deployment_networks =
|
|
211
208
|
_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
209
|
|
|
222
|
-
function
|
|
210
|
+
async function
|
|
223
211
|
_contract_address_get(
|
|
224
212
|
_deployments,
|
|
225
213
|
_contract,
|
|
@@ -231,13 +219,39 @@ function
|
|
|
231
219
|
_config,
|
|
232
220
|
_config_file_ext,
|
|
233
221
|
_config_path,
|
|
222
|
+
_evm_contract_deployment_versions_args,
|
|
223
|
+
_libevm_contract_deployment_versions_module,
|
|
234
224
|
_found,
|
|
235
225
|
_key_name,
|
|
236
226
|
_msg,
|
|
237
227
|
_net;
|
|
238
|
-
|
|
239
|
-
|
|
228
|
+
const
|
|
229
|
+
_global =
|
|
230
|
+
_global_get();
|
|
231
|
+
const
|
|
232
|
+
_quiet =
|
|
233
|
+
_global[
|
|
234
|
+
"quiet"];
|
|
235
|
+
_msg =
|
|
236
|
+
"Reading address from " +
|
|
237
|
+
"configuration file.";
|
|
238
|
+
_msg_info(
|
|
239
|
+
_msg);
|
|
240
|
+
const
|
|
241
|
+
_version_type =
|
|
242
|
+
typeof(
|
|
243
|
+
_version);
|
|
244
|
+
const
|
|
245
|
+
_configuration_format_type =
|
|
246
|
+
typeof(
|
|
247
|
+
_configuration_format);
|
|
248
|
+
if ( _configuration_format_type === "undefined" ||
|
|
240
249
|
_configuration_format == "" ) {
|
|
250
|
+
_msg =
|
|
251
|
+
"Configuration format not set, " +
|
|
252
|
+
"setting default (bash).";
|
|
253
|
+
_msg_info(
|
|
254
|
+
_msg);
|
|
241
255
|
_configuration_format =
|
|
242
256
|
"bash";
|
|
243
257
|
}
|
|
@@ -304,13 +318,78 @@ function
|
|
|
304
318
|
_key_name =
|
|
305
319
|
"contract_address";
|
|
306
320
|
}
|
|
321
|
+
else {
|
|
322
|
+
_msg =
|
|
323
|
+
"Unknown configuration format " +
|
|
324
|
+
`'${_configuration_format}'.`;
|
|
325
|
+
_msg_error(
|
|
326
|
+
_msg,
|
|
327
|
+
0);
|
|
328
|
+
throw _msg;
|
|
329
|
+
}
|
|
330
|
+
if ( _version_type === "undefined" ||
|
|
331
|
+
_version == "" ) {
|
|
332
|
+
_msg =
|
|
333
|
+
"No version selected, " +
|
|
334
|
+
"retrieving.";
|
|
335
|
+
_msg_info(
|
|
336
|
+
_msg);
|
|
337
|
+
_libevm_contract_deployment_versions_module =
|
|
338
|
+
await import(
|
|
339
|
+
"./libevm-contract-deployment-versions");
|
|
340
|
+
const
|
|
341
|
+
_evm_contract_deployment_versions =
|
|
342
|
+
_libevm_contract_deployment_versions_module._evm_contract_deployment_versions;
|
|
343
|
+
_evm_contract_deployment_versions_args = [
|
|
344
|
+
_config_path,
|
|
345
|
+
"y", // display highest
|
|
346
|
+
"n", // display lowest
|
|
347
|
+
_configuration_format
|
|
348
|
+
];
|
|
349
|
+
try {
|
|
350
|
+
_msg =
|
|
351
|
+
"Running '_evm_contract_deployment_versions' " +
|
|
352
|
+
"with arguments:";
|
|
353
|
+
_msg_info(
|
|
354
|
+
_msg);
|
|
355
|
+
if ( _quiet == "n" ) {
|
|
356
|
+
_echo(
|
|
357
|
+
_evm_contract_deployment_versions_args);
|
|
358
|
+
}
|
|
359
|
+
_version =
|
|
360
|
+
await _evm_contract_deployment_versions.apply(
|
|
361
|
+
null,
|
|
362
|
+
_evm_contract_deployment_versions_args);
|
|
363
|
+
_msg =
|
|
364
|
+
"Got contract version " +
|
|
365
|
+
`'${_version}'.`;
|
|
366
|
+
_msg_info(
|
|
367
|
+
_msg);
|
|
368
|
+
}
|
|
369
|
+
catch(
|
|
370
|
+
_error) {
|
|
371
|
+
_msg =
|
|
372
|
+
"Error while running " +
|
|
373
|
+
"'_evm_contract_deployment_versions' with arguments:";
|
|
374
|
+
_msg_error(
|
|
375
|
+
_msg,
|
|
376
|
+
0);
|
|
377
|
+
_echo2(
|
|
378
|
+
_evm_contract_deployment_versions_args);
|
|
379
|
+
throw _error;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
307
382
|
const
|
|
308
383
|
_contract_address =
|
|
309
384
|
_config[
|
|
310
385
|
_key_name][
|
|
311
386
|
_version];
|
|
312
|
-
|
|
313
|
-
|
|
387
|
+
const
|
|
388
|
+
_contract_address_type =
|
|
389
|
+
typeof(
|
|
390
|
+
_contract_address);
|
|
391
|
+
if ( _contract_address_type === "undefined" ||
|
|
392
|
+
_contract_address == "" ) {
|
|
314
393
|
_msg =
|
|
315
394
|
`No '${_contract}' version '${_version}' ` +
|
|
316
395
|
`contract deployment specified for network ` +
|
|
@@ -321,6 +400,12 @@ function
|
|
|
321
400
|
0);
|
|
322
401
|
throw _msg;
|
|
323
402
|
}
|
|
403
|
+
else if ( _contract_address_type == "string" ) {
|
|
404
|
+
_msg =
|
|
405
|
+
`Got contract address '${_contract_address}'`;
|
|
406
|
+
_msg_info(
|
|
407
|
+
_msg);
|
|
408
|
+
}
|
|
324
409
|
return _contract_address;
|
|
325
410
|
}
|
|
326
411
|
|
|
@@ -336,23 +421,71 @@ async function
|
|
|
336
421
|
_configuration_format,
|
|
337
422
|
_deployments_dir) {
|
|
338
423
|
let
|
|
424
|
+
_address,
|
|
339
425
|
_args,
|
|
340
426
|
_contract_address,
|
|
427
|
+
_msg,
|
|
341
428
|
_network,
|
|
342
429
|
_network_check_args,
|
|
343
430
|
_target_network,
|
|
344
431
|
_target_network_id,
|
|
345
432
|
_user_deployments_dir,
|
|
346
|
-
_system_deployments_dir
|
|
347
|
-
|
|
433
|
+
_system_deployments_dir;
|
|
434
|
+
const
|
|
435
|
+
_libevm_contract_deployments_dir_module =
|
|
436
|
+
await import(
|
|
437
|
+
"./libevm-contract-deployments-dir");
|
|
438
|
+
const
|
|
439
|
+
_evm_contract_deployments_dir =
|
|
440
|
+
_libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
|
|
348
441
|
const
|
|
349
442
|
_contracts_addresses =
|
|
350
443
|
[];
|
|
351
444
|
const
|
|
352
445
|
_contract_address_get_args =
|
|
353
446
|
[];
|
|
447
|
+
const
|
|
448
|
+
_user_defined_type =
|
|
449
|
+
typeof(
|
|
450
|
+
_user_defined);
|
|
451
|
+
const
|
|
452
|
+
_deployments_dir_type =
|
|
453
|
+
typeof(
|
|
454
|
+
_deployments_dir);
|
|
455
|
+
if ( _user_defined_type === "undefined" ||
|
|
456
|
+
_user_defined === "" ) {
|
|
457
|
+
_msg =
|
|
458
|
+
"User defined not specified, setting " +
|
|
459
|
+
"default (n).";
|
|
460
|
+
_msg_info(
|
|
461
|
+
_msg);
|
|
462
|
+
_user_defined =
|
|
463
|
+
"n";
|
|
464
|
+
}
|
|
465
|
+
if ( _deployments_dir_type === "undefined" ||
|
|
466
|
+
_deployments_dir === "" ) {
|
|
467
|
+
try {
|
|
468
|
+
_deployments_dir =
|
|
469
|
+
await _evm_contract_deployments_dir(
|
|
470
|
+
_target_app,
|
|
471
|
+
_user_defined);
|
|
472
|
+
}
|
|
473
|
+
catch(
|
|
474
|
+
_error) {
|
|
475
|
+
_msg =
|
|
476
|
+
"Error while retrieving system deployments " +
|
|
477
|
+
"directory location for auto-detection.";
|
|
478
|
+
_msg_error(
|
|
479
|
+
_msg,
|
|
480
|
+
0);
|
|
481
|
+
_msg_error(
|
|
482
|
+
_error,
|
|
483
|
+
0);
|
|
484
|
+
throw _error;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
354
487
|
if ( _user_defined == "n" ) {
|
|
355
|
-
if ( _target_app
|
|
488
|
+
if ( _target_app === "" ) {
|
|
356
489
|
_msg =
|
|
357
490
|
"A target application needs to " +
|
|
358
491
|
"be specified with option '-a' " +
|
|
@@ -365,10 +498,25 @@ async function
|
|
|
365
498
|
0);
|
|
366
499
|
throw _msg;
|
|
367
500
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
501
|
+
try {
|
|
502
|
+
_system_deployments_dir =
|
|
503
|
+
await _evm_contract_deployments_dir(
|
|
504
|
+
_target_app,
|
|
505
|
+
_user_defined);
|
|
506
|
+
}
|
|
507
|
+
catch(
|
|
508
|
+
_error) {
|
|
509
|
+
_msg =
|
|
510
|
+
"Error while retrieving system deployments " +
|
|
511
|
+
"directory location.";
|
|
512
|
+
_msg_error(
|
|
513
|
+
_msg,
|
|
514
|
+
0);
|
|
515
|
+
_msg_error(
|
|
516
|
+
_error,
|
|
517
|
+
0);
|
|
518
|
+
throw _error;
|
|
519
|
+
}
|
|
372
520
|
if ( _deployments_dir != _system_deployments_dir ) {
|
|
373
521
|
_msg =
|
|
374
522
|
"To set a custom deployments directory path " +
|
|
@@ -382,10 +530,25 @@ async function
|
|
|
382
530
|
}
|
|
383
531
|
else if ( _user_defined == "y" ) {
|
|
384
532
|
if ( _target_app != "" ) {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
533
|
+
try {
|
|
534
|
+
_user_deployments_dir =
|
|
535
|
+
await _evm_contract_deployments_dir(
|
|
536
|
+
_target_app,
|
|
537
|
+
_user_defined);
|
|
538
|
+
}
|
|
539
|
+
catch(
|
|
540
|
+
_error) {
|
|
541
|
+
_msg =
|
|
542
|
+
"Error while retrieving user deployments " +
|
|
543
|
+
"directory location.";
|
|
544
|
+
_msg_error(
|
|
545
|
+
_msg,
|
|
546
|
+
0);
|
|
547
|
+
_msg_error(
|
|
548
|
+
_error,
|
|
549
|
+
0);
|
|
550
|
+
throw _error;
|
|
551
|
+
}
|
|
389
552
|
}
|
|
390
553
|
if ( _deployments_dir != _user_deployments_dir ) {
|
|
391
554
|
_msg =
|
|
@@ -407,18 +570,46 @@ async function
|
|
|
407
570
|
_msg_error(
|
|
408
571
|
_msg,
|
|
409
572
|
0);
|
|
410
|
-
|
|
573
|
+
const
|
|
574
|
+
_exception = {
|
|
575
|
+
"msg":
|
|
576
|
+
_msg
|
|
577
|
+
};
|
|
578
|
+
throw _exception;
|
|
411
579
|
}
|
|
412
580
|
if ( _networks_all == "y" ) {
|
|
413
581
|
_msg =
|
|
414
582
|
"Selecting all networks.";
|
|
415
583
|
_msg_info(
|
|
416
584
|
_msg);
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
585
|
+
try {
|
|
586
|
+
_target_networks =
|
|
587
|
+
await _evm_contract_deployment_networks(
|
|
588
|
+
`${_deployments_dir}/${_target_contract}`,
|
|
589
|
+
_networks_all);
|
|
590
|
+
}
|
|
591
|
+
catch(
|
|
592
|
+
_error) {
|
|
593
|
+
_msg =
|
|
594
|
+
"Error while retrieving networks " +
|
|
595
|
+
`for contract '${_target_contract}'.`;
|
|
596
|
+
_msg_error(
|
|
597
|
+
_msg,
|
|
598
|
+
0);
|
|
599
|
+
_echo2(
|
|
600
|
+
_error);
|
|
601
|
+
throw _error;
|
|
602
|
+
}
|
|
421
603
|
}
|
|
604
|
+
_msg =
|
|
605
|
+
`Getting '${_target_contract}' contract address for ` +
|
|
606
|
+
`libEVM app '${_target_app}' ` +
|
|
607
|
+
`for networks with RPCs '${_target_networks}' ` +
|
|
608
|
+
`and chain ID '${_network_ids}', (user-defined contracts: ` +
|
|
609
|
+
`'${_user_defined}'), by looking for configuration files ` +
|
|
610
|
+
`of type '${_configuration_format}'.`;
|
|
611
|
+
_msg_info(
|
|
612
|
+
_msg);
|
|
422
613
|
for ( _network of _target_networks ) {
|
|
423
614
|
// _msg =
|
|
424
615
|
// "Info arguments for " +
|
|
@@ -461,20 +652,54 @@ async function
|
|
|
461
652
|
_deployments_dir,
|
|
462
653
|
_target_contract,
|
|
463
654
|
_target_network,
|
|
464
|
-
|
|
655
|
+
_network,
|
|
465
656
|
_contract_version,
|
|
466
657
|
_configuration_format
|
|
467
658
|
] );
|
|
468
659
|
}
|
|
469
660
|
for ( _args of _contract_address_get_args ) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
661
|
+
try {
|
|
662
|
+
_msg =
|
|
663
|
+
"Running " +
|
|
664
|
+
"_contract_address_get " +
|
|
665
|
+
`with parameters:`;
|
|
666
|
+
_msg_info(
|
|
667
|
+
_msg);
|
|
668
|
+
_echo2(
|
|
669
|
+
_args);
|
|
670
|
+
_contract_address =
|
|
671
|
+
await _contract_address_get.apply(
|
|
672
|
+
null,
|
|
673
|
+
_args);
|
|
674
|
+
}
|
|
675
|
+
catch(
|
|
676
|
+
_error) {
|
|
677
|
+
_msg =
|
|
678
|
+
"Error while running " +
|
|
679
|
+
"_contract_address_get " +
|
|
680
|
+
`with parameters:`;
|
|
681
|
+
_msg_error(
|
|
682
|
+
_msg,
|
|
683
|
+
0);
|
|
684
|
+
_echo2(
|
|
473
685
|
_args);
|
|
686
|
+
_echo2(
|
|
687
|
+
_error);
|
|
688
|
+
throw _msg;
|
|
689
|
+
}
|
|
474
690
|
_contracts_addresses.push(
|
|
475
691
|
_contract_address);
|
|
476
692
|
}
|
|
477
|
-
|
|
693
|
+
const
|
|
694
|
+
_contracts_addresses_set =
|
|
695
|
+
{};
|
|
696
|
+
for ( _address of _contracts_addresses ) {
|
|
697
|
+
_contracts_addresses_set[
|
|
698
|
+
_address] =
|
|
699
|
+
1;
|
|
700
|
+
}
|
|
701
|
+
return Object.keys(
|
|
702
|
+
_contracts_addresses_set);
|
|
478
703
|
}
|
|
479
704
|
|
|
480
705
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{ "name": "evm-contracts-tools",
|
|
2
2
|
"version":
|
|
3
|
-
"0.0.
|
|
3
|
+
"0.0.62",
|
|
4
4
|
"description":
|
|
5
5
|
"JavaScript programs and libraries to enable seamless development of native computer applications designed to interact with Ethereum Virtual Machine-compatible networks.",
|
|
6
6
|
"funding": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"crash-js-webpack":
|
|
103
|
-
"^0.0.
|
|
103
|
+
"^0.0.77",
|
|
104
104
|
"brace-expansion":
|
|
105
105
|
"^5.0.9",
|
|
106
106
|
"eslint":
|
|
@@ -108,11 +108,11 @@
|
|
|
108
108
|
"@eslint/js":
|
|
109
109
|
"^10.0.1",
|
|
110
110
|
"fast-uri":
|
|
111
|
-
"^4.1.
|
|
111
|
+
"^4.1.4",
|
|
112
112
|
"globals":
|
|
113
113
|
"^17.3.0",
|
|
114
114
|
"safely-serve":
|
|
115
|
-
"^0.0.
|
|
115
|
+
"^0.0.21",
|
|
116
116
|
"webpack":
|
|
117
117
|
"^5.109.2",
|
|
118
118
|
"webpack-cli":
|
|
@@ -120,31 +120,33 @@
|
|
|
120
120
|
},
|
|
121
121
|
"dependencies": {
|
|
122
122
|
"libcrash-js":
|
|
123
|
-
"npm:crash-js@^
|
|
123
|
+
"npm:crash-js@^1000000000000011.1000000000000001.1000000000000001",
|
|
124
124
|
"ethers":
|
|
125
125
|
"^6.13.2",
|
|
126
126
|
"evm-chains-info":
|
|
127
|
-
"^0.0.
|
|
127
|
+
"^0.0.36",
|
|
128
128
|
"evm-transactions-tools":
|
|
129
|
-
"^0.
|
|
129
|
+
"^0.1.10000000001",
|
|
130
130
|
"evm-wallet":
|
|
131
|
-
"npm:evm-wallet.js@^0.0.
|
|
131
|
+
"npm:evm-wallet.js@^0.0.96",
|
|
132
132
|
"libevm":
|
|
133
|
-
"^0.0.
|
|
133
|
+
"^0.0.41",
|
|
134
134
|
"ws":
|
|
135
135
|
"^8.21.0",
|
|
136
136
|
"yargs":
|
|
137
137
|
"18.0.0"
|
|
138
138
|
},
|
|
139
139
|
"overrides": {
|
|
140
|
+
"libcrash-js":
|
|
141
|
+
"npm:crash-js@^1000000000000011.1000000000000001.1000000000000001",
|
|
140
142
|
"evm-contracts-tools":
|
|
141
143
|
"./evm-contracts-tools",
|
|
142
144
|
"evm-wallet":
|
|
143
|
-
"npm:evm-wallet.js@^0.0.
|
|
145
|
+
"npm:evm-wallet.js@^0.0.96",
|
|
144
146
|
"evm-wallet.js":
|
|
145
|
-
"npm:evm-wallet.js@^0.0.
|
|
147
|
+
"npm:evm-wallet.js@^0.0.96",
|
|
146
148
|
"libevm":
|
|
147
|
-
"^0.0.
|
|
149
|
+
"^0.0.41"
|
|
148
150
|
},
|
|
149
151
|
"type":
|
|
150
152
|
"module",
|