evm-contracts-tools 0.0.51 → 0.0.54

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 (59) hide show
  1. package/Makefile +94 -24
  2. package/eslint.config.mjs +1 -20
  3. package/evm-contract-call +343 -146
  4. package/evm-contract-deployment-abi +212 -87
  5. package/evm-contract-deployment-address +209 -89
  6. package/evm-contract-deployment-bytecode +146 -61
  7. package/evm-contract-deployment-compiler-output +168 -67
  8. package/evm-contract-deployment-networks +160 -68
  9. package/evm-contract-deployment-versions +138 -66
  10. package/evm-contract-deployments-dir +116 -47
  11. package/evm-contracts-tools +41 -29
  12. package/lib/address-check +82 -34
  13. package/lib/bytecode-creation-get +135 -110
  14. package/lib/evm-contract-call-dynamic +0 -0
  15. package/lib/evm-contract-call-static +0 -0
  16. package/libevm-contract-call +254 -58
  17. package/libevm-contract-deployment +39 -41
  18. package/libevm-contract-deployment-abi +31 -18
  19. package/libevm-contract-deployment-bytecode +31 -18
  20. package/libevm-contract-deployment-compiler-output +32 -19
  21. package/libevm-contract-deployment-networks +20 -11
  22. package/libevm-contract-deployment-versions +16 -10
  23. package/libevm-contract-deployments-dir +12 -7
  24. package/package.json +15 -15
  25. package/dist/evm-contract-call/evm-contract-call.js +0 -2
  26. package/dist/evm-contract-call/fs-worker.js +0 -1
  27. package/dist/evm-contract-deployment-abi/evm-contract-deployment-abi.js +0 -2
  28. package/dist/evm-contract-deployment-abi/fs-worker.js +0 -1
  29. package/dist/evm-contract-deployment-address/evm-contract-deployment-address.js +0 -2
  30. package/dist/evm-contract-deployment-address/fs-worker.js +0 -1
  31. package/dist/evm-contract-deployment-bytecode/evm-contract-deployment-bytecode.js +0 -2
  32. package/dist/evm-contract-deployment-bytecode/fs-worker.js +0 -1
  33. package/dist/evm-contract-deployment-compiler-output/evm-contract-deployment-compiler-output.js +0 -2
  34. package/dist/evm-contract-deployment-compiler-output/fs-worker.js +0 -1
  35. package/dist/evm-contract-deployment-deployment-networks +0 -1
  36. package/dist/evm-contract-deployment-networks/evm-contract-deployment-networks.js +0 -2
  37. package/dist/evm-contract-deployment-versions/evm-contract-deployment-versions.js +0 -2
  38. package/dist/evm-contract-deployment-versions/fs-worker.js +0 -1
  39. package/dist/evm-contract-deployments-dir/evm-contract-deployments-dir.js +0 -2
  40. package/dist/evm-contract-deployments-dir/fs-worker.js +0 -1
  41. package/dist/evm-contracts-tools/evm-contracts-tools.js +0 -2
  42. package/dist/evm-contracts-tools/fs-worker.js +0 -1
  43. package/dist/libevm-contract-call/fs-worker.js +0 -1
  44. package/dist/libevm-contract-call/libevm-contract-call.js +0 -2
  45. package/dist/libevm-contract-deployment-abi/fs-worker.js +0 -1
  46. package/dist/libevm-contract-deployment-abi/libevm-contract-deployment-abi.js +0 -2
  47. package/dist/libevm-contract-deployment-address/fs-worker.js +0 -1
  48. package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +0 -2
  49. package/dist/libevm-contract-deployment-bytecode/fs-worker.js +0 -1
  50. package/dist/libevm-contract-deployment-bytecode/libevm-contract-deployment-bytecode.js +0 -2
  51. package/dist/libevm-contract-deployment-compiler-output/fs-worker.js +0 -1
  52. package/dist/libevm-contract-deployment-compiler-output/libevm-contract-deployment-compiler-output.js +0 -2
  53. package/dist/libevm-contract-deployment-deployment-networks +0 -1
  54. package/dist/libevm-contract-deployment-networks/libevm-contract-deployment-networks.js +0 -2
  55. package/dist/libevm-contract-deployment-versions/fs-worker.js +0 -1
  56. package/dist/libevm-contract-deployment-versions/libevm-contract-deployment-versions.js +0 -2
  57. package/dist/libevm-contract-deployments-dir/fs-worker.js +0 -1
  58. package/dist/libevm-contract-deployments-dir/libevm-contract-deployments-dir.js +0 -2
  59. package/dist/libevm-contracts-tools +0 -1
