aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/selectors.js
diff options
context:
space:
mode:
authorsdtsui <szehungdanieltsui@gmail.com>2017-08-11 10:35:01 +0800
committersdtsui <szehungdanieltsui@gmail.com>2017-08-11 10:35:01 +0800
commit77b72ee33f1a8384a673b03969426a94d07914ee (patch)
tree21d86bdedd2939f9904994f6fb34b6a5f9ff542b /ui/app/selectors.js
parent95eda70efedd47ac5be8e790d6cf89cb219f4161 (diff)
downloadtangerine-wallet-browser-77b72ee33f1a8384a673b03969426a94d07914ee.tar
tangerine-wallet-browser-77b72ee33f1a8384a673b03969426a94d07914ee.tar.gz
tangerine-wallet-browser-77b72ee33f1a8384a673b03969426a94d07914ee.tar.bz2
tangerine-wallet-browser-77b72ee33f1a8384a673b03969426a94d07914ee.tar.lz
tangerine-wallet-browser-77b72ee33f1a8384a673b03969426a94d07914ee.tar.xz
tangerine-wallet-browser-77b72ee33f1a8384a673b03969426a94d07914ee.tar.zst
tangerine-wallet-browser-77b72ee33f1a8384a673b03969426a94d07914ee.zip
Add selectors for txsToRender and conversionRate
Diffstat (limited to 'ui/app/selectors.js')
-rw-r--r--ui/app/selectors.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/ui/app/selectors.js b/ui/app/selectors.js
index 749f18d3b..fd203dbb4 100644
--- a/ui/app/selectors.js
+++ b/ui/app/selectors.js
@@ -1,7 +1,11 @@
+const valuesFor = require('./util').valuesFor
+
const selectors = {
getSelectedAddress,
getSelectedIdentity,
getSelectedAccount,
+ conversionRateSelector,
+ transactionsSelector,
}
module.exports = selectors
@@ -24,4 +28,18 @@ function getSelectedAccount(state) {
const selectedAddress = getSelectedAddress(state)
return accounts[selectedAddress]
+}
+
+function conversionRateSelector(state) {
+ return state.metamask.conversionRate
+}
+
+function transactionsSelector(state) {
+ const { network } = state.metamask
+ const unapprovedMsgs = valuesFor(state.metamask.unapprovedMsgs)
+ const shapeShiftTxList = (network === '1') ? state.metamask.shapeShiftTxList : undefined
+ const transactions = state.metamask.selectedAddressTxList || []
+ const txsToRender = !shapeShiftTxList ? transactions.concat(unapprovedMsgs) : transactions.concat(unapprovedMsgs, shapeShiftTxList)
+
+ return txsToRender.sort((a, b) => b.time - a.time)
} \ No newline at end of file