1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 12:29:06 +01:00

Simplfy _buildEventFragmentProperties so that necessary objects and data are defined when it is called during onBootCleanup (#16001)

This commit is contained in:
Dan J Miller 2022-09-28 09:08:22 -02:30 committed by GitHub
parent 8622e61bd3
commit 9e865970ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2117,7 +2117,6 @@ export default class TransactionController extends EventEmitter {
async _buildEventFragmentProperties(txMeta, extraParams) { async _buildEventFragmentProperties(txMeta, extraParams) {
const { const {
id,
type, type,
time, time,
status, status,
@ -2135,8 +2134,14 @@ export default class TransactionController extends EventEmitter {
originalType, originalType,
replacedById, replacedById,
metamaskNetworkId: network, metamaskNetworkId: network,
customTokenAmount,
dappProposedTokenAmount,
currentTokenBalance,
originalApprovalAmount,
finalApprovalAmount,
contractMethodName,
} = txMeta; } = txMeta;
const { transactions } = this.store.getState();
const source = referrer === ORIGIN_METAMASK ? 'user' : 'dapp'; const source = referrer === ORIGIN_METAMASK ? 'user' : 'dapp';
const { assetType, tokenStandard } = await determineTransactionAssetType( const { assetType, tokenStandard } = await determineTransactionAssetType(
@ -2228,11 +2233,6 @@ export default class TransactionController extends EventEmitter {
APPROVE: 'Approve', 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 transactionApprovalAmountType;
let transactionContractMethod; let transactionContractMethod;
let transactionApprovalAmountVsProposedRatio; let transactionApprovalAmountVsProposedRatio;
@ -2246,7 +2246,7 @@ export default class TransactionController extends EventEmitter {
transactionType = TRANSACTION_TYPES.DEPLOY_CONTRACT; transactionType = TRANSACTION_TYPES.DEPLOY_CONTRACT;
} else if (contractInteractionTypes) { } else if (contractInteractionTypes) {
transactionType = TRANSACTION_TYPES.CONTRACT_INTERACTION; transactionType = TRANSACTION_TYPES.CONTRACT_INTERACTION;
transactionContractMethod = transactions[id]?.contractMethodName; transactionContractMethod = contractMethodName;
if ( if (
transactionContractMethod === contractMethodNames.APPROVE && transactionContractMethod === contractMethodNames.APPROVE &&
tokenStandard === TOKEN_STANDARDS.ERC20 tokenStandard === TOKEN_STANDARDS.ERC20