diff --git a/ui/app/hooks/useSwappedTokenValue.js b/ui/app/hooks/useSwappedTokenValue.js index b7027d4af..8357d8749 100644 --- a/ui/app/hooks/useSwappedTokenValue.js +++ b/ui/app/hooks/useSwappedTokenValue.js @@ -44,6 +44,11 @@ export function useSwappedTokenValue (transactionGroup, currentAsset) { decimals, ) : transactionCategory === SWAP && primaryTransaction.swapTokenValue + + const isNegative = typeof swapTokenValue === 'string' + ? Math.sign(swapTokenValue) === -1 + : false + const _swapTokenFiatAmount = useTokenFiatAmount( address, swapTokenValue || '', @@ -52,5 +57,5 @@ export function useSwappedTokenValue (transactionGroup, currentAsset) { const swapTokenFiatAmount = ( swapTokenValue && isViewingReceivedTokenFromSwap && _swapTokenFiatAmount ) - return { swapTokenValue, swapTokenFiatAmount, isViewingReceivedTokenFromSwap } + return { swapTokenValue, swapTokenFiatAmount, isViewingReceivedTokenFromSwap, isNegative } } diff --git a/ui/app/hooks/useTransactionDisplayData.js b/ui/app/hooks/useTransactionDisplayData.js index de027d41e..c41fcaf99 100644 --- a/ui/app/hooks/useTransactionDisplayData.js +++ b/ui/app/hooks/useTransactionDisplayData.js @@ -115,7 +115,7 @@ export function useTransactionDisplayData (transactionGroup) { // The primary title of the Tx that will be displayed in the activity list let title - const { swapTokenValue, swapTokenFiatAmount, isViewingReceivedTokenFromSwap } = useSwappedTokenValue(transactionGroup, currentAsset) + const { swapTokenValue, isNegative, swapTokenFiatAmount, isViewingReceivedTokenFromSwap } = useSwappedTokenValue(transactionGroup, currentAsset) // There are seven types of transaction entries that are currently differentiated in the design // 1. Signature request @@ -145,8 +145,13 @@ export function useTransactionDisplayData (transactionGroup) { : initialTransaction.sourceTokenSymbol primaryDisplayValue = swapTokenValue secondaryDisplayValue = swapTokenFiatAmount - prefix = isViewingReceivedTokenFromSwap ? '+' : '-' - + if (isNegative) { + prefix = '' + } else if (isViewingReceivedTokenFromSwap) { + prefix = '+' + } else { + prefix = '-' + } } else if (transactionCategory === SWAP_APPROVAL) { category = TRANSACTION_CATEGORY_APPROVAL title = t('swapApproval', [primaryTransaction.sourceTokenSymbol])