1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 03:36:18 +02:00
metamask-extension/ui/app/ducks/index.js
Mark Stacey 1112277cd6
Remove seedWords completely from metamask state (#6920)
`seedWords` used to be stored on the metamask state temporarily at
certain points. This hasn't been the case since #5994, but references
to this state remained. All of the logic remained for correctly updating
these `seedWords`, handling them during navigation, and scrubbing them
from the state.

However the state was never updated in practice. The `seedWords` are
still returned by `verifySeedPhrase`, and they're still stored in
component state in a few places. But they aren't ever set in the Redux
metadata state or the Preferences controller.

All references to this state have been removed, along with any logic
for interacting with this state. A few unused actions were removed as
well.
2019-07-26 10:35:21 -03:00

89 lines
2.0 KiB
JavaScript

const clone = require('clone')
const extend = require('xtend')
const copyToClipboard = require('copy-to-clipboard')
//
// Sub-Reducers take in the complete state and return their sub-state
//
const reduceMetamask = require('./metamask/metamask')
const reduceApp = require('./app/app')
const reduceLocale = require('./locale/locale')
const reduceSend = require('./send/send.duck').default
import reduceConfirmTransaction from './confirm-transaction/confirm-transaction.duck'
import reduceGas from './gas/gas.duck'
window.METAMASK_CACHED_LOG_STATE = null
module.exports = rootReducer
function rootReducer (state, action) {
// clone
state = extend(state)
if (action.type === 'GLOBAL_FORCE_UPDATE') {
return action.value
}
//
// MetaMask
//
state.metamask = reduceMetamask(state, action)
//
// AppState
//
state.appState = reduceApp(state, action)
//
// LocaleMessages
//
state.localeMessages = reduceLocale(state, action)
//
// Send
//
state.send = reduceSend(state, action)
state.confirmTransaction = reduceConfirmTransaction(state, action)
state.gas = reduceGas(state, action)
window.METAMASK_CACHED_LOG_STATE = state
return state
}
window.getCleanAppState = function () {
const state = clone(window.METAMASK_CACHED_LOG_STATE)
// append additional information
state.version = global.platform.getVersion()
state.browser = window.navigator.userAgent
return state
}
window.logStateString = function (cb) {
const state = window.getCleanAppState()
global.platform.getPlatformInfo((err, platform) => {
if (err) return cb(err)
state.platform = platform
const stateString = JSON.stringify(state, null, 2)
cb(null, stateString)
})
}
window.logState = function (toClipboard) {
return window.logStateString((err, result) => {
if (err) {
console.error(err.message)
} else if (toClipboard) {
copyToClipboard(result)
console.log('State log copied')
} else {
console.log(result)
}
})
}