@toruslabs/ethereum-controllers 4.1.0 → 4.2.0

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.
@@ -792,7 +792,7 @@ const SUPPORTED_NETWORKS = {
792
792
  rpcTarget: `https://goerli.infura.io/v3/${process.env.VITE_APP_INFURA_PROJECT_KEY}`,
793
793
  ticker: "ETH",
794
794
  tickerName: "Ethereum",
795
- isTestNet: true
795
+ isTestnet: true
796
796
  },
797
797
  [SEPOLIA_CHAIN_ID]: {
798
798
  blockExplorerUrl: "https://sepolia.etherscan.io",
@@ -802,7 +802,7 @@ const SUPPORTED_NETWORKS = {
802
802
  rpcTarget: `https://sepolia.infura.io/v3/${process.env.VITE_APP_INFURA_PROJECT_KEY}`,
803
803
  ticker: "ETH",
804
804
  tickerName: "Ethereum",
805
- isTestNet: true
805
+ isTestnet: true
806
806
  },
807
807
  [POLYGON_MUMBAI_CHAIN_ID]: {
808
808
  blockExplorerUrl: "https://mumbai.polygonscan.com",
@@ -812,7 +812,7 @@ const SUPPORTED_NETWORKS = {
812
812
  rpcTarget: `https://polygon-mumbai.infura.io/v3/${process.env.VITE_APP_INFURA_PROJECT_KEY}`,
813
813
  ticker: "MATIC",
814
814
  tickerName: "Matic Network Token",
815
- isTestNet: true
815
+ isTestnet: true
816
816
  },
817
817
  [BSC_TESTNET_CHAIN_ID]: {
818
818
  blockExplorerUrl: "https://testnet.bscscan.com",
@@ -822,7 +822,7 @@ const SUPPORTED_NETWORKS = {
822
822
  rpcTarget: `https://data-seed-prebsc-1-s1.binance.org:8545`,
823
823
  ticker: "BNB",
824
824
  tickerName: "Binance Coin",
825
- isTestNet: true
825
+ isTestnet: true
826
826
  },
827
827
  [AVALANCHE_TESTNET_CHAIN_ID]: {
828
828
  blockExplorerUrl: "https://testnet.snowtrace.io",
@@ -832,7 +832,7 @@ const SUPPORTED_NETWORKS = {
832
832
  rpcTarget: `https://api.avax-test.network/ext/bc/C/rpc`,
833
833
  ticker: "AVAX",
834
834
  tickerName: "Avalanche",
835
- isTestNet: true
835
+ isTestnet: true
836
836
  },
837
837
  [ARBITRUM_TESTNET_CHAIN_ID]: {
838
838
  blockExplorerUrl: "https://testnet.arbiscan.io",
@@ -842,7 +842,7 @@ const SUPPORTED_NETWORKS = {
842
842
  rpcTarget: `https://arbitrum-rinkeby.infura.io/v3/${process.env.VITE_APP_INFURA_PROJECT_KEY}`,
843
843
  ticker: "ETH",
844
844
  tickerName: "Ethereum",
845
- isTestNet: true
845
+ isTestnet: true
846
846
  },
847
847
  [OPTIMISM_TESTNET_CHAIN_ID]: {
848
848
  blockExplorerUrl: "https://goerli-optimism.etherscan.io",
@@ -852,7 +852,7 @@ const SUPPORTED_NETWORKS = {
852
852
  rpcTarget: `https://optimism-goerli.infura.io/v3/${process.env.VITE_APP_INFURA_PROJECT_KEY}`,
853
853
  ticker: "ETH",
854
854
  tickerName: "Ethereum",
855
- isTestNet: true
855
+ isTestnet: true
856
856
  }
857
857
  };
858
858
  const METHOD_TYPES = {
@@ -3729,9 +3729,13 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
3729
3729
  calledFromEmbed,
3730
3730
  userInfo,
3731
3731
  rehydrate,
3732
- locale = "en-US"
3732
+ locale = "en-US",
3733
+ type
3733
3734
  } = params;
3734
- await super.init(address, userInfo, jwtToken);
3735
+ await super.init(address, userInfo, jwtToken, {
3736
+ type,
3737
+ email: userInfo.email
3738
+ });
3735
3739
  const {
3736
3740
  aggregateVerifier,
3737
3741
  verifier,
@@ -3862,6 +3866,17 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
3862
3866
  // }
3863
3867
  }
3864
3868
  }
3869
+ async fetchEtherscanTx(parameters) {
3870
+ try {
3871
+ const url = new URL(`${this.config.api}/etherscan`);
3872
+ Object.keys(parameters).forEach(key => url.searchParams.append(key, parameters[key]));
3873
+ const response = await (0,http_helpers_namespaceObject.get)(url.href, this.headers(parameters.selectedAddress));
3874
+ return response.success ? response.data : [];
3875
+ } catch (error) {
3876
+ external_loglevel_default().error("unable to fetch etherscan tx", error);
3877
+ return [];
3878
+ }
3879
+ }
3865
3880
  async getEtherScanTokens(address, chainId) {
3866
3881
  const selectedAddress = address;
3867
3882
  const apiUrl = new URL(this.config.api);
@@ -3907,7 +3922,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
3907
3922
  chain_id: network.chainId,
3908
3923
  symbol: network.ticker,
3909
3924
  block_explorer_url: network.blockExplorerUrl || undefined,
3910
- is_test_net: network.isTestNet || false
3925
+ is_test_net: network.isTestnet || false
3911
3926
  };
3912
3927
  const res = await (0,http_helpers_namespaceObject.post)(apiUrl.href, payload, this.headers(selectedAddress), {
3913
3928
  useAPIKey: true
@@ -3953,7 +3968,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
3953
3968
  chain_id: network.chainId,
3954
3969
  symbol: network.ticker || undefined,
3955
3970
  block_explorer_url: network.blockExplorerUrl || undefined,
3956
- is_test_net: network.isTestNet || false
3971
+ is_test_net: network.isTestnet || false
3957
3972
  };
3958
3973
  await (0,http_helpers_namespaceObject.patch)(apiUrl.href, payload, this.headers(selectedAddress), {
3959
3974
  useAPIKey: true