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 = {
|
const selectors = {
|
||||||
getSelectedAddress,
|
getSelectedAddress,
|
||||||
getSelectedIdentity,
|
getSelectedIdentity,
|
||||||
getSelectedAccount,
|
getSelectedAccount,
|
||||||
|
conversionRateSelector,
|
||||||
|
transactionsSelector,
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = selectors
|
module.exports = selectors
|
||||||
@ -24,4 +28,18 @@ function getSelectedAccount(state) {
|
|||||||
const selectedAddress = getSelectedAddress(state)
|
const selectedAddress = getSelectedAddress(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