evm-contracts-tools 0.0.55 → 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.
@@ -85,6 +85,11 @@ const
85
85
  const
86
86
  _dir_exists =
87
87
  _libcrash_module._dir_exists;
88
+ /* global
89
+ _echo */
90
+ const
91
+ _echo =
92
+ _libcrash_module._echo;
88
93
  /* global
89
94
  _file_exists */
90
95
  const
@@ -100,6 +105,11 @@ const
100
105
  const
101
106
  _from_bash_ass_array =
102
107
  _libcrash_module._from_bash_ass_array;
108
+ /* global
109
+ _get */
110
+ const
111
+ _get =
112
+ _libcrash_module._get;
103
113
  /* global
104
114
  _homedir_get */
105
115
  const
@@ -154,33 +164,12 @@ const
154
164
  const
155
165
  _evm_chains_info =
156
166
  _evm_chains_info_module._evm_chains_info;
157
- const
158
- _libevm_contract_deployments_dir_module =
159
- await _require(
160
- "./libevm-contract-deployments-dir");
161
- /* global
162
- _evm_contract_deployments_dir */
163
- const
164
- _evm_contract_deployments_dir =
165
- _libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
166
- const
167
- _libevm_contract_deployment_networks_module =
168
- await _require(
169
- "./libevm-contract-deployment-networks");
167
+ /* global
168
+ _evm_contract_deployments_dir */
170
169
  /* global
171
170
  _evm_contract_deployment_networks */
172
- const
173
- _evm_contract_deployment_networks =
174
- _libevm_contract_deployment_networks_module._evm_contract_deployment_networks;
175
- const
176
- _libevm_contract_deployment_versions_module =
177
- await _require(
178
- "./libevm-contract-deployment-versions");
179
171
  /* global
180
172
  _evm_contract_deployment_versions */
181
- const
182
- _evm_contract_deployment_versions =
183
- _libevm_contract_deployment_versions_module._evm_contract_deployment_versions;
184
173
 
185
174
  async function
186
175
  _network_check(
@@ -189,18 +178,45 @@ async function
189
178
  _target_network,
190
179
  _target_network_id) {
191
180
  let
181
+ _contract_deployments_path,
192
182
  _error_flag,
183
+ _evm_contract_deployment_networks,
184
+ _evm_chains_info_args,
193
185
  _msg,
194
186
  _network_id;
187
+ _msg =
188
+ "Network check for deployments " +
189
+ `'${_deployments}', contract '${_contract}', ` +
190
+ `network '${_target_network}' and network with ID ` +
191
+ `'${_target_network_id}'.`;
192
+ _msg_info(
193
+ _msg);
194
+ _evm_contract_deployment_networks =
195
+ _get(
196
+ "_evm_contract",
197
+ "deployment_networks");
198
+ const
199
+ _evm_contract_deployment_networks_type =
200
+ typeof(
201
+ _evm_contract_deployment_networks_dir);
202
+ if ( _evm_contract_deployment_networks_type == "undefined" ||
203
+ _evm_contract_deployment_networks == "" ) {
204
+ const
205
+ _libevm_contract_deployment_networks_module =
206
+ await import(
207
+ "./libevm-contract-deployment-networks");
208
+ _evm_contract_deployment_networks =
209
+ _libevm_contract_deployment_networks_module._evm_contract_deployment_networks;
210
+ }
195
211
  _error_flag =
196
212
  false;
197
- _deployments_path =
213
+ _contract_deployments_path =
198
214
  _path_join( [
199
215
  _deployments,
200
216
  _contract ]);
201
217
  const
202
218
  _evm_contract_deployment_networks_args = [
203
- _deployments_path,
219
+ _contract_deployments_path,
204
220
  "y", // Display all
205
221
  "n", // Display safest
206
222
  "n" // Display cheapest
@@ -240,7 +256,8 @@ async function
240
256
  if ( _error_flag ) {
241
257
  _msg_error(
242
258
  _msg,
243
- 1);
259
+ 0);
260
+ throw _msg;
244
261
  }
245
262
  if ( _target_network_id == "" ) {
246
263
  _evm_chains_info_args = [
@@ -256,12 +273,29 @@ async function
256
273
  _target_network,
257
274
  [] // database paths
258
275
  ];
259
- _network_id =
260
- await _evm_chains_info.apply(
261
- null,
262
- _evm_chains_info_args);
276
+ try {
277
+ _network_id =
278
+ await _evm_chains_info.apply(
279
+ null,
280
+ _evm_chains_info_args);
281
+ }
282
+ catch(
283
+ _error) {
284
+ _msg =
285
+ "Error while running '_evm_chains_info' " +
286
+ `with arguments '${_evm_chains_info_args}'.`;
287
+ _msg_error(
288
+ _msg,
289
+ 0);
290
+ _msg_error(
291
+ _error,
292
+ 0);
293
+ throw _error;
294
+ }
263
295
  }
264
296
  else if ( _target_network == "" ) {
297
+ _network_id =
298
+ _target_network_id;
265
299
  _evm_chains_info_args = [
266
300
  "get", // target command
267
301
  "id" , // input type
@@ -275,9 +309,25 @@ async function
275
309
  _target_network_id,
276
310
  [] // database paths
277
311
  ];
278
- _target_network =
279
- await _evm_chains_info(
280
- _evm_chains_info_args);
312
+ try {
313
+ _target_network =
314
+ await _evm_chains_info.apply(
315
+ null,
316
+ _evm_chains_info_args);
317
+ }
318
+ catch(
319
+ _error) {
320
+ _msg =
321
+ "Error while running '_evm_chains_info' " +
322
+ `with arguments '${_evm_chains_info_args}'.`;
323
+ _msg_error(
324
+ _msg,
325
+ 0);
326
+ _msg_error(
327
+ _error,
328
+ 0);
329
+ throw _error;
330
+ }
281
331
  }
282
332
  if ( _target_network_id != "" ) {
283
333
  if ( _target_network_id != _network_id ) {
@@ -288,18 +338,45 @@ async function
288
338
  `known ID '${_network_id}'.`;
289
339
  _msg_error(
290
340
  _msg,
291
- 1);
341
+ 0);
342
+ throw _msg;
292
343
  }
293
344
  }
