add selector for total supports

This commit is contained in:
zxawry 2019-08-11 17:29:21 +01:00
parent 3098aa2d5e
commit d6ca449bd9
No known key found for this signature in database
GPG key ID: 70F5D1B4F51F051A

View file

@ -90,6 +90,21 @@ export const selectSupportsByOutpoint = createSelector(
state => state.supports || {}
);
export const selectTotalSupports = createSelector(
selectSupportsByOutpoint,
byOutpoint => {
let total = parseFloat("0.0");
//let total = 0.0;
Object.values(byOutpoint).forEach(support => {
const { amount } = support;
total = amount ? total + parseFloat(amount) : total;
});
return total;
}
);
export const selectTransactionItems = createSelector(
selectTransactionsById,
byId => {