Skip to content

Commit fd3aa44

Browse files
committed
fix: simulator didnt work if wallet is not connected
1 parent 0f16c7a commit fd3aa44

File tree

1 file changed

+11
-7
lines changed
  • web/src/pages/Courts/CourtDetails/StakePanel/SimulatorPopup

1 file changed

+11
-7
lines changed

web/src/pages/Courts/CourtDetails/StakePanel/SimulatorPopup/index.tsx

+11-7
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,19 @@ const SimulatorPopup: React.FC<ISimulatorPopup> = ({ amountToStake, isStaking })
139139
const { address } = useAccount();
140140
const { data: stakeData } = useJurorStakeDetailsQuery(address?.toLowerCase() as `0x${string}`);
141141
const courtStakeData = stakeData?.jurorTokensPerCourts?.find(({ court }) => court.id === id);
142-
const jurorCurrentEffectiveStake = !isUndefined(courtStakeData)
143-
? Number(formatEther(courtStakeData.effectiveStake))
144-
: undefined;
145-
const jurorCurrentSpecificStake = !isUndefined(courtStakeData)
146-
? Number(formatEther(courtStakeData.staked))
147-
: undefined;
142+
const jurorCurrentEffectiveStake = address
143+
? !isUndefined(courtStakeData)
144+
? Number(formatEther(courtStakeData.effectiveStake))
145+
: undefined
146+
: 0;
147+
const jurorCurrentSpecificStake = address
148+
? !isUndefined(courtStakeData)
149+
? Number(formatEther(courtStakeData.staked))
150+
: undefined
151+
: 0;
148152

149153
const timeframedCourtData = useHomePageExtraStats(30);
150-
const { prices: pricesData } = useCoinPrice([CoinIds.ETH, CoinIds.PNK]);
154+
const { prices: pricesData } = useCoinPrice([CoinIds.ETH]);
151155
const ethPriceUSD = pricesData ? pricesData[CoinIds.ETH]?.price : undefined;
152156

153157
const foundCourt = useMemo(() => {

0 commit comments

Comments
 (0)