aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/pages/create-account
diff options
context:
space:
mode:
authorDan J Miller <danjm.com@gmail.com>2018-12-01 06:51:24 +0800
committerDan Finlay <542863+danfinlay@users.noreply.github.com>2018-12-01 06:51:24 +0800
commit4c2455554540b9d0dd979bad329892279fddd8b9 (patch)
treee3b101ec86a65500023d8b7e99dd5973a9473626 /ui/app/components/pages/create-account
parent45a9f40aa614753e274275eaeb4dd6c0251dcf45 (diff)
downloadtangerine-wallet-browser-4c2455554540b9d0dd979bad329892279fddd8b9.tar.gz
tangerine-wallet-browser-4c2455554540b9d0dd979bad329892279fddd8b9.tar.zst
tangerine-wallet-browser-4c2455554540b9d0dd979bad329892279fddd8b9.zip
Save recent network balances in local storage (#5843)
* Use selector for state.metamask.accounts in all cases. * Default to cached balance when selecting metamask accounts * Adds the cached-balances controller * Documentation and small codes fixes for #5843 Co-Authored-By: danjm <danjm.com@gmail.com>
Diffstat (limited to 'ui/app/components/pages/create-account')
-rw-r--r--ui/app/components/pages/create-account/connect-hardware/index.js4
-rw-r--r--ui/app/components/pages/create-account/import-account/json.js3
-rw-r--r--ui/app/components/pages/create-account/import-account/private-key.js3
3 files changed, 7 insertions, 3 deletions
diff --git a/ui/app/components/pages/create-account/connect-hardware/index.js b/ui/app/components/pages/create-account/connect-hardware/index.js
index 4fe25f629..bd877fd4e 100644
--- a/ui/app/components/pages/create-account/connect-hardware/index.js
+++ b/ui/app/components/pages/create-account/connect-hardware/index.js
@@ -3,6 +3,7 @@ const PropTypes = require('prop-types')
const h = require('react-hyperscript')
const connect = require('react-redux').connect
const actions = require('../../../../actions')
+const { getMetaMaskAccounts } = require('../../../../selectors')
const ConnectScreen = require('./connect-screen')
const AccountList = require('./account-list')
const { DEFAULT_ROUTE } = require('../../../../routes')
@@ -224,8 +225,9 @@ ConnectHardwareForm.propTypes = {
const mapStateToProps = state => {
const {
- metamask: { network, selectedAddress, identities = {}, accounts = [] },
+ metamask: { network, selectedAddress, identities = {} },
} = state
+ const accounts = getMetaMaskAccounts(state)
const numberOfExistingAccounts = Object.keys(identities).length
const {
appState: { defaultHdPaths },
diff --git a/ui/app/components/pages/create-account/import-account/json.js b/ui/app/components/pages/create-account/import-account/json.js
index 90279bbbd..bb6771e4d 100644
--- a/ui/app/components/pages/create-account/import-account/json.js
+++ b/ui/app/components/pages/create-account/import-account/json.js
@@ -7,6 +7,7 @@ const connect = require('react-redux').connect
const actions = require('../../../../actions')
const FileInput = require('react-simple-file-input').default
const { DEFAULT_ROUTE } = require('../../../../routes')
+const { getMetaMaskAccounts } = require('../../../../selectors')
const HELP_LINK = 'https://support.metamask.io/kb/article/7-importing-accounts'
import Button from '../../../button'
@@ -136,7 +137,7 @@ JsonImportSubview.propTypes = {
const mapStateToProps = state => {
return {
error: state.appState.warning,
- firstAddress: Object.keys(state.metamask.accounts)[0],
+ firstAddress: Object.keys(getMetaMaskAccounts(state))[0],
}
}
diff --git a/ui/app/components/pages/create-account/import-account/private-key.js b/ui/app/components/pages/create-account/import-account/private-key.js
index 8db1bfbdd..45068b96e 100644
--- a/ui/app/components/pages/create-account/import-account/private-key.js
+++ b/ui/app/components/pages/create-account/import-account/private-key.js
@@ -7,6 +7,7 @@ const PropTypes = require('prop-types')
const connect = require('react-redux').connect
const actions = require('../../../../actions')
const { DEFAULT_ROUTE } = require('../../../../routes')
+const { getMetaMaskAccounts } = require('../../../../selectors')
import Button from '../../../button'
PrivateKeyImportView.contextTypes = {
@@ -22,7 +23,7 @@ module.exports = compose(
function mapStateToProps (state) {
return {
error: state.appState.warning,
- firstAddress: Object.keys(state.metamask.accounts)[0],
+ firstAddress: Object.keys(getMetaMaskAccounts(state))[0],
}
}