1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Use initial transaction for settings swap transaction title params (#9543)

* Use initial transaction for settings swap transaction title params, and remove addition of swap properties to cancel transcations

* Update unit test data

* Use token symbol properties from initial transaction for filitering in transaction list
This commit is contained in:
Dan J Miller 2020-10-10 17:20:20 -02:30 committed by GitHub
parent d67a446131
commit 6409caa081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 10 deletions

View File

@ -366,11 +366,6 @@ export default class TransactionController extends EventEmitter {
type: TRANSACTION_TYPE_CANCEL,
})
if (originalTxMeta.transactionCategory === SWAP) {
newTxMeta.sourceTokenSymbol = originalTxMeta.sourceTokenSymbol
newTxMeta.destinationTokenSymbol = originalTxMeta.destinationTokenSymbol
}
this.addTx(newTxMeta)
await this.approveTransaction(newTxMeta.id)
return newTxMeta

View File

@ -512,6 +512,8 @@
"value": "0xde0b6b3a7640000"
},
"hash": "0xbcb195f393f4468945b4045cd41bcdbc2f19ad75ae92a32cf153a3004e42009a",
"destinationTokenSymbol": "ABC",
"sourceTokenSymbol": "ETH",
"transactionCategory": "swap"
},
"primaryTransaction": {

View File

@ -29,8 +29,6 @@ const getTransactionGroupRecipientAddressFilter = (recipientAddress) => {
const tokenTransactionFilter = ({
initialTransaction: {
transactionCategory,
},
primaryTransaction: {
destinationTokenSymbol,
sourceTokenSymbol,
},

View File

@ -133,14 +133,14 @@ export function useTransactionDisplayData (transactionGroup) {
} else if (transactionCategory === SWAP) {
category = TRANSACTION_CATEGORY_SWAP
title = t('swapTokenToToken', [
primaryTransaction.sourceTokenSymbol,
primaryTransaction.destinationTokenSymbol,
initialTransaction.sourceTokenSymbol,
initialTransaction.destinationTokenSymbol,
])
subtitle = origin
subtitleContainsOrigin = true
primarySuffix = isViewingReceivedTokenFromSwap
? currentAsset.symbol
: primaryTransaction.sourceTokenSymbol
: initialTransaction.sourceTokenSymbol
primaryDisplayValue = swapTokenValue
secondaryDisplayValue = swapTokenFiatAmount
prefix = isViewingReceivedTokenFromSwap ? '+' : '-'