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

refactor unused code

This commit is contained in:
Esteban MIno 2018-08-07 19:12:16 -04:00
parent 15ea8c04b2
commit 33357e3538
6 changed files with 14 additions and 19 deletions

View File

@ -452,7 +452,9 @@ class PreferencesController {
if (!rawAddress || !symbol || !decimals) throw new Error(`Cannot suggest token without address, symbol, and decimals`)
if (!(symbol.length < 5)) throw new Error(`Invalid symbol ${symbol} more than four characters`)
const numDecimals = parseInt(decimals, 10)
if (isNaN(numDecimals) || numDecimals > 18 || numDecimals < 0) throw new Error(`Invalid decimals ${decimals}`)
if (isNaN(numDecimals) || numDecimals > 36 || numDecimals < 0) {
throw new Error(`Invalid decimals ${decimals} must be at least 0, and not over 36`)
}
if (!isValidAddress(rawAddress)) throw new Error(`Invalid address ${rawAddress}`)
}

View File

@ -239,7 +239,7 @@ App.prototype.renderPrimary = function () {
return h(AddTokenScreen, {key: 'add-token'})
case 'add-suggested-token':
log.debug('rendering add-token screen from unlock screen.')
log.debug('rendering add-suggested-token screen from unlock screen.')
return h(AddSuggestedTokenScreen, {key: 'add-suggested-token'})
case 'config':

View File

@ -1639,12 +1639,6 @@ function removeSuggestedTokens () {
}
}
function clearPendingTokens () {
return {
type: actions.CLEAR_PENDING_TOKENS,
}
}
function updateTokens (newTokens) {
return {
type: actions.UPDATE_TOKENS,
@ -1652,6 +1646,12 @@ function updateTokens (newTokens) {
}
}
function clearPendingTokens () {
return {
type: actions.CLEAR_PENDING_TOKENS,
}
}
function goBackToInitView () {
return {
type: actions.BACK_TO_INIT_MENU,

View File

@ -90,9 +90,7 @@ export default class ConfirmAddToken extends Component {
type="default"
large
className="page-container__footer-button"
onClick={() => {
history.push(ADD_TOKEN_ROUTE)
}}
onClick={() => history.push(ADD_TOKEN_ROUTE)}
>
{ this.context.t('back') }
</Button>

View File

@ -1,16 +1,12 @@
import { connect } from 'react-redux'
import ConfirmAddToken from './confirm-add-token.component'
const extend = require('xtend')
const { addTokens, clearPendingTokens } = require('../../../actions')
const mapStateToProps = ({ metamask }) => {
const { pendingTokens, suggestedTokens } = metamask
const params = extend(pendingTokens, suggestedTokens)
const { pendingTokens } = metamask
return {
pendingTokens: params,
pendingTokens,
}
}

View File

@ -29,7 +29,6 @@ function reduceMetamask (state, action) {
tokenExchangeRates: {},
tokens: [],
pendingTokens: {},
suggestedTokens: {},
send: {
gasLimit: null,
gasPrice: null,