diff --git a/src/components/TransactionEventHandler.tsx b/src/components/TransactionEventHandler.tsx index 0650ab1c50..09b21deacb 100644 --- a/src/components/TransactionEventHandler.tsx +++ b/src/components/TransactionEventHandler.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react'; import { useRootStore } from 'src/store/root'; import { selectSuccessfulTransactions } from 'src/store/transactionsSelectors'; +import { getNetworkConfig } from 'src/utils/marketsAndNetworksConfig'; import { GENERAL } from 'src/utils/mixPanelEvents'; export const TransactionEventHandler = () => { @@ -14,10 +15,10 @@ export const TransactionEventHandler = () => { useEffect(() => { Object.keys(successfulTransactions).forEach((chainId) => { const chainIdNumber = +chainId; + const networkConfig = getNetworkConfig(chainIdNumber); Object.keys(successfulTransactions[chainIdNumber]).forEach((txHash) => { if (!postedTransactions[chainIdNumber]?.includes(txHash)) { const tx = successfulTransactions[chainIdNumber][txHash]; - // const event = actionToEvent(tx.action); trackEvent(GENERAL.TRANSACTION, { transactionType: tx.action, @@ -35,6 +36,8 @@ export const TransactionEventHandler = () => { outAssetName: tx.outAssetName, amountUsd: tx.amountUsd, outAmountUsd: tx.outAmountUsd, + chainId: chainIdNumber, + chainName: networkConfig.displayName || networkConfig.name, }); // update local state diff --git a/src/components/transactions/Switch/SwitchActions.tsx b/src/components/transactions/Switch/SwitchActions.tsx index 9b44df2fa4..652761042b 100644 --- a/src/components/transactions/Switch/SwitchActions.tsx +++ b/src/components/transactions/Switch/SwitchActions.tsx @@ -142,7 +142,6 @@ export const SwitchActions = ({ }, { chainId, - market: null, } ); setMainTxState({ @@ -158,10 +157,16 @@ export const SwitchActions = ({ txHash: response.hash, loading: false, }); - addTransaction(response.hash, { - txState: 'failed', - ...txData, - }); + addTransaction( + response.hash, + { + txState: 'failed', + ...txData, + }, + { + chainId, + } + ); } } catch (error) { const parsedError = getErrorTextFromError(error, TxAction.GAS_ESTIMATION, false);