1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

remove ui lookup of lastGasPrice field (#11411)

This commit is contained in:
Brad Decker 2021-06-29 11:02:00 -05:00 committed by GitHub
parent 3aae36754f
commit 844a021fcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 40 deletions

View File

@ -11,8 +11,6 @@ import {
getHexGasTotal,
addFiat,
addEth,
increaseLastGasPrice,
hexGreaterThan,
} from '../../helpers/utils/confirm-tx.util';
import { getTokenData, sumHexes } from '../../helpers/utils/transactions.util';
@ -180,32 +178,6 @@ export function updateNonce(nonce) {
};
}
function increaseFromLastGasPrice(txData) {
const {
lastGasPrice,
txParams: { gasPrice: previousGasPrice } = {},
} = txData;
// Set the minimum to a 10% increase from the lastGasPrice.
const minimumGasPrice = increaseLastGasPrice(lastGasPrice);
const gasPriceBelowMinimum = hexGreaterThan(
minimumGasPrice,
previousGasPrice,
);
const gasPrice =
!previousGasPrice || gasPriceBelowMinimum
? minimumGasPrice
: previousGasPrice;
return {
...txData,
txParams: {
...txData.txParams,
gasPrice,
},
};
}
export function updateTxDataAndCalculate(txData) {
return (dispatch, getState) => {
const state = getState();
@ -303,12 +275,7 @@ export function setTransactionToConfirm(transactionId) {
}
if (transaction.txParams) {
const { lastGasPrice } = transaction;
const txData = lastGasPrice
? increaseFromLastGasPrice(transaction)
: transaction;
dispatch(updateTxDataAndCalculate(txData));
dispatch(updateTxDataAndCalculate(transaction));
const { txParams } = transaction;
if (txParams.data) {

View File

@ -51,7 +51,6 @@ export default class ConfirmTransactionBase extends Component {
hexTransactionAmount: PropTypes.string,
hexTransactionFee: PropTypes.string,
hexTransactionTotal: PropTypes.string,
isTxReprice: PropTypes.bool,
methodData: PropTypes.object,
nonce: PropTypes.string,
useNonceField: PropTypes.bool,
@ -649,7 +648,6 @@ export default class ConfirmTransactionBase extends Component {
render() {
const { t } = this.context;
const {
isTxReprice,
fromName,
fromAddress,
toName,
@ -709,7 +707,7 @@ export default class ConfirmTransactionBase extends Component {
toAddress={toAddress}
toEns={toEns}
toNickname={toNickname}
showEdit={onEdit && !isTxReprice}
showEdit={onEdit}
action={functionType}
title={title}
titleComponent={this.renderTitleComponent()}

View File

@ -78,7 +78,7 @@ const mapStateToProps = (state, ownProps) => {
provider: { chainId },
} = metamask;
const { tokenData, txData, tokenProps, nonce } = confirmTransaction;
const { txParams = {}, lastGasPrice, id: transactionId, type } = txData;
const { txParams = {}, id: transactionId, type } = txData;
const transaction =
Object.values(unapprovedTxs).find(
({ id }) => id === (transactionId || Number(paramsTransactionId)),
@ -107,7 +107,6 @@ const mapStateToProps = (state, ownProps) => {
const addressBookObject = addressBook[checksummedAddress];
const toEns = ensResolutionsByAddress[checksummedAddress] || '';
const toNickname = addressBookObject ? addressBookObject.name : '';
const isTxReprice = Boolean(lastGasPrice);
const transactionStatus = transaction ? transaction.status : '';
const {
@ -165,7 +164,6 @@ const mapStateToProps = (state, ownProps) => {
tokenData,
methodData,
tokenProps,
isTxReprice,
conversionRate,
transactionStatus,
nonce,