1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +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) {
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