diff --git a/src/hooks/starknet-react.ts b/src/hooks/starknet-react.ts index 5441359e..ea0c4b58 100644 --- a/src/hooks/starknet-react.ts +++ b/src/hooks/starknet-react.ts @@ -45,12 +45,14 @@ export const useAccountDetails = (): { useEffect(() => { const fetchChainId = async () => { - try { - const Id = await provider.getChainId() - const convertedId: ChainId | undefined = convertStarknetToChainId(Id) - setChainId(convertedId) - } catch (error) { - console.error('Error fetching chainId:', error) + if (account) { + try { + const Id = await provider.getChainId() + const convertedId: ChainId | undefined = convertStarknetToChainId(Id) + setChainId(convertedId) + } catch (error) { + console.error('Error fetching chainId:', error) + } } } diff --git a/src/hooks/useV3SwapPools.ts b/src/hooks/useV3SwapPools.ts index 9674c01a..a998bbae 100644 --- a/src/hooks/useV3SwapPools.ts +++ b/src/hooks/useV3SwapPools.ts @@ -81,7 +81,7 @@ export function useV3SwapPools( pools: Pool[] loading: boolean } { - if (!allPools?.length) return { pools: [], loading: false } + if (!allPools || !allPools?.length) return { pools: [], loading: false } const poolProps = allPools.map((poolAddress: string) => getPoolProps(poolAddress))