evm-transactions-tools 0.0.1111 → 0.0.111111
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-transactions-tools
CHANGED
|
@@ -31,22 +31,27 @@
|
|
|
31
31
|
|
|
32
32
|
const
|
|
33
33
|
_transaction_get_module =
|
|
34
|
-
|
|
34
|
+
await import(
|
|
35
35
|
"./lib/transaction-get");
|
|
36
36
|
const
|
|
37
37
|
_transaction_get =
|
|
38
38
|
_transaction_get_module._transaction_get;
|
|
39
39
|
const
|
|
40
40
|
_transaction_receipt_get_module =
|
|
41
|
-
|
|
41
|
+
await import(
|
|
42
42
|
"./lib/transaction-receipt-get");
|
|
43
43
|
const
|
|
44
44
|
_transaction_receipt_get =
|
|
45
45
|
_transaction_receipt_get_module._transaction_receipt_get;
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
_transaction_get
|
|
49
|
-
|
|
50
|
-
_transaction_receipt_get:
|
|
51
|
-
_transaction_receipt_get
|
|
47
|
+
export {
|
|
48
|
+
_transaction_get,
|
|
49
|
+
_transaction_receipt_get
|
|
52
50
|
};
|
|
51
|
+
|
|
52
|
+
// module.exports = {
|
|
53
|
+
// _transaction_get:
|
|
54
|
+
// _transaction_get,
|
|
55
|
+
// _transaction_receipt_get:
|
|
56
|
+
// _transaction_receipt_get
|
|
57
|
+
// };
|
package/lib/transaction-get
CHANGED
|
@@ -33,73 +33,169 @@
|
|
|
33
33
|
|
|
34
34
|
const
|
|
35
35
|
_libcrash =
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
36
|
+
await import(
|
|
37
|
+
"libcrash-js");
|
|
38
|
+
/* global
|
|
39
|
+
_argv */
|
|
40
|
+
const
|
|
41
|
+
_argv =
|
|
42
|
+
_libcrash._argv;
|
|
43
|
+
/* global
|
|
44
|
+
_cmdline_check */
|
|
45
|
+
const
|
|
46
|
+
_cmdline_check =
|
|
47
|
+
_libcrash._cmdline_check;
|
|
48
|
+
/* global
|
|
49
|
+
_dirname */
|
|
50
|
+
const
|
|
51
|
+
_dirname =
|
|
52
|
+
_libcrash._dirname;
|
|
53
|
+
/* global
|
|
54
|
+
_echo */
|
|
55
|
+
const
|
|
56
|
+
_echo =
|
|
57
|
+
_libcrash._echo;
|
|
58
|
+
/* global
|
|
59
|
+
_exit */
|
|
60
|
+
const
|
|
61
|
+
_exit =
|
|
62
|
+
_libcrash._exit;
|
|
63
|
+
/* global
|
|
64
|
+
_file_read */
|
|
65
|
+
const
|
|
66
|
+
_file_read =
|
|
67
|
+
_libcrash._file_read;
|
|
68
|
+
/* global
|
|
69
|
+
_file_write */
|
|
70
|
+
const
|
|
71
|
+
_file_write =
|
|
72
|
+
_libcrash._file_write;
|
|
73
|
+
/* global
|
|
74
|
+
_global_get */
|
|
75
|
+
const
|
|
76
|
+
_global_get =
|
|
77
|
+
_libcrash._global_get;
|
|
78
|
+
/* global
|
|
79
|
+
_globals */
|
|
80
|
+
const
|
|
81
|
+
_globals =
|
|
82
|
+
_libcrash._globals;
|
|
83
|
+
/* global
|
|
84
|
+
_json_display */
|
|
85
|
+
const
|
|
86
|
+
_json_display =
|
|
87
|
+
_libcrash._json_display;
|
|
88
|
+
/* global
|
|
89
|
+
_path_join */
|
|
90
|
+
const
|
|
91
|
+
_path_join =
|
|
92
|
+
_libcrash._path_join;
|
|
93
|
+
/* global
|
|
94
|
+
_msg_info */
|
|
95
|
+
const
|
|
96
|
+
_msg_info =
|
|
97
|
+
_libcrash._msg_info;
|
|
98
|
+
/* global
|
|
99
|
+
_msg_error */
|
|
100
|
+
const
|
|
101
|
+
_msg_error =
|
|
102
|
+
_libcrash._msg_error;
|
|
103
|
+
/* global
|
|
104
|
+
_override_set */
|
|
105
|
+
const
|
|
106
|
+
_override_set =
|
|
107
|
+
_libcrash._override_set;
|
|
108
|
+
/* global
|
|
109
|
+
_printf */
|
|
110
|
+
const
|
|
111
|
+
_printf =
|
|
112
|
+
_libcrash._printf;
|
|
113
|
+
/* global
|
|
114
|
+
_require */
|
|
115
|
+
const
|
|
116
|
+
_require =
|
|
117
|
+
_libcrash._require;
|
|
118
|
+
/* global
|
|
119
|
+
_set */
|
|
120
|
+
const
|
|
121
|
+
_set =
|
|
122
|
+
_libcrash._set;
|
|
56
123
|
const
|
|
57
124
|
_evm_wallet_module =
|
|
58
|
-
|
|
59
|
-
"evm-wallet
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
125
|
+
await _require(
|
|
126
|
+
"evm-wallet");
|
|
127
|
+
/* global
|
|
128
|
+
_wallet_get */
|
|
129
|
+
const
|
|
130
|
+
_wallet_get =
|
|
131
|
+
_evm_wallet_module._wallet_get;
|
|
132
|
+
/* global
|
|
133
|
+
_provider_get */
|
|
134
|
+
const
|
|
135
|
+
_provider_get =
|
|
136
|
+
_evm_wallet_module._provider_get;
|
|
64
137
|
|
|
65
138
|
function
|
|
66
139
|
_global_variables() {
|
|
67
|
-
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
"";
|
|
71
|
-
|
|
72
|
-
""
|
|
73
|
-
|
|
74
|
-
"";
|
|
75
|
-
|
|
76
|
-
""
|
|
77
|
-
|
|
78
|
-
"";
|
|
79
|
-
|
|
80
|
-
""
|
|
81
|
-
|
|
82
|
-
"";
|
|
83
|
-
|
|
84
|
-
""
|
|
85
|
-
|
|
86
|
-
"";
|
|
87
|
-
|
|
140
|
+
_set(
|
|
141
|
+
"app",
|
|
142
|
+
"name",
|
|
143
|
+
"transaction-get");
|
|
144
|
+
_set(
|
|
145
|
+
"retries",
|
|
146
|
+
"max",
|
|
147
|
+
"");
|
|
148
|
+
_set(
|
|
149
|
+
"wallet",
|
|
150
|
+
"seed",
|
|
151
|
+
"");
|
|
152
|
+
_set(
|
|
153
|
+
"wallet",
|
|
154
|
+
"password_path",
|
|
155
|
+
"");
|
|
156
|
+
_set(
|
|
157
|
+
"transaction",
|
|
158
|
+
"address",
|
|
159
|
+
"");
|
|
160
|
+
_set(
|
|
161
|
+
"chain",
|
|
162
|
+
"id",
|
|
163
|
+
"");
|
|
164
|
+
_set(
|
|
165
|
+
"chain",
|
|
166
|
+
"name",
|
|
167
|
+
"");
|
|
168
|
+
_set(
|
|
169
|
+
"target",
|
|
170
|
+
"network",
|
|
171
|
+
"");
|
|
172
|
+
_set(
|
|
173
|
+
"api",
|
|
174
|
+
"key_path",
|
|
175
|
+
"");
|
|
176
|
+
_set(
|
|
177
|
+
"output",
|
|
178
|
+
"path",
|
|
179
|
+
"");
|
|
180
|
+
const
|
|
181
|
+
_global =
|
|
182
|
+
_global_get();
|
|
183
|
+
_global[
|
|
184
|
+
"quiet"] =
|
|
88
185
|
"";
|
|
89
186
|
}
|
|
90
187
|
|
|
91
188
|
function
|
|
92
189
|
_msg_error_no_input_data() {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
" ");
|
|
190
|
+
const
|
|
191
|
+
_text = [
|
|
192
|
+
"You need to provide either",
|
|
193
|
+
"the bytecode or the data"
|
|
194
|
+
];
|
|
195
|
+
const
|
|
196
|
+
_msg =
|
|
197
|
+
_text.join(
|
|
198
|
+
" ");
|
|
103
199
|
_msg_error(
|
|
104
200
|
_msg,
|
|
105
201
|
1);
|
|
@@ -108,15 +204,9 @@ function
|
|
|
108
204
|
function
|
|
109
205
|
_msg_info_wallet_selected(
|
|
110
206
|
_wallet) {
|
|
111
|
-
|
|
112
|
-
_msg
|
|
113
|
-
|
|
114
|
-
_template =
|
|
115
|
-
"Wallet is '{_wallet}'.";
|
|
116
|
-
_msg =
|
|
117
|
-
_template.replaceAll(
|
|
118
|
-
"{_wallet}",
|
|
119
|
-
_wallet);
|
|
207
|
+
const
|
|
208
|
+
_msg =
|
|
209
|
+
`Wallet is '${_wallet}'.`;
|
|
120
210
|
_msg_info(
|
|
121
211
|
_msg);
|
|
122
212
|
}
|
|
@@ -212,11 +302,13 @@ async function
|
|
|
212
302
|
_tx);
|
|
213
303
|
_file_write(
|
|
214
304
|
_output_path,
|
|
215
|
-
|
|
305
|
+
_json);
|
|
216
306
|
}
|
|
217
|
-
} catch (
|
|
218
|
-
|
|
219
|
-
|
|
307
|
+
} catch (_error) {
|
|
308
|
+
_msg_error(
|
|
309
|
+
_error,
|
|
310
|
+
0);
|
|
311
|
+
throw _error;
|
|
220
312
|
}
|
|
221
313
|
return _tx;
|
|
222
314
|
}
|
|
@@ -224,41 +316,20 @@ async function
|
|
|
224
316
|
function
|
|
225
317
|
_config_show() {
|
|
226
318
|
let
|
|
227
|
-
_line
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
chain_id));
|
|
242
|
-
_text.push(
|
|
243
|
-
" Chain Name: {chain_name}".replace(
|
|
244
|
-
"{chain_name}",
|
|
245
|
-
chain_name));
|
|
246
|
-
_text.push(
|
|
247
|
-
" Target network: {target_network}".replace(
|
|
248
|
-
"{target_network}",
|
|
249
|
-
target_network));
|
|
250
|
-
_text.push(
|
|
251
|
-
" API Key: {api_key_path}".replace(
|
|
252
|
-
"{api_key_path}",
|
|
253
|
-
api_key_path));
|
|
254
|
-
_text.push(
|
|
255
|
-
" Output path: {output_path}".replace(
|
|
256
|
-
"{output_path}",
|
|
257
|
-
output_path));
|
|
258
|
-
_text.push(
|
|
259
|
-
" Transaction address: {transaction_address}".replace(
|
|
260
|
-
"{transaction_address}",
|
|
261
|
-
transaction_address));
|
|
319
|
+
_line;
|
|
320
|
+
const
|
|
321
|
+
_text = [
|
|
322
|
+
` Maximum retries: ${retries_max}`,
|
|
323
|
+
` Wallet seed: ${wallet_seed}`,
|
|
324
|
+
` Wallet seed: ${wallet_seed}`,
|
|
325
|
+
` Chain ID: ${chain_id}`,
|
|
326
|
+
` Chain Name: ${chain_name}`,
|
|
327
|
+
` Target network: ${target_network}`,
|
|
328
|
+
` API Key: ${api_key_path}`,
|
|
329
|
+
` Output path: ${output_path}`,
|
|
330
|
+
` Output path: ${output_path}`,
|
|
331
|
+
` Transaction address: ${transaction_address}`,
|
|
332
|
+
];
|
|
262
333
|
for ( _line of _text ) {
|
|
263
334
|
_msg_info(
|
|
264
335
|
_line);
|
|
@@ -269,109 +340,147 @@ function
|
|
|
269
340
|
_usage(
|
|
270
341
|
_exit_code) {
|
|
271
342
|
let
|
|
272
|
-
_line
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
"
|
|
288
|
-
"
|
|
289
|
-
|
|
290
|
-
"
|
|
291
|
-
|
|
292
|
-
"
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
343
|
+
_line;
|
|
344
|
+
const
|
|
345
|
+
_app_name =
|
|
346
|
+
_get(
|
|
347
|
+
"app",
|
|
348
|
+
"name");
|
|
349
|
+
const
|
|
350
|
+
_text = [
|
|
351
|
+
"",
|
|
352
|
+
"Retrieve EVM networks transactions",
|
|
353
|
+
"",
|
|
354
|
+
"Usage:",
|
|
355
|
+
` ${_app_name}`,
|
|
356
|
+
" <quiet>",
|
|
357
|
+
" <retries-max>",
|
|
358
|
+
" <wallet-seed>",
|
|
359
|
+
" <wallet-password-path>",
|
|
360
|
+
" <chain-id>",
|
|
361
|
+
" <chain-name>",
|
|
362
|
+
" <target-network>",
|
|
363
|
+
" <api-key-path>",
|
|
364
|
+
" <output-path>",
|
|
365
|
+
" <transaction-address>",
|
|
366
|
+
"",
|
|
367
|
+
"Args:",
|
|
368
|
+
" <quiet> Can be 'y' or 'n'",
|
|
369
|
+
" Default: y",
|
|
370
|
+
" <retries-max> Maximum number of retries before",
|
|
371
|
+
" failing.",
|
|
372
|
+
" <wallet-seed> Path of the seed phrase.",
|
|
373
|
+
" <wallet-password-path> Wallet password path.",
|
|
374
|
+
" <chain-id> Chain ID for the network.",
|
|
375
|
+
" <chain-name> Name for the network.",
|
|
376
|
+
" <target-network> Network on which the transaction",
|
|
377
|
+
" resides.",
|
|
378
|
+
" <api-key-path> Path of the API key for the",
|
|
379
|
+
" network provider service.",
|
|
380
|
+
" <output-path> File on which to optionally save",
|
|
381
|
+
" the output.",
|
|
382
|
+
" <transaction-address> Transaction one wants to retrieve.",
|
|
383
|
+
"",
|
|
384
|
+
" Options:",
|
|
385
|
+
" -h This help.",
|
|
386
|
+
""
|
|
387
|
+
];
|
|
308
388
|
for ( _line of _text ) {
|
|
309
|
-
|
|
389
|
+
_echo(
|
|
310
390
|
_line);
|
|
311
391
|
}
|
|
312
|
-
|
|
392
|
+
_exit(
|
|
313
393
|
_exit_code);
|
|
314
394
|
}
|
|
315
395
|
|
|
316
396
|
function _cmdline_parse() {
|
|
317
|
-
|
|
397
|
+
const
|
|
398
|
+
_global =
|
|
399
|
+
_global_get();
|
|
400
|
+
_global[
|
|
401
|
+
"quiet"] =
|
|
318
402
|
"y";
|
|
319
|
-
|
|
403
|
+
_argv.forEach(
|
|
320
404
|
function (
|
|
321
405
|
_value,
|
|
322
|
-
_index
|
|
323
|
-
_array) {
|
|
406
|
+
_index) {
|
|
324
407
|
if ( _index == 2 ) {
|
|
325
|
-
|
|
408
|
+
_global[
|
|
409
|
+
"quiet"] =
|
|
326
410
|
_value;
|
|
327
411
|
}
|
|
328
412
|
if ( _index == 3 ) {
|
|
329
|
-
|
|
330
|
-
|
|
413
|
+
_set(
|
|
414
|
+
"retries",
|
|
415
|
+
"max",
|
|
416
|
+
_value);
|
|
331
417
|
}
|
|
332
418
|
if ( _index == 4 ) {
|
|
333
|
-
|
|
334
|
-
|
|
419
|
+
_set(
|
|
420
|
+
"wallet",
|
|
421
|
+
"seed",
|
|
422
|
+
_value);
|
|
335
423
|
}
|
|
336
424
|
if ( _index == 5 ) {
|
|
337
|
-
|
|
338
|
-
|
|
425
|
+
_set(
|
|
426
|
+
"wallet",
|
|
427
|
+
"password_path",
|
|
428
|
+
_value);
|
|
339
429
|
}
|
|
340
430
|
if ( _index == 6 ) {
|
|
341
|
-
|
|
342
|
-
|
|
431
|
+
_set(
|
|
432
|
+
"chain",
|
|
433
|
+
"id",
|
|
434
|
+
_value);
|
|
343
435
|
}
|
|
344
436
|
if ( _index == 7 ) {
|
|
345
|
-
|
|
346
|
-
|
|
437
|
+
_set(
|
|
438
|
+
"chain",
|
|
439
|
+
"name",
|
|
440
|
+
_value);
|
|
347
441
|
}
|
|
348
442
|
if ( _index == 8 ) {
|
|
349
|
-
|
|
350
|
-
|
|
443
|
+
_set(
|
|
444
|
+
"target",
|
|
445
|
+
"network",
|
|
446
|
+
_value);
|
|
351
447
|
}
|
|
352
448
|
if ( _index == 9 ) {
|
|
353
|
-
|
|
354
|
-
|
|
449
|
+
_set(
|
|
450
|
+
"api",
|
|
451
|
+
"key_path",
|
|
452
|
+
_value);
|
|
355
453
|
}
|
|
356
454
|
if ( _index == 10 ) {
|
|
357
|
-
|
|
358
|
-
|
|
455
|
+
_set(
|
|
456
|
+
"output",
|
|
457
|
+
"path",
|
|
458
|
+
_value);
|
|
359
459
|
}
|
|
360
460
|
if ( _index == 11 ) {
|
|
361
|
-
|
|
362
|
-
|
|
461
|
+
_set(
|
|
462
|
+
"transaction",
|
|
463
|
+
"address",
|
|
464
|
+
_value);
|
|
363
465
|
}
|
|
364
466
|
if ( _value == "-h" ||
|
|
365
467
|
_value == "--help" ) {
|
|
366
|
-
|
|
468
|
+
_global[
|
|
469
|
+
"quiet"] =
|
|
367
470
|
"n";
|
|
368
471
|
_usage(
|
|
369
472
|
0);
|
|
370
473
|
}
|
|
371
474
|
}
|
|
372
475
|
);
|
|
373
|
-
|
|
374
|
-
|
|
476
|
+
const
|
|
477
|
+
_transaction_address =
|
|
478
|
+
_get(
|
|
479
|
+
"transaction",
|
|
480
|
+
"address");
|
|
481
|
+
if ( _transaction_address == "" ) {
|
|
482
|
+
_global[
|
|
483
|
+
"quiet"] =
|
|
375
484
|
"n";
|
|
376
485
|
_usage(
|
|
377
486
|
1);
|
|
@@ -380,10 +489,10 @@ function _cmdline_parse() {
|
|
|
380
489
|
|
|
381
490
|
function
|
|
382
491
|
_overrides_set() {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
492
|
+
_override_set(
|
|
493
|
+
"retries",
|
|
494
|
+
"max",
|
|
495
|
+
100);
|
|
387
496
|
if ( chain_id == "" ) {
|
|
388
497
|
_msg_info(
|
|
389
498
|
"TODO: use evm_chains_info_module");
|
|
@@ -413,18 +522,29 @@ async function
|
|
|
413
522
|
_json);
|
|
414
523
|
}
|
|
415
524
|
else {
|
|
416
|
-
|
|
525
|
+
const
|
|
526
|
+
_msg =
|
|
527
|
+
"Function 'transaction-get' returned undefined value.";
|
|
528
|
+
const
|
|
529
|
+
_exception = {
|
|
530
|
+
"msg":
|
|
531
|
+
_msg
|
|
532
|
+
};
|
|
533
|
+
throw _exception;
|
|
417
534
|
}
|
|
418
|
-
} catch (
|
|
535
|
+
} catch (
|
|
536
|
+
_error) {
|
|
419
537
|
_msg_error(
|
|
420
|
-
|
|
538
|
+
_error,
|
|
421
539
|
1);
|
|
422
540
|
}
|
|
423
541
|
}
|
|
424
542
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
543
|
+
if ( await _cmdline_check(
|
|
544
|
+
"transaction-get") ||
|
|
545
|
+
await _cmdline_check(
|
|
546
|
+
"transaction-info") ) {
|
|
547
|
+
_globals;
|
|
428
548
|
_global_variables();
|
|
429
549
|
_cmdline_parse();
|
|
430
550
|
_overrides_set();
|
|
@@ -444,7 +564,11 @@ if ( _cmdline_check(
|
|
|
444
564
|
app_opts);
|
|
445
565
|
}
|
|
446
566
|
|
|
447
|
-
|
|
448
|
-
_transaction_get
|
|
449
|
-
_transaction_get
|
|
567
|
+
export {
|
|
568
|
+
_transaction_get
|
|
450
569
|
};
|
|
570
|
+
|
|
571
|
+
// module.exports = {
|
|
572
|
+
// _transaction_get:
|
|
573
|
+
// _transaction_get
|
|
574
|
+
// };
|