Skip to content

Commit

Permalink
[SOV-4525] - Display LP Fee Rate Without Wallet Connection
Browse files Browse the repository at this point in the history
  • Loading branch information
pietro-maximoff committed Oct 28, 2024
1 parent 952a673 commit e4ed82d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions apps/frontend/src/contexts/CrocContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import React, {
import { getProvider } from '@sovryn/ethers-provider';
import { CrocEnv } from '@sovryn/sdex';

import { useAccount } from '../hooks/useAccount';
import { useCurrentChain } from '../hooks/useChainStore';

type CrocContextValue = {
Expand All @@ -27,14 +26,13 @@ export const useCrocContext = () => useContext(CrocContext) as CrocContextValue;

export const CrocContextProvider: FC<PropsWithChildren> = ({ children }) => {
const chainId = useCurrentChain();
const { account, signer } = useAccount();
const [croc, setCroc] = useState(defaultContextValue.croc);

useEffect(() => {
if (!croc && account) {
setCroc(new CrocEnv(getProvider(chainId), signer));
if (!croc) {
setCroc(new CrocEnv(getProvider(chainId)));
}
}, [croc, account, signer, chainId]);
}, [croc, chainId]);

return (
<CrocContext.Provider value={{ croc }}>{children}</CrocContext.Provider>
Expand Down

0 comments on commit e4ed82d

Please sign in to comment.