mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +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 = {
|
const selectors = {
|
||||||
getSelectedAddress,
|
getSelectedAddress,
|
||||||
getSelectedIdentity,
|
getSelectedIdentity,
|
||||||
getSelectedAccount,
|
getSelectedAccount,
|
||||||
|
conversionRateSelector,
|
||||||
|
transactionsSelector,
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = selectors
|
module.exports = selectors
|
||||||
@ -25,3 +29,17 @@ function getSelectedAccount(state) {
|
|||||||
|
|
||||||
return accounts[selectedAddress]
|
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