Skip to content

Commit

Permalink
fix: optimism sepolia on wq reqs page
Browse files Browse the repository at this point in the history
  • Loading branch information
solidovic committed Sep 20, 2024
1 parent f901862 commit 289e4a9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
6 changes: 4 additions & 2 deletions features/withdrawals/hooks/contract/useRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useSTETHContractRPC,
useWSTETHContractRPC,
} from '@lido-sdk/react';
import { TOKENS, getWithdrawalQueueAddress } from '@lido-sdk/constants';
import { TOKENS, CHAINS, getWithdrawalQueueAddress } from '@lido-sdk/constants';

import { TokensWithdrawable } from 'features/withdrawals/types/tokens-withdrawable';
import { useWithdrawals } from 'features/withdrawals/contexts/withdrawals-context';
Expand Down Expand Up @@ -195,7 +195,9 @@ export const useWithdrawalRequest = ({
onRetry,
}: useWithdrawalRequestParams) => {
const { chainId } = useSDK();
const withdrawalQueueAddress = getWithdrawalQueueAddress(chainId);
const withdrawalQueueAddress = getWithdrawalQueueAddress(
chainId === CHAINS.OptimismSepolia ? CHAINS.Sepolia : chainId,
);

const { connector, address } = useAccount();
const { isBunker } = useWithdrawals();
Expand Down
16 changes: 14 additions & 2 deletions features/withdrawals/hooks/contract/useUnfinalizedSteth.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import { useContractSWR } from '@lido-sdk/react';
import { useMemo } from 'react';
import { useContractSWR, contractHooksFactory } from '@lido-sdk/react';
import { WithdrawalQueueAbiFactory } from '@lido-sdk/contracts';
import { CHAINS, getWithdrawalQueueAddress } from '@lido-sdk/constants';

import { useWithdrawalsContract } from './useWithdrawalsContract';
import { STRATEGY_LAZY } from 'consts/swr-strategies';

export const useUnfinalizedStETH = () => {
const { contractRpc } = useWithdrawalsContract();

const sepoliaContractRPC = useMemo(() => {
const withdrawalQueue = contractHooksFactory(
WithdrawalQueueAbiFactory,
() => getWithdrawalQueueAddress(CHAINS.Sepolia),
);
return withdrawalQueue.useContractRPC;
}, []);

return useContractSWR({
contract: contractRpc,
contract: contractRpc ? contractRpc : sepoliaContractRPC,
// contract: useWithdrawalQueueContractRPC,
method: 'unfinalizedStETH',
config: STRATEGY_LAZY,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const useWithdrawalsBaseData =
const { contractRpc } = useWithdrawalsContract();

return useLidoSWR(
['swr:wqBaseData', contractRpc.address, chainId],
['swr:wqBaseData', contractRpc?.address, chainId],
async () => {
const [minAmount, maxAmount, isPausedMode, isBunkerMode] =
await Promise.all([
Expand Down

0 comments on commit 289e4a9

Please sign in to comment.