evm-contracts-tools 0.0.51 → 0.0.52

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 (36) hide show
  1. package/dist/evm-contract-call/evm-contract-call.js +1 -2
  2. package/dist/evm-contract-deployment-abi/evm-contract-deployment-abi.js +1 -2
  3. package/dist/evm-contract-deployment-address/evm-contract-deployment-address.js +1 -2
  4. package/dist/evm-contract-deployment-bytecode/evm-contract-deployment-bytecode.js +1 -2
  5. package/dist/evm-contract-deployment-compiler-output/evm-contract-deployment-compiler-output.js +1 -2
  6. package/dist/evm-contract-deployment-networks/evm-contract-deployment-networks.js +1 -2
  7. package/dist/evm-contract-deployment-versions/evm-contract-deployment-versions.js +1 -2
  8. package/dist/evm-contract-deployments-dir/evm-contract-deployments-dir.js +1 -2
  9. package/dist/evm-contracts-tools/evm-contracts-tools.js +1 -2
  10. package/dist/libevm-contract-call/libevm-contract-call.js +1 -2
  11. package/dist/libevm-contract-deployment-abi/libevm-contract-deployment-abi.js +1 -2
  12. package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +1 -1
  13. package/dist/libevm-contract-deployment-bytecode/libevm-contract-deployment-bytecode.js +1 -2
  14. package/dist/libevm-contract-deployment-compiler-output/libevm-contract-deployment-compiler-output.js +1 -2
  15. package/dist/libevm-contract-deployment-networks/libevm-contract-deployment-networks.js +1 -2
  16. package/dist/libevm-contract-deployment-versions/libevm-contract-deployment-versions.js +1 -2
  17. package/dist/libevm-contract-deployments-dir/libevm-contract-deployments-dir.js +1 -2
  18. package/eslint.config.mjs +1 -20
  19. package/evm-contract-call +334 -144
  20. package/evm-contract-deployment-abi +212 -87
  21. package/evm-contract-deployment-address +209 -89
  22. package/evm-contract-deployment-bytecode +146 -61
  23. package/evm-contract-deployment-compiler-output +168 -67
  24. package/evm-contract-deployment-networks +160 -68
  25. package/evm-contract-deployment-versions +138 -66
  26. package/evm-contract-deployments-dir +116 -47
  27. package/evm-contracts-tools +41 -29
  28. package/libevm-contract-call +254 -58
  29. package/libevm-contract-deployment +39 -41
  30. package/libevm-contract-deployment-abi +31 -18
  31. package/libevm-contract-deployment-bytecode +31 -18
  32. package/libevm-contract-deployment-compiler-output +32 -19
  33. package/libevm-contract-deployment-networks +20 -11
  34. package/libevm-contract-deployment-versions +16 -10
  35. package/libevm-contract-deployments-dir +12 -7
  36. package/package.json +12 -12
@@ -33,11 +33,11 @@
33
33
 
34
34
  const
35
35
  _libcrash_module =
36
- require(
37
- "crash-js");
36
+ await import(
37
+ "libcrash-js");
38
38
  const
39
39
  _address_check_module =
