evm-contracts-tools 0.0.6 → 0.0.10

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/evm-contract-call CHANGED
@@ -70,40 +70,55 @@ const
70
70
  _process_exit =
71
71
  _libcrash._process_exit;
72
72
 
73
+
74
+ const
75
+ _libevm_module =
76
+ require(
77
+ "libevm");
78
+ /* global
79
+ _libevm_global_variables */
80
+ const
81
+ _libevm_global_variables =
82
+ _libevm_module._libevm_global_variables;
83
+ /* global
84
+ _wallet_overrides_set */
85
+ const
86
+ _wallet_overrides_set =
87
+ _libevm_module._wallet_overrides_set;
73
88
  const
74
- _libevm_chains_info =
89
+ _libevm_chains_info_module =
75
90
  require(
76
- "./libevm-chains-info");
91
+ "libevm-chains-info");
77
92
  /* global
78
93
  _evm_chains_db_path_get */
79
94
  const
80
95
  _evm_chains_db_path_get =
81
- _libevm_chains_info._evm_chains_db_path_get;
96
+ _libevm_chains_info_module._evm_chains_db_path_get;
82
97
  /* global
83
98
  _evm_chains_info_get */
84
99
  const
85
100
  _evm_chain_info_get =
86
- _libevm_chains_info._evm_chain_info_get;
101
+ _libevm_chains_info_module._evm_chain_info_get;
87
102
  /* global
88
103
  _rpc_backends_get */
89
104
  const
90
105
  _rpc_backend_get =
91
- _libevm_chains_info._rpc_backend_get;
106
+ _libevm_chains_info_module._rpc_backend_get;
92
107
  /* global
93
108
  _evm_chains_info */
94
109
  const
95
110
  _evm_chains_info =
96
- _libevm_chains_info._evm_chains_info;
111
+ _libevm_chains_info_module._evm_chains_info;
97
112
  /* global
98
113
  _db_paths_auto_detect */
99
114
  const
100
115
  _db_paths_auto_detect =
101
- _libevm_chains_info._db_paths_auto_detect;
116
+ _libevm_chains_info_module._db_paths_auto_detect;
102
117
  /* global
103
118
  _input_type_auto_detect */
104
119
  const
105
120
  _input_type_auto_detect =
106
- _libevm_chains_info._input_type_auto_detect;
121
+ _libevm_chains_info_module._input_type_auto_detect;
107
122
 
108
123
  function
