libevm 0.0.22 → 0.0.25

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.
Files changed (3) hide show
  1. package/dist/libevm +1 -1
  2. package/libevm +85 -4
  3. package/package.json +6 -2
package/libevm CHANGED
@@ -39,6 +39,12 @@ const
39
39
  no-global-assign */
40
40
  _homedir_get =
41
41
  _libcrash._homedir_get;
42
+ /* global
43
+ _msg_error */
44
+ /* eslint-disable-next-line
45
+ no-global-assign */
46
+ _msg_error =
47
+ _libcrash._msg_error;
42
48
  /* global
43
49
  _msg_info */
44
50
  /* eslint-disable-next-line
@@ -73,6 +79,12 @@ _rpc_backend_get =
73
79
  no-global-assign */
74
80
  _evm_chain_info_get =
75
81
  _evm_chains_info_module._evm_chain_info_get;
82
+ /* global
83
+ _evm_chains_info */
84
+ /* eslint-disable-next-line
85
+ no-global-assign */
86
+ _evm_chains_info =
87
+ _evm_chains_info_module._evm_chains_info;
76
88
  const
77
89
  _evm_wallet_module =
78
90
  require(
@@ -442,14 +454,14 @@ function
442
454
  "call-timeout"];
443
455
  }
444
456
  if ( "n" in _argv ) {
445
- target_networks =
457
+ target_networks.push(
446
458
  _argv[
447
- "n"];
459
+ "n"]);
448
460
  }
449
461
  if ( "network" in _argv ) {
450
- target_networks =
462
+ target_networks.push(
451
463
  _argv[
452
- "network"];
464
+ "network"]);
453
465
  }
454
466
  }
455
467
 
@@ -629,6 +641,73 @@ async function
629
641
  return true;
630
642
  }
631
643
 
644
+ function
645
+ _rpc_get(
646
+ _target_networks) {
647
+ let
648
+ _evm_chains_info_args,
649
+ _info_retrieve,
650
+ _msg,
651
+ _network,
652
+ _network_type;
653
+ const
654
+ _rpc =
655
+ {};
656
+ for ( _network of _target_networks ) {
657
+ _network_type =
658
+ typeof(
659
+ _network);
660
+ if ( _network_type == "string" ) {
661
+ if ( _network.startsWith(
662
+ "https://") ) {
663
+ _rpc[
664
+ _network] =
665
+ _network;
666
+ _info_retrieve =
667
+ "n";
668
+ }
669
+ else {
670
+ _info_retrieve =
671
+ "y";
672
+ }
673
+ }
674
+ else if ( _network_type == "number" ) {
675
+ _info_retrieve =
676
+ "y";
677
+ }
678
+ else {
679
+ _msg =
680
+ `Unknown type '${_network_type}' ` +
681
+ `for network variable.`;
682
+ _msg_error(
683
+ _msg,
684
+ 1);
685
+ }
686
+ if ( _info_retrieve == "y" ) {
687
+ _evm_chains_info_args = [
688
+ "get", // command
689
+ "id", // input type
690
+ "rpc", // output type
691
+ "offline", // retrieval method
692
+ [ "node", // db types
693
+ "system" ],
694
+ "kirsh", // selection method
695
+ "n", // api key
696
+ "n", // all networks
697
+ _network,
698
+ [] // db paths
699
+ ];
700
+ _rpc[
701
+ _network] =
702
+ _evm_chains_info.apply(
703
+ null,
704
+ _evm_chains_info_args)[
705
+ 0];
706
+ }
707
+ }
708
+ return _rpc;
709
+ }
710
+
632
711
  module.exports = {
633
712
  _contract_abi_get:
634
713
  _contract_abi_get,
@@ -652,6 +731,8 @@ module.exports = {
652
731
  _libevm_url_parse,
653
732
  _rpc_backend_get:
654
733
  _rpc_backend_get,
734
+ _rpc_get:
735
+ _rpc_get,
655
736
  _wallet_overrides_set:
656
737
  _wallet_overrides_set
657
738
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name":
3
3
  "libevm",
4
4
  "version":
5
- "0.0.22",
5
+ "0.0.25",
6
6
  "description":
7
7
  "Library providing useful functions to write native applications interacting with EVM-compatible blockchain networks.",
8
8
  "funding": {
@@ -76,12 +76,16 @@
76
76
  "crash-js":
77
77
  "^0.1.107",
78
78
  "evm-chains-info":
79
- "^0.0.21",
79
+ "^0.0.22",
80
80
  "evm-wallet.js":
81
81
  "^0.0.43",
82
82
  "yargs":
83
83
  "18.0.0"
84
84
  },
85
+ "override": {
86
+ "evm-chains-info":
87
+ "^0.0.22"
88
+ },
85
89
  "type":
86
90
  "commonjs",
87
91
  "main":