mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Merge pull request #5917 from MetaMask/correct-gas-limit-from-external-tx
Ensures that advanced tab gas limit reflects tx gas limit
This commit is contained in:
commit
7c60414075
@ -769,6 +769,22 @@ describe('MetaMask', function () {
|
||||
await driver.switchTo().window(popup)
|
||||
await delay(regularDelayMs)
|
||||
|
||||
const configureGas = await driver.wait(until.elementLocated(By.css('.confirm-detail-row__header-text--edit')), 10000)
|
||||
await configureGas.click()
|
||||
await delay(regularDelayMs)
|
||||
|
||||
const advancedTabButton = await driver.wait(until.elementLocated(By.xpath(`//li[contains(text(), 'Advanced')]`)), 10000)
|
||||
await advancedTabButton.click()
|
||||
await delay(tinyDelayMs)
|
||||
|
||||
const [gasPriceInput, gasLimitInput] = await findElements(driver, By.css('.advanced-tab__gas-edit-row__input'))
|
||||
assert(gasPriceInput.getAttribute('value'), 20)
|
||||
assert(gasLimitInput.getAttribute('value'), 4700000)
|
||||
|
||||
const saveButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Save')]`))
|
||||
await saveButton.click()
|
||||
await delay(regularDelayMs)
|
||||
|
||||
const confirmButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Confirm')]`))
|
||||
await confirmButton.click()
|
||||
await delay(regularDelayMs)
|
||||
|
@ -76,7 +76,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
|
||||
const customGasTotal = calcGasTotal(customModalGasLimitInHex, customModalGasPriceInHex)
|
||||
|
||||
const gasButtonInfo = getRenderableBasicEstimateData(state)
|
||||
const gasButtonInfo = getRenderableBasicEstimateData(state, customModalGasLimitInHex)
|
||||
|
||||
const currentCurrency = getCurrentCurrency(state)
|
||||
const conversionRate = getConversionRate(state)
|
||||
@ -235,7 +235,7 @@ function getTxParams (state, transactionId) {
|
||||
const { txParams: pendingTxParams } = pendingTransaction || {}
|
||||
return txData.txParams || pendingTxParams || {
|
||||
from: send.from,
|
||||
gas: send.gasLimit,
|
||||
gas: send.gasLimit || '0x5208',
|
||||
gasPrice: send.gasPrice || getFastPriceEstimateInHexWEI(state, true),
|
||||
to: send.to,
|
||||
value: getSelectedToken(state) ? '0x0' : send.amount,
|
||||
|
@ -29,7 +29,7 @@ const SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED = 'metamask/gas/SET_BASIC_PRICE_E
|
||||
const initState = {
|
||||
customData: {
|
||||
price: null,
|
||||
limit: '0x5208',
|
||||
limit: null,
|
||||
},
|
||||
basicEstimates: {
|
||||
average: null,
|
||||
|
@ -98,7 +98,7 @@ describe('Gas Duck', () => {
|
||||
const initState = {
|
||||
customData: {
|
||||
price: null,
|
||||
limit: '0x5208',
|
||||
limit: null,
|
||||
},
|
||||
basicEstimates: {
|
||||
average: null,
|
||||
|
@ -221,11 +221,10 @@ function getGasPriceInHexWei (price) {
|
||||
)(price)
|
||||
}
|
||||
|
||||
function getRenderableBasicEstimateData (state) {
|
||||
function getRenderableBasicEstimateData (state, gasLimit) {
|
||||
if (getBasicGasEstimateLoadingStatus(state)) {
|
||||
return []
|
||||
}
|
||||
const gasLimit = state.metamask.send.gasLimit || getCustomGasLimit(state)
|
||||
const conversionRate = state.metamask.conversionRate
|
||||
const currentCurrency = getCurrentCurrency(state)
|
||||
const {
|
||||
@ -270,7 +269,7 @@ function getRenderableEstimateDataForSmallButtonsFromGWEI (state) {
|
||||
if (getBasicGasEstimateLoadingStatus(state)) {
|
||||
return []
|
||||
}
|
||||
const gasLimit = state.metamask.send.gasLimit || getCustomGasLimit(state)
|
||||
const gasLimit = state.metamask.send.gasLimit || getCustomGasLimit(state) || '0x5208'
|
||||
const conversionRate = state.metamask.conversionRate
|
||||
const currentCurrency = getCurrentCurrency(state)
|
||||
const {
|
||||
|
@ -102,9 +102,6 @@ describe('custom-gas selectors', () => {
|
||||
metamask: {
|
||||
conversionRate: 255.71,
|
||||
currentCurrency: 'usd',
|
||||
send: {
|
||||
gasLimit: '0x5208',
|
||||
},
|
||||
},
|
||||
gas: {
|
||||
basicEstimates: {
|
||||
@ -168,7 +165,7 @@ describe('custom-gas selectors', () => {
|
||||
it('should return renderable data about basic estimates', () => {
|
||||
tests.forEach(test => {
|
||||
assert.deepEqual(
|
||||
getRenderableBasicEstimateData(test.mockState),
|
||||
getRenderableBasicEstimateData(test.mockState, '0x5208'),
|
||||
test.expectedResult
|
||||
)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user