109
124
  _global_variables() {
@@ -128,54 +143,54 @@ function
128
143
  call_date =
129
144
  "";
130
145
  /* global
131
- target_command:
146
+ call_type:
132
147
  writable */
133
- target_command =
148
+ call_type =
134
149
  "";
135
150
  /* global
136
- input_type:
151
+ index_retrieve:
137
152
  writable */
138
- input_type =
153
+ index_retrieve =
139
154
  "";
140
155
  /* global
141
- output_type:
156
+ contract_address:
142
157
  writable */
143
- output_type =
158
+ contract_address =
144
159
  "";
145
160
  /* global
146
- retrieval_mode:
161
+ contract_bytecode:
147
162
  writable */
148
- retrieval_mode =
163
+ contract_bytecode =
149
164
  "";
150
165
  /* global
151
- user_level:
166
+ contract_compiler_output:
152
167
  writable */
153
- user_level =
168
+ contract_compiler_output =
154
169
  "";
155
170
  /* global
156
- db_paths:
171
+ contract_abi:
157
172
  writable */
158
- db_paths =
159
- [];
173
+ contract_abi =
174
+ "";
160
175
  /* global
161
- selection_method:
176
+ contract_method:
162
177
  writable */
163
- selection_method =
178
+ contract_method =
164
179
  "";
165
180
  /* global
166
- api_key:
181
+ method_args:
167
182
  writable */
168
- api_key =
169
- "";
183
+ method_args =
184
+ [];
170
185
  /* global
171
- target_chain:
186
+ price_gas:
172
187
  writable */
173
- target_chain =
188
+ price_gas =
174
189
  "";
175
190
  /* global
176
- networks_all:
191
+ measure_unit:
177
192
  writable */
178
- networks_all =
193
+ measure_unit =
179
194
  "";
180
195
  /* global
181
196
  quiet:
@@ -195,6 +210,7 @@ function
195
210
  call_date =
196
211
  _get_date_human();
197
212
  }
213
+ _wallet_overrides_set();
198
214
  if ( target_command == "" ) {
199
215
  target_command =
200
216
  "get";
@@ -322,9 +338,19 @@ function
322
338
  let
323
339
  _help_display,
324
340
  _msg;
341
+ const
342
+ _argv_args = {
343
+ "booleans": [
344
+ "h",
345
+ "help",
346
+ "v",
347
+ "verbose"
348
+ ]
349
+ };
325
350
  const
326
351
  _argv =
327
- _argv_get();
352
+ _argv_get(
353
+ _argv_args);
328
354
  const
329
355
  _options =
330
356
  _argv[
@@ -333,16 +359,25 @@ function
333
359
  "y";
334
360
  runtime_environment =
335
361
  "node";
336
- if ( _options.indexOf(
337
- "--help") > -1 ||
338
- _options.indexOf(
339
- "-h") > -1) {
362
+ if ( _argv["h"] == true ) {
363
+ _help_display =
364
+ true;
365
+ }
366
+ if ( _argv["help"] == true ) {
367
+ _help_display =
368
+ true;
369
+ }
370
+ if ( ( _options.indexOf(
371
+ "--help") > -1 ||
372
+ _options.indexOf(
373
+ "-h") > -1) ) {
340
374
  _help_display =
341
375
  true;
342
376
  }
343
377
  if ( _help_display ) {
344
378
  quiet =
345
379
  "n";
380
+ _overrides_set();
346
381
  _usage(
347
382
  0);
348
383
  }
@@ -351,112 +386,164 @@ function
351
386
  _argv[
352
387
  "_"].length < 1 ) {
353
388
  _msg =
354
- "Target chain argument required.";
389
+ "Contract address argument required.";
355
390
  _msg_error(
356
391
  _msg,
357
392
  0);
358
393
  _usage(
359
394
  1);
360
395
  }
361
- target_chain =
396
+ contract_address =
362
397
  _argv[
363
398
  "_"][
364
399
  0];
365
- if ( "C" in _argv ) {
366
- target_command =
400
+ if ( typeof(
401
+ _argv) == "undefined" ||
402
+ _argv[
403
+ "_"].length < 2 ) {
404
+ _msg =
405
+ "Contract method argument required.";
406
+ _msg_error(
407
+ _msg,
408
+ 0);
409
+ _usage(
410
+ 1);
411
+ }
412
+ contract_method =
413
+ _argv[
414
+ "_"][
415
+ 0];
416
+ const
417
+ method_args =
418
+ _out.slice(
419
+ 2,
420
+ _argv[
421
+ "_"].length - 2);
422
+ if ( "t" in _argv ) {
423
+ call_type =
367
424
  _argv[
368
- "C"];
425
+ "t"];
369
426
  }
370
- if ( "command" in _argv ) {
371
- target_command =
427
+ if ( "call-type" in _argv ) {
428
+ call_type =
372
429
  _argv[
373
- "command"];
430
+ "call-type"];
374
431
  }
375
- if ( "i" in _argv ) {
376
- input_type =
432
+ if ( "T" in _argv ) {
433
+ call_timeout =
377
434
  _argv[
378
- "i"];
435
+ "t"];
379
436
  }
380
- if ( "input-type" in _argv ) {
381
- input_type =
437
+ if ( "call-timeout" in _argv ) {
438
+ call_timeout =
382
439
  _argv[
383
- "input-type"];
440
+ "call-timeout"];
384
441
  }
385
- if ( "o" in _argv ) {
386
- output_type =
442
+ if ( "I" in _argv ) {
443
+ index_retrieve =
387
444
  _argv[
388
- "o"];
445
+ "I"];
389
446
  }
390
- if ( "output-type" in _argv ) {
391
- output_type =
447
+ if ( "index_retrieve" in _argv ) {
448
+ index_retrieve =
392
449
  _argv[
393
- "output-type"];
450
+ "index-retrieve"];
394
451
  }
395
- if ( "m" in _argv ) {
396
- retrieval_mode =
452
+ if ( "P" in _argv ) {
453
+ price_gas =
397
454
  _argv[
398
- "m"];
455
+ "P"];
399
456
  }
400
- if ( "retrieval-mode" in _argv ) {
401
- retrieval_mode =
457
+ if ( "price-gas" in _argv ) {
458
+ price_gas =
402
459
  _argv[
403
- "retrieval-mode"];
460
+ "price-gas"];
404
461
  }
405
462
  if ( "u" in _argv ) {
406
- user_level =
463
+ measure_unit =
407
464
  _argv[
408
465
  "u"];
409
466
  }
410
- if ( "user-level" in _argv ) {
411
- user_level =
467
+ if ( "measure-unit" in _argv ) {
468
+ measure_unit =
412
469
  _argv[
413
- "user-level"];
470
+ "measure-unit"];
414
471
  }
415
- if ( "d" in _argv ) {
416
- db_paths.push(
472
+ if ( "V" in _argv ) {
473
+ msg_value =
417
474
  _argv[
418
- "d"]);
475
+ "V"];
419
476
  }
420
- if ( "db-path" in _argv ) {
421
- db_paths.push(
477
+ if ( "msg-value" in _argv ) {
478
+ msg_value =
422
479
  _argv[
423
- "user-level"]);
480
+ "msg-value"];
424
481
  }
425
- if ( "s" in _argv ) {
426
- selection_method =
482
+ if ( "r" in _argv ) {
483
+ retries_max =
427
484
  _argv[
428
- "s"];
485
+ "r"];
429
486
  }
430
- if ( "selection-method" in _argv ) {
431
- selection_method =
487
+ if ( "retries-max" in _argv ) {
488
+ retries_max =
432
489
  _argv[
433
- "selection-method"];
490
+ "retries-max"];
434
491
  }
435
- if ( "k" in _argv ) {
436
- api_key =
437
- "y";
492
+ if ( "S" in _argv ) {
493
+ rpc_selection =
494
+ _argv[
495
+ "S"];
438
496
  }
439
- if ( "api-key" in _argv ) {
440
- api_key =
441
- "y";
497
+ if ( "rpc-selection" in _argv ) {
498
+ rpc_selection =
499
+ _argv[
500
+ "rpc-selection"];
501
+ }
502
+ if ( "A" in _argv ) {
503
+ contract_abi =
504
+ _argv[
505
+ "A"];
506
+ }
507
+ if ( "contract-abi" in _argv ) {
508
+ contract_abi =
509
+ _argv[
510
+ "contract-abi"];
511
+ }
512
+ if ( "C" in _argv ) {
513
+ contract_compiler_output =
514
+ _argv[
515
+ "C"];
516
+ }
517
+ if ( "contract-compiler-output" in _argv ) {
518
+ contract_compiler_output =
519
+ _argv[
520
+ "contract-compiler-output"];
442
521
  }
443
522
  if ( "a" in _argv ) {
444
- networks_all =
523
+ call_auth =
445
524
  "y";
446
525
  }
447
- if ( "networks-all" in _argv ) {
448
- networks_all =
526
+ if ( "call-auth" in _argv ) {
527
+ call_auth =
449
528
  "y";
450
529
  }
530
+ if ( "n" in _argv ) {
531
+ target_networks.push(
532
+ _argv[
533
+ "n"]);
534
+ }
535
+ if ( "network" in _argv ) {
536
+ target_networks.push(
537
+ _argv[
538
+ "network"]);
539
+ }
451
540
  if ( "v" in _argv ) {
452
541
  verbose =
453
- _argv[
454
- "v"];
542
+ true;
455
543
  }
456
544
  if ( "verbose" in _argv ) {
457
545
  verbose =
458
- _argv[
459
- "verbose"];
546
+ true;
460
547
  }
461
548
  if ( verbose ) {
462
549
  quiet =
@@ -522,13 +609,13 @@ function
522
609
  }
523
610
 
524
611
  function
525
- _evm_chains_info_cmdline(
612
+ _evm_contract_call_cmdline(
526
613
  _app_opts) {
527
614
  let
528
615
  _result;
529
616
  const
530
617
  _results =
531
- _evm_chains_info.apply(
618
+ _evm_contract_call.apply(
532
619
  null,
533
620
  app_opts);
534
621
  for ( _result of _results ) {
@@ -538,6 +625,7 @@ function
538
625
  }
539
626
 
540
627
  _global_variables();
628
+ _libevm_global_variables();
541
629
  if ( _cmdline_check(
542
630
  "evm-contract-call.js") == true ||
543
631
  _cmdline_check(
@@ -560,5 +648,5 @@ app_opts = [
560
648
  target_chain,
561
649
  db_paths
562
650
  ];
563
- _evm_chains_info_cmdline(
651
+ _evm_contract_call_cmdline(
564
652
  app_opts);
@@ -28,49 +28,100 @@ const
28
28
  _libcrash =
29
29
  require(
30
30
  "crash-js");
31
- _cmdline_check =
32
- _libcrash._cmdline_check;
33
- _error_display =
34
- _libcrash._error_display;
35
- _file_read =
36
- _libcrash._file_read;
37
- _file_write =
38
- _libcrash._file_write;
39
- _msg_info =
40
- _libcrash._msg_info
41
- _msg_error =
42
- _libcrash._msg_error
43
- _printf =
44
- _libcrash._printf
31
+ /* global
32
+ _cmdline_check */
33
+ const
34
+ _cmdline_check =
35
+ _libcrash._cmdline_check;
36
+ /* global
37
+ _error_display */
38
+ const
39
+ _error_display =
40
+ _libcrash._error_display;
41
+ /* global
42
+ _file_read */
43
+ const
44
+ _file_read =
45
+ _libcrash._file_read;
46
+ /* global
47
+ _file_write */
48
+ const
49
+ _file_write =
50
+ _libcrash._file_write;
51
+ /* global
52
+ _msg_info */
53
+ const
54
+ _msg_info =
55
+ _libcrash._msg_info
56
+ /* global
57
+ _msg_error */
58
+ const
59
+ _msg_error =
60
+ _libcrash._msg_error
61
+ /* global
62
+ _printf */
63
+ const
64
+ _printf =
65
+ _libcrash._printf
45
66
  const
46
67
  _contract_get_module =
47
68
  require(
48
69
  './contract-get');
49
- _contract_get =
50
- _contract_get_module._contract_get
70
+ /* global
71
+ _contract_get */
72
+ const
73
+ _contract_get =
74
+ _contract_get_module._contract_get
51
75
  const
52
- _network_provider_module =
76
+ _evm_wallet_module =
53
77
  require(
54
- '../evm-wallet/network-provider');
55
- _provider_get =
56
- _network_provider_module._provider_get;
78
+ "evm-wallet");
79
+ /* global
80
+ _provider_get */
81
+ const
82
+ _provider_get =
83
+ _evm_wallet_module._provider_get;
57
84
 
