aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers
diff options
context:
space:
mode:
authorWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-04-19 11:33:51 +0800
committerWhymarrh Whitby <whymarrh.whitby@gmail.com>2018-05-17 23:27:39 +0800
commitc54e4c719110c2033b7cc3757676f97ad3329d42 (patch)
treeba596e96730a3b8b617278696df9068af0612d70 /app/scripts/controllers
parentcbe4d0d88c83ee1d8dd8efde537ee753bf19596a (diff)
downloadtangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar
tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar.gz
tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar.bz2
tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar.lz
tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar.xz
tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.tar.zst
tangerine-wallet-browser-c54e4c719110c2033b7cc3757676f97ad3329d42.zip
Add PreferencesController#setAddresses to update ids
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r--app/scripts/controllers/preferences.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/scripts/controllers/preferences.js b/app/scripts/controllers/preferences.js
index 55416d15f..a4ff1207e 100644
--- a/app/scripts/controllers/preferences.js
+++ b/app/scripts/controllers/preferences.js
@@ -63,6 +63,16 @@ class PreferencesController {
this.store.updateState({ currentLocale: key })
}
+ setAddresses (addresses) {
+ const oldIdentities = this.store.getState().identities
+ const identities = addresses.reduce((ids, address, index) => {
+ const oldId = oldIdentities[address] || {}
+ ids[address] = {name: `Account ${index + 1}`, address, ...oldId}
+ return ids
+ }, {})
+ this.store.updateState({ identities })
+ }
+
/**
* Setter for the `selectedAddress` property
*