libevm 0.0.15 → 0.0.20
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/libevm +2 -0
- package/libevm +186 -25
- package/package.json +8 -9
- package/fs-worker.js +0 -1
- package/libevm.js +0 -2
package/libevm
CHANGED
|
@@ -33,11 +33,17 @@ const
|
|
|
33
33
|
_libcrash =
|
|
34
34
|
require(
|
|
35
35
|
'crash-js');
|
|
36
|
+
/* global
|
|
37
|
+
_homedir_get */
|
|
38
|
+
/* eslint-disable-next-line
|
|
39
|
+
no-global-assign */
|
|
40
|
+
_homedir_get =
|
|
41
|
+
_libcrash._homedir_get;
|
|
36
42
|
/* global
|
|
37
43
|
_msg_info */
|
|
38
44
|
/* eslint-disable-next-line
|
|
39
45
|
no-global-assign */
|
|
40
|
-
|
|
46
|
+
_msg_info =
|
|
41
47
|
_libcrash._msg_info;
|
|
42
48
|
/* global
|
|
43
49
|
_path_join */
|
|
@@ -228,12 +234,148 @@ function
|
|
|
228
234
|
}
|
|
229
235
|
|
|
230
236
|
function
|
|
231
|
-
_wallet_path_get(
|
|
237
|
+
_wallet_path_get(
|
|
238
|
+
_wallet_app,
|
|
239
|
+
_wallet_name,
|
|
240
|
+
_qr_support) {
|
|
241
|
+
let
|
|
242
|
+
_wallet_dir;
|
|
243
|
+
if ( typeof(
|
|
244
|
+
_wallet_app) == "undefined" ||
|
|
245
|
+
_wallet_app == "" ) {
|
|
246
|
+
_wallet_app =
|
|
247
|
+
"evm-wallet";
|
|
248
|
+
}
|
|
249
|
+
if ( typeof(
|
|
250
|
+
_wallet_name) == "undefined" ||
|
|
251
|
+
_wallet_name == "" ) {
|
|
252
|
+
_wallet_name =
|
|
253
|
+
"default";
|
|
232
254
|
}
|
|
255
|
+
if ( typeof(
|
|
256
|
+
_qr_support) == "undefined" ||
|
|
257
|
+
_qr_support == "" ) {
|
|
258
|
+
_qr_support =
|
|
259
|
+
"n";
|
|
260
|
+
}
|
|
261
|
+
const
|
|
262
|
+
_home =
|
|
263
|
+
_homedir_get();
|
|
264
|
+
_wallet_dir =
|
|
265
|
+
_path_join( [
|
|
266
|
+
_home,
|
|
267
|
+
".config",
|
|
268
|
+
_wallet_app ]);
|
|
269
|
+
if ( _qr_support == "y" ) {
|
|
270
|
+
_wallet_dir =
|
|
271
|
+
_path_join( [
|
|
272
|
+
_wallet_dir,
|
|
273
|
+
"qr" ]);
|
|
274
|
+
}
|
|
275
|
+
const
|
|
276
|
+
_path =
|
|
277
|
+
_path_join( [
|
|
278
|
+
_wallet_dir,
|
|
279
|
+
`${_wallet_name}.dat` ]);
|
|
280
|
+
return _path;
|
|
281
|
+
}
|
|
233
282
|
|
|
234
283
|
function
|
|
235
|
-
|
|
236
|
-
|
|
284
|
+
_secret_path_get(
|
|
285
|
+
_secret,
|
|
286
|
+
_app,
|
|
287
|
+
_wallet_name,
|
|
288
|
+
_qr_support){
|
|
289
|
+
let
|
|
290
|
+
_config_dir;
|
|
291
|
+
if ( typeof(
|
|
292
|
+
_secret) == "undefined" ||
|
|
293
|
+
_secret == "" ) {
|
|
294
|
+
_secret =
|
|
295
|
+
"seed";
|
|
296
|
+
}
|
|
297
|
+
if ( typeof(
|
|
298
|
+
_app) == "undefined" ||
|
|
299
|
+
_app == "" ) {
|
|
300
|
+
_app =
|
|
301
|
+
"evm-wallet";
|
|
302
|
+
}
|
|
303
|
+
if ( typeof(
|
|
304
|
+
_wallet_name) == "undefined" ||
|
|
305
|
+
_wallet_name == "" ) {
|
|
306
|
+
_wallet_name =
|
|
307
|
+
"default";
|
|
308
|
+
}
|
|
309
|
+
if ( typeof(
|
|
310
|
+
_qr_support) == "undefined" ||
|
|
311
|
+
_qr_support == "" ) {
|
|
312
|
+
_qr_support =
|
|
313
|
+
"n";
|
|
314
|
+
}
|
|
315
|
+
_config_dir =
|
|
316
|
+
_path_join( [
|
|
317
|
+
_homedir_get(),
|
|
318
|
+
".config",
|
|
319
|
+
_app ]);
|
|
320
|
+
if ( _qr_support == "y" ) {
|
|
321
|
+
_config_dir =
|
|
322
|
+
_path_join( [
|
|
323
|
+
_config_dir,
|
|
324
|
+
"qr" ]);
|
|
325
|
+
}
|
|
326
|
+
const
|
|
327
|
+
_secret_path =
|
|
328
|
+
_path_join( [
|
|
329
|
+
_config_dir,
|
|
330
|
+
`${_wallet_name}-${_secret}.txt` ]);
|
|
331
|
+
return _secret_path;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function
|
|
335
|
+
_secret_get(
|
|
336
|
+
_secret,
|
|
337
|
+
_secret_type,
|
|
338
|
+
_wallet_app,
|
|
339
|
+
_wallet_name,
|
|
340
|
+
_qr_support) {
|
|
341
|
+
if ( typeof(
|
|
342
|
+
_secret) == "undefined" ||
|
|
343
|
+
_secret == "" ) {
|
|
344
|
+
_secret =
|
|
345
|
+
"seed";
|
|
346
|
+
}
|
|
347
|
+
if ( typeof(
|
|
348
|
+
_secret) == "undefined" ||
|
|
349
|
+
_secret == "" ) {
|
|
350
|
+
_secret_type =
|
|
351
|
+
"seed";
|
|
352
|
+
}
|
|
353
|
+
if ( typeof(
|
|
354
|
+
_wallet_app) == "undefined" ||
|
|
355
|
+
_wallet_app == "" ) {
|
|
356
|
+
_wallet_app =
|
|
357
|
+
"evm-wallet";
|
|
358
|
+
}
|
|
359
|
+
if ( typeof(
|
|
360
|
+
_wallet_name) == "undefined" ||
|
|
361
|
+
_wallet_name == "" ) {
|
|
362
|
+
_wallet_name =
|
|
363
|
+
"default";
|
|
364
|
+
}
|
|
365
|
+
if ( typeof(
|
|
366
|
+
_qr_support) == "undefined" ||
|
|
367
|
+
_qr_support == "" ) {
|
|
368
|
+
_qr_support =
|
|
369
|
+
"n";
|
|
370
|
+
}
|
|
371
|
+
const
|
|
372
|
+
_secret_path =
|
|
373
|
+
_secret_path_get(
|
|
374
|
+
_secret,
|
|
375
|
+
_wallet_app,
|
|
376
|
+
_wallet_name,
|
|
377
|
+
_qr_support);
|
|
378
|
+
return _secret_path;
|
|
237
379
|
}
|
|
238
380
|
|
|
239
381
|
function
|
|
@@ -364,14 +506,14 @@ function
|
|
|
364
506
|
0];
|
|
365
507
|
}
|
|
366
508
|
|
|
367
|
-
|
|
368
|
-
function
|
|
509
|
+
async function
|
|
369
510
|
_wallet_overrides_set(
|
|
370
511
|
_wallet_app,
|
|
371
512
|
_wallet_name,
|
|
372
513
|
_call_auth,
|
|
373
514
|
_qr_support) {
|
|
374
515
|
let
|
|
516
|
+
_msg,
|
|
375
517
|
_wallet_address,
|
|
376
518
|
_wallet_seed,
|
|
377
519
|
_wallet_password,
|
|
@@ -406,26 +548,38 @@ function
|
|
|
406
548
|
}
|
|
407
549
|
_wallet_address =
|
|
408
550
|
"";
|
|
551
|
+
_msg =
|
|
552
|
+
"Getting default wallets credentials paths for " +
|
|
553
|
+
`app '${_wallet_app}' and wallet '${_wallet_name}'.`;
|
|
554
|
+
_msg_info(
|
|
555
|
+
_msg);
|
|
409
556
|
if ( _call_auth == "y" ) {
|
|
410
557
|
// undefined
|
|
411
558
|
_wallet_path =
|
|
412
|
-
_wallet_path_get(
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
559
|
+
_wallet_path_get(
|
|
560
|
+
_wallet_app,
|
|
561
|
+
_wallet_name,
|
|
562
|
+
_qr_support);
|
|
563
|
+
_wallet_seed =
|
|
564
|
+
_secret_get(
|
|
565
|
+
"seed",
|
|
566
|
+
"seed",
|
|
567
|
+
_wallet_app,
|
|
568
|
+
_wallet_name,
|
|
569
|
+
_qr_support);
|
|
570
|
+
_msg =
|
|
571
|
+
`Wallet seed: '${_wallet_seed}'`;
|
|
572
|
+
_msg_info(
|
|
573
|
+
_msg);
|
|
574
|
+
_wallet_password =
|
|
575
|
+
_secret_get(
|
|
576
|
+
"password",
|
|
577
|
+
"plain",
|
|
578
|
+
_wallet_app,
|
|
579
|
+
_wallet_name,
|
|
580
|
+
_qr_support);
|
|
427
581
|
_wallet_address =
|
|
428
|
-
_address_get(
|
|
582
|
+
await _address_get(
|
|
429
583
|
_wallet_seed,
|
|
430
584
|
"", // _target_network,
|
|
431
585
|
"", // _api_key,
|
|
@@ -434,9 +588,8 @@ function
|
|
|
434
588
|
"", // _output_file
|
|
435
589
|
);
|
|
436
590
|
// to be turned into _msg_debug
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
`Wallet address: '${_wallet_address}'`;
|
|
591
|
+
_msg =
|
|
592
|
+
`Wallet address: '${_wallet_address}'`;
|
|
440
593
|
_msg_info(
|
|
441
594
|
_msg);
|
|
442
595
|
}
|
|
@@ -470,6 +623,14 @@ function
|
|
|
470
623
|
wallet_address =
|
|
471
624
|
_wallet_address;
|
|
472
625
|
}
|
|
626
|
+
if ( typeof(
|
|
627
|
+
wallet_seed) == "undefined" ||
|
|
628
|
+
wallet_seed == "" ||
|
|
629
|
+
wallet_seed == [] ) {
|
|
630
|
+
wallet_seed =
|
|
631
|
+
_wallet_seed;
|
|
632
|
+
}
|
|
633
|
+
return true;
|
|
473
634
|
}
|
|
474
635
|
|
|
475
636
|
module.exports = {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name":
|
|
3
3
|
"libevm",
|
|
4
4
|
"version":
|
|
5
|
-
"0.0.
|
|
5
|
+
"0.0.20",
|
|
6
6
|
"description":
|
|
7
7
|
"Library providing useful functions to write native applications interacting with EVM-compatible blockchain networks.",
|
|
8
8
|
"funding": {
|
|
@@ -18,9 +18,8 @@
|
|
|
18
18
|
"AUTHORS.rst",
|
|
19
19
|
"COPYING",
|
|
20
20
|
"README.md",
|
|
21
|
+
"dist",
|
|
21
22
|
"libevm",
|
|
22
|
-
"libevm.js",
|
|
23
|
-
"fs-worker.js",
|
|
24
23
|
"fs-worker.webpack.config.js",
|
|
25
24
|
"index.html",
|
|
26
25
|
"package.json",
|
|
@@ -75,11 +74,11 @@
|
|
|
75
74
|
},
|
|
76
75
|
"dependencies": {
|
|
77
76
|
"crash-js":
|
|
78
|
-
"^0.1.
|
|
77
|
+
"^0.1.107",
|
|
79
78
|
"evm-chains-info":
|
|
80
|
-
"^0.0.
|
|
79
|
+
"^0.0.21",
|
|
81
80
|
"evm-wallet.js":
|
|
82
|
-
"^0.0.
|
|
81
|
+
"^0.0.38",
|
|
83
82
|
"yargs":
|
|
84
83
|
"18.0.0"
|
|
85
84
|
},
|
|
@@ -89,9 +88,9 @@
|
|
|
89
88
|
"libevm",
|
|
90
89
|
"scripts": {
|
|
91
90
|
"build-fs-worker":
|
|
92
|
-
"npx webpack --mode 'production' --config 'fs-worker.webpack.config.cjs' --stats-error-details",
|
|
91
|
+
"npx webpack --mode 'production' --config 'fs-worker.webpack.config.cjs' --stats-error-details && mkdir -p 'dist' && cp 'fs-worker.js' 'dist/libevm'",
|
|
93
92
|
"build-lib":
|
|
94
|
-
"npx webpack --mode 'production' --config 'webpack.config.cjs' --stats-error-details",
|
|
93
|
+
"npx webpack --mode 'production' --config 'webpack.config.cjs' --stats-error-details && mv 'libevm.js' 'dist/libevm'",
|
|
95
94
|
"build":
|
|
96
95
|
"npm run lint && npm run build-fs-worker && npm run build-lib",
|
|
97
96
|
"lint":
|
|
@@ -99,7 +98,7 @@
|
|
|
99
98
|
"publish-pnm":
|
|
100
99
|
"npm run build && npm publish --access public",
|
|
101
100
|
"start":
|
|
102
|
-
"npx safely-serve
|
|
101
|
+
"npx safely-serve 'dist/libevm' --port 3000 --https --no-cache",
|
|
103
102
|
"test":
|
|
104
103
|
"echo \"Error: no test specified\" && exit 1"
|
|
105
104
|
}
|
package/fs-worker.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(()=>{var e={816(e,o,n){function t(){let e;return"undefined"==typeof window&&void 0!==n.g&&n.g.global===n.g&&"function"!=typeof n||(e=function(){let e;try{e=n(816)}catch(e){console.log(e);const o="Error importing the '@themartiancompany/opfs' module as 'opfs'. If you got this error while bundling a webpack for a project depending on this module double check its 'webpack.config.js' file or whether the 'opfs' module is listed in developer dependencies and install them.I'm sorry for this inconvenience but Node packagement system does not currently distinguish 'development' from 'build' dependencies.";throw console.error(o),e}return e}()),e}const r=t();e.exports=r,e.exports.getModule=function(e){let o;if(""==_module_name||"undefined"==typeof _module_name)o=t();else if("opfs"==_module_name)o=n(816);else{if("fs"!=_module_name){const e="Unknown file system module "+`'${_module_name}'.`.const;throw _error={msg:e},console.error(e),_error}o=n(816)}return o}},314(e,o,n){const t=n(816);_sync_agent=t.startSyncAgent,e.exports={_sync_agent},_sync_agent()}},o={};function n(t){var r=o[t];if(void 0!==r)return r.exports;var s=o[t]={exports:{}};return e[t](s,s.exports,n),s.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n(314)})();
|