345
+ _msg =
346
+ "Network check for deployments " +
347
+ `'${_deployments}', contract '${_contract}', ` +
348
+ `network '${_target_network}' and network with ID ` +
349
+ `'${_target_network_id}' completed.`;
350
+ _msg_info(
351
+ _msg);
294
352
  }
295
353
 
296
354
  async function
297
355
  _user_deployments_init(
298
356
  _app,
299
357
  _deployments_dir) {
358
+ let
359
+ _evm_contract_deployments_dir;
300
360
  const
301
361
  _user_defined =
302
362
  "y";
363
+ _evm_contract_deployments_dir =
364
+ _get(
365
+ "_evm_contract",
366
+ "deployments_dir");
367
+ const
368
+ _evm_contract_deployments_dir_type =
369
+ typeof(
370
+ _evm_contract_deployments_dir);
371
+ if ( _evm_contract_deployments_dir_type == "undefined" ||
372
+ _evm_contract_deployments_dir == "" ) {
373
+ const
374
+ _libevm_contract_deployments_dir_module =
375
+ await import(
376
+ "./libevm-contract-deployments-dir");
377
+ _evm_contract_deployments_dir =
378
+ _libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
379
+ }
303
380
  const
304
381
  _evm_contract_deployments_dir_args = [
305
382
  _app,
@@ -347,7 +424,8 @@ async function
347
424
  async function
348
425
  _deployments_dir_auto_detect() {
349
426
  let
350
- _deployments;
427
+ _deployments,
428
+ _evm_contract_deployments_dir;
351
429
  _deployments =
352
430
  "";
353
431
  const
@@ -362,6 +440,23 @@ async function
362
440
  const
363
441
  _user_defined =
364
442
  user_defined;
443
+ _evm_contract_deployments_dir =
444
+ _get(
445
+ "_evm_contract",
446
+ "deployments_dir");
447
+ const
448
+ _evm_contract_deployments_dir_type =
449
+ typeof(
450
+ _evm_contract_deployments_dir);
451
+ if ( _evm_contract_deployments_dir_type == "undefined" ||
452
+ _evm_contract_deployments_dir == "" ) {
453
+ const
454
+ _libevm_contract_deployments_dir_module =
455
+ await import(
456
+ "./libevm-contract-deployments-dir");
457
+ _evm_contract_deployments_dir =
458
+ _libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
459
+ }
365
460
  const
366
461
  _evm_contract_deployments_dir_args = [
367
462
  _app,
@@ -384,6 +479,7 @@ async function
384
479
  _config,
385
480
  _config_ext,
386
481
  _deployments,
482
+ _evm_contracts_deployment_versions,
387
483
  _found,
388
484
  _net,
389
485
  _network,
@@ -485,6 +581,27 @@ async function
485
581
  _msg,
486
582
  1);
487
583
  }
584
+ const
585
+ _libevm_contract_deployment_versions_module =
586
+ await import(
587
+ "./libevm-contract-deployment-versions");
588
+ _evm_contract_deployment_versions =
589
+ _get(
590
+ "_evm_contract",
591
+ "deployment_versions");
592
+ const
593
+ _evm_contract_deployment_versions_type =
594
+ typeof(
595
+ _evm_contract_deployment_versions_dir);
596
+ if ( _evm_contract_deployment_versions_type == "undefined" ||
597
+ _evm_contract_deployment_versions == "" ) {
598
+ const
599
+ _libevm_contract_deployment_versions_module =
600
+ await import(
601
+ "./libevm-contract-deployment-versions");
602
+ _evm_contract_deployment_versions =
603
+ _libevm_contract_deployment_versions_module._evm_contract_deployment_versions;
604
+ }
488
605
  const
489
606
  _evm_contract_deployment_versions_args = [
490
607
  _config,
@@ -548,6 +665,7 @@ async function
548
665
  const
549
666
  _user_defined =
550
667
  user_defined;
668
+
551
669
  const
552
670
  _evm_contract_deployments_dir_args = [
553
671
  _dir_current_name,