aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorsdtsui <szehungdanieltsui@gmail.com>2017-08-10 12:40:01 +0800
committersdtsui <szehungdanieltsui@gmail.com>2017-08-10 12:42:16 +0800
commitbe116ecfbd687dffd5a1dfd2987a027b606e09cd (patch)
tree11b5928d902bc383feb8194fb636773e91fad601 /ui
parent5f74564debd0f7e498d632f6a8120d46994c7c57 (diff)
downloadtangerine-wallet-browser-be116ecfbd687dffd5a1dfd2987a027b606e09cd.tar
tangerine-wallet-browser-be116ecfbd687dffd5a1dfd2987a027b606e09cd.tar.gz
tangerine-wallet-browser-be116ecfbd687dffd5a1dfd2987a027b606e09cd.tar.bz2
tangerine-wallet-browser-be116ecfbd687dffd5a1dfd2987a027b606e09cd.tar.lz
tangerine-wallet-browser-be116ecfbd687dffd5a1dfd2987a027b606e09cd.tar.xz
tangerine-wallet-browser-be116ecfbd687dffd5a1dfd2987a027b606e09cd.tar.zst
tangerine-wallet-browser-be116ecfbd687dffd5a1dfd2987a027b606e09cd.zip
Add new selectors for addresses, identities, and accounts
Diffstat (limited to 'ui')
-rw-r--r--ui/app/selectors.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/ui/app/selectors.js b/ui/app/selectors.js
new file mode 100644
index 000000000..749f18d3b
--- /dev/null
+++ b/ui/app/selectors.js
@@ -0,0 +1,27 @@
+const selectors = {
+ getSelectedAddress,
+ getSelectedIdentity,
+ getSelectedAccount,
+}
+
+module.exports = selectors
+
+function getSelectedAddress(state) {
+ const selectedAddress = state.metamask.selectedAddress || Object.keys(accounts)[0]
+
+ return selectedAddress
+}
+
+function getSelectedIdentity(state) {
+ const selectedAddress = getSelectedAddress(state)
+ const identities = state.metamask.identities
+
+ return identities[selectedAddress]
+}
+
+function getSelectedAccount(state) {
+ const accounts = state.metamask.accounts
+ const selectedAddress = getSelectedAddress(state)
+
+ return accounts[selectedAddress]
+} \ No newline at end of file