Skip to content

Commit

Permalink
Remove unused state from swaps Redux store (#44)
Browse files Browse the repository at this point in the history
These portions of state were never read.

* `swapsTokens` and `tradeTxId` were never read, and the action
creators to set them were nevercalled.
* `quotes` was present only in the initial state, and was never read or
written.

The `swapsQuotesFetchStartTime` state was also never read, but it is
used in a subsequent PR.
  • Loading branch information
Gudahtt authored and danjm committed Oct 6, 2020
1 parent 596fd0f commit 9f17694
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions ui/app/ducks/swaps/swaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@
const SET_FROM_TOKEN = 'metamask/swaps/SET_FROM_TOKEN'
const SET_TO_TOKEN = 'metamask/swaps/SET_TO_TOKEN'
const CLEAR_SWAPS_STATE = 'metamask/swaps/CLEAR_SWAPS_STATE'
const SET_TRADE_TX_ID = 'metamask/swaps/SET_TRADE_TX_ID'
const SET_APPROVE_TX_ID = 'metamask/swaps/SET_APPROVE_TX_ID'
const SET_FETCHING_QUOTES = 'metamask/swaps/SET_FETCHING_QUOTES'
const SET_BALANCE_ERROR = 'metamask/swaps/SET_BALANCE_ERROR'
const SET_SWAPS_TOKENS = 'metamask/swaps/SET_SWAPS_TOKENS'
const SET_TOP_ASSETS = 'metamask/swaps/SET_TOP_ASSETS'
const SET_AGGREGATOR_METADATA = 'metamask/swaps/SET_AGGREGATOR_METADATA'
const SET_SWAP_QUOTES_FETCH_START_TIME = 'metamask/swaps/SET_SWAP_QUOTES_FETCH_START_TIME'

const emptyState = {
fromToken: null,
toToken: null,
quotes: [],
swapsTokens: [],
approveTxId: null,
tradeTxId: null,
fetchingQuotes: false,
balanceError: false,
aggregatorMetadata: null,
Expand All @@ -41,12 +36,6 @@ export default function reduceSwaps (state = {}, action) {
toToken: action.value,
}

case SET_TRADE_TX_ID:
return {
...swapsState,
tradeTxId: action.value,
}

case SET_APPROVE_TX_ID:
return {
...swapsState,
Expand All @@ -65,12 +54,6 @@ export default function reduceSwaps (state = {}, action) {
balanceError: action.value,
}

case SET_SWAPS_TOKENS:
return {
...swapsState,
swapsTokens: action.value,
}

case SET_TOP_ASSETS:
return {
...swapsState,
Expand Down Expand Up @@ -119,13 +102,6 @@ export function clearSwapsState () {
}
}

export function setTradeTxId (id) {
return {
type: SET_TRADE_TX_ID,
value: id,
}
}

export function setApproveTxId (approveTxId) {
return {
type: SET_APPROVE_TX_ID,
Expand All @@ -147,13 +123,6 @@ export function setBalanceError (balanceError) {
}
}

export function setSwapsTokens (tokens) {
return {
type: SET_SWAPS_TOKENS,
value: tokens,
}
}

export function setTopAssets (topAssets) {
return {
type: SET_TOP_ASSETS,
Expand Down

0 comments on commit 9f17694

Please sign in to comment.