1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +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, type: TRANSACTION_TYPE_CANCEL,
}) })
if (originalTxMeta.transactionCategory === SWAP) {
newTxMeta.sourceTokenSymbol = originalTxMeta.sourceTokenSymbol
newTxMeta.destinationTokenSymbol = originalTxMeta.destinationTokenSymbol
}
this.addTx(newTxMeta) this.addTx(newTxMeta)
await this.approveTransaction(newTxMeta.id) await this.approveTransaction(newTxMeta.id)
return newTxMeta return newTxMeta

View File

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

View File

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

View File

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