diff --git a/ui/app/ducks/gas/gas-duck.test.js b/ui/app/ducks/gas/gas-duck.test.js index aceea5efb..519741f25 100644 --- a/ui/app/ducks/gas/gas-duck.test.js +++ b/ui/app/ducks/gas/gas-duck.test.js @@ -14,8 +14,6 @@ const { setBasicGasEstimateData, setCustomGasPrice, setCustomGasLimit, - setCustomGasTotal, - setCustomGasErrors, resetCustomGasState, fetchBasicGasEstimates, } = GasDuck @@ -68,7 +66,6 @@ describe('Gas Duck', function () { safeLow: null, }, basicEstimateIsLoading: true, - errors: {}, basicPriceEstimatesLastRetrieved: 0, } const BASIC_GAS_ESTIMATE_LOADING_FINISHED = @@ -77,10 +74,8 @@ describe('Gas Duck', function () { 'metamask/gas/BASIC_GAS_ESTIMATE_LOADING_STARTED' const RESET_CUSTOM_GAS_STATE = 'metamask/gas/RESET_CUSTOM_GAS_STATE' const SET_BASIC_GAS_ESTIMATE_DATA = 'metamask/gas/SET_BASIC_GAS_ESTIMATE_DATA' - const SET_CUSTOM_GAS_ERRORS = 'metamask/gas/SET_CUSTOM_GAS_ERRORS' const SET_CUSTOM_GAS_LIMIT = 'metamask/gas/SET_CUSTOM_GAS_LIMIT' const SET_CUSTOM_GAS_PRICE = 'metamask/gas/SET_CUSTOM_GAS_PRICE' - const SET_CUSTOM_GAS_TOTAL = 'metamask/gas/SET_CUSTOM_GAS_TOTAL' const SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED = 'metamask/gas/SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED' @@ -143,26 +138,6 @@ describe('Gas Duck', function () { ) }) - it('should set customData.total when receiving a SET_CUSTOM_GAS_TOTAL action', function () { - assert.deepStrictEqual( - GasReducer(mockState, { - type: SET_CUSTOM_GAS_TOTAL, - value: 10000, - }), - { customData: { total: 10000 }, ...mockState }, - ) - }) - - it('should set errors when receiving a SET_CUSTOM_GAS_ERRORS action', function () { - assert.deepStrictEqual( - GasReducer(mockState, { - type: SET_CUSTOM_GAS_ERRORS, - value: { someError: 'error_error' }, - }), - { errors: { someError: 'error_error' }, ...mockState }, - ) - }) - it('should return the initial state in response to a RESET_CUSTOM_GAS_STATE action', function () { assert.deepStrictEqual( GasReducer(mockState, { type: RESET_CUSTOM_GAS_STATE }), @@ -318,24 +293,6 @@ describe('Gas Duck', function () { }) }) - describe('setCustomGasTotal', function () { - it('should create the correct action', function () { - assert.deepStrictEqual(setCustomGasTotal('mockCustomGasTotal'), { - type: SET_CUSTOM_GAS_TOTAL, - value: 'mockCustomGasTotal', - }) - }) - }) - - describe('setCustomGasErrors', function () { - it('should create the correct action', function () { - assert.deepStrictEqual(setCustomGasErrors('mockErrorObject'), { - type: SET_CUSTOM_GAS_ERRORS, - value: 'mockErrorObject', - }) - }) - }) - describe('resetCustomGasState', function () { it('should create the correct action', function () { assert.deepStrictEqual(resetCustomGasState(), { diff --git a/ui/app/ducks/gas/gas.duck.js b/ui/app/ducks/gas/gas.duck.js index 751b4304b..83b15ecf1 100644 --- a/ui/app/ducks/gas/gas.duck.js +++ b/ui/app/ducks/gas/gas.duck.js @@ -12,10 +12,8 @@ const BASIC_GAS_ESTIMATE_LOADING_STARTED = const RESET_CUSTOM_GAS_STATE = 'metamask/gas/RESET_CUSTOM_GAS_STATE' const RESET_CUSTOM_DATA = 'metamask/gas/RESET_CUSTOM_DATA' const SET_BASIC_GAS_ESTIMATE_DATA = 'metamask/gas/SET_BASIC_GAS_ESTIMATE_DATA' -const SET_CUSTOM_GAS_ERRORS = 'metamask/gas/SET_CUSTOM_GAS_ERRORS' const SET_CUSTOM_GAS_LIMIT = 'metamask/gas/SET_CUSTOM_GAS_LIMIT' const SET_CUSTOM_GAS_PRICE = 'metamask/gas/SET_CUSTOM_GAS_PRICE' -const SET_CUSTOM_GAS_TOTAL = 'metamask/gas/SET_CUSTOM_GAS_TOTAL' const SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED = 'metamask/gas/SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED' @@ -31,7 +29,6 @@ const initState = { }, basicEstimateIsLoading: true, basicPriceEstimatesLastRetrieved: 0, - errors: {}, } // Reducer @@ -68,22 +65,6 @@ export default function reducer(state = initState, action) { limit: action.value, }, } - case SET_CUSTOM_GAS_TOTAL: - return { - ...state, - customData: { - ...state.customData, - total: action.value, - }, - } - case SET_CUSTOM_GAS_ERRORS: - return { - ...state, - errors: { - ...state.errors, - ...action.value, - }, - } case SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED: return { ...state, @@ -211,20 +192,6 @@ export function setCustomGasLimit(newLimit) { } } -export function setCustomGasTotal(newTotal) { - return { - type: SET_CUSTOM_GAS_TOTAL, - value: newTotal, - } -} - -export function setCustomGasErrors(newErrors) { - return { - type: SET_CUSTOM_GAS_ERRORS, - value: newErrors, - } -} - export function setBasicPriceEstimatesLastRetrieved(retrievalTime) { return { type: SET_BASIC_PRICE_ESTIMATES_LAST_RETRIEVED, diff --git a/ui/app/selectors/custom-gas.js b/ui/app/selectors/custom-gas.js index 44e2af494..8b1df8b89 100644 --- a/ui/app/selectors/custom-gas.js +++ b/ui/app/selectors/custom-gas.js @@ -13,10 +13,6 @@ import { getCurrentCurrency, getIsMainnet, getPreferences } from '.' const NUMBER_OF_DECIMALS_SM_BTNS = 5 -export function getCustomGasErrors(state) { - return state.gas.errors -} - export function getCustomGasLimit(state) { return state.gas.customData.limit } @@ -25,10 +21,6 @@ export function getCustomGasPrice(state) { return state.gas.customData.price } -export function getCustomGasTotal(state) { - return state.gas.customData.total -} - export function getBasicGasEstimateLoadingStatus(state) { return state.gas.basicEstimateIsLoading } diff --git a/ui/app/selectors/tests/custom-gas.test.js b/ui/app/selectors/tests/custom-gas.test.js index 9cbbf5c0d..cd5d9686e 100644 --- a/ui/app/selectors/tests/custom-gas.test.js +++ b/ui/app/selectors/tests/custom-gas.test.js @@ -2,10 +2,8 @@ import assert from 'assert' import proxyquire from 'proxyquire' const { - getCustomGasErrors, getCustomGasLimit, getCustomGasPrice, - getCustomGasTotal, getRenderableBasicEstimateData, getRenderableEstimateDataForSmallButtonsFromGWEI, } = proxyquire('../custom-gas', {}) @@ -25,20 +23,6 @@ describe('custom-gas selectors', function () { }) }) - describe('getCustomGasTotal()', function () { - it('should return gas.customData.total', function () { - const mockState = { gas: { customData: { total: 'mockTotal' } } } - assert.strictEqual(getCustomGasTotal(mockState), 'mockTotal') - }) - }) - - describe('getCustomGasErrors()', function () { - it('should return gas.errors', function () { - const mockState = { gas: { errors: 'mockErrors' } } - assert.strictEqual(getCustomGasErrors(mockState), 'mockErrors') - }) - }) - describe('getRenderableBasicEstimateData()', function () { const tests = [ {