Skip to content

Commit

Permalink
chore: addd route handler
Browse files Browse the repository at this point in the history
  • Loading branch information
slavastartsev committed Jan 24, 2025
1 parent 5fb2557 commit 5eeb8b0
Show file tree
Hide file tree
Showing 10 changed files with 628 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@ import { BridgeAlert } from './BridgeAlert';
import { l1StandardBridgeAbi } from '@/abis/L1StandardBridge.abi';
import { l2StandardBridgeAbi } from '@/abis/L2StandardBridge.abi';
import { AuthButton } from '@/connect-ui';
import { L1_CHAIN, L2_CHAIN } from '@/constants';
import { L1_CHAIN, L2_CHAIN, publicClientL1, publicClientL2 } from '@/constants';
import { bridgeContracts } from '@/constants/bridge';
import {
BridgeToken,
useApproval,
useBalances,
useBridgeTokens,
useIsContract,
usePublicClientL1,
usePublicClientL2,
useSubscribeBalances,
useWalletClientL1,
useWalletClientL2
Expand Down Expand Up @@ -91,9 +89,6 @@ const BobBridgeForm = ({

const { data: tokens } = useBridgeTokens(L1_CHAIN, L2_CHAIN);

const publicClientL1 = usePublicClientL1();
const publicClientL2 = usePublicClientL2();

const walletClientL1 = useWalletClientL1();
const walletClientL2 = useWalletClientL2();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import { ProveStep } from './ProveStep';
import { RelayStep } from './RelayStep';
import { TimeStep } from './TimeStep';

import { usePublicClientL1, usePublicClientL2, useWalletClientL1, useWalletClientL2 } from '@/hooks';
import { useWalletClientL1, useWalletClientL2 } from '@/hooks';
import { bridgeKeys } from '@/lib/react-query';
import { publicClientL1, publicClientL2 } from '@/constants';

type Props = { data: BridgeTransaction; isExpanded: boolean; onProveSuccess?: () => void; onRelaySuccess?: () => void };

Expand All @@ -25,9 +26,6 @@ type InheritAttrs = Omit<FlexProps, keyof Props | 'children'>;
type WithdrawStatusProps = Props & InheritAttrs;

const WithdrawStatus = ({ data, isExpanded, onProveSuccess, onRelaySuccess }: WithdrawStatusProps): JSX.Element => {
const publicClientL1 = usePublicClientL1();
const publicClientL2 = usePublicClientL2();

const walletClientL1 = useWalletClientL1();
const walletClientL2 = useWalletClientL2();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { Address, TransactionReceipt, decodeAbiParameters, isAddressEqual, parse
import { GetWithdrawalStatusReturnType, getL2TransactionHashes, getWithdrawals } from 'viem/op-stack';
import { useAccount } from 'wagmi';

import { ETH, INTERVAL, L1_CHAIN, L2_CHAIN, wstETH } from '@/constants';
import { useBridgeTokens, usePublicClientL1, usePublicClientL2 } from '@/hooks';
import { ETH, INTERVAL, L1_CHAIN, L2_CHAIN, publicClientL1, publicClientL2, wstETH } from '@/constants';
import { useBridgeTokens } from '@/hooks';
import { bridgeKeys } from '@/lib/react-query';
import { store } from '@/lib/store';
import { BridgeTransaction, BridgeTransactionStatus, TransactionDirection, TransactionType } from '@/types';
Expand Down Expand Up @@ -193,8 +193,6 @@ const getWithdrawRefetchInterval = ((query: any) => {
const useGetBridgeTransactions = () => {
const { address } = useAccount();
const { data: tokens } = useBridgeTokens(L1_CHAIN, L2_CHAIN);
const publicClientL1 = usePublicClientL1();
const publicClientL2 = usePublicClientL2();

const queryClient = useQueryClient();

Expand All @@ -221,7 +219,7 @@ const useGetBridgeTransactions = () => {

return receipt;
},
[publicClientL1, publicClientL2, queryClient]
[queryClient]
);

const getDepositStatus = useCallback(
Expand Down Expand Up @@ -299,7 +297,7 @@ const useGetBridgeTransactions = () => {

return remainingTime ? new Date(remainingTime) : undefined;
},
[address, publicClientL1, publicClientL2.chain, queryClient]
[address, queryClient]
);

const getWithdrawStatus = useCallback(
Expand Down Expand Up @@ -339,7 +337,7 @@ const useGetBridgeTransactions = () => {
statusEndDate
};
},
[getTxReceipt, address, publicClientL1, getStatusEndDate, queryClient]
[getTxReceipt, address, getStatusEndDate, queryClient]
);

const getEthDeposit = useCallback(
Expand Down
Loading

0 comments on commit 5eeb8b0

Please sign in to comment.