evm-contracts-tools 0.0.45 → 0.0.47
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 +13 -0
- package/dist/evm-contract-call/evm-contract-call.js +1 -1
- package/dist/evm-contract-deployment-abi/fs-worker.js +1 -0
- package/dist/evm-contract-deployment-abi/index.html +31 -0
- package/dist/evm-contract-deployment-bytecode/fs-worker.js +1 -0
- package/dist/evm-contract-deployment-bytecode/index.html +31 -0
- package/dist/evm-contract-deployment-compiler-output/fs-worker.js +1 -0
- package/dist/evm-contract-deployment-compiler-output/index.html +31 -0
- 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-deployments-dir/evm-contract-deployments-dir.js +1 -1
- package/dist/evm-contracts-tools/evm-contracts-tools.js +1 -1
- package/dist/libevm-contract-call/libevm-contract-call.js +1 -1
- package/dist/libevm-contract-deployment-abi/fs-worker.js +1 -0
- package/dist/libevm-contract-deployment-abi/index.html +24 -0
- package/dist/libevm-contract-deployment-abi/libevm-contract-deployment-abi.js +2 -0
- package/dist/libevm-contract-deployment-bytecode/fs-worker.js +1 -0
- package/dist/libevm-contract-deployment-bytecode/index.html +24 -0
- package/dist/libevm-contract-deployment-compiler-output/fs-worker.js +1 -0
- package/dist/libevm-contract-deployment-compiler-output/index.html +24 -0
- package/dist/libevm-contract-deployment-networks/libevm-contract-deployment-networks.js +1 -1
- package/dist/libevm-contract-deployment-versions/libevm-contract-deployment-versions.js +1 -1
- package/dist/libevm-contract-deployments-dir/libevm-contract-deployments-dir.js +1 -1
- package/evm-contract-call +44 -40
- package/evm-contract-deployment-abi +540 -0
- package/evm-contract-deployment-address +23 -18
- package/evm-contract-deployment-bytecode +540 -0
- package/evm-contract-deployment-compiler-output +540 -0
- package/lib/address-check +0 -0
- package/lib/evm-contract-call-dynamic +46 -17
- package/lib/evm-contract-call-static +0 -0
- package/libevm-contract-deployment-abi +465 -0
- package/libevm-contract-deployment-address +58 -372
- package/libevm-contract-deployment-bytecode +466 -0
- package/libevm-contract-deployment-compiler-output +863 -0
- package/package.json +50 -12
- package/dist/evm-contract-deployment-address/evm-contract-deployment-address.js +0 -2
- package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +0 -2
|
@@ -65,10 +65,13 @@ const
|
|
|
65
65
|
_libcrash_module =
|
|
66
66
|
require(
|
|
67
67
|
"crash-js");
|
|
68
|
+
/* global
|
|
69
|
+
_basename */
|
|
70
|
+
const
|
|
71
|
+
_basename =
|
|
72
|
+
_libcrash_module._basename;
|
|
68
73
|
/* global
|
|
69
74
|
_chmod */
|
|
70
|
-
/* eslint-disable-next-line
|
|
71
|
-
no-global-assign */
|
|
72
75
|
const
|
|
73
76
|
_chmod =
|
|
74
77
|
_libcrash_module._chmod;
|
|
@@ -79,10 +82,13 @@ const
|
|
|
79
82
|
const
|
|
80
83
|
_cp =
|
|
81
84
|
_libcrash_module._cp;
|
|
85
|
+
/* global
|
|
86
|
+
_dir_exists */
|
|
87
|
+
const
|
|
88
|
+
_dir_exists =
|
|
89
|
+
_libcrash_module._dir_exists;
|
|
82
90
|
/* global
|
|
83
91
|
_file_exists */
|
|
84
|
-
/* eslint-disable-next-line
|
|
85
|
-
no-global-assign */
|
|
86
92
|
const
|
|
87
93
|
_file_exists =
|
|
88
94
|
_libcrash_module._file_exists;
|
|
@@ -142,6 +148,11 @@ const
|
|
|
142
148
|
const
|
|
143
149
|
_msg_error =
|
|
144
150
|
_libcrash_module._msg_error;
|
|
151
|
+
/* global
|
|
152
|
+
_override_set */
|
|
153
|
+
const
|
|
154
|
+
_override_set =
|
|
155
|
+
_libcrash_module._override_set;
|
|
145
156
|
/* global
|
|
146
157
|
_path_join */
|
|
147
158
|
/* eslint-disable-next-line
|
|
@@ -149,6 +160,11 @@ const
|
|
|
149
160
|
const
|
|
150
161
|
_path_join =
|
|
151
162
|
_libcrash_module._path_join;
|
|
163
|
+
/* global
|
|
164
|
+
_pwd */
|
|
165
|
+
const
|
|
166
|
+
_pwd =
|
|
167
|
+
_libcrash_module._pwd;
|
|
152
168
|
const
|
|
153
169
|
_evm_chains_info_module =
|
|
154
170
|
require(
|
|
@@ -167,6 +183,40 @@ const
|
|
|
167
183
|
const
|
|
168
184
|
_evm_contract_deployments_dir =
|
|
169
185
|
_libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
|
|
186
|
+
const
|
|
187
|
+
_libevm_contract_deployment_module =
|
|
188
|
+
require(
|
|
189
|
+
"./libevm-contract-deployment");
|
|
190
|
+
/* global
|
|
191
|
+
_contract_version_auto_detect */
|
|
192
|
+
const
|
|
193
|
+
_contract_version_auto_detect =
|
|
194
|
+
_libevm_contract_deployment._contract_version_auto_detect;
|
|
195
|
+
/* global
|
|
196
|
+
_deployments_dir_auto_detect */
|
|
197
|
+
const
|
|
198
|
+
_deployments_dir_auto_detect =
|
|
199
|
+
_libevm_contract_deployment._deployments_dir_auto_detect;
|
|
200
|
+
/* global
|
|
201
|
+
_network_check */
|
|
202
|
+
const
|
|
203
|
+
_network_check =
|
|
204
|
+
_libevm_contract_deployment._network_check;
|
|
205
|
+
/* global
|
|
206
|
+
_networks_all_auto_detect */
|
|
207
|
+
const
|
|
208
|
+
_networks_all_auto_detect =
|
|
209
|
+
_libevm_contract_deployment._networks_all_auto_detect;
|
|
210
|
+
/* global
|
|
211
|
+
_target_app_auto_detect */
|
|
212
|
+
const
|
|
213
|
+
_target_app_auto_detect =
|
|
214
|
+
_libevm_contract_deployment._target_app_auto_detect;
|
|
215
|
+
/* global
|
|
216
|
+
_user_deployments_check */
|
|
217
|
+
const
|
|
218
|
+
_user_deployments_check =
|
|
219
|
+
_libevm_contract_deployment._user_deployments_check;
|
|
170
220
|
const
|
|
171
221
|
_libevm_contract_deployment_networks_module =
|
|
172
222
|
require(
|
|
@@ -198,7 +248,7 @@ function
|
|
|
198
248
|
_config,
|
|
199
249
|
_config_file_ext,
|
|
200
250
|
_config_path,
|
|
201
|
-
|
|
251
|
+
_contract_address,
|
|
202
252
|
_found,
|
|
203
253
|
_key_name,
|
|
204
254
|
_msg,
|
|
@@ -233,7 +283,6 @@ function
|
|
|
233
283
|
_found =
|
|
234
284
|
false;
|
|
235
285
|
for ( _net of _networks ) {
|
|
236
|
-
_path_join_args =
|
|
237
286
|
_config_path =
|
|
238
287
|
_path_join( [
|
|
239
288
|
_deployments,
|
|
@@ -290,168 +339,6 @@ function
|
|
|
290
339
|
return _contract_address;
|
|
291
340
|
}
|
|
292
341
|
|
|
293
|
-
async function
|
|
294
|
-
_network_check(
|
|
295
|
-
_deployments,
|
|
296
|
-
_contract,
|
|
297
|
-
_target_network,
|
|
298
|
-
_target_network_id) {
|
|
299
|
-
let
|
|
300
|
-
_error_flag,
|
|
301
|
-
_msg,
|
|
302
|
-
_network_id;
|
|
303
|
-
_error_flag =
|
|
304
|
-
false;
|
|
305
|
-
_deployments_path =
|
|
306
|
-
_path_join( [
|
|
307
|
-
_deployments,
|
|
308
|
-
_contract ]);
|
|
309
|
-
const
|
|
310
|
-
_evm_contract_deployment_networks_args = [
|
|
311
|
-
_deployments_path,
|
|
312
|
-
"y", // Display all
|
|
313
|
-
"n", // Display safest
|
|
314
|
-
"n" // Display cheapest
|
|
315
|
-
];
|
|
316
|
-
const
|
|
317
|
-
_networks =
|
|
318
|
-
await _evm_contract_deployment_networks.apply(
|
|
319
|
-
null,
|
|
320
|
-
_evm_contract_deployment_networks_args);
|
|
321
|
-
if ( _target_network_id != "" ) {
|
|
322
|
-
if ( ! _networks.includes(
|
|
323
|
-
_target_network_id) ) {
|
|
324
|
-
_msg =
|
|
325
|
-
"The contract does not result deployed on " +
|
|
326
|
-
`network with id '${_target_network_id}'.`;
|
|
327
|
-
_error_flag =
|
|
328
|
-
true;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
else if ( _target_network != "" ) {
|
|
332
|
-
if ( ! _networks.includes(
|
|
333
|
-
_target_network) ) {
|
|
334
|
-
_msg =
|
|
335
|
-
"The contract does not result deployed on " +
|
|
336
|
-
`network '${_target_network}'.`;
|
|
337
|
-
_error_flag =
|
|
338
|
-
true;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
342
|
-
_msg =
|
|
343
|
-
"Provide one between a target network name " +
|
|
344
|
-
"or ID.";
|
|
345
|
-
_error_flag =
|
|
346
|
-
true;
|
|
347
|
-
}
|
|
348
|
-
if ( _error_flag ) {
|
|
349
|
-
_msg_error(
|
|
350
|
-
_msg,
|
|
351
|
-
1);
|
|
352
|
-
}
|
|
353
|
-
if ( _target_network_id == "" ) {
|
|
354
|
-
_evm_chains_info_args = [
|
|
355
|
-
"get", // target command
|
|
356
|
-
"name", // input type
|
|
357
|
-
"id", // output type
|
|
358
|
-
"offline",
|
|
359
|
-
[ "node",
|
|
360
|
-
"system" ], // db types
|
|
361
|
-
"kirsh", // selection method, first
|
|
362
|
-
"n", // api keys
|
|
363
|
-
"n", // query all networks
|
|
364
|
-
_target_network,
|
|
365
|
-
[] // database paths
|
|
366
|
-
];
|
|
367
|
-
_network_id =
|
|
368
|
-
await _evm_chains_info.apply(
|
|
369
|
-
null,
|
|
370
|
-
_evm_chains_info_args);
|
|
371
|
-
}
|
|
372
|
-
else if ( _target_network == "" ) {
|
|
373
|
-
_evm_chains_info_args = [
|
|
374
|
-
"get", // target command
|
|
375
|
-
"id" , // input type
|
|
376
|
-
"name", // output type
|
|
377
|
-
"offline",
|
|
378
|
-
[ "node",
|
|
379
|
-
"system" ], // db types
|
|
380
|
-
"kirsh", // selection method, first
|
|
381
|
-
"n", // api keys
|
|
382
|
-
"n", // query all networks
|
|
383
|
-
_target_network_id,
|
|
384
|
-
[] // database paths
|
|
385
|
-
];
|
|
386
|
-
_target_network =
|
|
387
|
-
await _evm_chains_info(
|
|
388
|
-
_evm_chains_info_args);
|
|
389
|
-
}
|
|
390
|
-
if ( _target_network_id != "" ) {
|
|
391
|
-
if ( _target_network_id != _network_id ) {
|
|
392
|
-
_msg =
|
|
393
|
-
"Requested target network ID " +
|
|
394
|
-
`'${_target_network_id}' does ` +
|
|
395
|
-
`not correspond to '${_target_network}' ` +
|
|
396
|
-
`known ID '${_network_id}'.`;
|
|
397
|
-
_msg_error(
|
|
398
|
-
_msg,
|
|
399
|
-
1);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
async function
|
|
405
|
-
_user_deployments_init(
|
|
406
|
-
_app,
|
|
407
|
-
_deployments_dir) {
|
|
408
|
-
const
|
|
409
|
-
_user_defined =
|
|
410
|
-
"y";
|
|
411
|
-
const
|
|
412
|
-
_evm_contract_deployments_dir_args = [
|
|
413
|
-
_app,
|
|
414
|
-
_user_defined
|
|
415
|
-
];
|
|
416
|
-
const
|
|
417
|
-
_system_deployments =
|
|
418
|
-
await _evm_contract_deployments_dir.apply(
|
|
419
|
-
null,
|
|
420
|
-
_evm_contract_deployments_dir_args);
|
|
421
|
-
_chmod(
|
|
422
|
-
_deployments_dir,
|
|
423
|
-
"0700");
|
|
424
|
-
const
|
|
425
|
-
_files =
|
|
426
|
-
await _ls(
|
|
427
|
-
_system_deployments);
|
|
428
|
-
for ( _file of _files ) {
|
|
429
|
-
_cp(
|
|
430
|
-
_file,
|
|
431
|
-
_deployments_dir);
|
|
432
|
-
}
|
|
433
|
-
return true;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
async function
|
|
437
|
-
_user_deployments_check(
|
|
438
|
-
_app,
|
|
439
|
-
_deployments_dir) {
|
|
440
|
-
if ( ! _file_exists(
|
|
441
|
-
_deployments_dir) ) {
|
|
442
|
-
const
|
|
443
|
-
_user_deployments_init_args = [
|
|
444
|
-
_app,
|
|
445
|
-
_deployments_dir
|
|
446
|
-
];
|
|
447
|
-
const
|
|
448
|
-
_initialized =
|
|
449
|
-
await _user_deployments_init.apply(
|
|
450
|
-
null,
|
|
451
|
-
_user_deployments_init_args);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
342
|
async function
|
|
456
343
|
_evm_contract_deployment_address(
|
|
457
344
|
_target_networks,
|
|
@@ -602,209 +489,6 @@ async function
|
|
|
602
489
|
return _contracts_addresses;
|
|
603
490
|
}
|
|
604
491
|
|
|
605
|
-
async function
|
|
606
|
-
_deployments_dir_auto_detect() {
|
|
607
|
-
let
|
|
608
|
-
_deployments;
|
|
609
|
-
_deployments =
|
|
610
|
-
"";
|
|
611
|
-
const
|
|
612
|
-
_app =
|
|
613
|
-
target_app;
|
|
614
|
-
const
|
|
615
|
-
_app_type =
|
|
616
|
-
typeof(
|
|
617
|
-
_app);
|
|
618
|
-
if ( _app_type != "undefined" &&
|
|
619
|
-
_app != "" ) {
|
|
620
|
-
const
|
|
621
|
-
_user_defined =
|
|
622
|
-
user_defined;
|
|
623
|
-
const
|
|
624
|
-
_evm_contract_deployments_dir_args = [
|
|
625
|
-
_app,
|
|
626
|
-
_user_defined
|
|
627
|
-
];
|
|
628
|
-
_deployments =
|
|
629
|
-
await _evm_contract_deployments_dir.apply(
|
|
630
|
-
null,
|
|
631
|
-
_evm_contract_deployments_dir_args);
|
|
632
|
-
}
|
|
633
|
-
const
|
|
634
|
-
_deployments_dir_type =
|
|
635
|
-
typeof(
|
|
636
|
-
deployments_dir);
|
|
637
|
-
if ( _deployments_dir_type === "undefined" ||
|
|
638
|
-
deployments_dir == "" ) {
|
|
639
|
-
deployments_dir =
|
|
640
|
-
_deployments;
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
async function
|
|
645
|
-
_contract_version_auto_detect() {
|
|
646
|
-
let
|
|
647
|
-
_config,
|
|
648
|
-
_config_ext,
|
|
649
|
-
_deployments,
|
|
650
|
-
_found,
|
|
651
|
-
_net,
|
|
652
|
-
_network,
|
|
653
|
-
_network_id,
|
|
654
|
-
_networks,
|
|
655
|
-
_version,
|
|
656
|
-
_msg;
|
|
657
|
-
_networks =
|
|
658
|
-
[];
|
|
659
|
-
const
|
|
660
|
-
_contract =
|
|
661
|
-
target_contract;
|
|
662
|
-
_found =
|
|
663
|
-
false;
|
|
664
|
-
if ( configuration_format == "bash" ) {
|
|
665
|
-
_config_ext =
|
|
666
|
-
"sh";
|
|
667
|
-
}
|
|
668
|
-
else if ( configuration_format == "bash" ) {
|
|
669
|
-
_config_ext =
|
|
670
|
-
"json";
|
|
671
|
-
}
|
|
672
|
-
const
|
|
673
|
-
_contract_type =
|
|
674
|
-
typeof(
|
|
675
|
-
_contract);
|
|
676
|
-
if ( _contract != "" &&
|
|
677
|
-
_contract_type != "undefined" ) {
|
|
678
|
-
const
|
|
679
|
-
_deployments_dir_type =
|
|
680
|
-
typeof(
|
|
681
|
-
deployments_dir);
|
|
682
|
-
if ( _deployments_dir_type != "undefined" &&
|
|
683
|
-
deployments_dir != "" ) {
|
|
684
|
-
_deployments =
|
|
685
|
-
deployments_dir;
|
|
686
|
-
if ( 0 < target_networks.length ) {
|
|
687
|
-
_network =
|
|
688
|
-
target_networks[
|
|
689
|
-
0];
|
|
690
|
-
}
|
|
691
|
-
if ( 0 < network_ids.length ) {
|
|
692
|
-
_network_id =
|
|
693
|
-
_network_ids[
|
|
694
|
-
0];
|
|
695
|
-
}
|
|
696
|
-
const
|
|
697
|
-
_deployments_path =
|
|
698
|
-
_path_join( [
|
|
699
|
-
_deployments,
|
|
700
|
-
_contract ] );
|
|
701
|
-
if ( networks_all == "n" ) {
|
|
702
|
-
_networks.push(
|
|
703
|
-
_network,
|
|
704
|
-
_network_id);
|
|
705
|
-
}
|
|
706
|
-
else if ( networks_all == "y" ) {
|
|
707
|
-
const
|
|
708
|
-
_evm_contract_deployment_networks_args = [
|
|
709
|
-
_deployments_path,
|
|
710
|
-
"y", // Display all
|
|
711
|
-
"n", // Display safest
|
|
712
|
-
"n" // Display cheapest
|
|
713
|
-
];
|
|
714
|
-
_networks_new =
|
|
715
|
-
await _evm_contract_deployment_networks.apply(
|
|
716
|
-
null,
|
|
717
|
-
_evm_contract_deployment_networks_args);
|
|
718
|
-
_networks =
|
|
719
|
-
_networks.concat(
|
|
720
|
-
_networks_new);
|
|
721
|
-
}
|
|
722
|
-
for ( _net of _networks ) {
|
|
723
|
-
_config =
|
|
724
|
-
_path_join( [
|
|
725
|
-
_deployments_path,
|
|
726
|
-
_net,
|
|
727
|
-
`config.${_config_ext}`
|
|
728
|
-
]);
|
|
729
|
-
if ( _file_exists(
|
|
730
|
-
_config) ) {
|
|
731
|
-
_found =
|
|
732
|
-
true;
|
|
733
|
-
_msg =
|
|
734
|
-
`Found deployment configuration ` +
|
|
735
|
-
`at location '${_config}'.`;
|
|
736
|
-
_msg_info(
|
|
737
|
-
_msg);
|
|
738
|
-
break;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
if ( ! _found ) {
|
|
742
|
-
_msg =
|
|
743
|
-
"No deployment configuration " +
|
|
744
|
-
"file found for network " +
|
|
745
|
-
`'${_network}' with ID ` +
|
|
746
|
-
`'${_network_id}'.`;
|
|
747
|
-
_msg_error(
|
|
748
|
-
_msg,
|
|
749
|
-
1);
|
|
750
|
-
}
|
|
751
|
-
const
|
|
752
|
-
_evm_contract_deployment_versions_args = [
|
|
753
|
-
_config,
|
|
754
|
-
"y", // display highest
|
|
755
|
-
"n", // display lowest
|
|
756
|
-
configuration_format
|
|
757
|
-
];
|
|
758
|
-
_version =
|
|
759
|
-
await _evm_contract_deployment_versions.apply(
|
|
760
|
-
null,
|
|
761
|
-
_evm_contract_deployment_versions_args);
|
|
762
|
-
}
|
|
763
|
-
else if ( _deployments_dir_type == "undefined" ||
|
|
764
|
-
deployments_dir == "" ) {
|
|
765
|
-
const
|
|
766
|
-
_msg =
|
|
767
|
-
"If no target application is specified " +
|
|
768
|
-
"then the user-defined deployments " +
|
|
769
|
-
"switch must be enabled with '-u' and " +
|
|
770
|
-
"a deployments directory must be specified " +
|
|
771
|
-
"with '-d'.";
|
|
772
|
-
_msg_error(
|
|
773
|
-
_msg,
|
|
774
|
-
1);
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
const
|
|
778
|
-
_contract_version_type =
|
|
779
|
-
typeof(
|
|
780
|
-
contract_version);
|
|
781
|
-
if ( _contract_version_type == "undefined" ||
|
|
782
|
-
contract_version == "" ) {
|
|
783
|
-
contract_version =
|
|
784
|
-
_version;
|
|
785
|
-
}
|
|
786
|
-
return true;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
function
|
|
790
|
-
_networks_all_auto_detect() {
|
|
791
|
-
let
|
|
792
|
-
_networks_all;
|
|
793
|
-
_networks_all =
|
|
794
|
-
"n";
|
|
795
|
-
if ( target_networks.length < 1 &&
|
|
796
|
-
network_ids.length < 1 ) {
|
|
797
|
-
_networks_all =
|
|
798
|
-
"y";
|
|
799
|
-
}
|
|
800
|
-
if ( typeof(
|
|
801
|
-
networks_all) === "undefined" ||
|
|
802
|
-
networks_all == "" ) {
|
|
803
|
-
networks_all =
|
|
804
|
-
_networks_all;
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
|
|
808
492
|
module.exports = {
|
|
809
493
|
_contract_version_auto_detect:
|
|
810
494
|
_contract_version_auto_detect,
|
|
@@ -813,5 +497,7 @@ module.exports = {
|
|
|
813
497
|
_evm_contract_deployment_address:
|
|
814
498
|
_evm_contract_deployment_address,
|
|
815
499
|
_networks_all_auto_detect:
|
|
816
|
-
_networks_all_auto_detect
|
|
500
|
+
_networks_all_auto_detect,
|
|
501
|
+
_target_app_auto_detect:
|
|
502
|
+
_target_app_auto_detect
|
|
817
503
|
};
|