40
- require(
40
+ await import(
41
41
  "./lib/address-check");
42
42
  /* global
43
43
  _address_check */
@@ -46,7 +46,7 @@ const
46
46
  _address_check_module._address_check;
47
47
  const
48
48
  _bytecode_creation_get_module =
49
- require(
49
+ await import(
50
50
  "./lib/bytecode-creation-get");
51
51
  /* global
52
52
  _bytecode_creation_get */
@@ -55,7 +55,7 @@ const
55
55
  _bytecode_creation_get_module._bytecode_creation_get;
56
56
  const
57
57
  _bytecode_runtime_get_module =
58
- require(
58
+ await import(
59
59
  "./lib/bytecode-runtime-get");
60
60
  /* global
61
61
  _bytecode_runtime_get */
@@ -65,7 +65,7 @@ const
65
65
 
66
66
  const
67
67
  _contract_get_module =
68
- require(
68
+ await import(
69
69
  "./lib/contract-get");
70
70
  /* global
71
71
  _contract_get */
@@ -74,7 +74,7 @@ const
74
74
  _contract_get_module._contract_get;
75
75
  const
76
76
  _deployer_get_module =
77
- require(
77
+ await import(
78
78
  "./lib/deployer-get");
79
79
  /* global
80
80
  _deployer_get */
@@ -83,7 +83,7 @@ const
83
83
  _deployer_get_module._deployer_get;
84
84
  const
85
85
  _deployer_verify_module =
86
- require(
86
+ await import(
87
87
  "./lib/deployer-verify");
88
88
  /* global
89
89
  _deployer_verify */
@@ -92,7 +92,7 @@ const
92
92
  _deployer_verify_module._deployer_verify;
93
93
  const
94
94
  _evm_contract_call_dynamic_module =
95
- require(
95
+ await import(
96
96
  "./lib/evm-contract-call-dynamic");
97
97
  /* global
98
98
  _contract_call_dynamic */
@@ -106,7 +106,7 @@ const
106
106
  _evm_contract_call_dynamic_module._contract_run;
107
107
  const
108
108
  _evm_contract_call_static_module =
109
- require(
109
+ await import(
110
110
  "./lib/evm-contract-call-static");
111
111
  /* global
112
112
  _contract_call_static */
@@ -114,23 +114,35 @@ const
114
114
  _contract_call_static =
115
115
  _evm_contract_call_static_module._contract_call_static;
116
116
 
117
- module.exports = {
118
- _address_check:
119
- _address_check,
120
- _bytecode_creation_get:
121
- _bytecode_creation_get,
122
- _bytecode_runtime_get:
123
- _bytecode_runtime_get,
124
- _contract_call_dynamic:
125
- _contract_call_dynamic,
126
- _contract_call_static:
127
- _contract_call_static,
128
- _contract_get:
129
- _contract_get,
130
- _contract_run:
131
- _contract_run,
132
- _deployer_get:
133
- _deployer_get,
134
- _deployer_verify:
135
- _deployer_verify,
117
+ export {
118
+ _address_check,
119
+ _bytecode_creation_get,
120
+ _bytecode_runtime_get,
121
+ _contract_call_dynamic,
122
+ _contract_call_static,
123
+ _contract_get,
124
+ _contract_run,
125
+ _deployer_get,
126
+ _deployer_verify,
136
127
  };
128
+
129
+ // module.exports = {
130
+ // _address_check:
131
+ // _address_check,
132
+ // _bytecode_creation_get:
133
+ // _bytecode_creation_get,
134
+ // _bytecode_runtime_get:
135
+ // _bytecode_runtime_get,
136
+ // _contract_call_dynamic:
137
+ // _contract_call_dynamic,
138
+ // _contract_call_static:
139
+ // _contract_call_static,
140
+ // _contract_get:
141
+ // _contract_get,
142
+ // _contract_run:
143
+ // _contract_run,
144
+ // _deployer_get:
145
+ // _deployer_get,
146
+ // _deployer_verify:
147
+ // _deployer_verify,
148
+ // };
@@ -63,8 +63,8 @@
63
63
 
64
64
  const
65
65
  _libcrash_module =
66
- require(
67
- "crash-js");
66
+ await import(
67
+ "libcrash-js");
68
68
  /* global
69
69
  _dirname */
70
70
  const
@@ -75,6 +75,11 @@ const
75
75
  const
76
76
  _file_exists =
77
77
  _libcrash_module._file_exists;
78
+ /* global
79
+ _get */
80
+ const
81
+ _get =
82
+ _libcrash_module._get;
78
83
  /* global
79
84
  _homedir_get */
80
85
  const
@@ -115,18 +120,28 @@ const
115
120
  const
116
121
  _range =
117
122
  _libcrash_module._range;
123
+ /* global
124
+ _require */
125
+ const
126
+ _require =
127
+ _libcrash_module._require;
128
+ /* global
129
+ _set */
130
+ const
131
+ _set =
132
+ _libcrash_module._set;
118
133
  const
119
134
  _evm_contracts_tools_module =
120
- require("./evm-contracts-tools");
135
+ await import(
136
+ "./evm-contracts-tools");
121
137
  /* global
122
138
  _address_check */
123
139
  const
124
140
  _address_check =
125
141
  _evm_contracts_tools_module._address_check;
126
-
127
142
  const
128
143
  _ethereum_data_module =
129
- require(
144
+ await _require(
130
145
  "ethereum-data");
131
146
  /* global
132
147
  _data_get */
@@ -135,21 +150,59 @@ const
135
150
  _ethereum_data_module._data_get;
136
151
 
137
152
  function
138
- _target_networks_auto_detect() {
153
+ _target_networks_get(
154
+ _target_networks) {
139
155
  // TODO:
140
- // _evm_wallet_module.balance-discovery
141
- if ( target_networks == "" ||
142
- target_networks == [] ) {
156
+ // _evm_wallet_module._balance_discovery
157
+ const
158
+ _target_networks_type =
159
+ typeof(
160
+ _target_networks);
161
+ if ( _target_networks_type == "undefined" ) {
162
+ _target_networks =
163
+ _get(
164
+ "target",
165
+ "networks");
166
+ }
167
+ if ( _target_networks == "" ||
168
+ _target_networks == [] ) {
143
169
  // to be auto-detected
144
- target_networks = [
145
- "1"
146
- ];
170
+ _target_networks = [
171
+ "1"
172
+ ];
147
173
  }
148
- // to be auto-detected
174
+ const
175
+ _target_network =
176
+ _target_network[0];
177
+ return [ _target_networks,
178
+ _target_network ];
179
+ }
180
+
181
+ function
182
+ _target_networks_auto_detect() {
183
+ // TODO:
184
+ // _evm_wallet_module._balance_discovery
185
+ let
186
+ _target_network,
187
+ _target_networks;
188
+ _target_networks =
189
+ _get(
190
+ "target",
191
+ "networks");
192
+ [ _target_networks,
193
+ /* eslint-disable-next-line
194
+ prefer-const */
195
+ _target_network ] =
196
+ _target_networks_auto_detect(
197
+ _target_networks);
198
+ _set(
199
+ "target",
200
+ "networks",
201
+ _target_networks);
149
202
  _override_set(
150
203
  "target",
151
204
  "network",
152
- "1");
205
+ _target_network);
153
206
  }
154
207
 
155
208
  function
@@ -202,26 +255,66 @@ function
202
255
  }
203
256
 
204
257
  function
205
- _contract_abi_auto_detect() {
258
+ _contract_abi_get(
259
+ _network,
260
+ _address,
261
+ _api_key,
262
+ _compiler_output,
263
+ _abi) {
206
264
  let
207
- _abi,
208
265
  _abi_target;
209
266
  const
267
+ _abi_type =
268
+ typeof(
269
+ _abi);
270
+ if ( _abi_type == "undefined" ) {
271
+ _abi =
272
+ _get(
273
+ "contract",
274
+ "abi");
275
+ }
276
+ const
277
+ _network_type =
278
+ typeof(
279
+ _network);
280
+ if ( _network_type == "undefined" ) {
210
281
  _network =
211
- target_network;
282
+ _get(
283
+ "target",
284
+ "network");
285
+ }
212
286
  const
287
+ _address_type =
288
+ typeof(
289
+ _address);
290
+ if ( _address_type == "undefined" ) {
213
291
  _address =
214
- contract_address;
292
+ _get(
293
+ "contract",
294
+ "address");
295
+ }
215
296
  const
216
- _key =
217
- api_key;
297
+ _api_key_type =
298
+ typeof(
299
+ _api_key);
300
+ if ( _api_key_type == "undefined" ) {
301
+ _api_key =
302
+ _get(
303
+ "api",
304
+ "key");
305
+ }
218
306
  const
307
+ _compiler_output_type =
308
+ typeof(
309
+ _compiler_output);
310
+ if ( _compiler_output_type == "undefined" ) {
219
311
  _compiler_output =
220
- contract_compiler_output;
221
- _abi =
222
- contract_abi;
223
- _abi_target =
224
- _abi;
312
+ _get(
313
+ "contract",
314
+ "compiler_output");
315
+ }
316
+ _abi_target =
317
+ _abi;
225
318
  if ( typeof(
226
319
  _abi_target) == "undefined" ||
227
320
  _abi_target == "" ) {
@@ -247,16 +340,71 @@ function
247
340
  _abi_dir);
248
341
  }
249
342
  }
343
+ return _abi;
250
344
  }
251
345
 
252
346
  function
253
- _call_auth_auto_detect() {
254
- if ( call_type == "static" ) {
255
- call_auth =
347
+ _contract_abi_auto_detect() {
348
+ let
349
+ _abi;
350
+ const
351
+ _network =
352
+ _get(
353
+ "target",
354
+ "network");
355
+ const
356
+ _address =
357
+ _get(
358
+ "contract",
359
+ "address");
360
+ const
361
+ _api_key =
362
+ _get(
363
+ "api",
364
+ "key");
365
+ const
366
+ _compiler_output =
367
+ _get(
368
+ "contract",
369
+ "compiler_output");
370
+ _abi =
371
+ _get(
372
+ "contract",
373
+ "abi");
374
+ _abi =
375
+ _contract_abi_get(
376
+ _network,
377
+ _address,
378
+ _api_key,
379
+ _compiler_output,
380
+ _abi);
381
+ _override_set(
382
+ "contract",
383
+ "abi",
384
+ _abi);
385
+ }
386
+
387
+ function
388
+ _call_auth_get(
389
+ _call_type) {
390
+ let
391
+ _call_auth;
392
+ const
393
+ _call_type_type =
394
+ typeof(
395
+ _call_type);
396
+ if ( _call_type_type == "undefined" ) {
397
+ _call_type =
398
+ _get(
399
+ "call",
400
+ "type");
401
+ }
402
+ if ( _call_type == "static" ) {
403
+ _call_auth =
256
404
  "n";
257
405
  }
258
406
  else if ( call_type == "dynamic" ) {
259
- call_auth =
407
+ _call_auth =
260
408
  "y";
261
409
  }
262
410
  else {
@@ -265,11 +413,30 @@ function
265
413
  `Unknown call type '${call_type}'.`;
266
414
  _msg_error(
267
415
  _msg,
268
- 1);
416
+ 0);
417
+ throw _msg;
269
418
  }
419
+ return _call_auth;
270
420
  }
271
421
 
272
422
  function
423
+ _call_auth_auto_detect() {
424
+ const
425
+ _call_type =
426
+ _get(
427
+ "call",
428
+ "type");
429
+ const
430
+ _call_auth =
431
+ _call_auth_get(
432
+ _call_type);
433
+ _override_set(
434
+ "call",
435
+ "type",
436
+ _call_type);
437
+ }
438
+
439
+ async function
273
440
  _evm_contract_call(
274
441
  _call_type,
275
442
  _call_timeout,
@@ -301,7 +468,6 @@ function
301
468
  [];
302
469
  _out =
303
470
  "";
304
-
305
471
  }
306
472
  else if ( _call_type == "dynamic" ) {
307
473
  _out =
@@ -314,45 +480,75 @@ function
314
480
  `'${_call_type}'.`;
315
481
  _msg_error(
316
482
  _msg,
317
- 1);
483
+ 0);
484
+ throw _msg;
318
485
  }
319
486
  return _out;
320
487
  }
321
488
 
322
489
  function
323
490
  _artifact_local_auto_detect(
324
- _type) {
491
+ _artifact_type) {
325
492
  const
326
493
  _artifact =
327
494
  _default_artifact_path_get(
328
- _type);
329
- if ( _type == "abi" ) {
330
- contract_abi =
331
- _artifact;
495
+ _artifact_type);
496
+ if ( _artifact_type == "abi" ) {
497
+ _override_set(
498
+ "contract",
499
+ "abi",
500
+ _artifact);
332
501
  }
333
- else if ( _type == "bytecode" ) {
334
- contract_bytecode =
335
- _artifact;
502
+ else if ( _artifact_type == "bytecode" ) {
503
+ _override_set(
504
+ "contract",
505
+ "bytecode",
506
+ _artifact);
336
507
  }
337
- else if ( _type == "compiler_output" ) {
338
- contract_compiler_output =
339
- _artifact;
508
+ else if ( _artifact_type == "compiler_output" ) {
509
+ _override_set(
510
+ "contract",
511
+ "compiler_output",
512
+ _artifact);
340
513
  }
341
514
  }
342
515
 
343
- module.exports = {
344
- _address_check:
345
- _address_check,
346
- _artifact_local_auto_detect:
347
- _artifact_local_auto_detect,
348
- _call_auth_auto_detect:
349
- _call_auth_auto_detect,
350
- _contract_abi_auto_detect:
351
- _contract_abi_auto_detect,
352
- _default_artifact_path_get:
353
- _default_artifact_path_get,
354
- _evm_contract_call:
355
- _evm_contract_call,
356
- _target_networks_auto_detect:
357
- _target_networks_auto_detect
516
+ // ES6 module exports
517
+
518
+ export {
519
+ _address_check,
520
+ _artifact_local_auto_detect,
521
+ _call_auth_auto_detect,
522
+ _call_auth_get,
523
+ _contract_abi_auto_detect,
524
+ _contract_abi_get,
525
+ _default_artifact_path_get,
526
+ _evm_contract_call,
527
+ _target_networks_auto_detect,
528
+ _target_networks_get
358
529
  };
530
+
531
+ // Common Javascript exports
532
+
533
+ // module.exports = {
534
+ // _address_check:
535
+ // _address_check,
536
+ // _artifact_local_auto_detect:
537
+ // _artifact_local_auto_detect,
538
+ // _call_auth_auto_detect:
539
+ // _call_auth_auto_detect,
540
+ // _call_auth_get:
541
+ // _call_auth_get,
542
+ // _contract_abi_auto_detect:
543
+ // _contract_abi_auto_detect,
544
+ // _contract_abi_get:
545
+ // _contract_abi_get,
546
+ // _default_artifact_path_get:
547
+ // _default_artifact_path_get,
548
+ // _evm_contract_call:
549
+ // _evm_contract_call,
550
+ // _target_networks_auto_detect:
551
+ // _target_networks_auto_detect,
552
+ // _target_networks_get:
553
+ // _target_networks_get
554
+ // };
@@ -63,8 +63,8 @@
63
63
 
64
64
  const
65
65
  _libcrash_module =
66
- require(
67
- "crash-js");
66
+ await import(
67
+ "libcrash-js");
68
68
  /* global
69
69
  _basename */
70
70
  const
@@ -77,8 +77,6 @@ const
77
77
  _libcrash_module._chmod;
78
78
  /* global
79
79
  _cp */
80
- /* eslint-disable-next-line
81
- no-global-assign */
82
80
  const
83
81
  _cp =
84
82
  _libcrash_module._cp;
@@ -94,50 +92,36 @@ const
94
92
  _libcrash_module._file_exists;
95
93
  /* global
96
94
  _file_read */
97
- /* eslint-disable-next-line
98
- no-global-assign */
99
95
  const
100
96
  _file_read =
101
97
  _libcrash_module._file_read;
102
98
  /* global
103
99
  _from_bash_ass_array */
104
- /* eslint-disable-next-line
105
- no-global-assign */
106
100
  const
107
101
  _from_bash_ass_array =
108
102
  _libcrash_module._from_bash_ass_array;
109
103
  /* global
110
104
  _homedir_get */
111
- /* eslint-disable-next-line
112
- no-global-assign */
113
105
  const
114
106
  _homedir_get =
115
107
  _libcrash_module._homedir_get;
116
108
  /* global
117
109
  _json_read */
118
- /* eslint-disable-next-line
119
- no-global-assign */
120
110
  const
121
111
  _json_read =
122
112
  _libcrash_module._json_read;
123
113
  /* global
124
114
  _mkdir */
125
- /* eslint-disable-next-line
126
- no-global-assign */
127
115
  const
128
116
  _mkdir =
129
117
  _libcrash_module._mkdir;
130
118
  /* global
131
119
  _msg_info */
132
- /* eslint-disable-next-line
133
- no-global-assign */
134
120
  const
135
121
  _msg_info =
136
122
  _libcrash_module._msg_info;
137
123
  /* global
138
124
  _msg_error */
139
- /* eslint-disable-next-line
140
- no-global-assign */
141
125
  const
142
126
  _msg_error =
143
127
  _libcrash_module._msg_error;
@@ -148,8 +132,6 @@ const
148
132
  _libcrash_module._override_set;
149
133
  /* global
150
134
  _path_join */
151
- /* eslint-disable-next-line
152
- no-global-assign */
153
135
  const
154
136
  _path_join =
155
137
  _libcrash_module._path_join;
@@ -158,9 +140,14 @@ const
158
140
  const
159
141
  _pwd =
160
142
  _libcrash_module._pwd;
143
+ /* global
144
+ _require */
145
+ const
146
+ _require =
147
+ _libcrash_module._require;
161
148
  const
162
149
  _evm_chains_info_module =
163
- require(
150
+ await _require(
164
151
  "evm-chains-info");
165
152
  /* global
166
153
  _evm_chains_info */
@@ -169,7 +156,7 @@ const
169
156
  _evm_chains_info_module._evm_chains_info;
170
157
  const
171
158
  _libevm_contract_deployments_dir_module =
172
- require(
159
+ await _require(
173
160
  "./libevm-contract-deployments-dir");
174
161
  /* global
175
162
  _evm_contract_deployments_dir */
@@ -178,7 +165,7 @@ const
178
165
  _libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
179
166
  const
180
167
  _libevm_contract_deployment_networks_module =
181
- require(
168
+ await _require(
182
169
  "./libevm-contract-deployment-networks");
183
170
  /* global
184
171
  _evm_contract_deployment_networks */
@@ -187,7 +174,7 @@ const
187
174
  _libevm_contract_deployment_networks_module._evm_contract_deployment_networks;
188
175
  const
189
176
  _libevm_contract_deployment_versions_module =
190
- require(
177
+ await _require(
191
178
  "./libevm-contract-deployment-versions");
192
179
  /* global
193
180
  _evm_contract_deployment_versions */
@@ -630,21 +617,32 @@ function
630
617
  _configuration_format);
631
618
  }
632
619
 
633
- module.exports = {
634
- _configuration_format_auto_detect:
635
- _configuration_format_auto_detect,
636
- _configuration_format_get:
637
- _configuration_format_get,
638
- _contract_version_auto_detect:
639
- _contract_version_auto_detect,
640
- _deployments_dir_auto_detect:
641
- _deployments_dir_auto_detect,
642
- _network_check:
643
- _network_check,
644
- _networks_all_auto_detect:
645
- _networks_all_auto_detect,
646
- _target_app_auto_detect:
647
- _target_app_auto_detect,
648
- _user_deployments_check:
649
- _user_deployments_check,
620
+ export {
621
+ _configuration_format_auto_detect,
622
+ _configuration_format_get,
623
+ _contract_version_auto_detect,
624
+ _deployments_dir_auto_detect,
625
+ _network_check,
626
+ _networks_all_auto_detect,
627
+ _target_app_auto_detect,
628
+ _user_deployments_check,
650
629
  };
630
+
631
+ // module.exports = {
632
+ // _configuration_format_auto_detect:
633
+ // _configuration_format_auto_detect,
634
+ // _configuration_format_get:
635
+ // _configuration_format_get,
636
+ // _contract_version_auto_detect:
637
+ // _contract_version_auto_detect,
638
+ // _deployments_dir_auto_detect:
639
+ // _deployments_dir_auto_detect,
640
+ // _network_check:
641
+ // _network_check,
642
+ // _networks_all_auto_detect:
643
+ // _networks_all_auto_detect,
644
+ // _target_app_auto_detect:
645
+ // _target_app_auto_detect,
646
+ // _user_deployments_check:
647
+ // _user_deployments_check,
648
+ // };