evm-contracts-tools 0.0.62 → 0.0.64
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/dist/evm-contract-call/evm-contract-call.js +1 -1
- package/dist/evm-contract-call/fs-worker.js +1 -1
- package/dist/evm-contract-deployment-abi/evm-contract-deployment-abi.js +1 -1
- package/dist/evm-contract-deployment-abi/fs-worker.js +1 -1
- package/dist/evm-contract-deployment-address/evm-contract-deployment-address.js +1 -1
- package/dist/evm-contract-deployment-address/fs-worker.js +1 -1
- package/dist/evm-contract-deployment-bytecode/evm-contract-deployment-bytecode.js +1 -1
- package/dist/evm-contract-deployment-bytecode/fs-worker.js +1 -1
- package/dist/evm-contract-deployment-compiler-output/evm-contract-deployment-compiler-output.js +1 -1
- package/dist/evm-contract-deployment-compiler-output/fs-worker.js +1 -1
- package/dist/evm-contract-deployment-deployment-networks +1 -1
- 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-deployment-versions/fs-worker.js +1 -1
- package/dist/evm-contract-deployments-dir/evm-contract-deployments-dir.js +1 -1
- package/dist/evm-contract-deployments-dir/fs-worker.js +1 -1
- package/dist/evm-contracts-tools/evm-contracts-tools.js +1 -1
- package/dist/evm-contracts-tools/fs-worker.js +1 -1
- package/dist/libevm-contract-call/fs-worker.js +1 -1
- package/dist/libevm-contract-call/libevm-contract-call.js +1 -1
- package/dist/libevm-contract-deployment-abi/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-abi/libevm-contract-deployment-abi.js +1 -1
- package/dist/libevm-contract-deployment-address/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-address/libevm-contract-deployment-address.js +1 -1
- package/dist/libevm-contract-deployment-bytecode/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-bytecode/libevm-contract-deployment-bytecode.js +1 -1
- package/dist/libevm-contract-deployment-compiler-output/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-compiler-output/libevm-contract-deployment-compiler-output.js +1 -1
- package/dist/libevm-contract-deployment-deployment-networks +1 -1
- package/dist/libevm-contract-deployment-networks/libevm-contract-deployment-networks.js +1 -1
- package/dist/libevm-contract-deployment-versions/fs-worker.js +1 -1
- package/dist/libevm-contract-deployment-versions/libevm-contract-deployment-versions.js +1 -1
- package/dist/libevm-contract-deployments-dir/fs-worker.js +1 -1
- package/dist/libevm-contract-deployments-dir/libevm-contract-deployments-dir.js +1 -1
- package/dist/libevm-contracts-tools +1 -1
- package/eslint.config.mjs +1 -1
- package/evm-contract-call +514 -172
- package/evm-contract-deployment-abi +16 -12
- package/evm-contract-deployment-address +15 -12
- package/evm-contract-deployment-bytecode +15 -12
- package/evm-contract-deployment-compiler-output +16 -13
- package/evm-contract-deployment-networks +15 -12
- package/evm-contract-deployment-versions +15 -12
- package/evm-contract-deployments-dir +16 -13
- package/evm-contracts-tools +14 -12
- package/lib/contract-get +169 -39
- package/lib/evm-contract-call-dynamic +1112 -361
- package/lib/evm-contract-call-static +463 -73
- package/libevm-contract-call +625 -435
- package/libevm-contract-deployment +4388 -481
- package/libevm-contract-deployment-abi +287 -91
- package/libevm-contract-deployment-address +27 -16
- package/libevm-contract-deployment-bytecode +275 -80
- package/libevm-contract-deployment-compiler-output +341 -93
- package/libevm-contract-deployments-dir +53 -50
- package/package.json +11 -11
|
@@ -2,25 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* libevm-contract-deployment-
|
|
7
|
-
*
|
|
5
|
+
/** ----------------------------------------------------------
|
|
6
|
+
* libevm-contract-deployment-abi
|
|
7
|
+
* ----------------------------------------------------------
|
|
8
8
|
* Copyright ©
|
|
9
9
|
* Pellegrino Prevete
|
|
10
10
|
* 2025, 2026
|
|
11
11
|
*
|
|
12
12
|
* All rights reserved
|
|
13
|
-
*
|
|
13
|
+
* ----------------------------------------------------------
|
|
14
14
|
*
|
|
15
|
-
* This program is free software: you can redistribute it
|
|
16
|
-
* modify it under the terms of the GNU General
|
|
17
|
-
* published by the Free Software
|
|
18
|
-
*
|
|
15
|
+
* This program is free software: you can redistribute it
|
|
16
|
+
* and/or modify it under the terms of the GNU General
|
|
17
|
+
* Public License as published by the Free Software
|
|
18
|
+
* Foundation, either version 3 of the License, or
|
|
19
|
+
* (at your option) any later version.
|
|
19
20
|
*
|
|
20
|
-
* This program is distributed in the hope that it will
|
|
21
|
-
* but WITHOUT ANY WARRANTY; without even the
|
|
22
|
-
* MERCHANTABILITY or FITNESS FOR A
|
|
23
|
-
*
|
|
21
|
+
* This program is distributed in the hope that it will
|
|
22
|
+
* be useful, but WITHOUT ANY WARRANTY; without even the
|
|
23
|
+
* implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
24
|
+
* PARTICULAR PURPOSE.
|
|
25
|
+
* See the GNU General Public License for more details.
|
|
24
26
|
*
|
|
25
27
|
* You should have received a copy of the
|
|
26
28
|
* GNU General Public License
|
|
@@ -83,6 +85,11 @@ const
|
|
|
83
85
|
const
|
|
84
86
|
_dir_exists =
|
|
85
87
|
_libcrash_module._dir_exists;
|
|
88
|
+
/* global
|
|
89
|
+
_echo2 */
|
|
90
|
+
const
|
|
91
|
+
_echo2 =
|
|
92
|
+
_libcrash_module._echo2;
|
|
86
93
|
/* global
|
|
87
94
|
_file_exists */
|
|
88
95
|
const
|
|
@@ -191,6 +198,16 @@ const
|
|
|
191
198
|
const
|
|
192
199
|
_user_deployments_check =
|
|
193
200
|
_libevm_contract_deployment_module._user_deployments_check;
|
|
201
|
+
/* global
|
|
202
|
+
_user_defined_check */
|
|
203
|
+
const
|
|
204
|
+
_user_defined_check =
|
|
205
|
+
_libevm_contract_deployment_module._user_defined_check;
|
|
206
|
+
/* global
|
|
207
|
+
_version_check */
|
|
208
|
+
const
|
|
209
|
+
_version_check =
|
|
210
|
+
_libevm_contract_deployment_module._version_check;
|
|
194
211
|
const
|
|
195
212
|
_libevm_contract_deployments_dir_module =
|
|
196
213
|
await import(
|
|
@@ -209,53 +226,133 @@ const
|
|
|
209
226
|
const
|
|
210
227
|
_evm_contract_deployment_networks =
|
|
211
228
|
_libevm_contract_deployment_networks_module._evm_contract_deployment_networks;
|
|
212
|
-
const
|
|
213
|
-
_libevm_contract_deployment_versions_module =
|
|
214
|
-
await import(
|
|
215
|
-
"./libevm-contract-deployment-versions");
|
|
216
|
-
/* global
|
|
217
|
-
_evm_contract_deployment_versions */
|
|
218
|
-
const
|
|
219
|
-
_evm_contract_deployment_versions =
|
|
220
|
-
_libevm_contract_deployment_versions_module._evm_contract_deployment_versions;
|
|
221
229
|
|
|
222
|
-
function
|
|
230
|
+
async function
|
|
223
231
|
_contract_bytecode_get(
|
|
224
232
|
_deployments,
|
|
233
|
+
_app,
|
|
225
234
|
_contract,
|
|
226
235
|
_network,
|
|
227
236
|
_network_id,
|
|
228
|
-
_version
|
|
237
|
+
_version,
|
|
238
|
+
_configuration_format,
|
|
239
|
+
_user_defined) {
|
|
229
240
|
let
|
|
230
241
|
_bytecode_path,
|
|
242
|
+
_bytecode_retrieve,
|
|
243
|
+
_bytecode,
|
|
244
|
+
_break,
|
|
231
245
|
_found,
|
|
232
246
|
_key_name,
|
|
233
247
|
_msg,
|
|
234
|
-
_net
|
|
248
|
+
_net,
|
|
249
|
+
_non_empty_networks;
|
|
235
250
|
const
|
|
236
251
|
_networks = [
|
|
237
252
|
_network,
|
|
238
253
|
_network_id
|
|
239
254
|
];
|
|
255
|
+
_non_empty_networks =
|
|
256
|
+
false;
|
|
240
257
|
_found =
|
|
241
258
|
false;
|
|
242
259
|
for ( _net of _networks ) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
260
|
+
_bytecode_retrieve =
|
|
261
|
+
false;
|
|
262
|
+
_break =
|
|
263
|
+
false;
|
|
264
|
+
if ( _net.length < 1 ) {
|
|
265
|
+
_msg =
|
|
266
|
+
`Empty value network '${_net}', ` +
|
|
267
|
+
"skipping.";
|
|
268
|
+
_msg_info(
|
|
269
|
+
_msg);
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
_bytecode_retrieve =
|
|
273
|
+
true;
|
|
274
|
+
}
|
|
275
|
+
if ( _bytecode_retrieve ) {
|
|
276
|
+
_non_empty_networks =
|
|
254
277
|
true;
|
|
278
|
+
_msg =
|
|
279
|
+
"Getting bytecode for network " +
|
|
280
|
+
`'${_net}'.`;
|
|
281
|
+
_msg_info(
|
|
282
|
+
_msg);
|
|
283
|
+
const
|
|
284
|
+
_version_check_args = [
|
|
285
|
+
_version,
|
|
286
|
+
_app, // app
|
|
287
|
+
_contract,
|
|
288
|
+
"", // address
|
|
289
|
+
_net,
|
|
290
|
+
_user_defined,
|
|
291
|
+
_deployments,
|
|
292
|
+
"", // config file
|
|
293
|
+
_configuration_format
|
|
294
|
+
];
|
|
295
|
+
try {
|
|
296
|
+
_version =
|
|
297
|
+
await _version_check.apply(
|
|
298
|
+
null,
|
|
299
|
+
_version_check_args);
|
|
300
|
+
}
|
|
301
|
+
catch(
|
|
302
|
+
_error) {
|
|
303
|
+
_msg =
|
|
304
|
+
"Error running '_version_check' " +
|
|
305
|
+
"with arguments:";
|
|
306
|
+
_msg_error(
|
|
307
|
+
_msg,
|
|
308
|
+
0);
|
|
309
|
+
_echo2(
|
|
310
|
+
_version_check_args);
|
|
311
|
+
_echo2(
|
|
312
|
+
_error);
|
|
313
|
+
throw _error;
|
|
314
|
+
}
|
|
315
|
+
_msg =
|
|
316
|
+
`Checked version '${_version}'.`;
|
|
317
|
+
_msg_info(
|
|
318
|
+
_msg);
|
|
319
|
+
_bytecode_path =
|
|
320
|
+
_path_join([
|
|
321
|
+
_deployments,
|
|
322
|
+
_contract,
|
|
323
|
+
_net,
|
|
324
|
+
_version,
|
|
325
|
+
`${_contract}.bin`
|
|
326
|
+
]);
|
|
327
|
+
_msg =
|
|
328
|
+
`Checking file '${_bytecode_path}'.`;
|
|
329
|
+
_msg_info(
|
|
330
|
+
_msg);
|
|
331
|
+
if ( _file_exists(
|
|
332
|
+
_bytecode_path) ) {
|
|
333
|
+
_found =
|
|
334
|
+
true;
|
|
335
|
+
_break =
|
|
336
|
+
true;
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
_msg =
|
|
340
|
+
`Bytecode at path '${_bytecode_path}' ` +
|
|
341
|
+
`not found.`;
|
|
342
|
+
_msg_info(
|
|
343
|
+
_msg);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if ( _break ) {
|
|
347
|
+
_msg =
|
|
348
|
+
"File found, breaking loop.";
|
|
349
|
+
_msg_info(
|
|
350
|
+
_msg);
|
|
255
351
|
break;
|
|
256
352
|
}
|
|
257
353
|
}
|
|
258
|
-
if ( ! _found
|
|
354
|
+
if ( ! _found &&
|
|
355
|
+
_non_empty_networks ) {
|
|
259
356
|
_msg =
|
|
260
357
|
`No bytecode for network '${_network}' deployment ` +
|
|
261
358
|
`of contract '${_contract}' ` +
|
|
@@ -268,10 +365,13 @@ function
|
|
|
268
365
|
const
|
|
269
366
|
_contract_bytecode =
|
|
270
367
|
_bytecode_path;
|
|
368
|
+
const
|
|
369
|
+
_contract_bytecode_type =
|
|
370
|
+
typeof(
|
|
371
|
+
_contract_bytecode);
|
|
271
372
|
if ( _contract_bytecode == "" ||
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
_contract_bytecode) === "undefined" ) {
|
|
373
|
+
_contract_bytecode_type === "undefined" ||
|
|
374
|
+
_contract_bytecode == null ) {
|
|
275
375
|
_msg =
|
|
276
376
|
`No '${_contract}' version '${_version}' ` +
|
|
277
377
|
`contract deployment specified for network ` +
|
|
@@ -282,6 +382,10 @@ function
|
|
|
282
382
|
0);
|
|
283
383
|
throw _msg;
|
|
284
384
|
}
|
|
385
|
+
_msg =
|
|
386
|
+
`Got bytecode: '${_contract_bytecode}'.`;
|
|
387
|
+
_msg_info(
|
|
388
|
+
_msg);
|
|
285
389
|
return _contract_bytecode;
|
|
286
390
|
}
|
|
287
391
|
|
|
@@ -299,6 +403,7 @@ async function
|
|
|
299
403
|
let
|
|
300
404
|
_args,
|
|
301
405
|
_contract_bytecode,
|
|
406
|
+
_deployments_dir_get,
|
|
302
407
|
_network,
|
|
303
408
|
_network_check_args,
|
|
304
409
|
_target_network,
|
|
@@ -312,6 +417,59 @@ async function
|
|
|
312
417
|
const
|
|
313
418
|
_contract_bytecode_get_args =
|
|
314
419
|
[];
|
|
420
|
+
_user_defined =
|
|
421
|
+
_user_defined_check(
|
|
422
|
+
_user_defined);
|
|
423
|
+
const
|
|
424
|
+
_deployments_dir_type =
|
|
425
|
+
typeof(
|
|
426
|
+
_deployments_dir);
|
|
427
|
+
_deployments_dir_get =
|
|
428
|
+
false;
|
|
429
|
+
if ( _deployments_dir_type === "undefined" ) {
|
|
430
|
+
_msg =
|
|
431
|
+
"Deployments directory undefined, getting.";
|
|
432
|
+
_msg_info(
|
|
433
|
+
_msg);
|
|
434
|
+
_deployments_dir_get =
|
|
435
|
+
true;
|
|
436
|
+
}
|
|
437
|
+
else if ( _deployments_dir_type === "string" ) {
|
|
438
|
+
if ( _deployments_dir.length < 1 ) {
|
|
439
|
+
_msg =
|
|
440
|
+
"Deployments directory not set, getting.";
|
|
441
|
+
_msg_info(
|
|
442
|
+
_msg);
|
|
443
|
+
_deployments_dir_get =
|
|
444
|
+
true;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
if ( _deployments_dir_get ) {
|
|
448
|
+
const
|
|
449
|
+
_evm_contract_deployments_dir_args = [
|
|
450
|
+
_target_app,
|
|
451
|
+
_user_defined
|
|
452
|
+
];
|
|
453
|
+
try {
|
|
454
|
+
_deployments_dir =
|
|
455
|
+
await _evm_contract_deployments_dir.apply(
|
|
456
|
+
null,
|
|
457
|
+
_evm_contract_deployments_dir_args);
|
|
458
|
+
}
|
|
459
|
+
catch(
|
|
460
|
+
_error) {
|
|
461
|
+
_msg =
|
|
462
|
+
"Error while retrieving system deployments " +
|
|
463
|
+
"directory location for auto-detection.";
|
|
464
|
+
_msg_error(
|
|
465
|
+
_msg,
|
|
466
|
+
0);
|
|
467
|
+
_msg_error(
|
|
468
|
+
_error,
|
|
469
|
+
0);
|
|
470
|
+
throw _error;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
315
473
|
if ( _user_defined == "n" ) {
|
|
316
474
|
if ( _target_app == "" ) {
|
|
317
475
|
_msg =
|
|
@@ -386,51 +544,88 @@ async function
|
|
|
386
544
|
// `network '${_network}'.`;
|
|
387
545
|
// _msg_info(
|
|
388
546
|
// _msg);
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
547
|
+
if ( _network.length < 1 ) {
|
|
548
|
+
_msg =
|
|
549
|
+
"Empty network, skipping.";
|
|
550
|
+
_msg_info(
|
|
551
|
+
_msg);
|
|
552
|
+
}
|
|
553
|
+
else {
|
|
554
|
+
_target_network_id =
|
|
555
|
+
"";
|
|
556
|
+
_network_check_args = [
|
|
557
|
+
_deployments_dir,
|
|
558
|
+
_target_contract,
|
|
559
|
+
_network,
|
|
560
|
+
_target_network_id
|
|
561
|
+
];
|
|
562
|
+
await _network_check.apply(
|
|
563
|
+
null,
|
|
564
|
+
_network_check_args);
|
|
565
|
+
_contract_bytecode_get_args.push( [
|
|
566
|
+
_deployments_dir,
|
|
567
|
+
_target_app,
|
|
568
|
+
_target_contract,
|
|
569
|
+
_network,
|
|
570
|
+
_target_network_id,
|
|
571
|
+
_contract_version,
|
|
572
|
+
_configuration_format,
|
|
573
|
+
_user_defined
|
|
574
|
+
] );
|
|
575
|
+
}
|
|
408
576
|
}
|
|
409
|
-
for ( _network of
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
577
|
+
for ( _network of _network_ids ) {
|
|
578
|
+
if ( _network.length < 1 ) {
|
|
579
|
+
_msg =
|
|
580
|
+
"Empty network, skipping.";
|
|
581
|
+
_msg_info(
|
|
582
|
+
_msg);
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
_target_network =
|
|
586
|
+
"";
|
|
587
|
+
_network_check_args = [
|
|
588
|
+
_deployments_dir,
|
|
589
|
+
_target_contract,
|
|
590
|
+
_target_network,
|
|
591
|
+
_network
|
|
592
|
+
];
|
|
593
|
+
await _network_check.apply(
|
|
594
|
+
null,
|
|
595
|
+
_network_check_args);
|
|
596
|
+
_contract_bytecode_get_args.push( [
|
|
597
|
+
_deployments_dir,
|
|
598
|
+
_target_app,
|
|
599
|
+
_target_contract,
|
|
600
|
+
_target_network,
|
|
601
|
+
_network,
|
|
602
|
+
_contract_version,
|
|
603
|
+
_configuration_format,
|
|
604
|
+
_user_defined
|
|
605
|
+
] );
|
|
606
|
+
}
|
|
428
607
|
}
|
|
429
608
|
for ( _args of _contract_bytecode_get_args ) {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
609
|
+
try {
|
|
610
|
+
_contract_bytecode =
|
|
611
|
+
await _contract_bytecode_get.apply(
|
|
612
|
+
null,
|
|
613
|
+
_args);
|
|
614
|
+
}
|
|
615
|
+
catch(
|
|
616
|
+
_error) {
|
|
617
|
+
_msg =
|
|
618
|
+
"Error running '_contract_bytecode_get' " +
|
|
619
|
+
"with parameters:";
|
|
620
|
+
_msg_error(
|
|
621
|
+
_msg,
|
|
622
|
+
0);
|
|
623
|
+
_echo2(
|
|
433
624
|
_args);
|
|
625
|
+
_echo2(
|
|
626
|
+
_error);
|
|
627
|
+
throw _error;
|
|
628
|
+
}
|
|
434
629
|
_contracts_bytecodes.push(
|
|
435
630
|
_contract_bytecode);
|
|
436
631
|
}
|