diff options
author | Alexander Tseung <alextsg@gmail.com> | 2018-07-24 11:25:04 +0800 |
---|---|---|
committer | Alexander Tseung <alextsg@gmail.com> | 2018-07-24 11:25:04 +0800 |
commit | 152246f3b0862c8c5a8b42872852d236400c0e9d (patch) | |
tree | ddcaf398ef77eb07d5de35cfa96ac8eaa559c3cd /ui/app/selectors | |
parent | 2359062b62cf65f38b36ccb6bb33fa7d15ada1ae (diff) | |
download | tangerine-wallet-browser-152246f3b0862c8c5a8b42872852d236400c0e9d.tar tangerine-wallet-browser-152246f3b0862c8c5a8b42872852d236400c0e9d.tar.gz tangerine-wallet-browser-152246f3b0862c8c5a8b42872852d236400c0e9d.tar.bz2 tangerine-wallet-browser-152246f3b0862c8c5a8b42872852d236400c0e9d.tar.lz tangerine-wallet-browser-152246f3b0862c8c5a8b42872852d236400c0e9d.tar.xz tangerine-wallet-browser-152246f3b0862c8c5a8b42872852d236400c0e9d.tar.zst tangerine-wallet-browser-152246f3b0862c8c5a8b42872852d236400c0e9d.zip |
Add close window support to signature requests. Move logic to actions
Diffstat (limited to 'ui/app/selectors')
-rw-r--r-- | ui/app/selectors/confirm-transaction.js | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/ui/app/selectors/confirm-transaction.js b/ui/app/selectors/confirm-transaction.js index 54016a30e..8f8e0ea74 100644 --- a/ui/app/selectors/confirm-transaction.js +++ b/ui/app/selectors/confirm-transaction.js @@ -62,6 +62,34 @@ export const unconfirmedTransactionsHashSelector = createSelector( } ) +const unapprovedMsgCountSelector = state => state.metamask.unapprovedMsgCount +const unapprovedPersonalMsgCountSelector = state => state.metamask.unapprovedPersonalMsgCount +const unapprovedTypedMessagesCountSelector = state => state.metamask.unapprovedTypedMessagesCount + +export const unconfirmedTransactionsCountSelector = createSelector( + unapprovedTxsSelector, + unapprovedMsgCountSelector, + unapprovedPersonalMsgCountSelector, + unapprovedTypedMessagesCountSelector, + networkSelector, + ( + unapprovedTxs = {}, + unapprovedMsgCount = 0, + unapprovedPersonalMsgCount = 0, + unapprovedTypedMessagesCount = 0, + network + ) => { + const filteredUnapprovedTxIds = Object.keys(unapprovedTxs).filter(txId => { + const { metamaskNetworkId } = unapprovedTxs[txId] + return metamaskNetworkId === network + }) + + return filteredUnapprovedTxIds.length + unapprovedTypedMessagesCount + unapprovedMsgCount + + unapprovedPersonalMsgCount + } +) + + export const currentCurrencySelector = state => state.metamask.currentCurrency export const conversionRateSelector = state => state.metamask.conversionRate @@ -156,7 +184,6 @@ export const sendTokenTokenAmountAndToAddressSelector = createSelector( } ) - export const contractExchangeRateSelector = createSelector( contractExchangeRatesSelector, tokenAddressSelector, |