58
85
  function
59
86
  _global_variables() {
87
+ /* global
88
+ app_name:
89
+ writable */
60
90
  app_name =
61
91
  "bytecode-runtime-get";
92
+ /* global
93
+ wallet_seed:
94
+ writable */
62
95
  wallet_seed =
63
96
  "";
97
+ /* global
98
+ retries_max:
99
+ writable */
64
100
  retries_max =
65
101
  "";
102
+ /* global
103
+ api_key_path:
104
+ writable */
66
105
  api_key_path =
67
106
  "";
107
+ /* global
108
+ target_network:
109
+ writable */
68
110
  target_network =
69
111
  "";
112
+ /* global
113
+ contract_address:
114
+ writable */
70
115
  contract_address =
71
116
  "";
117
+ /* global
118
+ contract_abi_path:
119
+ writable */
72
120
  contract_abi_path =
73
121
  "";
122
+ /* global
123
+ contract_bytecode_path:
124
+ writable */
74
125
  contract_bytecode_path =
75
126
  "";
76
127
  // contract_compiler_output_path =
@@ -79,8 +130,11 @@ function
79
130
  // "";
80
131
  // method_args =
81
132
  // [];
133
+ /* global
134
+ quiet:
135
+ writable */
82
136
  quiet =
83
- '';
137
+ "";
84
138
  }
