From 61f29327be0f15b87732d41ee01d47761ee6f637 Mon Sep 17 00:00:00 2001 From: Joaquin Battilana Date: Thu, 19 Oct 2023 01:14:08 +0100 Subject: [PATCH 1/2] feat: added chainId to actions --- src/components/TransactionEventHandler.tsx | 5 ++++- src/components/transactions/Switch/SwitchActions.tsx | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) 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..3cd304228b 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({ From 9f8d52f14bba4af72ffa0c3519cd3aaca2aa482b Mon Sep 17 00:00:00 2001 From: Joaquin Battilana Date: Thu, 19 Oct 2023 01:17:17 +0100 Subject: [PATCH 2/2] feat: added chainId to failed txs --- .../transactions/Switch/SwitchActions.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/transactions/Switch/SwitchActions.tsx b/src/components/transactions/Switch/SwitchActions.tsx index 3cd304228b..652761042b 100644 --- a/src/components/transactions/Switch/SwitchActions.tsx +++ b/src/components/transactions/Switch/SwitchActions.tsx @@ -157,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);