@@ -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
+ // };
package/lib/address-check CHANGED
@@ -28,13 +28,13 @@
28
28
 
29
29
  const
30
30
  _libcrash =
31
- require(
32
- "crash-js");
31
+ await import(
32
+ "libcrash-js");
33
33
  /* global
34
- _argv_get */
34
+ _argv */
35
35
  const
36
- _argv_get =
37
- _libcrash._argv_get;
36
+ _argv =
37
+ _libcrash._argv;
38
38
  /* global
39
39
  _basename */
40
40
  const
@@ -45,11 +45,21 @@ const
45
45
  const
46
46
  _cmdline_check =
47
47
  _libcrash._cmdline_check;
48
+ /* global
49
+ _echo */
50
+ const
51
+ _echo =
52
+ _libcrash._echo;
48
53
  /* global
49
54
  _exit */
50
55
  const
51
56
  _exit =
52
57
  _libcrash._exit;
58
+ /* global
59
+ _global_get */
60
+ const
61
+ _global_get =
62
+ _libcrash._global_get;
53
63
  /* global
54
64
  _msg_info */
55
65
  const
@@ -60,11 +70,21 @@ const
60
70
  const
61
71
  _msg_error =
62
72
  _libcrash._msg_error;
73
+ /* global
74
+ _override_set */
75
+ const
76
+ _override_set =
77
+ _libcrash._override_set;
63
78
  /* global
64
79
  _require */
65
80
  const
66
81
  _require =
67
82
  _libcrash._require;
83
+ /* global
84
+ _set */
85
+ const
86
+ _set =
87
+ _libcrash._override_set;
68
88
  const
69
89
  _ethers_module =
70
90
  await _require(
@@ -80,17 +100,32 @@ const
80
100
 
81
101
  function
82
102
  _global_variables() {
83
- app_name =
84
- "address-check";
85
103
  /* global
86
- target_address:
104
+ app_name:
87
105
  writable */
88
- target_address =
89
- "";
106
+ _set(
107
+ "app",
108
+ "name",
109
+ "address-check");
90
110
  /* global
91
- quiet:
111
+ app_opts:
92
112
  writable */
93
- quiet =
113
+ _set(
114
+ "app",
115
+ "opts",
116
+ []);
117
+ /* global
118
+ target_address:
119
+ writable */
120
+ _set(
121
+ "target",
122
+ "address",
123
+ "");
124
+ const
125
+ _global =
126
+ _global_get();
127
+ _global[
128
+ "quiet"] =
94
129
  "";
95
130
  }
96
131
 
@@ -98,14 +133,11 @@ function
98
133
  _config_show() {
99
134
  let
100
135
  _line;
101
- const
102
- _argv =
103
- _argv_get();
104
136
  const
105
137
  _program =
106
138
  _basename(
107
139
  _argv[
108
- "$0"]);
140
+ 0]);
109
141
  const
110
142
  _text = [
111
143
  `${_program} configuration:`,
@@ -123,14 +155,11 @@ function
123
155
  let
124
156
  _display_fun,
125
157
  _line;
126
- const
127
- _argv =
128
- _argv_get();
129
158
  const
130
159
  _program =
131
160
  _basename(
132
161
  _argv[
133
- "$0"]);
162
+ 0]);
134
163
  const
135
164
  _text = [
136
165
  "Checks whether an address is valid.",
@@ -148,7 +177,7 @@ function
148
177
  " -h --help This help."
149
178
  ];