85
139
 
86
140
  function
@@ -92,15 +146,9 @@ function
92
146
  function
93
147
  _msg_info_contract_obtained(
94
148
  _contract) {
95
- let
96
- _msg,
97
- _template;
98
- _template =
99
- "Contract '{_contract}' obtained.";
100
- _msg =
101
- _template.replaceAll(
102
- "{_contract}",
103
- _contract);
149
+ const
150
+ _msg =
151
+ `Contract '${_contract}' obtained.`;
104
152
  _msg_info(
105
153
  _msg);
106
154
  }
@@ -108,10 +156,9 @@ function
108
156
  function
109
157
  _msg_info_method_obtained(
110
158
  _method) {
111
- let
112
- _msg;
113
- _msg =
114
- "Method obtained.";
159
+ const
160
+ _msg =
161
+ "Method obtained.";
115
162
  _msg_info(
116
163
  _msg);
117
164
  }
@@ -128,6 +175,7 @@ async function
128
175
  let
129
176
  _api_key,
130
177
  _code,
178
+ _msg,
131
179
  _network_provider,
132
180
  _passed,
133
181
  _wallet_password;
@@ -157,8 +205,10 @@ async function
157
205
  await _network_provider.getCode(
158
206
  _contract_address);
159
207
  if ( _code != undefined ) {
208
+ _msg =
209
+ `Bytecode length: ${_code.length}`;
160
210
  _msg_info(
161
- `Bytecode length: ${_code.length}`);
211
+ _msg);
162
212
  _file_write(
163
213
  _contract_bytecode_path,
164
214
  _code);
@@ -166,9 +216,11 @@ async function
166
216
  true;
167
217
  }
168
218
  else if ( _code == undefined ) {
219
+ _msg =
220
+ "Code not retrieved."
169
221
  throw {"error": {
170
222
  "message":
171
- "Code not retrieved." } };
223
+ _msg } };
172
224
  }
173
225
  } catch (
174
226
  _error) {
@@ -176,8 +228,10 @@ async function
176
228
  _error);
177
229
  _retry =
178
230
  _retry + 1;
231
+ _msg =
232
+ "Increasing retry and waiting 3 seconds.";
179
233
  _msg_error(
180
- "Increasing retry and waiting 3 seconds.",
234
+ _msg,
181
235
  0);
182
236
  await _delay(
183
237
  3000);
