diff --git a/apps/app/src/components/Account/AccountDepositsHeader.tsx b/apps/app/src/components/Account/AccountDepositsHeader.tsx index 716304c0..ae7554ac 100644 --- a/apps/app/src/components/Account/AccountDepositsHeader.tsx +++ b/apps/app/src/components/Account/AccountDepositsHeader.tsx @@ -1,4 +1,3 @@ -import { useUserTotalBalance } from '@generationsoftware/hyperstructure-react-hooks' import { CurrencyValue } from '@shared/react-components' import { Spinner } from '@shared/ui' import { NETWORK, shorten } from '@shared/utilities' @@ -7,6 +6,7 @@ import { useTranslations } from 'next-intl' import { useMemo } from 'react' import { Address } from 'viem' import { useAccount, useEnsName } from 'wagmi' +import { useUserTotalBalance } from '@hooks/useUserTotalBalance' interface AccountDepositsHeaderProps { address?: Address diff --git a/packages/hyperstructure-react-hooks/src/vaults/useUserTotalBalance.ts b/apps/app/src/hooks/useUserTotalBalance.ts similarity index 85% rename from packages/hyperstructure-react-hooks/src/vaults/useUserTotalBalance.ts rename to apps/app/src/hooks/useUserTotalBalance.ts index 7d468187..1fc3b7fa 100644 --- a/packages/hyperstructure-react-hooks/src/vaults/useUserTotalBalance.ts +++ b/apps/app/src/hooks/useUserTotalBalance.ts @@ -1,6 +1,10 @@ +import { + useAllUserVaultBalances, + useAllVaultSharePrices, + useSelectedVaults +} from '@generationsoftware/hyperstructure-react-hooks' import { useMemo } from 'react' import { Address, formatUnits } from 'viem' -import { useAllUserVaultBalances, useAllVaultSharePrices, useSelectedVaults } from '..' /** * Returns a user's total balance in ETH @@ -24,7 +28,8 @@ export const useUserTotalBalance = (userAddress: Address) => { isFetchedVaultBalances && !!allVaultShareTokens && !!vaultBalances && - !!vaults.underlyingTokenAddresses + !!vaults.underlyingTokenAddresses && + Object.values(allVaultShareTokens).some((token) => token.price !== undefined) const data = useMemo(() => { if (isFetched) { diff --git a/apps/app/src/hooks/useUserTotalDelegations.ts b/apps/app/src/hooks/useUserTotalDelegations.ts index 73411440..ee891d44 100644 --- a/apps/app/src/hooks/useUserTotalDelegations.ts +++ b/apps/app/src/hooks/useUserTotalDelegations.ts @@ -34,7 +34,8 @@ export const useUserTotalDelegations = (userAddress: Address) => { !!allVaultSharePrices && !!shareBalances && !!delegationBalances && - !!vaults.underlyingTokenAddresses + !!vaults.underlyingTokenAddresses && + Object.values(allVaultSharePrices).some((token) => token.price !== undefined) const data = useMemo(() => { if (isFetched) { diff --git a/apps/app/src/hooks/useUserTotalWinnings.ts b/apps/app/src/hooks/useUserTotalWinnings.ts index 005819f6..f8678245 100644 --- a/apps/app/src/hooks/useUserTotalWinnings.ts +++ b/apps/app/src/hooks/useUserTotalWinnings.ts @@ -9,6 +9,8 @@ import { useSupportedPrizePools } from './useSupportedPrizePools' /** * Returns a user's total prize winnings in ETH + * @param userAddress user address to get total winnings for + * @param options optional settings * @returns */ export const useUserTotalWinnings = ( @@ -54,7 +56,12 @@ export const useUserTotalWinnings = ( return useMemo(() => { const isFetched = - isFetchedWins && isFetchedPrizeToken && !!wins && !!prizeToken && !!totalTokensWonByChain + isFetchedWins && + isFetchedPrizeToken && + !!wins && + !!prizeToken && + prizeToken.price !== undefined && + !!totalTokensWonByChain let totalWinnings = 0 diff --git a/packages/hyperstructure-react-hooks/README.md b/packages/hyperstructure-react-hooks/README.md index 5ba3d141..a522f6ad 100644 --- a/packages/hyperstructure-react-hooks/README.md +++ b/packages/hyperstructure-react-hooks/README.md @@ -154,7 +154,6 @@ yarn add @generationsoftware/hyperstructure-react-hooks - `useAllVaultTokenPrices` - `useAllVaultTotalSupplyTwabs` - `useSortedVaults` -- `useUserTotalBalance` - `useUserVaultDelegate` - `useUserVaultDelegationBalance` - `useUserVaultShareBalance` diff --git a/packages/hyperstructure-react-hooks/package.json b/packages/hyperstructure-react-hooks/package.json index 5ea54a3e..427eb631 100644 --- a/packages/hyperstructure-react-hooks/package.json +++ b/packages/hyperstructure-react-hooks/package.json @@ -1,6 +1,6 @@ { "name": "@generationsoftware/hyperstructure-react-hooks", - "version": "1.7.9", + "version": "1.7.10", "license": "MIT", "main": "./dist/index.mjs", "types": "./dist/index.d.ts", diff --git a/packages/hyperstructure-react-hooks/src/index.ts b/packages/hyperstructure-react-hooks/src/index.ts index 4fcec14e..edf3d23f 100644 --- a/packages/hyperstructure-react-hooks/src/index.ts +++ b/packages/hyperstructure-react-hooks/src/index.ts @@ -115,7 +115,6 @@ export * from './vaults/useAllVaultTokenData' export * from './vaults/useAllVaultTokenPrices' export * from './vaults/useAllVaultTotalSupplyTwabs' export * from './vaults/useSortedVaults' -export * from './vaults/useUserTotalBalance' export * from './vaults/useUserVaultDelegate' export * from './vaults/useUserVaultDelegationBalance' export * from './vaults/useUserVaultShareBalance'