WA-234 Adding pendingTransactions selector

This commit is contained in:
apanizo 2018-06-12 10:37:59 +02:00
parent 442723cfad
commit 9bef7f3894
1 changed files with 16 additions and 1 deletions

View File

@ -1,11 +1,26 @@
// @flow
import { createStructuredSelector } from 'reselect'
import { List } from 'immutable'
import { createStructuredSelector, createSelector } from 'reselect'
import { userAccountSelector } from '~/wallets/store/selectors/index'
import { type Transaction } from '~/routes/safe/store/model/transaction'
import { safeTransactionsSelector } from '~/routes/safe/store/selectors/index'
const pendingTransactionsSelector = createSelector(
safeTransactionsSelector,
(transactions: List<Transaction>) =>
transactions.findEntry((transaction: Transaction) => {
const txHash = transaction.get('tx')
return txHash === '' || txHash === undefined
}) !== undefined,
)
export type SelectorProps = {
executor: userAccountSelector,
pendingTransactions: pendingTransactionsSelector,
}
export default createStructuredSelector({
executor: userAccountSelector,
pendingTransactions: pendingTransactionsSelector,
})