Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
imhson committed Aug 8, 2024
1 parent 161d535 commit ab0c097
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/Modal/ConnectWalletModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<Connector[]>([])
Expand Down Expand Up @@ -96,7 +96,9 @@ export default function ConnectWalletModal() {
{
onSuccess: (data) => {
setLoading(false)
connectHandler(data)
if (data?.accounts[0] == account?.activeWalletAddress) {
connectHandler(data)
}
},

onError: (props) => {
Expand Down
2 changes: 1 addition & 1 deletion src/context/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function ContextProvider({ children }: any) {
chainId: config.CHAIN_INFO.evmChainId,
},
{
onSuccess: signConnectMessage,
onSuccess: () => signConnectMessage(data),
onError: (error) => console.error(error),
}
)
Expand Down

0 comments on commit ab0c097

Please sign in to comment.