diff --git a/app/components/UI/CustomGas/__snapshots__/index.test.js.snap b/app/components/UI/CustomGas/__snapshots__/index.test.js.snap index c76d06819e1..7a67756cabc 100644 --- a/app/components/UI/CustomGas/__snapshots__/index.test.js.snap +++ b/app/components/UI/CustomGas/__snapshots__/index.test.js.snap @@ -130,7 +130,6 @@ exports[`CustomGas should render correctly 1`] = ` Array [ Object { "alignSelf": "center", - "height": "100%", "paddingTop": 24, "position": "absolute", "width": "100%", @@ -212,24 +211,17 @@ exports[`CustomGas should render correctly 1`] = ` - 0 @@ -308,24 +300,17 @@ exports[`CustomGas should render correctly 1`] = ` - 0 @@ -404,24 +389,17 @@ exports[`CustomGas should render correctly 1`] = ` - 0 @@ -449,11 +427,10 @@ exports[`CustomGas should render correctly 1`] = ` "fontFamily": "EuclidCircularB-Regular", "fontSize": 12, "fontWeight": "400", - "paddingBottom": 20, } } > - Select the network fee you are willing to pay. The higher the fee, the better chances and faster your transaction will go through. + The network fee covers the cost of processing your transaction on the Ethereum network. MetaMask does not profit from this fee. The higher the fee the better chances of your transaction getting processed. - {safeLowWait} - + {getRenderableEthGasFee(safeLowGwei, gas)} {ticker} @@ -528,8 +520,7 @@ class CustomGas extends PureComponent { - {averageWait} - + {getRenderableEthGasFee(averageGwei, gas)} {ticker} @@ -547,8 +538,7 @@ class CustomGas extends PureComponent { - {fastWait} - + {getRenderableEthGasFee(fastGwei, gas)} {ticker} diff --git a/app/util/custom-gas.js b/app/util/custom-gas.js index 033d3ad2d50..82cc62f2d3e 100644 --- a/app/util/custom-gas.js +++ b/app/util/custom-gas.js @@ -21,7 +21,7 @@ export function apiEstimateModifiedToWEI(estimate) { * @returns {string} - The GWEI value as a string */ export function convertApiValueToGWEI(val) { - return (parseInt(val, 10) / 10).toString(); + return parseInt(val, 10).toString(); } /** @@ -103,46 +103,22 @@ export function parseWaitTime(min) { * @returns {Object} - Object containing basic estimates */ export async function fetchBasicGasEstimates() { - const apiKey = process.env.ETH_GAS_STATION_API_KEY ? `?api-key=${process.env.ETH_GAS_STATION_API_KEY}` : ''; - return await fetch(`https://ethgasstation.info/api/ethgasAPI.json${apiKey}`, { + return await fetch(`https://api.metaswap.codefi.network/gasPrices`, { headers: {}, - referrer: 'http://ethgasstation.info/json/', referrerPolicy: 'no-referrer-when-downgrade', body: null, method: 'GET', mode: 'cors' }) .then(r => r.json()) - .then( - ({ - average, - avgWait, - block_time: blockTime, - blockNum, - fast, - fastest, - fastestWait, - fastWait, - safeLow, - safeLowWait, - speed - }) => { - const basicEstimates = { - average, - averageWait: avgWait, - blockTime, - blockNum, - fast, - fastest, - fastestWait, - fastWait, - safeLow, - safeLowWait, - speed - }; - return basicEstimates; - } - ); + .then(({ SafeGasPrice, ProposeGasPrice, FastGasPrice }) => { + const basicEstimates = { + average: ProposeGasPrice, + safeLow: SafeGasPrice, + fast: FastGasPrice + }; + return basicEstimates; + }); } /** @@ -162,17 +138,13 @@ export async function getBasicGasEstimates() { Logger.log('Error while trying to get gas limit estimates', error); basicGasEstimates = { average: AVERAGE_GAS, - averageWait: 2, safeLow: LOW_GAS, - safeLowWait: 4, - fast: FAST_GAS, - fastWait: 1 + fast: FAST_GAS }; } // Handle api failure returning same gas prices let { average, fast, safeLow } = basicGasEstimates; - const { averageWait, fastWait, safeLowWait } = basicGasEstimates; if (average === fast && average === safeLow) { average = AVERAGE_GAS; @@ -183,9 +155,6 @@ export async function getBasicGasEstimates() { return { averageGwei: convertApiValueToGWEI(average), fastGwei: convertApiValueToGWEI(fast), - safeLowGwei: convertApiValueToGWEI(safeLow), - averageWait: parseWaitTime(averageWait), - fastWait: parseWaitTime(fastWait), - safeLowWait: parseWaitTime(safeLowWait) + safeLowGwei: convertApiValueToGWEI(safeLow) }; } diff --git a/locales/en.json b/locales/en.json index f3a42caff7d..9bac3b915e9 100644 --- a/locales/en.json +++ b/locales/en.json @@ -644,7 +644,7 @@ "gas_price": "Gas Price: (GWEI)", "save": "Save", "warning_gas_limit": "Gas limit must be greater than 20999 and less than 7920027", - "cost_explanation": "Select the network fee you are willing to pay. The higher the fee, the better chances and faster your transaction will go through." + "cost_explanation": "The network fee covers the cost of processing your transaction on the Ethereum network. MetaMask does not profit from this fee. The higher the fee the better chances of your transaction getting processed." }, "spend_limit_edition": { "save": "Save", diff --git a/locales/es.json b/locales/es.json index 58547e9aa64..0731231efed 100644 --- a/locales/es.json +++ b/locales/es.json @@ -595,7 +595,7 @@ "gas_limit": "Límite de Gas:", "gas_price": "Precio de Gas: (GWEI)", "warning_gas_limit": "Límite de gas debe ser mayor a 20999 y menor que 7920027", - "cost_explanation": "Este es el costo por procesar este pago en la blockchain." + "cost_explanation": "La tarifa de la red cubre el costo de procesar tu transacción en la red Ethereum. MetaMask no se beneficia de esta tarifa. Cuanto mayor sea la tarifa, mayores serán las posibilidades de que se procese tu transacción." }, "spend_limit_edition": { "save": "Guardar",