mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-01 13:47:06 +01:00
2070e5e42a
* Added code fences * Continue working on this ticket * Fixed policies * Added compliance-row component * Fixed tests and css * Fixed invalid locale * Fixing linting * Add optional check * Fixing issues * Fixed storybook * Added missing dependency * ran lavamoat auto * ran dedupe and lavamoat * lint * Removed compliance row * Removed unneeded package * Removed unneeded proptyes * updates mmi packages * updating lavamoat * formatting main * Fixed conflicts * updates lock file * Moved code fences to have them all in the same place * Updated yarn.lock and lavamoat * remove linebreak * Improved logic in order to not have many code fences and improve readability * Fixing proptypes issues with eslint * runs lavamoat auto * Testing fixes issue e2e tests * Testing issues * Reverting code fences container * Fixing issue with binding * Added code fences in proptypes * Reverting code fences * Removed institutional from main lavamoat * Added code fences in confirm transaction base component * Adding tests for handleMainSubmit * Improving code * Added test for handleMainSubmit * Removed waitFor --------- Co-authored-by: Antonio Regadas <antonio.regadas@consensys.net> Co-authored-by: António Regadas <apregadas@gmail.com>
60 lines
1.2 KiB
JavaScript
60 lines
1.2 KiB
JavaScript
import { TransactionType } from '../constants/transaction';
|
|
|
|
export default function updateTxData({
|
|
txData,
|
|
maxFeePerGas,
|
|
customTokenAmount,
|
|
dappProposedTokenAmount,
|
|
currentTokenBalance,
|
|
maxPriorityFeePerGas,
|
|
baseFeePerGas,
|
|
addToAddressBookIfNew,
|
|
toAccounts,
|
|
toAddress,
|
|
name,
|
|
}) {
|
|
if (txData.type === TransactionType.simpleSend) {
|
|
addToAddressBookIfNew(toAddress, toAccounts);
|
|
}
|
|
|
|
if (baseFeePerGas) {
|
|
txData.estimatedBaseFee = baseFeePerGas;
|
|
}
|
|
|
|
if (name) {
|
|
txData.contractMethodName = name;
|
|
}
|
|
|
|
if (dappProposedTokenAmount) {
|
|
txData.dappProposedTokenAmount = dappProposedTokenAmount;
|
|
txData.originalApprovalAmount = dappProposedTokenAmount;
|
|
}
|
|
|
|
if (customTokenAmount) {
|
|
txData.customTokenAmount = customTokenAmount;
|
|
txData.finalApprovalAmount = customTokenAmount;
|
|
} else if (dappProposedTokenAmount !== undefined) {
|
|
txData.finalApprovalAmount = dappProposedTokenAmount;
|
|
}
|
|
|
|
if (currentTokenBalance) {
|
|
txData.currentTokenBalance = currentTokenBalance;
|
|
}
|
|
|
|
if (maxFeePerGas) {
|
|
txData.txParams = {
|
|
...txData.txParams,
|
|
maxFeePerGas,
|
|
};
|
|
}
|
|
|
|
if (maxPriorityFeePerGas) {
|
|
txData.txParams = {
|
|
...txData.txParams,
|
|
maxPriorityFeePerGas,
|
|
};
|
|
}
|
|
|
|
return txData;
|
|
}
|