@@ -193,40 +247,19 @@ function
193
247
  _config_show() {
194
248
  let
195
249
  _line,
196
- _method_args,
197
- _text;
198
- _text =
199
- [];
200
- _text.push(
201
- " bytecode-runtime-get configuration:");
202
- _text.push(
203
- " Contract address: {contract_address}".replace(
204
- "{contract_address}",
205
- contract_address));
206
- _text.push(
207
- " Contract bytecode: {contract_bytecode_path}".replace(
208
- "{contract_bytecode_path}",
209
- contract_bytecode_path));
210
- _text.push(
211
- " Max retries: {retries_max}".replace(
212
- "{retries_max}",
213
- retries_max));
214
- _text.push(
215
- " Credentials options:");
216
- _text.push(
217
- " Wallet seed: {wallet_seed}".replace(
218
- "{wallet_seed}",
219
- wallet_seed));
220
- _text.push(
221
- " API Key path: {api_key_path}".replace(
222
- "{api_key_path}",
223
- api_key_path));
224
- _text.push(
225
- " Network options:");
226
- _text.push(
227
- " Target network: {target_network}".replace(
228
- "{target_network}",
229
- target_network));
250
+ _method_args;
251
+ const
252
+ _text = [
253
+ " bytecode-runtime-get configuration:",
254
+ ` Contract address: ${contract_address}`,
255
+ ` Contract bytecode: ${contract_bytecode_path}`,
256
+ ` Max retries: ${retries_max}`,
257
+ ` Credentials options:`,
258
+ ` Wallet seed: ${wallet_seed}`,
259
+ ` API Key path: ${api_key_path}`,
260
+ ` Network options:`,
261
+ ` Target network: ${target_network}`,
262
+ ];
230
263
  for (_line of _text) {
231
264
  _msg_info(
232
265
  _line);
@@ -245,26 +278,27 @@ function
245
278
  "Usage:",
246
279
  " bytecode-runtime-get",
247
280
  " <quiet>",
248
- " <wallet_seed>",
249
- " <retries_max>",
250
- " <api_key_path>",
251
- " <target_network>",
252
- " <contract_address>",
253
- " <contract_bytecode_path>",
281
+ " <wallet-seed>",
282
+ " <retries-max>",
283
+ " <api-key-path>",
284
+ " <target-network>",
285
+ " <contract-address>",
286
+ " <contract-bytecode_path>",
254
287
  "",
255
288
  "Args:",
256
289
  " <quiet> Can be 'y' or 'n'",
257
- " Default: y",
258
- " <wallet_seed> Path of the file containing",
290
+ ` Default: ${quiet}`,
291
+ " <wallet-seed> Path of the file containing",
259
292
  " the seed phrase.",
260
- " <retries_max> Maximum number of retries before",
293
+ " <retries-max> Maximum number of retries before",
261
294
  " failing.",
262
- " <api_key_path> Path of the API key for the",
295
+ ` Default: ${retries_max}`,
296
+ " <api-key-path> Path of the API key for the",
263
297
  " contract ABI provider service",
264
- " <target_network> Network on which the contract",
298
+ " <target-network> Network on which the contract",
265
299
  " resides.",
266
- " <contract_address> Address of the contract",
267
- " <contract_bytecode_path> Path in which to save",
300
+ " <contract-address> Address of the contract",
301
+ " <contract-bytecode-path> Path in which to save",
268
302
  " the runtime bytecode.",
269
303
  "",
270
304
  " Options:",
@@ -331,11 +365,15 @@ function
331
365
  }
332
366
  );
333
367
  if ( contract_address == "" ) {
368
+ const
369
+ _msg =
370
+ "It is required to set a contract address.";
334
371
  _msg_error(
335
- "It is required to set a contract address.",
372
+ _msg,
336
373
  0);
337
374
  quiet =
338
375
  "n";
376
+ _overrides_set();
339
377
  _usage(
340
378
  1);
341
379
  }
package/lib/contract-get CHANGED
@@ -28,80 +28,135 @@ const
28
28
  { ethers } =
29
29
  require(
30
30
  "ethers");
31
- _ethers =
32
- ethers;
33
- _contract_factory =
34
- _ethers.ContractFactory;
35
- _base_contract =
36
- _ethers.BaseContract;
31
+ const
32
+ _ethers =
33
+ ethers;
34
+ const
35
+ _contract_factory =
36
+ _ethers.ContractFactory;
37
+ const
38
+ _base_contract =
39
+ _ethers.BaseContract;
37
40
  const
38
41
  _libcrash =
39
42
  require(
40
43
  "crash-js");
41
- _cmdline_check =
42
- _libcrash._cmdline_check;
43
- _dirname =
44
- _libcrash._dirname;
45
- _file_read =
46
- _libcrash._file_read;
47
- _json_read =
48
- _libcrash._json_read;
49
- _path_join =
50
- _libcrash._path_join;
51
- _msg_info =
52
- _libcrash._msg_info;
53
- _msg_error =
54
- _libcrash._msg_error;
44
+ /* global
45
+ _file_read */
55
46
  const
56
- _evm_wallet_get =
57
- require(
58
- '../evm-wallet/wallet-get');
59
- _wallet_get =
60
- _evm_wallet_get._wallet_get;
47
+ _cmdline_check =
48
+ _libcrash._cmdline_check;
49
+ /* global
50
+ _file_read */
51
+ const
52
+ _dirname =
53
+ _libcrash._dirname;
54
+ /* global
55
+ _file_read */
56
+ const
57
+ _file_read =
58
+ _libcrash._file_read;
59
+ /* global
60
+ _json_read */
61
+ const
62
+ _json_read =
63
+ _libcrash._json_read;
64
+ /* global
65
+ _path_join */
66
+ const
67
+ _path_join =
68
+ _libcrash._path_join;
69
+ /* global
70
+ _msg_info */
71
+ const
72
+ _msg_info =
73
+ _libcrash._msg_info;
74
+ /* global
75
+ _msg_error */
61
76
  const