150
179
  for (_line of _text) {
151
- _msg_info(
180
+ _echo(
152
181
  _line);
153
182
  }
154
183
  _exit(
@@ -164,30 +193,41 @@ function
164
193
  _cmdline_parse() {
165
194
  quiet =
166
195
  "y";
167
- process.argv.forEach(
196
+ _argv.forEach(
168
197
  function (
169
198
  _value,
170
- _index,
171
- _array) {
199
+ _index) {
200
+ const
201
+ _global =
202
+ _global_get();
172
203
  if ( _index == 2 ) {
173
- target_address =
174
- _value;
204
+ _set(
205
+ "target",
206
+ "address",
207
+ _value);
175
208
  }
176
209
  else if ( _value == "-v" ||
177
210
  _value == "--verbose" ) {
178
- quiet =
211
+ _global[
212
+ "quiet"] =
179
213
  "n";
180
214
  }
181
215
  else if ( _value == "-h" ||
182
216
  _value == "--help" ) {
183
- quiet =
217
+ _global[
218
+ "quiet"] =
184
219
  "n";
185
220
  _usage(
186
221
  0);
187
222
  }
188
223
  }
189
224
  );
190
- if ( target_address == "" ) {
225
+ const
226
+ _target_address =
227
+ _get(
228
+ "target",
229
+ "address");
230
+ if ( _target_address == "" ) {
191
231
  const
192
232
  _msg =
193
233
  "No target address specified.";
@@ -237,9 +277,9 @@ async function
237
277
  }
238
278
  }
239
279
 
240
- if ( _cmdline_check(
280
+ if ( await _cmdline_check(
241
281
  "address-check") ||
242
- _cmdline_check(
282
+ await _cmdline_check(
243
283
  "ethereum-address-validate") ) {
244
284
  _global_variables();
245
285
  await _cmdline_parse();
@@ -251,8 +291,16 @@ if ( _cmdline_check(
251
291
  _address_check_cmdline(
252
292
  app_opts);
253
293
  }
294
+ else {
295
+ _echo(
296
+ "chromi");
297
+ }
254
298
 
255
- module.exports = {
256
- _address_check:
257
- _address_check
299
+ export {
300
+ _address_check
258
301
  };
302
+
303
+ // module.exports = {
304
+ // _address_check:
305
+ // _address_check
306
+ // };
@@ -26,8 +26,18 @@
26
26
 
27
27
  const
28
28
  _libcrash =
29
- require(
30
- "crash-js");
29
+ await import(
30
+ "libcrash-js");
31
+ /* global
32
+ _argv */
33
+ const
34
+ _argv =
35
+ _libcrash._argv;
36
+ /* global
37
+ _basename */
38
+ const
39
+ _basename =
40
+ _libcrash._basename;
31
41
  /* global
32
42
  _cmdline_check */
33
43
  const
@@ -38,6 +48,11 @@ const
38
48
  const
39
49
  _error_display =
40
50
  _libcrash._error_display;
51
+ /* global
52
+ _echo */
53
+ const
54
+ _echo =
55
+ _libcrash._echo;
41
56
  /* global
42
57
  _exit */
43
58
  const
@@ -268,45 +283,24 @@ async function
268
283
  function
269
284
  _config_show() {
270
285
  let
271
- _line,
272
- _method_args,
273
- _text;
274
- _text =
275
- [];
276
- _text.push(
277
- "bytecode-creation-get configuration:");
278
- _text.push(
279
- " Wallet seed: {wallet_seed}".replace(
280
- "{wallet_seed}",
281
- wallet_seed));
282
- _text.push(
283
- " Max retries: {retries_max}".replace(
284
- "{retries_max}",
285
- retries_max));
286
- _text.push(
287
- " API Key path: {api_key_path}".replace(
288
- "{api_key_path}",
289
- api_key_path));
290
- _text.push(
291
- " Chain ID: {chain_id}".replace(
292
- "{chain_id}",
293
- chain_id));
294
- _text.push(
295
- " Chain Name: {chain_name}".replace(
296
- "{chain_name}",
297
- chain_name));
298
- _text.push(
299
- " Target network: {target_network}".replace(
300
- "{target_network}",
301
- target_network));
302
- _text.push(
303
- " Contract address: {contract_address}".replace(
304
- "{contract_address}",
305
- contract_address));
306
- _text.push(
307
- " Deployment transaction: {transaction_deployment}".replace(
308
- "{transaction_deployment}",
309
- transaction_deployment));
286
+ _line;
287
+ const
288
+ _program =
289
+ _basename(
290
+ _argv[
291
+ "1"]);
292
+ const
293
+ _text = [
294
+ `${_program} configuration:`,
295
+ ` Wallet seed: ${wallet_seed}`,
296
+ ` Max retries: ${retries_max}`,
297
+ ` API Key path: ${api_key_path}`,
298
+ ` Chain ID: ${chain_id}`,
299
+ ` Chain Name: ${chain_name}`,
300
+ ` Target network: ${target_network}`,
301
+ ` Contract address: ${contract_address}`,
302
+ ` Deployment transaction: ${transaction_deployment}`,
303
+ ];
310
304
  for (_line of _text) {
311
305
  _msg_info(
312
306
  _line);
@@ -317,47 +311,48 @@ function
317
311
  _usage(
318
312
  _exit_code) {
319
313
  let
320
- _display_fun,
321
- _line,
322
- _text;
323
- _text = [
324
- "Returns the creation bytecode for a contract given its deployment transaction hash.",
325
- "",
326
- "Usage:",
327
- " bytecode-creation-get",
328
- " <quiet>",
329
- " <wallet_seed>",
330
- " <retries_max>",
331
- " <api_key_path>",
332
- " <chain_id>",
333
- " <chain_name>",
334
- " <target_network>",
335
- " <contract_address>",
336
- " <transaction_deployment>",
337
- " <contract_bytecode_path>",
338
- "",
339
- "Args:",
340
- " <quiet> Can be 'y' or 'n'",
341
- " Default: y",
342
- " <wallet_seed> Path of the file containing",
343
- " the seed phrase.",
344
- " <retries_max> Maximum number of retries before",
345
- " failing.",
346
- " <api_key_path> Path of the API key for the",
347
- " contract ABI provider service",
348
- " <chain_id> Chain ID for the network.",
349
- " <chain_name> Name for the network.",
350
- " <target_network> Network on which the contract",
351
- " resides.",
352
- " <contract_address> Address of the contract",
353
- " <transaction_deployment> Contract deployment transaction.",
354
- " <contract_bytecode_path> Where to save contract bytecode.",
355
- "",
356
- " Options:",
357
- " -h This help."
358
- ];
314
+ _line;
315
+ const
316
+ _text = [
317
+ "",
318
+ "Returns the creation bytecode for a contract given its deployment transaction hash.",
319
+ "",
320
+ "Usage:",
321
+ ` ${_program}`,
322
+ " <quiet>",
323
+ " <wallet-seed>",
324
+ " <retries-max>",
325
+ " <api-key-path>",
326
+ " <chain-id>",
327
+ " <chain-name>",
328
+ " <target-network>",
329
+ " <contract-address>",
330
+ " <transaction-deployment>",
331
+ " <contract-bytecode-path>",
332
+ "",
333
+ "Args:",
334
+ " <quiet> Can be 'y' or 'n'",
335
+ " Default: y",
336
+ " <wallet-seed> Path of the file containing",
337
+ " the seed phrase.",
338
+ " <retries-max> Maximum number of retries before",
339
+ " failing.",
340
+ " <api-key-path> Path of the API key for the",
341
+ " contract ABI provider service",
342
+ " <chain-id> Chain ID for the network.",
343
+ " <chain-name> Name for the network.",
344
+ " <target-network> Network on which the contract",
345
+ " resides.",
346
+ " <contract-address> Address of the contract",
347
+ " <transaction-deployment> Contract deployment transaction.",
348
+ " <contract-bytecode-path> Where to save contract bytecode.",
349
+ "",
350
+ " Options:",
351
+ " -h This help.",
352
+ ""
353
+ ];
359
354
  for (_line of _text) {
360
- _msg_info(
355
+ _echo(
361
356
  _line);
362
357
  }
363
358
  _exit(
@@ -377,56 +372,79 @@ function
377
372
  let
378
373
  _error,
379
374
  _msg;
380
- quiet =
375
+ const
376
+ _global =
377
+ _global_get();
378
+ _global[
379
+ "quiet"] =
381
380
  "y";
382
- process.argv.forEach(
381
+ _argv.forEach(
383
382
  function (
384
383
  _value,
385
- _index,
386
- _array) {
384
+ _index) {
387
385
  if ( _index == 2 ) {
388
- quiet =
386
+ _global[
387
+ "quiet"] =
389
388
  _value;
390
389
  }
391
390
  if ( _index == 3 ) {
392
- wallet_seed =
393
- _value;
391
+ _set(
392
+ "wallet",
393
+ "seed",
394
+ _value);
394
395
  }
395
396
  if ( _index == 4 ) {
396
- retries_max =
397
- _value;
397
+ _set(
398
+ "retries",
399
+ "max",
400
+ _value);
398
401
  }
399
402
  if ( _index == 5 ) {
400
- api_key_path =
401
- _value;
403
+ _set(
404
+ "api_key",
405
+ "path",
406
+ _value);
402
407
  }
403
408
  if ( _index == 6 ) {
404
- chain_id =
405
- _value;
409
+ _set(
410
+ "chain",
411
+ "id",
412
+ _value);
406
413
  }
407
414
  if ( _index == 7 ) {
408
- chain_name =
409
- _value;
415
+ _set(
416
+ "chain",
417
+ "name",
418
+ _value);
410
419
  }
411
420
  if ( _index == 8 ) {
412
- target_network =
413
- _value;
421
+ _set(
422
+ "target",
423
+ "network",
424
+ _value);
414
425
  }
415
426
  if ( _index == 9 ) {
416
- contract_address =
417
- _value;
427
+ _set(
428
+ "contract",
429
+ "address",
430
+ _value);
418
431
  }
419
432
  if ( _index == 10 ) {
420
- transaction_deployment =
421
- _value;
433
+ _set(
434
+ "transaction",
435
+ "deployment",
436
+ _value);
422
437
  }
423
438
  if ( _index == 11 ) {
424
- contract_bytecode_path =
425
- _value;
439
+ _set(
440
+ "contract_bytecode",
441
+ "path",
442
+ _value);
426
443
  }
427
444
  if ( _value == "-h" ||
428
445
  _value == "--help" ) {
429
- quiet =
446
+ _global[
447
+ "quiet"] =
430
448
  "n";
431
449
  _usage(
432
450
  0);
@@ -451,7 +469,8 @@ function
451
469
  _msg_error(
452
470
  _msg,
453
471
  0);
454
- quiet =
472
+ _global[
473
+ "quiet"] =
455
474
  "n";
456
475
  _usage(
457
476
  1);
@@ -469,8 +488,10 @@ async function
469
488
  null,
470
489
  _app_opts);
471
490
  if ( _bytecode != undefined ) {
491
+ _msg =
492
+ `Bytecode has length '${_bytecode.length}'`;
472
493
  _msg_info(
473
- `Bytecode has length '${_bytecode.length}'`);
494
+ _msg);
474
495
  // _printf(
475
496
  // _bytecode.toString());
476
497
  }
@@ -509,7 +530,11 @@ if ( _cmdline_check(
509
530
  app_opts);
510
531
  }
511
532
 
512
- module.exports = {
513
- _bytecode_creation_get:
514
- _bytecode_creation_get
533
+ export {
534
+ _bytecode_creation_get
515
535
  };
536
+
537
+ // module.exports = {
538
+ // _bytecode_creation_get:
539
+ // _bytecode_creation_get
540
+ // };
File without changes
File without changes