Skip to content

Commit

Permalink
fix: add disconnect support
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeday committed Mar 11, 2024
1 parent bca6bc2 commit 410a98a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions features/ipfs/update-promt-banner/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const WarningText = styled(Text).attrs({
export const WarningSubText = styled(Text).attrs({
weight: 400,
size: 'xs',
as: 'span',
color: 'secondary',
})`
text-align: center;
Expand Down
8 changes: 4 additions & 4 deletions features/ipfs/update-promt-banner/use-version-check.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useLidoSWR } from '@lido-sdk/react';
import { useForceDisconnect } from 'reef-knot/web3-react';
import { useForceDisconnect } from 'reef-knot/core-react';

import { BASE_PATH_ASSET, dynamics } from 'config';
import { useMainnetStaticRpcProvider } from 'shared/hooks/use-mainnet-static-rpc-provider';
Expand Down Expand Up @@ -60,7 +60,7 @@ const isVersionLess = (versionA: string, versionB: string): boolean => {

export const useVersionCheck = () => {
const { setIsWalletConnectionAllowed } = useClientConfig();
const { disconnect } = useForceDisconnect();
const { forceDisconnect } = useForceDisconnect();
const [areConditionsAccepted, setConditionsAccepted] = useState(false);
const provider = useMainnetStaticRpcProvider();

Expand Down Expand Up @@ -140,10 +140,10 @@ export const useVersionCheck = () => {
setIsWalletConnectionAllowed(false);
}
if (isVersionUnsafe || (dynamics.ipfsMode && isNotVerifiable)) {
disconnect();
forceDisconnect();
}
}, [
disconnect,
forceDisconnect,
isNotVerifiable,
isVersionUnsafe,
setIsWalletConnectionAllowed,
Expand Down
2 changes: 2 additions & 0 deletions providers/web3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { useGetRpcUrlByChainId } from 'config';
import { SDKLegacyProvider } from './sdk-legacy';

const Web3Provider: FC<PropsWithChildren> = ({ children }) => {
const { isWalletConnectionAllowed } = useClientConfig();
const {
defaultChain: defaultChainId,
supportedChainIds,
Expand Down Expand Up @@ -95,6 +96,7 @@ const Web3Provider: FC<PropsWithChildren> = ({ children }) => {
return (
<WagmiConfig client={client}>
<ReefKnot
autoConnect={isWalletConnectionAllowed}
defaultChain={defaultChain}
chains={supportedChains}
rpc={backendRPC}
Expand Down

0 comments on commit 410a98a

Please sign in to comment.