Skip to content

Commit fed06f9

Browse files
committed
refactor: useBalance hook to use balanceSelector
1 parent e65f651 commit fed06f9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/store/reselect/aggregations.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { ETransferType } from '../types/wallet';
88
import { blocktankInfoSelector } from './blocktank';
99
import {
1010
channelsSizeSelector,
11-
claimableBalanceSelector,
1211
lightningBalanceSelector,
1312
pendingPaymentsSelector,
1413
} from './lightning';
@@ -41,19 +40,22 @@ export const balanceSelector = createSelector(
4140
onChainBalanceSelector,
4241
pendingTransfersSelector,
4342
pendingPaymentsSelector,
44-
claimableBalanceSelector,
4543
newChannelsNotificationsSelector,
4644
lightningBalanceSelector,
4745
],
4846
(
4947
onchainBalance,
5048
pendingTransfers,
5149
pendingPayments,
52-
claimableBalance,
5350
newChannels,
5451
lnBalance,
5552
): TBalance => {
56-
const { lightningBalance, spendingBalance, reserveBalance } = lnBalance;
53+
const {
54+
lightningBalance,
55+
spendingBalance,
56+
reserveBalance,
57+
claimableBalance,
58+
} = lnBalance;
5759
const spendableBalance = onchainBalance + spendingBalance;
5860
const pendingPaymentsBalance = pendingPayments.reduce(
5961
(acc, payment) => acc + payment.amount,
@@ -128,7 +130,8 @@ export const lnSetupSelector = createSelector(
128130
(_, spending): number => spending,
129131
],
130132
(blocktankInfo, balance, channelsSize, spending: number): TLnSetup => {
131-
const { totalBalance, onchainBalance, lightningBalance } = balance;
133+
const { onchainBalance, lightningBalance } = balance;
134+
const totalBalance = onchainBalance + lightningBalance;
132135
const clientBalance = spending - lightningBalance;
133136
const { minChannelSizeSat, maxChannelSizeSat } = blocktankInfo.options;
134137
// Because BT /info minChannelSizeSat constantly changes depending on network fees,

0 commit comments

Comments
 (0)