evm-contracts-tools 0.0.33 → 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 +222 -0
- package/dist/evm-contract-call/index.html +24 -0
- package/dist/evm-contract-deployments-dir/index.html +31 -0
- package/dist/evm-contracts-tools/index.html +24 -0
- package/dist/libevm-contract-call/fs-worker.js +1 -0
- package/dist/libevm-contract-call/index.html +24 -0
- package/dist/libevm-contract-deployments-dir/index.html +24 -0
- package/evm-contract-call +25 -13
- package/evm-contract-deployments-dir +376 -0
- package/evm-contracts-tools +12 -14
- package/lib/address-check +253 -0
- package/lib/bytecode-creation-get +40 -9
- package/lib/bytecode-runtime-get +9 -4
- package/libevm-contract-call +37 -18
- package/libevm-contract-deployments-dir +247 -0
- package/package.json +44 -13
|
@@ -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
|
|
@@ -36,6 +35,15 @@ const
|
|
|
36
35
|
_libcrash_module =
|
|
37
36
|
require(
|
|
38
37
|
"crash-js");
|
|
38
|
+
const
|
|
39
|
+
_address_check_module =
|
|
40
|
+
require(
|
|
41
|
+
"./lib/address-check");
|
|
42
|
+
/* global
|
|
43
|
+
_address_check */
|
|
44
|
+
const
|
|
45
|
+
_address_check =
|
|
46
|
+
_address_check_module._address_check;
|
|
39
47
|
const
|
|
40
48
|
_bytecode_creation_get_module =
|
|
41
49
|
require(
|
|
@@ -106,23 +114,13 @@ const
|
|
|
106
114
|
_contract_call_static =
|
|
107
115
|
_evm_contract_call_static_module._contract_call_static;
|
|
108
116
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
function
|
|
113
|
-
_artifact_local_auto_detect() {
|
|
114
|
-
true;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
117
|
module.exports = {
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
_address_check:
|
|
119
|
+
_address_check,
|
|
120
120
|
_bytecode_creation_get:
|
|
121
121
|
_bytecode_creation_get,
|
|
122
122
|
_bytecode_runtime_get:
|
|
123
123
|
_bytecode_runtime_get,
|
|
124
|
-
_call_auth_auto_detect:
|
|
125
|
-
_call_auth_auto_detect,
|
|
126
124
|
_contract_call_dynamic:
|
|
127
125
|
_contract_call_dynamic,
|
|
128
126
|
_contract_call_static:
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
|
|
5
|
+
/** ----------------------------------------------------------------------
|
|
6
|
+
* address-check
|
|
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 modify
|
|
16
|
+
* it under the terms of the GNU General Public License as published by
|
|
17
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
18
|
+
* (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. If not, see <https://www.gnu.org/licenses/>.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
const
|
|
30
|
+
_libcrash =
|
|
31
|
+
require(
|
|
32
|
+
"crash-js");
|
|
33
|
+
/* global
|
|
34
|
+
_argv_get */
|
|
35
|
+
const
|
|
36
|
+
_argv_get =
|
|
37
|
+
_libcrash._argv_get;
|
|
38
|
+
/* global
|
|
39
|
+
_basename */
|
|
40
|
+
const
|
|
41
|
+
_basename =
|
|
42
|
+
_libcrash._basename;
|
|
43
|
+
/* global
|
|
44
|
+
_cmdline_check */
|
|
45
|
+
const
|
|
46
|
+
_cmdline_check =
|
|
47
|
+
_libcrash._cmdline_check;
|
|
48
|
+
/* global
|
|
49
|
+
_msg_info */
|
|
50
|
+
const
|
|
51
|
+
_msg_info =
|
|
52
|
+
_libcrash._msg_info;
|
|
53
|
+
/* global
|
|
54
|
+
_msg_error */
|
|
55
|
+
const
|
|
56
|
+
_msg_error =
|
|
57
|
+
_libcrash._msg_error;
|
|
58
|
+
/* global
|
|
59
|
+
_process_exit */
|
|
60
|
+
const
|
|
61
|
+
_process_exit =
|
|
62
|
+
_libcrash._process_exit;
|
|
63
|
+
const
|
|
64
|
+
{ ethers } =
|
|
65
|
+
require(
|
|
66
|
+
"ethers");
|
|
67
|
+
const
|
|
68
|
+
_ethers =
|
|
69
|
+
ethers;
|
|
70
|
+
/* global
|
|
71
|
+
_address_check */
|
|
72
|
+
const
|
|
73
|
+
_address_check =
|
|
74
|
+
_ethers.isAddress;
|
|
75
|
+
|
|
76
|
+
function
|
|
77
|
+
_global_variables() {
|
|
78
|
+
app_name =
|
|
79
|
+
"address-check";
|
|
80
|
+
/* global
|
|
81
|
+
target_address:
|
|
82
|
+
writable */
|
|
83
|
+
target_address =
|
|
84
|
+
"";
|
|
85
|
+
/* global
|
|
86
|
+
quiet:
|
|
87
|
+
writable */
|
|
88
|
+
quiet =
|
|
89
|
+
"";
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function
|
|
93
|
+
_config_show() {
|
|
94
|
+
let
|
|
95
|
+
_line;
|
|
96
|
+
const
|
|
97
|
+
_argv =
|
|
98
|
+
_argv_get();
|
|
99
|
+
const
|
|
100
|
+
_program =
|
|
101
|
+
_basename(
|
|
102
|
+
_argv[
|
|
103
|
+
"$0"]);
|
|
104
|
+
const
|
|
105
|
+
_text = [
|
|
106
|
+
`${_program} configuration:`,
|
|
107
|
+
` Target address: ${target_address}`,
|
|
108
|
+
];
|
|
109
|
+
for (_line of _text) {
|
|
110
|
+
_msg_info(
|
|
111
|
+
_line);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function
|
|
116
|
+
_usage(
|
|
117
|
+
_exit) {
|
|
118
|
+
let
|
|
119
|
+
_display_fun,
|
|
120
|
+
_line;
|
|
121
|
+
const
|
|
122
|
+
_argv =
|
|
123
|
+
_argv_get();
|
|
124
|
+
const
|
|
125
|
+
_program =
|
|
126
|
+
_basename(
|
|
127
|
+
_argv[
|
|
128
|
+
"$0"]);
|
|
129
|
+
const
|
|
130
|
+
_text = [
|
|
131
|
+
"Checks whether an address is valid.",
|
|
132
|
+
"",
|
|
133
|
+
"usage:",
|
|
134
|
+
` ${_program}`,
|
|
135
|
+
" <target-address>",
|
|
136
|
+
" [options]",
|
|
137
|
+
"",
|
|
138
|
+
"args:",
|
|
139
|
+
" <target-address> Address to check.",
|
|
140
|
+
"",
|
|
141
|
+
" options:",
|
|
142
|
+
" -v --verbose Extended output.",
|
|
143
|
+
" -h --help This help."
|
|
144
|
+
];
|
|
145
|
+
for (_line of _text) {
|
|
146
|
+
_msg_info(
|
|
147
|
+
_line);
|
|
148
|
+
}
|
|
149
|
+
_process_exit(
|
|
150
|
+
_exit);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function
|
|
154
|
+
_overrides_set() {
|
|
155
|
+
true;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function
|
|
159
|
+
_cmdline_parse() {
|
|
160
|
+
quiet =
|
|
161
|
+
"y";
|
|
162
|
+
process.argv.forEach(
|
|
163
|
+
function (
|
|
164
|
+
_value,
|
|
165
|
+
_index,
|
|
166
|
+
_array) {
|
|
167
|
+
if ( _index == 2 ) {
|
|
168
|
+
target_address =
|
|
169
|
+
_value;
|
|
170
|
+
}
|
|
171
|
+
else if ( _value == "-v" ||
|
|
172
|
+
_value == "--verbose" ) {
|
|
173
|
+
quiet =
|
|
174
|
+
"n";
|
|
175
|
+
}
|
|
176
|
+
else if ( _value == "-h" ||
|
|
177
|
+
_value == "--help" ) {
|
|
178
|
+
quiet =
|
|
179
|
+
"n";
|
|
180
|
+
_usage(
|
|
181
|
+
0);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
if ( target_address == "" ) {
|
|
186
|
+
const
|
|
187
|
+
_msg =
|
|
188
|
+
"No target address specified.";
|
|
189
|
+
_msg_error(
|
|
190
|
+
_msg,
|
|
191
|
+
0);
|
|
192
|
+
quiet =
|
|
193
|
+
"n";
|
|
194
|
+
_usage(
|
|
195
|
+
1);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async function
|
|
199
|
+
_address_check_cmdline(
|
|
200
|
+
_app_opts) {
|
|
201
|
+
let
|
|
202
|
+
_is_address,
|
|
203
|
+
_msg;
|
|
204
|
+
try {
|
|
205
|
+
_is_address =
|
|
206
|
+
await _address_check.apply(
|
|
207
|
+
null,
|
|
208
|
+
_app_opts);
|
|
209
|
+
const
|
|
210
|
+
_return_type =
|
|
211
|
+
typeof(
|
|
212
|
+
_is_address);
|
|
213
|
+
if ( _return_type == "undefined" ) {
|
|
214
|
+
_msg =
|
|
215
|
+
"Big error.";
|
|
216
|
+
_msg_error(
|
|
217
|
+
_msg,
|
|
218
|
+
1);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
if ( ! _is_address ) {
|
|
222
|
+
_msg =
|
|
223
|
+
`Address '${target_address}' not is valid.'`;
|
|
224
|
+
throw _msg;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
} catch (
|
|
228
|
+
_error) {
|
|
229
|
+
_msg_error(
|
|
230
|
+
_error,
|
|
231
|
+
1);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if ( _cmdline_check(
|
|
236
|
+
"address-check") ||
|
|
237
|
+
_cmdline_check(
|
|
238
|
+
"ethereum-address-validate") ) {
|
|
239
|
+
_global_variables();
|
|
240
|
+
_cmdline_parse();
|
|
241
|
+
_overrides_set();
|
|
242
|
+
_config_show();
|
|
243
|
+
app_opts = [
|
|
244
|
+
target_address,
|
|
245
|
+
];
|
|
246
|
+
_address_check_cmdline(
|
|
247
|
+
app_opts);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
module.exports = {
|
|
251
|
+
_address_check:
|
|
252
|
+
_address_check
|
|
253
|
+
};
|