diff --git a/src/components/Modal/ConnectWalletModal.tsx b/src/components/Modal/ConnectWalletModal.tsx index 15070089..1cb4ade9 100644 --- a/src/components/Modal/ConnectWalletModal.tsx +++ b/src/components/Modal/ConnectWalletModal.tsx @@ -10,7 +10,7 @@ import { sepolia } from 'viem/chains' import { Connector, useConnect, useDisconnect } from 'wagmi' export default function ConnectWalletModal() { const { connectWalletOpen: show } = useContext(ModalContext) - const { connectHandler } = useContext(Context) + const { connectHandler, account } = useContext(Context) const { connectors, connectAsync: wagmiConnect } = useConnect() const { disconnect: wagmiDisconnect, disconnectAsync } = useDisconnect() const [installed, setInstalled] = useState([]) @@ -96,7 +96,9 @@ export default function ConnectWalletModal() { { onSuccess: (data) => { setLoading(false) - connectHandler(data) + if (data?.accounts[0] == account?.activeWalletAddress) { + connectHandler(data) + } }, onError: (props) => { diff --git a/src/context/index.tsx b/src/context/index.tsx index bb07f99f..5c1c3ca0 100644 --- a/src/context/index.tsx +++ b/src/context/index.tsx @@ -153,7 +153,7 @@ function ContextProvider({ children }: any) { chainId: config.CHAIN_INFO.evmChainId, }, { - onSuccess: signConnectMessage, + onSuccess: () => signConnectMessage(data), onError: (error) => console.error(error), } )