62
- _network_provider_module =
77
+ _msg_error =
78
+ _libcrash._msg_error;
79
+ const
80
+ _evm_wallet_module =
63
81
  require(
64
- '../evm-wallet/network-provider');
65
- _provider_get =
66
- _network_provider_module._provider_get;
82
+ "evm-wallet.js");
83
+ /* global
84
+ _wallet_get */
85
+ const
86
+ _wallet_get =
87
+ _evm_wallet_module._wallet_get;
88
+ /* global
89
+ _provider_get */
90
+ const
91
+ _provider_get =
92
+ _network_provider_module._provider_get;
67
93
 
68
94
 
69
95
  function
70
96
  _global_variables() {
97
+ /* global
98
+ app_name:
99
+ writable */
71
100
  app_name =
72
101
  "contract-get"
102
+ /* global
103
+ wallet_seed:
104
+ writable */
73
105
  wallet_seed =
74
106
  "";
107
+ /* global
108
+ wallet_password_path:
109
+ writable */
75
110
  wallet_password_path =
76
111
  "";
112
+ /* global
113
+ contract_address:
114
+ writable */
77
115
  contract_address =
78
116
  "";
117
+ /* global
118
+ contract_abi_path:
119
+ writable */
79
120
  contract_abi_path =
80
121
  "";
122
+ /* global
123
+ contract_bytecode_path:
124
+ writable */
81
125
  contract_bytecode_path =
82
126
  "";
127
+ /* global
128
+ contract_compiler_output_path:
129
+ writable */
83
130
  contract_compiler_output_path =
84
131
  "";
132
+ /* global
133
+ target_network:
134
+ writable */
85
135
  target_network =
86
136
  "";
137
+ /* global
138
+ api_key_path:
139
+ writable */
87
140
  api_key_path =
88
141
  "";
142
+ /* global
143
+ quiet:
144
+ writable */
89
145
  quiet =
90
146
  "";
91
147
  }
92
148
 
93
149
  function
94
150
  _msg_error_no_input_data() {
95
- let
96
- _msg,
97
- _text;
98
- _text = [
99
- "You need to provide either",
100
- "the bytecode or the data"
101
- ];
102
- _msg =
103
- _text.join(
104
- " ");
151
+ const
152
+ _text = [
153
+ "You need to provide either",
154
+ "the bytecode or the data"
155
+ ];
156
+ const
157
+ _msg =
158
+ _text.join(
159
+ " ");
105
160
  _msg_error(
106
161
  _msg,
107
162
  1);
@@ -110,15 +165,9 @@ function
110
165
  function
111
166
  _msg_info_wallet_selected(
112
167
  _wallet) {
113
- let
114
- _msg,
115
- _template;
116
- _template =
117
- "Wallet is '{_wallet}'.";
118
- _msg =
119
- _template.replaceAll(
120
- "{_wallet}",
121
- _wallet);
168
+ const
169
+ _msg =
170
+ `Wallet is '${_wallet}'.`;
122
171
  _msg_info(
123
172
  _msg);
124
173
  }
@@ -128,18 +177,17 @@ async function
128
177
  _wallet,
129
178
  _contract_address,
130
179
  _contract_abi_path) {
131
- let
132
- _contract,
133
- _contract_abi;
134
- _contract_abi =
135
- _json_read(
136
- _contract_abi_path);
137
- _contract = new
138
- _base_contract(
139
- _contract_address,
140
- _contract_abi,
141
- runner =
142
- _wallet);
180
+ const
181
+ _contract_abi =
182
+ _json_read(
183
+ _contract_abi_path);
184
+ const
185
+ _contract = new
186
+ _base_contract(
187
+ _contract_address,
188
+ _contract_abi,
189
+ runner =
190
+ _wallet);
143
191
  return _contract;
144
192
  }
145
193
 
@@ -153,7 +201,7 @@ async function
153
201
  _contract,
154
202
  _contract_abi,
155
203
  _contract_bytecode,
156
- _factory;
204
+ _msg;
157
205
  if ( _contract_abi_path == "" ) {
158
206
  _contract_abi = [];
159
207
  }
@@ -167,11 +215,12 @@ async function
167
215
  _file_read(
168
216
  _contract_bytecode_path);
169
217
  }
170
- _factory =
171
- new _contract_factory(
172
- _contract_abi,
173
- _contract_bytecode,
174
- _wallet);
218
+ const
219
+ _factory =
220
+ new _contract_factory(
221
+ _contract_abi,
222
+ _contract_bytecode,
223
+ _wallet);
175
224
  if ( _contract_address != "" ) {
176
225
  _contract =
177
226
  _factory.attach(
@@ -182,8 +231,14 @@ async function
182
231
  _contract =
183
232
  _factory.getDeployTransaction();
184
233
  } catch (e) {
234
+ const
235
+ _msg =
236
+ `Encountered the above error.`;
185
237
  console.error(
186
238
  e);
239
+ _msg_error(
240
+ _msg,
241
+ 0);
187
242
  }
188
243
  }
189
244
  return _contract;
@@ -195,16 +250,16 @@ async function
195
250
  _contract_address,
