From 0d925944ad39a3b0c997ccbc7d62f4615f383ad1 Mon Sep 17 00:00:00 2001 From: brave-builds <45370463+brave-builds@users.noreply.github.com> Date: Wed, 18 Dec 2024 08:45:01 +0100 Subject: [PATCH] fix(wallet): Post Confirmation Transfer Value (uplift to 1.74.x) (#27045) Uplift of #26939 (squashed) to beta --- .../common/transaction_intent.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/components/brave_wallet_ui/components/extension/post-confirmation/common/transaction_intent.tsx b/components/brave_wallet_ui/components/extension/post-confirmation/common/transaction_intent.tsx index 7bcb6610fc66..bb57ecea5521 100644 --- a/components/brave_wallet_ui/components/extension/post-confirmation/common/transaction_intent.tsx +++ b/components/brave_wallet_ui/components/extension/post-confirmation/common/transaction_intent.tsx @@ -59,7 +59,7 @@ interface Props { export const TransactionIntent = (props: Props) => { const { transaction } = props - // Computed + // Computed & Queries const isBridge = isBridgeTransaction(transaction) const isSwap = isSwapTransaction(transaction) const isSwapOrBridge = isBridge || isSwap @@ -72,8 +72,13 @@ export const TransactionIntent = (props: Props) => { const isSOLSwapOrBridge = txCoinType === BraveWallet.CoinType.SOL && isSwapOrBridge - // Queries const { account: txAccount } = useAccountQuery(transaction.fromAccountId) + const { data: combinedTokensList } = useGetCombinedTokensListQuery() + + const transactionsToken = findTransactionToken( + transaction, + combinedTokensList + ) // Custom Hooks const transactionNetwork = useTransactionsNetwork(transaction) @@ -82,6 +87,7 @@ export const TransactionIntent = (props: Props) => { const { normalizedTransferredValue } = getFormattedTransactionTransferredValue({ tx: transaction, + token: transactionsToken, txAccount, txNetwork: transactionNetwork }) @@ -108,8 +114,6 @@ export const TransactionIntent = (props: Props) => { const { buyToken, sellToken, buyAmountWei, sellAmountWei } = useSwapTransactionParser(transaction) - const { data: combinedTokensList } = useGetCombinedTokensListQuery() - const formattedSellAmount = sellToken ? sellAmountWei .divideByDecimals(sellToken.decimals) @@ -145,11 +149,6 @@ export const TransactionIntent = (props: Props) => { accountInfosRegistry ) - const transactionsToken = findTransactionToken( - transaction, - combinedTokensList - ) - const formattedSendAmount = React.useMemo(() => { if (!transactionsToken) { return ''