Skip to content

Commit

Permalink
fix: portfolio stats when value is 0 (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
YohanTz authored Sep 25, 2024
1 parent 4720187 commit b23654d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface PortfolioValueProps {
export default function PortfolioValue({ address }: PortfolioValueProps) {
const { data } = usePortfolioStats({ address });
const { convertInUsd, isLoading } = usePrices();
const totalValue = formatUnits(data.total_value, 18);
const totalValue = formatUnits(data.total_value ?? "0", 18);
const totalValueInUsd = convertInUsd({ amount: parseEther(totalValue) });

return (
Expand Down
2 changes: 1 addition & 1 deletion apps/arkmarket/src/hooks/usePortfolioStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function usePortfolioStats({ address }: UsePortfolioStatsProps) {
queryFn: () => getPortfolioStats({ address }),
refetchInterval: REFETCH_INTERVAL,
initialData: {
total_value: "0",
total_value: null,
},
enabled: !!address,
});
Expand Down
2 changes: 1 addition & 1 deletion apps/arkmarket/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export interface OwnersTokensApiResponse {
}

export interface PortfolioStats {
total_value: string;
total_value: string | null;
}

export interface TokenMarketData {
Expand Down

0 comments on commit b23654d

Please sign in to comment.