Skip to content

Commit ea165ff

Browse files
committed
fiat wallets partial selection bug fix
1 parent ad4a769 commit ea165ff

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

packages/wallet-widget/src/components/SequenceWalletProvider/ProviderComponents/FiatWalletsMapProvider.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import { computeBalanceFiat } from '../../../utils'
1010
// Define the provider component
1111
export const FiatWalletsMapProvider = ({ children }: { children: ReactNode }) => {
1212
const { wallets } = useWallets()
13-
const { selectedNetworks, selectedWallets, hideUnlistedTokens, fiatCurrency } = useSettings()
13+
const { selectedNetworks, hideUnlistedTokens, fiatCurrency } = useSettings()
1414

1515
const [fiatWalletsMap, setFiatWalletsMap] = useState<FiatWalletPair[]>([])
1616

1717
const { data: tokenBalancesData, isPending: isTokenBalancesPending } = useGetTokenBalancesDetails({
1818
chainIds: selectedNetworks,
1919
filter: {
20-
accountAddresses: selectedWallets.map(wallet => wallet.address),
20+
accountAddresses: wallets.map(wallet => wallet.address),
2121
contractStatus: hideUnlistedTokens ? ContractVerificationStatus.VERIFIED : ContractVerificationStatus.ALL,
2222
omitNativeBalances: false
2323
}
@@ -69,7 +69,7 @@ export const FiatWalletsMapProvider = ({ children }: { children: ReactNode }) =>
6969
setFiatWalletsMap(newFiatWalletsMap)
7070
}
7171
}
72-
}, [coinBalancesUnordered, coinPrices, conversionRate, fiatCurrency, selectedNetworks, selectedWallets, hideUnlistedTokens])
72+
}, [coinBalancesUnordered, coinPrices, conversionRate])
7373

7474
return <FiatWalletsMapContextProvider value={{ fiatWalletsMap, setFiatWalletsMap }}>{children}</FiatWalletsMapContextProvider>
7575
}

packages/wallet-widget/src/views/Home/IntegratedWallet/index.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@ export const IntegratedWallet = () => {
7575

7676
const isPending = isTokenBalancesPending || isCoinPricesPending || isConversionRatePending
7777

78-
const totalFiatValue = fiatWalletsMap.reduce((acc, wallet) => acc + Number(wallet.fiatValue), 0)
78+
const totalFiatValue = fiatWalletsMap.reduce((acc, wallet) => {
79+
if (selectedWallets.some(selectedWallet => selectedWallet.address === wallet.accountAddress)) {
80+
const walletFiatValue = Number(wallet.fiatValue)
81+
return acc + walletFiatValue
82+
}
83+
return acc
84+
}, 0)
7985

8086
const coinBalances = coinBalancesUnordered.sort((a, b) => {
8187
const isHigherFiat =
@@ -332,7 +338,9 @@ export const IntegratedWallet = () => {
332338
label="Select active wallet"
333339
buttonLabel="Close"
334340
type="bypassMenuWallets"
335-
handleButtonPress={() => {}}
341+
handleButtonPress={() => {
342+
setWalletFilterOpen(false)
343+
}}
336344
/>
337345
)}
338346
</AnimatePresence>

0 commit comments

Comments
 (0)