@toruslabs/ethereum-controllers 5.2.13 → 5.2.15

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.
@@ -1007,8 +1007,8 @@ const formatPastTx = (x, lowerCaseSelectedAddress) => {
1007
1007
  currencyAmountString,
1008
1008
  amount: `${totalAmountString} / ${currencyAmountString}`,
1009
1009
  status: x.status,
1010
- etherscanLink: getEtherScanHashLink(x.transaction_hash, x.network || MAINNET_CHAIN_ID),
1011
- networkType: x.network,
1010
+ etherscanLink: getEtherScanHashLink(x.transaction_hash, x.chain_id || MAINNET_CHAIN_ID),
1011
+ chainId: x.chain_id,
1012
1012
  ethRate: Number.parseFloat(x === null || x === void 0 ? void 0 : x.total_amount) && Number.parseFloat(x === null || x === void 0 ? void 0 : x.currency_amount) ? `1 ${x.symbol} = ${significantDigits(Number.parseFloat(x.currency_amount) / Number.parseFloat(x.total_amount))}` : "",
1013
1013
  currencyUsed: x.selected_currency,
1014
1014
  type: x.type,
@@ -3729,7 +3729,7 @@ class PreferencesController extends BasePreferencesController {
3729
3729
  var _this$getAddressState2;
3730
3730
  const formattedTx = formatPastTx(tx);
3731
3731
  const storePastTx = (_this$getAddressState2 = this.getAddressState(address)) === null || _this$getAddressState2 === void 0 ? void 0 : _this$getAddressState2.formattedPastTransactions;
3732
- const duplicateIndex = storePastTx.findIndex(x => x.transaction_hash === tx.transaction_hash && x.networkType === tx.network);
3732
+ const duplicateIndex = storePastTx.findIndex(x => x.transaction_hash === tx.transaction_hash && x.chainId === tx.chain_id);
3733
3733
  if (tx.status === TransactionStatus.submitted || tx.status === TransactionStatus.confirmed) {
3734
3734
  if (duplicateIndex === -1) {
3735
3735
  // No duplicate found
@@ -3957,7 +3957,7 @@ class PreferencesController extends BasePreferencesController {
3957
3957
  const pendingTx = [];
3958
3958
  const lowerCaseSelectedAddress = address.toLowerCase();
3959
3959
  for (const x of txs) {
3960
- if (x.network === SUPPORTED_NETWORKS[this.getProviderConfig().chainId].chainId && x.to && x.from && (lowerCaseSelectedAddress === x.from.toLowerCase() || lowerCaseSelectedAddress === x.to.toLowerCase())) {
3960
+ if (x.chain_id === SUPPORTED_NETWORKS[this.getProviderConfig().chainId].chainId && x.to && x.from && (lowerCaseSelectedAddress === x.from.toLowerCase() || lowerCaseSelectedAddress === x.to.toLowerCase())) {
3961
3961
  if (x.status !== "confirmed") {
3962
3962
  pendingTx.push(x);
3963
3963
  } else {
@@ -3974,8 +3974,7 @@ class PreferencesController extends BasePreferencesController {
3974
3974
  pastTx.push(finalObject);
3975
3975
  if (lowerCaseSelectedAddress === element.from.toLowerCase() && finalObject.status && finalObject.status !== element.status) this.patchPastTx({
3976
3976
  id: element.id,
3977
- status: finalObject.status,
3978
- updated_at: new Date().toISOString()
3977
+ status: finalObject.status
3979
3978
  }, address);
3980
3979
  }
3981
3980
  const finalTx = this.cancelTxCalculate(pastTx);