add selectors for total supports and claim supports #178

Merged
zxawry merged 5 commits from supports-selectors into master 2019-08-16 06:25:33 +02:00
Showing only changes of commit d6ca449bd9 - Show all commits

View file

@ -90,6 +90,21 @@ export const selectSupportsByOutpoint = createSelector(
state => state.supports || {} 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( export const selectTransactionItems = createSelector(
selectTransactionsById, selectTransactionsById,
byId => { byId => {