Skip to content

Commit

Permalink
fix(web): attempt-to-fix-sdk-not-defined-in-deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Harman-singh-waraich committed Mar 4, 2024
1 parent 91d79f6 commit d8cf199
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions web/src/context/LiFiProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ export const useLifiSDK = () => {
return context;
};

const lifi = new LiFi({
integrator: "Kleros",
apiUrl: "https://staging.li.quest/v1",
});

export const LifiProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const { address } = useAccount();
const [tokens, setTokens] = useState<Token[]>([]);
Expand All @@ -75,6 +70,12 @@ export const LifiProvider: React.FC<{ children: React.ReactNode }> = ({ children
setSelectedRoute(undefined);
setRoutes([]);
};

const lifi = new LiFi({
integrator: "Kleros",
apiUrl: "https://staging.li.quest/v1",
});

// update tokens for the chain
useEffect(() => {
resetRoutes();
Expand All @@ -92,7 +93,7 @@ export const LifiProvider: React.FC<{ children: React.ReactNode }> = ({ children
.getTokenBalance(address, fromToken)
.then((res) => setSwapData({ ...swapData, tokenBalance: res?.amount }))
.catch((err) => console.log("Error fetching token balance: ", { err }));
}, [swapData.fromToken, address, tokens, swapData.fromTokenAddress, lifi]);
}, [swapData.fromToken, address, tokens, swapData.fromTokenAddress]);

useDebounce(
() => {
Expand Down Expand Up @@ -137,7 +138,7 @@ export const LifiProvider: React.FC<{ children: React.ReactNode }> = ({ children
return { status: false };
})
.finally(() => setIsExecuting(false));
}, [routes, signer, lifi]);
}, [routes, signer]);

return (
<LifiContext.Provider
Expand Down

0 comments on commit d8cf199

Please sign in to comment.