From 9e865970ed010208980bbc7850ae41cc8e5681df Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Wed, 28 Sep 2022 09:08:22 -0230 Subject: [PATCH] Simplfy _buildEventFragmentProperties so that necessary objects and data are defined when it is called during onBootCleanup (#16001) --- app/scripts/controllers/transactions/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 54f372fc9..c6cf3a061 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -2117,7 +2117,6 @@ export default class TransactionController extends EventEmitter { async _buildEventFragmentProperties(txMeta, extraParams) { const { - id, type, time, status, @@ -2135,8 +2134,14 @@ export default class TransactionController extends EventEmitter { originalType, replacedById, metamaskNetworkId: network, + customTokenAmount, + dappProposedTokenAmount, + currentTokenBalance, + originalApprovalAmount, + finalApprovalAmount, + contractMethodName, } = txMeta; - const { transactions } = this.store.getState(); + const source = referrer === ORIGIN_METAMASK ? 'user' : 'dapp'; const { assetType, tokenStandard } = await determineTransactionAssetType( @@ -2228,11 +2233,6 @@ export default class TransactionController extends EventEmitter { APPROVE: 'Approve', }; - const customTokenAmount = transactions[id]?.customTokenAmount; - const dappProposedTokenAmount = transactions[id]?.dappProposedTokenAmount; - const currentTokenBalance = transactions[id]?.currentTokenBalance; - const originalApprovalAmount = transactions[id]?.originalApprovalAmount; - const finalApprovalAmount = transactions[id]?.finalApprovalAmount; let transactionApprovalAmountType; let transactionContractMethod; let transactionApprovalAmountVsProposedRatio; @@ -2246,7 +2246,7 @@ export default class TransactionController extends EventEmitter { transactionType = TRANSACTION_TYPES.DEPLOY_CONTRACT; } else if (contractInteractionTypes) { transactionType = TRANSACTION_TYPES.CONTRACT_INTERACTION; - transactionContractMethod = transactions[id]?.contractMethodName; + transactionContractMethod = contractMethodName; if ( transactionContractMethod === contractMethodNames.APPROVE && tokenStandard === TOKEN_STANDARDS.ERC20