evm-contracts-tools 0.0.34 → 0.0.36
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/Makefile +11 -12
- package/dist/evm-contract-deployments-dir/index.html +31 -0
- package/dist/libevm-contract-deployments-dir/index.html +24 -0
- package/evm-contract-call +20 -4
- package/evm-contract-deployments-dir +376 -0
- package/evm-contracts-tools +1 -14
- package/libevm-contract-deployments-dir +247 -0
- package/package.json +28 -7
package/Makefile
CHANGED
|
@@ -60,20 +60,19 @@ NPM_FILES=\
|
|
|
60
60
|
"dist" \
|
|
61
61
|
"evm-contract-call" \
|
|
62
62
|
"evm-contract-call.webpack.config.cjs" \
|
|
63
|
+
"evm-contract-deployments-dir" \
|
|
64
|
+
"evm-contract-deployments-dir.webpack.config.cjs" \
|
|
63
65
|
"lib" \
|
|
64
66
|
"libevm-contract-call" \
|
|
65
67
|
"libevm-contract-call.webpack.config.cjs" \
|
|
68
|
+
"libevm-contract-deployments-dir" \
|
|
69
|
+
"libevm-contract-deployments-dir.webpack.config.cjs" \
|
|
66
70
|
"$(_PROJECT_NPM)" \
|
|
67
71
|
"eslint.config.mjs" \
|
|
68
72
|
"fs-worker.webpack.config.cjs" \
|
|
69
73
|
"package.json" \
|
|
70
74
|
"webpack.config.cjs"
|
|
71
75
|
|
|
72
|
-
MAN_FILES=\
|
|
73
|
-
evm-contract-bytecode-get \
|
|
74
|
-
evm-contract-call \
|
|
75
|
-
evm-contract-deployer-get
|
|
76
|
-
|
|
77
76
|
all: build-man build-npm build-scripts
|
|
78
77
|
|
|
79
78
|
check: eslint
|
|
@@ -101,13 +100,13 @@ install-scripts:
|
|
|
101
100
|
-s \
|
|
102
101
|
"$(PREFIX)/lib/$(_PROJECT_NPM)/nodejs/$${_file}" \
|
|
103
102
|
"$(LIB_DIR)/$${_file}" || \
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
true; \
|
|
104
|
+
done
|
|
105
|
+
# ln \
|
|
106
|
+
# -s \
|
|
107
|
+
# "$(PREFIX)/lib/$(_PROJECT_NPM)/node/lib$(_PROJECT_NPM)" \
|
|
108
|
+
# "$(LIB_DIR)/$(_PROJECT_NPM)-js" || \
|
|
109
|
+
# true
|
|
111
110
|
|
|
112
111
|
build-man:
|
|
113
112
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
---------------------------------------------
|
|
5
|
+
Copyright © 2024, 2025, 2026
|
|
6
|
+
Pellegrino Prevete
|
|
7
|
+
|
|
8
|
+
All rights reserved
|
|
9
|
+
---------------------------------------------
|
|
10
|
+
|
|
11
|
+
This program is free software: you can
|
|
12
|
+
redistribute it and/or modify it under the
|
|
13
|
+
terms of the GNU Affero General Public
|
|
14
|
+
License as published by the Free Software
|
|
15
|
+
Foundation, either version 3 of the License,
|
|
16
|
+
or (at your option) any later version.
|
|
17
|
+
|
|
18
|
+
This program is distributed in the hope that
|
|
19
|
+
it will be useful, but WITHOUT ANY WARRANTY;
|
|
20
|
+
without even the implied warranty of
|
|
21
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
22
|
+
PURPOSE. See the GNU Affero General Public
|
|
23
|
+
License for more details.
|
|
24
|
+
|
|
25
|
+
You should have received a copy of the GNU
|
|
26
|
+
Affero General Public License
|
|
27
|
+
along with this program.
|
|
28
|
+
If not, see <https://www.gnu.org/licenses/>.
|
|
29
|
+
-->
|
|
30
|
+
|
|
31
|
+
<script src="evm-contract-deployments-dir.js"></script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
SPDX-License-Identifier: AGPL-3.0-or-later
|
|
3
|
+
|
|
4
|
+
----------------------------------------------------------------------
|
|
5
|
+
Copyright © 2024, 2025, 2026 Pellegrino Prevete
|
|
6
|
+
|
|
7
|
+
All rights reserved
|
|
8
|
+
----------------------------------------------------------------------
|
|
9
|
+
|
|
10
|
+
This program is free software: you can redistribute it and/or modify
|
|
11
|
+
it under the terms of the GNU Affero General Public License as published by
|
|
12
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
13
|
+
(at your option) any later version.
|
|
14
|
+
|
|
15
|
+
This program is distributed in the hope that it will be useful,
|
|
16
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18
|
+
GNU Affero General Public License for more details.
|
|
19
|
+
|
|
20
|
+
You should have received a copy of the GNU Affero General Public License
|
|
21
|
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
22
|
+
-->
|
|
23
|
+
|
|
24
|
+
<script src="libevm-contract-deployments-dir.js"></script>
|
package/evm-contract-call
CHANGED
|
@@ -265,8 +265,24 @@ function
|
|
|
265
265
|
|
|
266
266
|
async function
|
|
267
267
|
_overrides_set() {
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
if ( ! _help_display &&
|
|
269
|
+
typeof(_help_display) != "undefined" &&
|
|
270
|
+
_help_display != "" ) {
|
|
271
|
+
const
|
|
272
|
+
_address_valid =
|
|
273
|
+
_address_check(
|
|
274
|
+
contract_address);
|
|
275
|
+
if ( ! _address_valid ) {
|
|
276
|
+
const
|
|
277
|
+
_msg =
|
|
278
|
+
"Contract address " +
|
|
279
|
+
`'${contract_address}' is ` +
|
|
280
|
+
`invalid.`;
|
|
281
|
+
_msg_error(
|
|
282
|
+
_msg,
|
|
283
|
+
1);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
270
286
|
if ( call_date == "" ||
|
|
271
287
|
typeof(
|
|
272
288
|
call_date) == "undefined" ) {
|
|
@@ -524,7 +540,8 @@ async function
|
|
|
524
540
|
if ( _help_display ) {
|
|
525
541
|
quiet =
|
|
526
542
|
"n";
|
|
527
|
-
await _overrides_set(
|
|
543
|
+
await _overrides_set(
|
|
544
|
+
_help_display);
|
|
528
545
|
_usage(
|
|
529
546
|
0);
|
|
530
547
|
}
|
|
@@ -844,7 +861,6 @@ if ( _cmdline_check(
|
|
|
844
861
|
_cmdline_check(
|
|
845
862
|
"evm-contract-call") == true ) {
|
|
846
863
|
_cmdline_parse();
|
|
847
|
-
console.log("quiet", quiet);
|
|
848
864
|
}
|
|
849
865
|
else{
|
|
850
866
|
_url_parse();
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
|
|
5
|
+
/** ----------------------------------------------------------------
|
|
6
|
+
* evm-contract-deployment-dir.js
|
|
7
|
+
* ----------------------------------------------------------------
|
|
8
|
+
* Copyright ©
|
|
9
|
+
* Pellegrino Prevete
|
|
10
|
+
* 2024, 2025, 2026
|
|
11
|
+
*
|
|
12
|
+
* All rights reserved
|
|
13
|
+
* ----------------------------------------------------------------
|
|
14
|
+
*
|
|
15
|
+
* This program is free software: you can redistribute it and/or
|
|
16
|
+
* modify it under the terms of the GNU General Public License as
|
|
17
|
+
* published by the Free Software Foundation, either version 3 of
|
|
18
|
+
* the License, or (at your option) any later version.
|
|
19
|
+
*
|
|
20
|
+
* This program is distributed in the hope that it will be useful,
|
|
21
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
23
|
+
* GNU General Public License for more details.
|
|
24
|
+
*
|
|
25
|
+
* You should have received a copy of the GNU General Public License
|
|
26
|
+
* along with this program.
|
|
27
|
+
* If not, see <https://www.gnu.org/licenses/>.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/* eslint-disable
|
|
31
|
+
no-unused-vars */
|
|
32
|
+
|
|
33
|
+
/* Crash Javascript global variables */
|
|
34
|
+
/* global
|
|
35
|
+
quiet:
|
|
36
|
+
writable */
|
|
37
|
+
|
|
38
|
+
const
|
|
39
|
+
_libcrash =
|
|
40
|
+
require(
|
|
41
|
+
"crash-js");
|
|
42
|
+
/* global
|
|
43
|
+
_argv_get */
|
|
44
|
+
const
|
|
45
|
+
_argv_get =
|
|
46
|
+
_libcrash._argv_get;
|
|
47
|
+
/* global
|
|
48
|
+
_argv_url_get */
|
|
49
|
+
const
|
|
50
|
+
_argv_url_get =
|
|
51
|
+
_libcrash._argv_url_get;
|
|
52
|
+
/* global
|
|
53
|
+
_cmdline_check */
|
|
54
|
+
const
|
|
55
|
+
_cmdline_check =
|
|
56
|
+
_libcrash._cmdline_check;
|
|
57
|
+
/* global
|
|
58
|
+
_get_date_human */
|
|
59
|
+
const
|
|
60
|
+
_get_date_human =
|
|
61
|
+
_libcrash._get_date_human;
|
|
62
|
+
/* global
|
|
63
|
+
_msg_info */
|
|
64
|
+
const
|
|
65
|
+
_msg_info =
|
|
66
|
+
_libcrash._msg_info;
|
|
67
|
+
/* global
|
|
68
|
+
_msg_error */
|
|
69
|
+
const
|
|
70
|
+
_msg_error =
|
|
71
|
+
_libcrash._msg_error;
|
|
72
|
+
/* global
|
|
73
|
+
_printf */
|
|
74
|
+
const
|
|
75
|
+
_printf =
|
|
76
|
+
_libcrash._printf;
|
|
77
|
+
/* global
|
|
78
|
+
_process_exit */
|
|
79
|
+
const
|
|
80
|
+
_process_exit =
|
|
81
|
+
_libcrash._process_exit;
|
|
82
|
+
const
|
|
83
|
+
_libevm_contract_deployments_dir_module =
|
|
84
|
+
require(
|
|
85
|
+
"./libevm-contract-deployments-dir");
|
|
86
|
+
/* global
|
|
87
|
+
_evm_contract_deployments_dir */
|
|
88
|
+
const
|
|
89
|
+
_evm_contract_deployments_dir =
|
|
90
|
+
_libevm_contract_deployments_dir_module._evm_contract_deployments_dir;
|
|
91
|
+
|
|
92
|
+
function
|
|
93
|
+
_global_variables() {
|
|
94
|
+
/* global
|
|
95
|
+
app_name:
|
|
96
|
+
writable */
|
|
97
|
+
app_name =
|
|
98
|
+
"evm-contract-deployments-dir.js";
|
|
99
|
+
/* global
|
|
100
|
+
app_opts:
|
|
101
|
+
writable */
|
|
102
|
+
app_opts =
|
|
103
|
+
[];
|
|
104
|
+
/* global
|
|
105
|
+
runtime_environment:
|
|
106
|
+
writable */
|
|
107
|
+
runtime_environment =
|
|
108
|
+
"";
|
|
109
|
+
/* global
|
|
110
|
+
resolve_date:
|
|
111
|
+
writable */
|
|
112
|
+
resolve_date =
|
|
113
|
+
"";
|
|
114
|
+
/* global
|
|
115
|
+
user_level:
|
|
116
|
+
writable */
|
|
117
|
+
user_level =
|
|
118
|
+
"";
|
|
119
|
+
quiet =
|
|
120
|
+
"";
|
|
121
|
+
/* global
|
|
122
|
+
verbose:
|
|
123
|
+
writable */
|
|
124
|
+
verbose =
|
|
125
|
+
"";
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async function
|
|
129
|
+
_overrides_set(
|
|
130
|
+
_help_display) {
|
|
131
|
+
if ( ! _help_display &&
|
|
132
|
+
typeof(_help_display) != "undefined" &&
|
|
133
|
+
_help_display != "" ) {
|
|
134
|
+
const
|
|
135
|
+
_address_valid =
|
|
136
|
+
_address_check(
|
|
137
|
+
contract_address);
|
|
138
|
+
if ( ! _address_valid ) {
|
|
139
|
+
const
|
|
140
|
+
_msg =
|
|
141
|
+
"Contract address " +
|
|
142
|
+
`'${contract_address}' is ` +
|
|
143
|
+
`invalid.`;
|
|
144
|
+
_msg_error(
|
|
145
|
+
_msg,
|
|
146
|
+
1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if ( resolve_date == "" ||
|
|
150
|
+
typeof(
|
|
151
|
+
resolve_date) == "undefined" ) {
|
|
152
|
+
resolve_date =
|
|
153
|
+
_get_date_human();
|
|
154
|
+
}
|
|
155
|
+
if ( user_level == "" ) {
|
|
156
|
+
user_level =
|
|
157
|
+
"n";
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function
|
|
162
|
+
_config_show() {
|
|
163
|
+
let
|
|
164
|
+
_line;
|
|
165
|
+
const
|
|
166
|
+
_text = [
|
|
167
|
+
`${app_name} configuration:`,
|
|
168
|
+
` Resolve date: ${resolve_date}`,
|
|
169
|
+
` Runtime environment: ${runtime_environment}`,
|
|
170
|
+
` Target application: ${target_app}`,
|
|
171
|
+
` User level: ${user_level}`,
|
|
172
|
+
];
|
|
173
|
+
for ( _line of _text ) {
|
|
174
|
+
_msg_info(
|
|
175
|
+
_line);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function
|
|
180
|
+
_usage(
|
|
181
|
+
_exit_code) {
|
|
182
|
+
let
|
|
183
|
+
_line;
|
|
184
|
+
const
|
|
185
|
+
_text = [
|
|
186
|
+
"",
|
|
187
|
+
"Returns default deployments directory for an application",
|
|
188
|
+
"",
|
|
189
|
+
"Usage:",
|
|
190
|
+
"",
|
|
191
|
+
` ${app_name}`,
|
|
192
|
+
" [options]",
|
|
193
|
+
" <target-app>",
|
|
194
|
+
"",
|
|
195
|
+
" options:",
|
|
196
|
+
"",
|
|
197
|
+
" -u --user-level Returns user-level location",
|
|
198
|
+
" for an application deployments",
|
|
199
|
+
` Default: '${user_level}`,
|
|
200
|
+
"",
|
|
201
|
+
" -h --help This message.",
|
|
202
|
+
" -v --verbose Enable verbose output.",
|
|
203
|
+
""
|
|
204
|
+
];
|
|
205
|
+
for ( _line of _text ) {
|
|
206
|
+
console.log(
|
|
207
|
+
_line);
|
|
208
|
+
}
|
|
209
|
+
_process_exit(
|
|
210
|
+
_exit_code);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async function
|
|
214
|
+
_cmdline_parse() {
|
|
215
|
+
let
|
|
216
|
+
_help_display,
|
|
217
|
+
_msg;
|
|
218
|
+
const
|
|
219
|
+
_argv_args = {
|
|
220
|
+
"booleans": [
|
|
221
|
+
"u",
|
|
222
|
+
"user-level",
|
|
223
|
+
"h",
|
|
224
|
+
"help",
|
|
225
|
+
"v",
|
|
226
|
+
"verbose"
|
|
227
|
+
]
|
|
228
|
+
};
|
|
229
|
+
const
|
|
230
|
+
_argv =
|
|
231
|
+
_argv_get(
|
|
232
|
+
_argv_args);
|
|
233
|
+
const
|
|
234
|
+
_options =
|
|
235
|
+
_argv[
|
|
236
|
+
"_"];
|
|
237
|
+
quiet =
|
|
238
|
+
"y";
|
|
239
|
+
runtime_environment =
|
|
240
|
+
"node";
|
|
241
|
+
if ( _argv[
|
|
242
|
+
"h"] ) {
|
|
243
|
+
_help_display =
|
|
244
|
+
true;
|
|
245
|
+
}
|
|
246
|
+
if ( _argv[
|
|
247
|
+
"help"] ) {
|
|
248
|
+
_help_display =
|
|
249
|
+
true;
|
|
250
|
+
}
|
|
251
|
+
if ( ( _options.indexOf(
|
|
252
|
+
"--help") > -1 ||
|
|
253
|
+
_options.indexOf(
|
|
254
|
+
"-h") > -1) ) {
|
|
255
|
+
_help_display =
|
|
256
|
+
true;
|
|
257
|
+
}
|
|
258
|
+
if ( _help_display ) {
|
|
259
|
+
quiet =
|
|
260
|
+
"n";
|
|
261
|
+
await _overrides_set(
|
|
262
|
+
_help_display);
|
|
263
|
+
_usage(
|
|
264
|
+
0);
|
|
265
|
+
}
|
|
266
|
+
if ( typeof(
|
|
267
|
+
_argv) == "undefined" ||
|
|
268
|
+
_argv[
|
|
269
|
+
"_"].length < 1 ) {
|
|
270
|
+
_msg =
|
|
271
|
+
"Target application " +
|
|
272
|
+
"argument required.";
|
|
273
|
+
_msg_error(
|
|
274
|
+
_msg,
|
|
275
|
+
0);
|
|
276
|
+
_usage(
|
|
277
|
+
1);
|
|
278
|
+
}
|
|
279
|
+
target_app =
|
|
280
|
+
_argv[
|
|
281
|
+
"_"][
|
|
282
|
+
0];
|
|
283
|
+
if ( "u" in _argv ) {
|
|
284
|
+
user_level =
|
|
285
|
+
_argv[
|
|
286
|
+
"u"];
|
|
287
|
+
}
|
|
288
|
+
if ( "user_level" in _argv ) {
|
|
289
|
+
user_level =
|
|
290
|
+
_argv[
|
|
291
|
+
"user_level"];
|
|
292
|
+
}
|
|
293
|
+
if ( _argv[
|
|
294
|
+
"v"] ||
|
|
295
|
+
_argv[
|
|
296
|
+
"verbose"] ) {
|
|
297
|
+
quiet =
|
|
298
|
+
"n";
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function
|
|
303
|
+
_url_parse() {
|
|
304
|
+
let
|
|
305
|
+
_method,
|
|
306
|
+
_network;
|
|
307
|
+
runtime_environment =
|
|
308
|
+
"browser";
|
|
309
|
+
user_level =
|
|
310
|
+
_argv_url_get(
|
|
311
|
+
"user_level")[
|
|
312
|
+
0];
|
|
313
|
+
quiet =
|
|
314
|
+
_argv_url_get(
|
|
315
|
+
"quiet");
|
|
316
|
+
if ( quiet.length === 0 ) {
|
|
317
|
+
quiet =
|
|
318
|
+
"n";
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
async function
|
|
323
|
+
_evm_contract_deployments_dir_cmdline(
|
|
324
|
+
_app_opts) {
|
|
325
|
+
let
|
|
326
|
+
_result;
|
|
327
|
+
const
|
|
328
|
+
_results =
|
|
329
|
+
await _evm_contract_deployments_dir.apply(
|
|
330
|
+
null,
|
|
331
|
+
app_opts);
|
|
332
|
+
const
|
|
333
|
+
_results_type =
|
|
334
|
+
typeof(
|
|
335
|
+
_results);
|
|
336
|
+
if ( _results_type == "object" ) {
|
|
337
|
+
for ( _result of _results ) {
|
|
338
|
+
console.log(
|
|
339
|
+
_result);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
else if ( _results_type == "string" ) {
|
|
343
|
+
_printf(
|
|
344
|
+
_results);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
async function
|
|
349
|
+
_main() {
|
|
350
|
+
const
|
|
351
|
+
_overrides_set_up =
|
|
352
|
+
await _overrides_set();
|
|
353
|
+
_config_show();
|
|
354
|
+
const
|
|
355
|
+
app_opts = [
|
|
356
|
+
target_app,
|
|
357
|
+
user_level
|
|
358
|
+
];
|
|
359
|
+
const
|
|
360
|
+
_deployments =
|
|
361
|
+
await _evm_contract_deployments_dir.apply(
|
|
362
|
+
null,
|
|
363
|
+
app_opts);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
_global_variables();
|
|
367
|
+
if ( _cmdline_check(
|
|
368
|
+
"evm-contract-deployments-dir.js") == true ||
|
|
369
|
+
_cmdline_check(
|
|
370
|
+
"evm-contract-deployments-dir") == true ) {
|
|
371
|
+
_cmdline_parse();
|
|
372
|
+
}
|
|
373
|
+
else{
|
|
374
|
+
_url_parse();
|
|
375
|
+
}
|
|
376
|
+
_main();
|
package/evm-contracts-tools
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
4
|
|
|
6
5
|
/** ----------------------------------------------------------------
|
|
7
|
-
*
|
|
6
|
+
* evm-contracts-tools
|
|
8
7
|
* ----------------------------------------------------------------
|
|
9
8
|
* Copyright ©
|
|
10
9
|
* Pellegrino Prevete
|
|
@@ -115,25 +114,13 @@ const
|
|
|
115
114
|
_contract_call_static =
|
|
116
115
|
_evm_contract_call_static_module._contract_call_static;
|
|
117
116
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
function
|
|
122
|
-
_artifact_local_auto_detect() {
|
|
123
|
-
true;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
117
|
module.exports = {
|
|
127
118
|
_address_check:
|
|
128
119
|
_address_check,
|
|
129
|
-
_artifact_local_auto_detect:
|
|
130
|
-
_artifact_local_auto_detect,
|
|
131
120
|
_bytecode_creation_get:
|
|
132
121
|
_bytecode_creation_get,
|
|
133
122
|
_bytecode_runtime_get:
|
|
134
123
|
_bytecode_runtime_get,
|
|
135
|
-
_call_auth_auto_detect:
|
|
136
|
-
_call_auth_auto_detect,
|
|
137
124
|
_contract_call_dynamic:
|
|
138
125
|
_contract_call_dynamic,
|
|
139
126
|
_contract_call_static:
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
|
|
5
|
+
/** ----------------------------------------------------------------
|
|
6
|
+
* libevm-contract-deployments-dir
|
|
7
|
+
* ----------------------------------------------------------------
|
|
8
|
+
* Copyright ©
|
|
9
|
+
* Pellegrino Prevete
|
|
10
|
+
* 2025, 2026
|
|
11
|
+
*
|
|
12
|
+
* All rights reserved
|
|
13
|
+
* ----------------------------------------------------------------
|
|
14
|
+
*
|
|
15
|
+
* This program is free software: you can redistribute it and/or
|
|
16
|
+
* modify it under the terms of the GNU General Public License as
|
|
17
|
+
* published by the Free Software Foundation, either version 3 of
|
|
18
|
+
* the License, or (at your option) any later version.
|
|
19
|
+
*
|
|
20
|
+
* This program is distributed in the hope that it will be useful,
|
|
21
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
23
|
+
* GNU General Public License for more details.
|
|
24
|
+
*
|
|
25
|
+
* You should have received a copy of the
|
|
26
|
+
* GNU General Public License
|
|
27
|
+
* along with this program.
|
|
28
|
+
* If not, see <https://www.gnu.org/licenses/>.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/* eslint-disable
|
|
32
|
+
no-unused-vars */
|
|
33
|
+
/* eslint-disable
|
|
34
|
+
no-useless-assignment */
|
|
35
|
+
|
|
36
|
+
/* EVM Contracts tools global variables */
|
|
37
|
+
/* global
|
|
38
|
+
call_type */
|
|
39
|
+
/* global
|
|
40
|
+
call_auth:
|
|
41
|
+
writable */
|
|
42
|
+
|
|
43
|
+
/* libEVM global variables */
|
|
44
|
+
/* global
|
|
45
|
+
api_key */
|
|
46
|
+
/* global
|
|
47
|
+
contract_abi:
|
|
48
|
+
writable */
|
|
49
|
+
/* global
|
|
50
|
+
contract_address */
|
|
51
|
+
/* global
|
|
52
|
+
contract_bytecode:
|
|
53
|
+
writable */
|
|
54
|
+
/* global
|
|
55
|
+
contract_compiler_output:
|
|
56
|
+
writable */
|
|
57
|
+
/* global
|
|
58
|
+
target_network:
|
|
59
|
+
writable */
|
|
60
|
+
/* global
|
|
61
|
+
target_networks:
|
|
62
|
+
writable */
|
|
63
|
+
|
|
64
|
+
const
|
|
65
|
+
_libcrash_module =
|
|
66
|
+
require(
|
|
67
|
+
"crash-js");
|
|
68
|
+
/* global
|
|
69
|
+
_dirname */
|
|
70
|
+
/* eslint-disable-next-line
|
|
71
|
+
no-global-assign */
|
|
72
|
+
const
|
|
73
|
+
_dirname =
|
|
74
|
+
_libcrash_module._dirname;
|
|
75
|
+
/* global
|
|
76
|
+
_file_exists */
|
|
77
|
+
/* eslint-disable-next-line
|
|
78
|
+
no-global-assign */
|
|
79
|
+
const
|
|
80
|
+
_file_exists =
|
|
81
|
+
_libcrash_module._file_exists;
|
|
82
|
+
/* global
|
|
83
|
+
_homedir_get */
|
|
84
|
+
/* eslint-disable-next-line
|
|
85
|
+
no-global-assign */
|
|
86
|
+
const
|
|
87
|
+
_homedir_get =
|
|
88
|
+
_libcrash_module._homedir_get;
|
|
89
|
+
/* global
|
|
90
|
+
_json_read */
|
|
91
|
+
/* eslint-disable-next-line
|
|
92
|
+
no-global-assign */
|
|
93
|
+
const
|
|
94
|
+
_json_read =
|
|
95
|
+
_libcrash_module._json_read;
|
|
96
|
+
/* global
|
|
97
|
+
_lib_get */
|
|
98
|
+
/* eslint-disable-next-line
|
|
99
|
+
no-global-assign */
|
|
100
|
+
const
|
|
101
|
+
_lib_get =
|
|
102
|
+
_libcrash_module._lib_get;
|
|
103
|
+
/* global
|
|
104
|
+
_msg_info */
|
|
105
|
+
/* eslint-disable-next-line
|
|
106
|
+
no-global-assign */
|
|
107
|
+
const
|
|
108
|
+
_msg_info =
|
|
109
|
+
_libcrash_module._msg_info;
|
|
110
|
+
/* global
|
|
111
|
+
_msg_error */
|
|
112
|
+
/* eslint-disable-next-line
|
|
113
|
+
no-global-assign */
|
|
114
|
+
const
|
|
115
|
+
_msg_error =
|
|
116
|
+
_libcrash_module._msg_error;
|
|
117
|
+
/* global
|
|
118
|
+
_path_join */
|
|
119
|
+
/* eslint-disable-next-line
|
|
120
|
+
no-global-assign */
|
|
121
|
+
const
|
|
122
|
+
_path_join =
|
|
123
|
+
_libcrash_module._path_join;
|
|
124
|
+
/* global
|
|
125
|
+
_range */
|
|
126
|
+
/* eslint-disable-next-line
|
|
127
|
+
no-global-assign */
|
|
128
|
+
const
|
|
129
|
+
_range =
|
|
130
|
+
_libcrash_module._range;
|
|
131
|
+
const
|
|
132
|
+
_evm_contracts_tools_module =
|
|
133
|
+
require("./evm-contracts-tools");
|
|
134
|
+
/* global
|
|
135
|
+
_address_check */
|
|
136
|
+
const
|
|
137
|
+
_address_check =
|
|
138
|
+
_evm_contracts_tools_module._address_check;
|
|
139
|
+
|
|
140
|
+
const
|
|
141
|
+
_ethereum_data_module =
|
|
142
|
+
require(
|
|
143
|
+
"ethereum-data");
|
|
144
|
+
/* global
|
|
145
|
+
_data_get */
|
|
146
|
+
const
|
|
147
|
+
_data_get =
|
|
148
|
+
_ethereum_data_module._data_get;
|
|
149
|
+
|
|
150
|
+
function
|
|
151
|
+
_app_check(
|
|
152
|
+
_app) {
|
|
153
|
+
let
|
|
154
|
+
_error_flag,
|
|
155
|
+
_msg;
|
|
156
|
+
const
|
|
157
|
+
_app_type =
|
|
158
|
+
typeof(
|
|
159
|
+
_app);
|
|
160
|
+
if ( _app_type == "undefined" ||
|
|
161
|
+
_app == "" ) {
|
|
162
|
+
_msg =
|
|
163
|
+
"No application specified.";
|
|
164
|
+
_error_flag =
|
|
165
|
+
true;
|
|
166
|
+
}
|
|
167
|
+
console.log(_app);
|
|
168
|
+
if ( _app_type != "string" ) {
|
|
169
|
+
_msg =
|
|
170
|
+
"Application argument must be of " +
|
|
171
|
+
"type string.";
|
|
172
|
+
_error_flag =
|
|
173
|
+
true;
|
|
174
|
+
}
|
|
175
|
+
if ( _error_flag ) {
|
|
176
|
+
_msg_error(
|
|
177
|
+
_msg,
|
|
178
|
+
1);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function
|
|
183
|
+
_default_deployments_dir_get(
|
|
184
|
+
_app,
|
|
185
|
+
_type) {
|
|
186
|
+
_app_check(
|
|
187
|
+
_app);
|
|
188
|
+
if ( typeof(
|
|
189
|
+
_type) == "undefined" ||
|
|
190
|
+
_type == "" ) {
|
|
191
|
+
_type =
|
|
192
|
+
"system";
|
|
193
|
+
}
|
|
194
|
+
let
|
|
195
|
+
_conf_dir;
|
|
196
|
+
if ( _type == "system" ) {
|
|
197
|
+
_conf_dir =
|
|
198
|
+
_lib_get();
|
|
199
|
+
}
|
|
200
|
+
else if ( _type == "user" ) {
|
|
201
|
+
const
|
|
202
|
+
_homedir =
|
|
203
|
+
_homedir_get();
|
|
204
|
+
_conf_dir =
|
|
205
|
+
`${_homedir}/.config`;
|
|
206
|
+
}
|
|
207
|
+
return `${_conf_dir}/${_app}/deployments`;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function
|
|
211
|
+
_evm_contract_deployments_dir(
|
|
212
|
+
_app,
|
|
213
|
+
_user_level) {
|
|
214
|
+
let
|
|
215
|
+
_deployments,
|
|
216
|
+
_deployment_type;
|
|
217
|
+
_app_check(
|
|
218
|
+
_app);
|
|
219
|
+
if ( _user_level == "n" ) {
|
|
220
|
+
_deployment_type =
|
|
221
|
+
"system";
|
|
222
|
+
}
|
|
223
|
+
else if ( _user_level == "n" ) {
|
|
224
|
+
_deployment_type =
|
|
225
|
+
"system";
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
_msg =
|
|
229
|
+
"User level argument must be " +
|
|
230
|
+
"can be 'y' or 'n'."
|
|
231
|
+
_msg_error(
|
|
232
|
+
_msg,
|
|
233
|
+
1);
|
|
234
|
+
}
|
|
235
|
+
_deployments =
|
|
236
|
+
_default_deployments_dir_get(
|
|
237
|
+
_app,
|
|
238
|
+
_deployment_type);
|
|
239
|
+
return _deployments;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
module.exports = {
|
|
243
|
+
_default_deployments_dir_get:
|
|
244
|
+
_default_deployments_dir_get,
|
|
245
|
+
_evm_contract_deployments_dir:
|
|
246
|
+
_evm_contract_deployments_dir,
|
|
247
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{ "name": "evm-contracts-tools",
|
|
2
2
|
"version":
|
|
3
|
-
"0.0.
|
|
3
|
+
"0.0.36",
|
|
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": {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"./man/evm-contract-bytecode-get.1",
|
|
15
15
|
"./man/evm-contract-deployer-get.1",
|
|
16
16
|
"./man/evm-contract-deployment-address.1",
|
|
17
|
+
"./man/evm-contract-deployments-dir.1",
|
|
17
18
|
"./man/evm-contract-call.1",
|
|
18
19
|
"./man/evm-contract-call-dynamic.1"
|
|
19
20
|
],
|
|
@@ -25,10 +26,14 @@
|
|
|
25
26
|
"dist",
|
|
26
27
|
"evm-contract-call",
|
|
27
28
|
"evm-contract-call.webpack.config.js",
|
|
29
|
+
"evm-contract-deployments-dir",
|
|
30
|
+
"evm-contract-deployments-dir.webpack.config.js",
|
|
28
31
|
"fs-worker.webpack.config.js",
|
|
29
32
|
"index.html",
|
|
30
33
|
"libevm-contract-call",
|
|
31
34
|
"libevm-contract-call.webpack.config.js",
|
|
35
|
+
"libevm-contract-deployments-dir",
|
|
36
|
+
"libevm-contract-deployments-dir.webpack.config.js",
|
|
32
37
|
"lib",
|
|
33
38
|
"evm-contracts-tools",
|
|
34
39
|
"package.json",
|
|
@@ -40,13 +45,15 @@
|
|
|
40
45
|
"themartiancompany",
|
|
41
46
|
"dogeos",
|
|
42
47
|
"ethereum",
|
|
43
|
-
"evmfs"
|
|
48
|
+
"evmfs",
|
|
49
|
+
"libevm",
|
|
50
|
+
"evm-toolchain"
|
|
44
51
|
],
|
|
45
52
|
"homepage":
|
|
46
53
|
"https://github.com/themartiancompany/evm-contracts-tools",
|
|
47
54
|
"bugs": {
|
|
48
55
|
"url":
|
|
49
|
-
"https://github.com/themartiancompany/evm-contracts-tools/issues"
|
|
56
|
+
"https://github.com/themartiancompany/evm-contracts-tools.js/issues"
|
|
50
57
|
},
|
|
51
58
|
"repository": {
|
|
52
59
|
"type":
|
|
@@ -66,7 +73,7 @@
|
|
|
66
73
|
},
|
|
67
74
|
"devDependencies": {
|
|
68
75
|
"crash-js-webpack":
|
|
69
|
-
"^0.0.
|
|
76
|
+
"^0.0.28",
|
|
70
77
|
"flatted":
|
|
71
78
|
"^3.2.9",
|
|
72
79
|
"eslint":
|
|
@@ -84,7 +91,7 @@
|
|
|
84
91
|
},
|
|
85
92
|
"dependencies": {
|
|
86
93
|
"crash-js":
|
|
87
|
-
"^0.1.
|
|
94
|
+
"^0.1.134",
|
|
88
95
|
"ethers":
|
|
89
96
|
"^6.13.2",
|
|
90
97
|
"evm-chains-info":
|
|
@@ -118,15 +125,29 @@
|
|
|
118
125
|
"evm-contract-call",
|
|
119
126
|
"evm-contract-call-dynamic.js":
|
|
120
127
|
"lib/evm-contract-call-dynamic",
|
|
128
|
+
"evm-contract-deployments-dir.js":
|
|
129
|
+
"evm-contract-deployments-dir",
|
|
130
|
+
"evm-contract-deployments-dir":
|
|
131
|
+
"evm-contract-deployments-dir",
|
|
121
132
|
"evm-contract-call-static.js":
|
|
122
133
|
"lib/evm-contract-call-static" },
|
|
123
134
|
"scripts": {
|
|
124
135
|
"build-fs-worker":
|
|
125
136
|
"npx webpack --mode 'production' --config 'fs-worker.webpack.config.cjs' --stats-error-details && cp 'fs-worker.js' 'dist/'{'evm-contract-call','evm-contracts-tools','libevm-contract-call'}",
|
|
126
|
-
"build-
|
|
137
|
+
"build-libevm-contract-call":
|
|
127
138
|
"npx webpack --mode 'production' --config 'libevm-contract-call.webpack.config.cjs' --stats-error-details && mv 'libevm-contract-call.js' 'dist/libevm-contract-call'",
|
|
139
|
+
"build-libevm-contract-deployments-dir":
|
|
140
|
+
"npx webpack --mode 'production' --config 'libevm-contract-deployments-dir.webpack.config.cjs' --stats-error-details && mv 'libevm-contract-deployments-dir.js' 'dist/libevm-contract-deployments-dir'",
|
|
141
|
+
"build-lib":
|
|
142
|
+
"npm run build-libevm-contract-call && npm run build-libevm-contract-deployments-dir",
|
|
143
|
+
"build-evm-contract-call":
|
|
144
|
+
"npx webpack --mode 'production' --config 'evm-contract-call.webpack.config.cjs' --stats-error-details && mv 'evm-contract-call.js' 'dist/evm-contract-call'",
|
|
145
|
+
"build-evm-contracts-tools":
|
|
146
|
+
"npx webpack --mode 'production' --config 'webpack.config.cjs' --stats-error-details && mv 'evm-contracts-tools.js' 'dist/evm-contracts-tools'",
|
|
147
|
+
"build-evm-contract-deployments-dir":
|
|
148
|
+
"npx webpack --mode 'production' --config 'evm-contract-deployments-dir.webpack.config.cjs' --stats-error-details && mv 'evm-contract-deployments-dir.js' 'dist/evm-contract-deployments-dir' && npx webpack --mode 'production' --config 'webpack.config.cjs' --stats-error-details && mv 'evm-contracts-tools.js' 'dist/evm-contracts-tools'",
|
|
128
149
|
"build-bin":
|
|
129
|
-
"
|
|
150
|
+
"npm run build-evm-contract-call && npm run build-evm-contract-deployments-dir && npm run build-evm-contracts-tools",
|
|
130
151
|
"build-man":
|
|
131
152
|
"make build-man",
|
|
132
153
|
"build":
|