evm-contracts-tools 0.0.11 → 0.0.14
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 +297 -128
- package/lib/deployer-verify +141 -98
- package/lib/evm-contract-call-dynamic +3 -3
- package/libevm-contract-call +104 -716
- package/libevm-contracts-tools +16 -0
- package/package.json +2 -2
package/lib/deployer-verify
CHANGED
|
@@ -28,43 +28,96 @@ const
|
|
|
28
28
|
_libcrash =
|
|
29
29
|
require(
|
|
30
30
|
"crash-js");
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
/* global
|
|
32
|
+
_cmdline_check */
|
|
33
|
+
const
|
|
34
|
+
_cmdline_check =
|
|
35
|
+
_libcrash._cmdline_check;
|
|
36
|
+
/* global
|
|
37
|
+
_msg_info */
|
|
38
|
+
const
|
|
39
|
+
_msg_info =
|
|
40
|
+
_libcrash._msg_info;
|
|
41
|
+
/* global
|
|
42
|
+
_msg_error */
|
|
43
|
+
const
|
|
44
|
+
_msg_error =
|
|
45
|
+
_libcrash._msg_error;
|
|
46
|
+
/* global
|
|
47
|
+
_msg_error */
|
|
48
|
+
const
|
|
49
|
+
_printf =
|
|
50
|
+
_libcrash._printf;
|
|
51
|
+
/* global
|
|
52
|
+
_process_exit */
|
|
53
|
+
const
|
|
54
|
+
_process_exit =
|
|
55
|
+
_libcrash._process_exit;
|
|
39
56
|
const
|
|
40
57
|
_deployer_get_module =
|
|
41
58
|
require(
|
|
42
59
|
'./deployer-get');
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
/* global
|
|
61
|
+
_deployer_get */
|
|
62
|
+
const
|
|
63
|
+
_deployer_get =
|
|
64
|
+
_deployer_get_module._deployer_get;
|
|
45
65
|
|
|
46
66
|
function
|
|
47
67
|
_global_variables() {
|
|
68
|
+
/* global
|
|
69
|
+
app_name:
|
|
70
|
+
writable */
|
|
48
71
|
app_name =
|
|
49
72
|
"deployer-verify";
|
|
73
|
+
/* global
|
|
74
|
+
wallet_seed:
|
|
75
|
+
writable */
|
|
50
76
|
wallet_seed =
|
|
51
77
|
"";
|
|
78
|
+
/* global
|
|
79
|
+
retries_max:
|
|
80
|
+
writable */
|
|
52
81
|
retries_max =
|
|
53
82
|
"";
|
|
83
|
+
/* global
|
|
84
|
+
api_key_path:
|
|
85
|
+
writable */
|
|
54
86
|
api_key_path =
|
|
55
87
|
"";
|
|
88
|
+
/* global
|
|
89
|
+
chain_id:
|
|
90
|
+
writable */
|
|
56
91
|
chain_id =
|
|
57
92
|
"";
|
|
93
|
+
/* global
|
|
94
|
+
chain_name:
|
|
95
|
+
writable */
|
|
58
96
|
chain_name =
|
|
59
97
|
"";
|
|
98
|
+
/* global
|
|
99
|
+
target_network:
|
|
100
|
+
writable */
|
|
60
101
|
target_network =
|
|
61
102
|
"";
|
|
103
|
+
/* global
|
|
104
|
+
contract_address:
|
|
105
|
+
writable */
|
|
62
106
|
contract_address =
|
|
63
107
|
"";
|
|
108
|
+
/* global
|
|
109
|
+
contract_deployer:
|
|
110
|
+
writable */
|
|
64
111
|
contract_deployer =
|
|
65
112
|
"";
|
|
113
|
+
/* global
|
|
114
|
+
transaction_deployment:
|
|
115
|
+
writable */
|
|
66
116
|
transaction_deployment =
|
|
67
117
|
"";
|
|
118
|
+
/* global
|
|
119
|
+
quiet:
|
|
120
|
+
writable */
|
|
68
121
|
quiet =
|
|
69
122
|
"";
|
|
70
123
|
}
|
|
@@ -87,32 +140,38 @@ async function
|
|
|
87
140
|
_contract_deployer,
|
|
88
141
|
_transaction_deployment) {
|
|
89
142
|
let
|
|
90
|
-
_deployer_get_opts,
|
|
91
|
-
_deployer_real,
|
|
92
143
|
_is_deployer;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
144
|
+
const
|
|
145
|
+
_deployer_get_opts = [
|
|
146
|
+
_wallet_seed,
|
|
147
|
+
_retries_max,
|
|
148
|
+
_api_key_path,
|
|
149
|
+
_chain_id,
|
|
150
|
+
_chain_name,
|
|
151
|
+
_target_network,
|
|
152
|
+
_contract_address,
|
|
153
|
+
_transaction_deployment
|
|
154
|
+
];
|
|
155
|
+
const
|
|
156
|
+
_deployer_real =
|
|
157
|
+
await _deployer_get.apply(
|
|
158
|
+
null,
|
|
159
|
+
_deployer_get_opts);
|
|
160
|
+
if ( typeof(
|
|
161
|
+
_deployer_real) == "undefined" ) {
|
|
162
|
+
const
|
|
163
|
+
_msg =
|
|
164
|
+
"Error obtaining the deployer from input data.";
|
|
165
|
+
throw _msg;
|
|
109
166
|
}
|
|
110
167
|
if ( _contract_deployer == _deployer_real ) {
|
|
111
168
|
_is_deployer =
|
|
112
169
|
true;
|
|
170
|
+
}
|
|
113
171
|
else if ( _contract_deployer != _deployer_real ) {
|
|
114
172
|
_is_deployer =
|
|
115
173
|
false;
|
|
174
|
+
}
|
|
116
175
|
return _is_deployer;
|
|
117
176
|
}
|
|
118
177
|
|
|
@@ -122,46 +181,19 @@ function
|
|
|
122
181
|
_line,
|
|
123
182
|
_method_args,
|
|
124
183
|
_text;
|
|
125
|
-
|
|
126
|
-
[
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
" API Key path: {api_key_path}".replace(
|
|
139
|
-
"{api_key_path}",
|
|
140
|
-
api_key_path));
|
|
141
|
-
_text.push(
|
|
142
|
-
" Chain ID: {chain_id}".replace(
|
|
143
|
-
"{chain_id}",
|
|
144
|
-
chain_id));
|
|
145
|
-
_text.push(
|
|
146
|
-
" Chain Name: {chain_name}".replace(
|
|
147
|
-
"{chain_name}",
|
|
148
|
-
chain_name));
|
|
149
|
-
_text.push(
|
|
150
|
-
" Target network: {target_network}".replace(
|
|
151
|
-
"{target_network}",
|
|
152
|
-
target_network));
|
|
153
|
-
_text.push(
|
|
154
|
-
" Contract address: {contract_address}".replace(
|
|
155
|
-
"{contract_address}",
|
|
156
|
-
contract_address));
|
|
157
|
-
_text.push(
|
|
158
|
-
" Contract deployer: {contract_deployer}".replace(
|
|
159
|
-
"{contract_deployer}",
|
|
160
|
-
contract_deployer));
|
|
161
|
-
_text.push(
|
|
162
|
-
" Deployment transaction: {transaction_deployment}".replace(
|
|
163
|
-
"{transaction_deployment}",
|
|
164
|
-
transaction_deployment));
|
|
184
|
+
const
|
|
185
|
+
_text = [
|
|
186
|
+
"deployer-get configuration:",
|
|
187
|
+
` Wallet seed: ${wallet_seed}`,
|
|
188
|
+
` Max retries: ${retries_max}`,
|
|
189
|
+
` API Key path: ${api_key_path}`,
|
|
190
|
+
` Chain ID: ${chain_id}`,
|
|
191
|
+
` Chain Name: ${chain_name}`,
|
|
192
|
+
` Target network: ${target_network}`,
|
|
193
|
+
` Contract address: ${contract_address}`,
|
|
194
|
+
` Contract deployer: ${contract_deployer}`,
|
|
195
|
+
` Deployment transaction: ${transaction_deployment}`
|
|
196
|
+
];
|
|
165
197
|
for (_line of _text) {
|
|
166
198
|
_msg_info(
|
|
167
199
|
_line);
|
|
@@ -183,30 +215,30 @@ function
|
|
|
183
215
|
"Usage:",
|
|
184
216
|
" deployer-verify",
|
|
185
217
|
" <quiet>",
|
|
186
|
-
" <
|
|
187
|
-
" <
|
|
188
|
-
" <
|
|
189
|
-
" <
|
|
190
|
-
" <
|
|
191
|
-
" <
|
|
192
|
-
" <
|
|
193
|
-
" <
|
|
194
|
-
" <
|
|
218
|
+
" <wallet-seed>",
|
|
219
|
+
" <retries-max>",
|
|
220
|
+
" <api-key-path>",
|
|
221
|
+
" <chain-id>",
|
|
222
|
+
" <chain-name>",
|
|
223
|
+
" <target-network>",
|
|
224
|
+
" <contract-address>",
|
|
225
|
+
" <contract-deployer>",
|
|
226
|
+
" <transaction-deployment>",
|
|
195
227
|
"",
|
|
196
228
|
"Args:",
|
|
197
229
|
" <quiet> Can be 'y' or 'n'",
|
|
198
230
|
" Default: y",
|
|
199
|
-
" <
|
|
231
|
+
" <wallet-seed> Path of the file containing",
|
|
200
232
|
" the seed phrase.",
|
|
201
|
-
" <
|
|
233
|
+
" <retries-max> Maximum number of retries before",
|
|
202
234
|
" failing.",
|
|
203
|
-
" <
|
|
235
|
+
" <api-key-path> Path of the API key for the",
|
|
204
236
|
" contract ABI provider service",
|
|
205
|
-
" <
|
|
237
|
+
" <target-network> Network on which the contract",
|
|
206
238
|
" resides.",
|
|
207
|
-
" <
|
|
208
|
-
" <
|
|
209
|
-
" <
|
|
239
|
+
" <contract-address> Address of the contract.",
|
|
240
|
+
" <contract-deployer> Address of the supposed deployer.",
|
|
241
|
+
" <transaction-deployment> Contract deployment transaction.",
|
|
210
242
|
"",
|
|
211
243
|
" Options:",
|
|
212
244
|
" -h This help."
|
|
@@ -215,7 +247,7 @@ function
|
|
|
215
247
|
_msg_info(
|
|
216
248
|
_line);
|
|
217
249
|
}
|
|
218
|
-
|
|
250
|
+
_process_exit(
|
|
219
251
|
_exit);
|
|
220
252
|
}
|
|
221
253
|
|
|
@@ -229,6 +261,8 @@ function
|
|
|
229
261
|
|
|
230
262
|
function
|
|
231
263
|
_cmdline_parse() {
|
|
264
|
+
let
|
|
265
|
+
_msg;
|
|
232
266
|
quiet =
|
|
233
267
|
"y";
|
|
234
268
|
process.argv.forEach(
|
|
@@ -284,29 +318,38 @@ function
|
|
|
284
318
|
}
|
|
285
319
|
);
|
|
286
320
|
if ( contract_address == "" ) {
|
|
321
|
+
_msg =
|
|
322
|
+
"No contract address specified.";
|
|
287
323
|
_msg_error(
|
|
288
|
-
|
|
324
|
+
_msg,
|
|
289
325
|
0);
|
|
290
326
|
quiet =
|
|
291
327
|
"n";
|
|
328
|
+
_overrides_set();
|
|
292
329
|
_usage(
|
|
293
330
|
1);
|
|
294
331
|
}
|
|
295
332
|
if ( contract_deployer == "" ) {
|
|
333
|
+
_msg =
|
|
334
|
+
"No contract deployer specified.";
|
|
296
335
|
_msg_error(
|
|
297
|
-
|
|
336
|
+
_msg,
|
|
298
337
|
0);
|
|
299
338
|
quiet =
|
|
300
339
|
"n";
|
|
340
|
+
_overrides_set();
|
|
301
341
|
_usage(
|
|
302
342
|
1);
|
|
303
343
|
}
|
|
304
344
|
if ( transaction_deployment == "" ) {
|
|
345
|
+
_msg =
|
|
346
|
+
"No deployement transaction specified.";
|
|
305
347
|
_msg_error(
|
|
306
|
-
|
|
348
|
+
_msg,
|
|
307
349
|
0);
|
|
308
350
|
quiet =
|
|
309
351
|
"n";
|
|
352
|
+
_overrides_set();
|
|
310
353
|
_usage(
|
|
311
354
|
1);
|
|
312
355
|
}
|
|
@@ -316,27 +359,28 @@ async function
|
|
|
316
359
|
_deployer_verify_cmdline(
|
|
317
360
|
_app_opts) {
|
|
318
361
|
let
|
|
319
|
-
_is_deployer
|
|
320
|
-
_msg;
|
|
362
|
+
_is_deployer;
|
|
321
363
|
try {
|
|
322
364
|
_is_deployer =
|
|
323
365
|
await _deployer_verify.apply(
|
|
324
366
|
null,
|
|
325
367
|
_app_opts);
|
|
326
|
-
if (
|
|
368
|
+
if ( typeof(
|
|
369
|
+
_is_deployer) != "undefined" ) {
|
|
327
370
|
_printf(
|
|
328
371
|
_is_deployer.toString());
|
|
329
372
|
}
|
|
330
373
|
else {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
374
|
+
const
|
|
375
|
+
_msg =
|
|
376
|
+
"It has not been possile to discern from " +
|
|
377
|
+
"input data whether the candidate deployer " +
|
|
378
|
+
"is the contract actual deployer.";
|
|
335
379
|
throw _msg;
|
|
336
380
|
}
|
|
337
|
-
} catch (
|
|
381
|
+
} catch (_error) {
|
|
338
382
|
_msg_error(
|
|
339
|
-
|
|
383
|
+
_error,
|
|
340
384
|
1);
|
|
341
385
|
}
|
|
342
386
|
}
|
|
@@ -366,4 +410,3 @@ module.exports = {
|
|
|
366
410
|
_deployer_verify:
|
|
367
411
|
_deployer_verify
|
|
368
412
|
};
|
|
369
|
-
|
|
@@ -81,14 +81,14 @@ const
|
|
|
81
81
|
_parse_units =
|
|
82
82
|
_ethers.parseUnits;
|
|
83
83
|
const
|
|
84
|
-
|
|
84
|
+
_evm_wallet_module =
|
|
85
85
|
require(
|
|
86
|
-
|
|
86
|
+
"evm-wallet.js");
|
|
87
87
|
/* global
|
|
88
88
|
_price_gas_transaction_get */
|
|
89
89
|
const
|
|
90
90
|
_price_gas_transaction_get =
|
|
91
|
-
|
|
91
|
+
_evm_wallet_module._price_gas_transaction_get;
|
|
92
92
|
const
|
|
93
93
|
_contract_get_module =
|
|
94
94
|
require(
|