196
251
  _contract_compiler_output_path) {
197
252
  let
198
- _contract,
199
- _contract_compiler_output,
200
- _factory;
201
- _contract_compiler_output =
202
- _file_read(
203
- _contract_compiler_output_path);
204
- _factory =
205
- _contract_factory.fromSolidity(
206
- _contract_compiler_output,
207
- _wallet);
253
+ _contract;
254
+ const
255
+ _contract_compiler_output =
256
+ _file_read(
257
+ _contract_compiler_output_path);
258
+ const
259
+ _factory =
260
+ _contract_factory.fromSolidity(
261
+ _contract_compiler_output,
262
+ _wallet);
208
263
  if ( _contract_address != "" ) {
209
264
  _contract =
210
265
  _factory.attach(
@@ -217,7 +272,6 @@ async function
217
272
  return _contract;
218
273
  }
219
274
 
220
-
221
275
  async function
222
276
  _contract_get(
223
277
  _wallet_seed,
@@ -28,77 +28,161 @@ const
28
28
  _libcrash =
29
29
  require(
30
30
  "crash-js");
31
- _cmdline_check =
32
- _libcrash._cmdline_check;
33
- _dirname =
34
- _libcrash._dirname;
35
- _error_display =
36
- _libcrash._error_display;
37
- _msg_info =
38
- _libcrash._msg_info;
39
- _msg_error =
40
- _libcrash._msg_error;
41
- _path_join =
42
- _libcrash._path_join;
43
- _sleep =
44
- _libcrash._sleep;
31
+ /* global
32
+ _cmdline_check */
33
+ const
34
+ _cmdline_check =
35
+ _libcrash._cmdline_check;
36
+ /* global
37
+ _dirname */
38
+ const
39
+ _dirname =
40
+ _libcrash._dirname;
41
+ /* global
42
+ _error_display */
43
+ const
44
+ _error_display =
45
+ _libcrash._error_display;
46
+ /* global
47
+ _msg_info */
48
+ const
49
+ _msg_info =
50
+ _libcrash._msg_info;
51
+ /* global
52
+ _msg_error */
53
+ const
54
+ _msg_error =
55
+ _libcrash._msg_error;
56
+ /* global
57
+ _path_join */
58
+ const
59
+ _path_join =
60
+ _libcrash._path_join;
61
+ /* global
62
+ _sleep */
63
+ const
64
+ _sleep =
65
+ _libcrash._sleep;
45
66
  const
46
67
  { ethers } =
47
68
  require(
48
69
  "ethers");
49
- _ethers =
50
- ethers;
51
- _wei_to_ether =
52
- _ethers.formatEther;
53
- _parse_units =
54
- _ethers.parseUnits;
70
+ const
71
+ _ethers =
72
+ ethers;
73
+ /* global
74
+ _wei_to_ether */
75
+ const
76
+ _wei_to_ether =
77
+ _ethers.formatEther;
78
+ /* global
79
+ _parse_units */
80
+ const
81
+ _parse_units =
82
+ _ethers.parseUnits;
55
83
  const
56
84
  _price_gas_transaction_get_module =
57
85
  require(
58
86
  '../evm-wallet/price-gas-transaction-get');
59
- _price_gas_transaction_get =
60
- _price_gas_transaction_get_module._price_gas_transaction_get;
87
+ /* global
88
+ _price_gas_transaction_get */
89
+ const
90
+ _price_gas_transaction_get =
91
+ _price_gas_transaction_get_module._price_gas_transaction_get;
61
92
  const
62
93
  _contract_get_module =
63
94
  require(
64
95
  './contract-get');
96
+ /* global
97
+ _contract_get */
65
98
  _contract_get =
66
99
  _contract_get_module._contract_get;
67
100
 
68
101
  function
69
102
  _global_variables() {
103
+ /* global
104
+ app_name:
105
+ writable */
70
106
  app_name =
71
107
  "evm-contract-call-dynamic";
108
+ /* global
109
+ retries_max:
110
+ writable */
72
111
  retries_max =
73
112
  "";
113
+ /* global
114
+ call_timeout:
115
+ writable */
74
116
  call_timeout =
75
117
  "";
118
+ /* global
119
+ wallet_seed:
120
+ writable */
76
121
  wallet_seed =
77
122
  "";
123
+ /* global
124
+ wallet_password:
125
+ writable */
78
126
  wallet_password =
79
127
  "";
128
+ /* global
129
+ api_key_path:
130
+ writable */
80
131
  api_key_path =
81
132
  "";
133
+ /* global
134
+ price_gas:
135
+ writable */
82
136
  price_gas =
83
137
  "";
138
+ /* global
139
+ msg_value:
140
+ writable */
84
141
  msg_value =
85
142
  "";
143
+ /* global
144
+ measure_unit:
145
+ writable */
86
146
  measure_unit =
87
147
  "";
148
+ /* global
149
+ target_network:
150
+ writable */
88
151
  target_network =
89
152
  "";
153
+ /* global
154
+ contract_address:
155
+ writable */
90
156
  contract_address =
91
157
  "";
158
+ /* global
159
+ contract_abi_path:
160
+ writable */
92
161
  contract_abi_path =
93
162
  "";
163
+ /* global
164
+ contract_bytecode_path:
165
+ writable */
94
166
  contract_bytecode_path =
95
167
  "";
168
+ /* global
169
+ contract_compiler_output_path:
170
+ writable */
96
171
  contract_compiler_output_path =
97
172
  "";
173
+ /* global
174
+ contract_method:
175
+ writable */
98
176
  contract_method =
99
177
  "";
178
+ /* global
179
+ method_args:
180
+ writable */
100
181
  method_args =
101
182
  [];
183
+ /* global
184
+ quiet:
185
+ writable */
102
186
  quiet =
103
187
  "";
104
188
  }
@@ -106,15 +190,9 @@ function
106
190
  function
107
191
  _msg_info_wallet_selected(
108
192
  _wallet_path) {
109
- let
110
- _msg,
111
- _template;
112
- _template =
113
- "Selecting '{_wallet_path}'.";
114
- _msg =
115
- _template.replaceAll(
116
- "{_wallet_path}",
117
- _wallet_path);
193
+ const
194
+ _msg =
195
+ `Selecting '${_wallet_path}'.`;
118
196
  _msg_info(
119
197
  _msg);
120
198
  }
@@ -122,15 +200,10 @@ function
122
200
  async function
123
201
  _msg_info_contract_obtained(
124
202
  _contract) {
125
- let
126
- _msg,
127
- _template;
128
- _template =
129
- "Contract object '{_contract}' obtained.";
130
- _msg =
131
- _template.replaceAll(
132
- "{_contract}",
133
- _contract);
203
+ const
204
+ _msg =
205
+ `Contract object obtained.`;
206
+ // `Contract object '${_contract}' obtained.`;
134
207
  _msg_info(
135
208
  _msg);
136
209
  }
@@ -138,10 +211,9 @@ async function
138
211
  function
139
212
  _msg_info_method_obtained(
140
213
  _method) {
141
- let
142
- _msg;
143
- _msg =
144
- "Method obtained.";
214
+ const
215
+ _msg =
216
+ "Method obtained.";
145
217
  _msg_info(
146
218
  _msg);
147
219
  }
@@ -149,17 +221,9 @@ function
149
221
  function
150
222
  _msg_error_transaction_undefined(
151
223
  _attempt) {
152
- let
153
- _msg,
154
- _template;
155
- _template =
156
- "Transaction undefined at attempt '{_attempt}'.";
157
- _msg =
158
- _template.replaceAll(
159
- "{_attempt}",
160
- _attempt);
161
- _msg_info(
162
- _msg);
224
+ const
225
+ _msg =
226
+ `Transaction undefined at attempt '${_attempt}'.`;
163
227
  _msg_error(
164
228
  _msg,
165
229
  0);
@@ -168,10 +232,9 @@ function
168
232
  function
169
233
  _msg_error_transaction_failed(
170
234
  _attempt) {
171
- let
172
- _msg;
173
- _msg =
174
- `Transaction failed at attempt '${_attempt}'.`;
235
+ const
236
+ _msg =
237
+ `Transaction failed at attempt '${_attempt}'.`;
175
238
  _msg_error(
176
239
  _msg,
177
240
  0);
@@ -39,7 +39,7 @@ const
39
39
  const
40
40
  _bytecode_creation_get_module =
41
41
  require(
42
- "./lib/bytecode_creation_get");
42
+ "./lib/bytecode-creation-get");
43
43
  /* global
44
44
  _bytecode_creation_get */
45
45
  const
@@ -48,7 +48,7 @@ const
48
48
  const
49
49
  _bytecode_runtime_get_module =
50
50
  require(
51
- "./lib/bytecode_runtime_get");
51
+ "./lib/bytecode-runtime-get");
52
52
  /* global
53
53
  _bytecode_runtime_get */
54
54
  const
@@ -58,7 +58,7 @@ const
58
58
  const
59
59
  _contract_get_module =
60
60
  require(
61
- "./lib/contract_get");
61
+ "./lib/contract-get");
62
62
  /* global
63
63
  _contract_get */
64
64
  const
@@ -67,7 +67,7 @@ const
67
67
  const
68
68
  _deployer_get_module =
69
69
  require(
70
- "./lib/deployer_get");
70
+ "./lib/deployer-get");
71
71
  /* global
72
72
  _deployer_get */
73
73
  const
@@ -76,7 +76,7 @@ const
76
76
  const
77
77
  _deployer_verify_module =
78
78
  require(
79
- "./lib/deployer_verify");
79
+ "./lib/deployer-verify");
80
80
  /* global
81
81
  _deployer_verify */
82
82
  const
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  { "name": "evm-contracts-tools",
2
2
  "version":
3
- "0.0.6",
3
+ "0.0.10",
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": {
@@ -96,6 +96,8 @@
96
96
  "libevm-contracts-tools",
97
97
  "bin":
98
98
  {
99
+ "evm-contract-call":
100
+ "evm-contract-call",
99
101
  "evm-contract-call.js":
100
102
  "evm-contract-call",
101
103
  "evm-contract-call-dynamic.js":