@toruslabs/ethereum-controllers 5.3.7 → 5.3.9

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.
@@ -1573,7 +1573,7 @@ const formatPastTx = (x, lowerCaseSelectedAddress) => {
1573
1573
  var _x$to;
1574
1574
  let totalAmountString = "";
1575
1575
  if (x.type === CONTRACT_TYPE_ERC721 || x.type === CONTRACT_TYPE_ERC1155) totalAmountString = x.symbol;else if (x.type === CONTRACT_TYPE_ERC20) totalAmountString = (0,base_controllers_namespaceObject.formatSmallNumbers)(Number.parseFloat(x.total_amount), x.symbol, true);else totalAmountString = (0,base_controllers_namespaceObject.formatSmallNumbers)(Number.parseFloat(x.total_amount), x.type_name, true);
1576
- const currencyAmountString = x.type === CONTRACT_TYPE_ERC721 || x.type === CONTRACT_TYPE_ERC1155 ? "" : (0,base_controllers_namespaceObject.formatSmallNumbers)(Number.parseFloat(x.currency_amount), x.selected_currency, true);
1576
+ const currencyAmountString = x.type === CONTRACT_TYPE_ERC721 || x.type === CONTRACT_TYPE_ERC1155 || x.isEtherscan ? "" : (0,base_controllers_namespaceObject.formatSmallNumbers)(Number.parseFloat(x.currency_amount), x.selected_currency, true);
1577
1577
  const finalObject = {
1578
1578
  id: x.created_at.toString(),
1579
1579
  date: new Date(x.created_at).toString(),
@@ -1598,7 +1598,6 @@ const formatPastTx = (x, lowerCaseSelectedAddress) => {
1598
1598
  type_image_link: x.type_image_link,
1599
1599
  transaction_hash: x.transaction_hash,
1600
1600
  transaction_category: x.transaction_category,
1601
- // TODO: // figure out how to handle these values.
1602
1601
  isEtherscan: x.isEtherscan,
1603
1602
  input: x.input || "",
1604
1603
  token_id: x.token_id || "",
@@ -1719,7 +1718,7 @@ const addEtherscanTransactions = async (txn, lowerCaseSelectedAddress, provider,
1719
1718
  }));
1720
1719
  const finalTxs = transactionPromises.reduce((accumulator, x) => {
1721
1720
  var _SUPPORTED_NETWORKS$c3, _SUPPORTED_NETWORKS$c4;
1722
- const totalAmount = x.value ? (0,external_ethers_namespaceObject.formatEther)(x.value) : "";
1721
+ const totalAmountString = x.value ? (0,external_ethers_namespaceObject.formatEther)(x.value) : "";
1723
1722
  const etherscanTransaction = {
1724
1723
  etherscanLink: getEtherScanHashLink(x.hash, chainId),
1725
1724
  type: x.type || ((_SUPPORTED_NETWORKS$c3 = SUPPORTED_NETWORKS[chainId]) === null || _SUPPORTED_NETWORKS$c3 === void 0 ? void 0 : _SUPPORTED_NETWORKS$c3.ticker) || CONTRACT_TYPE_ETH,
@@ -1727,12 +1726,12 @@ const addEtherscanTransactions = async (txn, lowerCaseSelectedAddress, provider,
1727
1726
  type_name: x.type_name || "n/a",
1728
1727
  symbol: (_SUPPORTED_NETWORKS$c4 = SUPPORTED_NETWORKS[chainId]) === null || _SUPPORTED_NETWORKS$c4 === void 0 ? void 0 : _SUPPORTED_NETWORKS$c4.ticker,
1729
1728
  token_id: x.tokenID || "",
1730
- total_amount: totalAmount,
1729
+ total_amount: totalAmountString,
1731
1730
  created_at: new Date(Number(x.timeStamp) * 1000),
1732
1731
  from: x.from,
1733
1732
  to: x.to,
1734
1733
  transaction_hash: x.hash,
1735
- status: x.txreceipt_status && x.txreceipt_status === "0" ? base_controllers_namespaceObject.TransactionStatus.failed : base_controllers_namespaceObject.TransactionStatus.approved,
1734
+ status: x.txreceipt_status && x.txreceipt_status === "0" ? base_controllers_namespaceObject.TransactionStatus.failed : base_controllers_namespaceObject.TransactionStatus.confirmed,
1736
1735
  isEtherscan: true,
1737
1736
  input: x.input,
1738
1737
  contract_address: x.contractAddress,
@@ -4688,6 +4687,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4688
4687
  chainId: this.getProviderConfig().chainId
4689
4688
  });
4690
4689
  const finalEthScanTxn = await addEtherscanTransactions(etherscanTxn, selectedAddress, this.provider, chainId);
4690
+ external_loglevel_default().info("Formatted Etherscan Response", finalEthScanTxn);
4691
4691
  this.updateState({
4692
4692
  etherscanTransactions: finalEthScanTxn
4693
4693
  });
@@ -4700,7 +4700,7 @@ class PreferencesController extends base_controllers_namespaceObject.BasePrefere
4700
4700
  const url = new URL(`${this.config.api}/etherscan`);
4701
4701
  url.searchParams.append("chainId", parameters.chainId);
4702
4702
  const response = await (0,http_helpers_namespaceObject.get)(url.href, this.headers(parameters.selectedAddress));
4703
- external_loglevel_default().info("Etherscan Response", response);
4703
+ external_loglevel_default().info("Etherscan Response API", response);
4704
4704
  return response.success ? response.data : [];
4705
4705
  } catch (error) {
4706
4706
  external_loglevel_default().error("unable to fetch etherscan tx", error);