mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Add selectors for txsToRender and conversionRate
This commit is contained in:
parent
95eda70efe
commit
77b72ee33f
@ -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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user