From 0a17becfb9723861f03c0d793f6952ecc9ab1dff Mon Sep 17 00:00:00 2001 From: Tom Kirkpatrick Date: Fri, 18 Sep 2020 21:03:21 +0100 Subject: [PATCH] fix(wallet): improve channels menu balance display --- renderer/containers/Channels/ChannelsMenu.js | 2 +- renderer/reducers/balance/selectors.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/renderer/containers/Channels/ChannelsMenu.js b/renderer/containers/Channels/ChannelsMenu.js index ef7f13e4d6b..abe84537985 100644 --- a/renderer/containers/Channels/ChannelsMenu.js +++ b/renderer/containers/Channels/ChannelsMenu.js @@ -8,7 +8,7 @@ import { channelsSelectors } from 'reducers/channels' const mapStateToProps = state => ({ cryptoUnitName: tickerSelectors.cryptoUnitName(state), lightningBalance: balanceSelectors.channelBalanceConfirmed(state), - pendingBalance: balanceSelectors.channelBalancePending(state), + pendingBalance: balanceSelectors.pendingBalance(state), onchainBalance: balanceSelectors.walletBalance(state), channelCount: channelsSelectors.allChannelsCount(state), }) diff --git a/renderer/reducers/balance/selectors.js b/renderer/reducers/balance/selectors.js index db24301b48d..bf7160843a2 100644 --- a/renderer/reducers/balance/selectors.js +++ b/renderer/reducers/balance/selectors.js @@ -61,6 +61,16 @@ export const walletBalanceUnconfirmed = state => state.balance.walletBalanceUnco */ export const limboBalance = state => state.channels.pendingChannels.totalLimboBalance +/** + * pendingBalance - Pending balance. + * + * @param {State} state Redux state + * @returns {string|null} Pending balance + */ +export const pendingBalance = createSelector(channelBalancePending, limboBalance, (cb, lb) => { + return CoinBig.sum(cb, lb).toString() +}) + /** * totalBalance - Total balance. * @@ -96,5 +106,6 @@ export default { walletBalanceConfirmed, walletBalanceUnconfirmed, limboBalance, + pendingBalance, totalBalance, }