Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions config/external-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export { ManifestConfigPageList, ManifestConfigPageEnum } from './types';
export {
isManifestValid,
isManifestEntryValid,
isEnabledDexesValid,
isFeatureFlagsValid,
isMultiChainBannerValid,
isPagesValid,
shouldRedirectToRoot,
} from './utils';
6 changes: 2 additions & 4 deletions modules/web3/hooks/use-aa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { TransactionCallbackStage } from '@lidofinance/lido-ethereum-sdk';

import { useDappStatus } from './use-dapp-status';
import { useLidoSDK, useLidoSDKL2 } from '../web3-provider';
import { useLidoSDK } from '../web3-provider';
import { config } from 'config';

import type { Address, Hash } from 'viem';
Expand Down Expand Up @@ -75,9 +75,7 @@ export type AACall = { to: Address; data?: Hash; value?: bigint };

export const useSendAACalls = () => {
const { sendCallsAsync } = useSendCalls();
const { core: l1core } = useLidoSDK();
const { core: l2core, isL2 } = useLidoSDKL2();
const core = isL2 ? l2core : l1core;
const { core } = useLidoSDK();

return useCallback(
async (
Expand Down
12 changes: 5 additions & 7 deletions modules/web3/hooks/use-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useAccount,
} from 'wagmi';

import { useDappStatus, useLidoSDK, useLidoSDKL2 } from 'modules/web3';
import { useDappStatus, useLidoSDK } from 'modules/web3';
import { config } from 'config';

import type { Address, WatchContractEventOnLogsFn } from 'viem';
Expand Down Expand Up @@ -235,17 +235,16 @@ export const useStethBalance = ({
}: UseBalanceProps = {}) => {
const { chainId } = useDappStatus();
const { stETH } = useLidoSDK();
const { l2, isL2 } = useLidoSDKL2();
const { isSupportedChain, address } = useDappStatus();

const mergedAccount = account ?? address;

const { data: contract, isLoading } = useQuery({
queryKey: ['steth-contract', chainId, isL2],
queryKey: ['steth-contract', chainId],
enabled: !!mergedAccount && isSupportedChain,

staleTime: Infinity,
queryFn: async () => (isL2 ? l2.steth.getContract() : stETH.getContract()),
queryFn: async () => stETH.getContract(),
});

const balanceData = useTokenBalance(
Expand All @@ -269,13 +268,12 @@ export const useWstethBalance = ({
const mergedAccount = account ?? address;
const { chainId } = useDappStatus();
const { wstETH } = useLidoSDK();
const { l2, isL2 } = useLidoSDKL2();

const { data: contract, isLoading } = useQuery({
queryKey: ['wsteth-contract', chainId, isL2],
queryKey: ['wsteth-contract', chainId],
enabled: !!mergedAccount && isSupportedChain,
staleTime: Infinity,
queryFn: () => (isL2 ? l2.wsteth.getContract() : wstETH.getContract()),
queryFn: () => wstETH.getContract(),
});

const balanceData = useTokenBalance(
Expand Down
11 changes: 4 additions & 7 deletions modules/web3/hooks/use-stETH-by-wstETH.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import invariant from 'tiny-invariant';
import { useQuery } from '@tanstack/react-query';
import { useDappStatus, useLidoSDK, useLidoSDKL2 } from 'modules/web3';
import { useDappStatus, useLidoSDK } from 'modules/web3';

export const useStETHByWstETH = (wsteth?: bigint | null) => {
const { chainId } = useDappStatus();
const { wrap } = useLidoSDK();
const { l2, isL2 } = useLidoSDKL2();

return useQuery({
queryKey: ['use-steth-by-wsteth', wsteth?.toString(), isL2, chainId],
enabled: wsteth != null && !!(isL2 ? l2.steth : wrap),
queryKey: ['use-steth-by-wsteth', wsteth?.toString(), chainId],
enabled: wsteth != null && !!wrap,
staleTime: Infinity,
queryFn: () => {
if (wsteth === 0n) return 0n;
invariant(wsteth);

return isL2
? l2.steth.convertToSteth(wsteth)
: wrap.convertWstethToSteth(wsteth);
return wrap.convertWstethToSteth(wsteth);
},
});
};
10 changes: 4 additions & 6 deletions modules/web3/hooks/use-steth-contract-address.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { useQuery } from '@tanstack/react-query';
import { useLidoSDK, useLidoSDKL2 } from 'modules/web3';
import { useLidoSDK } from 'modules/web3';

export const useStETHContractAddress = () => {
const { stETH } = useLidoSDK();
const { l2, isL2 } = useLidoSDKL2();

return useQuery({
queryKey: ['use-steth-contract-address', isL2, l2.steth, stETH],
enabled: !!(isL2 ? l2.steth : stETH),
queryKey: ['use-steth-contract-address', stETH],
enabled: !!stETH,
staleTime: Infinity,
queryFn: () =>
isL2 ? l2.steth.contractAddress() : stETH.contractAddress(),
queryFn: () => stETH.contractAddress(),
});
};
11 changes: 4 additions & 7 deletions modules/web3/hooks/use-wstETH-by-stETH.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import invariant from 'tiny-invariant';
import { useQuery } from '@tanstack/react-query';
import { useLidoSDK, useLidoSDKL2 } from 'modules/web3';
import { useLidoSDK } from 'modules/web3';

export const useWstethBySteth = (steth?: bigint | null) => {
const { wrap, chainId } = useLidoSDK();
const { l2, isL2 } = useLidoSDKL2();

return useQuery({
queryKey: ['use-wsteth-by-steth', steth?.toString(), isL2, chainId],
enabled: steth != null && !!(isL2 ? l2.wsteth : wrap),
queryKey: ['use-wsteth-by-steth', steth?.toString(), chainId],
enabled: steth != null && !!wrap,
staleTime: Infinity,
queryFn: () => {
if (steth === 0n) return 0n;
invariant(steth);

return isL2
? l2.steth.convertToShares(steth)
: wrap.convertStethToWsteth(steth);
return wrap.convertStethToWsteth(steth);
},
});
};
10 changes: 4 additions & 6 deletions modules/web3/hooks/use-wsteth-contract-address.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { useQuery } from '@tanstack/react-query';
import { useLidoSDK, useLidoSDKL2 } from 'modules/web3';
import { useLidoSDK } from 'modules/web3';

export const useWstETHContractAddress = () => {
const { wstETH } = useLidoSDK();
const { l2, isL2 } = useLidoSDKL2();

return useQuery({
queryKey: ['use-wsteth-contract-address', isL2, l2.wsteth, wstETH],
enabled: !!(isL2 ? l2.wsteth : wstETH),
queryKey: ['use-wsteth-contract-address', wstETH],
enabled: !!wstETH,
staleTime: Infinity,
queryFn: () =>
isL2 ? l2.wsteth.contractAddress() : wstETH.contractAddress(),
queryFn: () => wstETH.contractAddress(),
});
};
6 changes: 3 additions & 3 deletions shared/wallet/fallback/useErrorMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ import { useConnectorInfo } from 'reef-knot/core-react';
// TODO: to remove the 'reef-knot/web3-react' after it will be deprecated
import { helpers } from 'reef-knot/web3-react';
import { joinWithOr } from 'utils/join-with-or';
import { useConnect } from 'wagmi';
import { useAccount, useConnect } from 'wagmi';

export const useErrorMessage = (): string | undefined => {
const { isLedger } = useConnectorInfo();
const {
isSupportedChain,
isChainTypeMatched,
isAccountActive,
chainType,
supportedChainLabels,
} = useDappStatus();
const { error } = useConnect();
const { chainId } = useAccount();

// Errors from chain state

if (isAccountActive && !isChainTypeMatched) {
return `Wrong network. Please switch to ${supportedChainLabels[chainType]} in your wallet to wrap/unwrap.`;
return `Wrong network. Please switch to ${supportedChainLabels[chainId || 1]} in your wallet to wrap/unwrap.`;
}

if (!isSupportedChain) {
Expand Down
2 changes: 1 addition & 1 deletion styles/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const GlobalStyle = createGlobalStyle`
text-size-adjust: none;
}
main {
min-height: calc(100vh - 150px);
min-height: calc(100vh - 200px);
}
a {
cursor: pointer;
Expand Down
6 changes: 0 additions & 6 deletions utils/apply-gas-limit-ratio.ts

This file was deleted.

Loading