Skip to content

Commit

Permalink
Update SwitchNetwork.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
mateodaza committed Jan 28, 2025
1 parent f47ff1e commit dab8b04
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/modals/SwitchNetwork.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,17 @@ const SwitchNetwork: FC<ISwitchNetworkModal> = ({
};
}) || defaultNetworks;

const handleNetworkItemClick = (networkId: number) => {
const handleNetworkItemClick = (networkId: number, chainType: string) => {
if (walletChainType === ChainType.SOLANA) {
setPendingNetworkId(networkId);
handleSingOutAndSignInWithEVM();
closeModal(); // Close the modal since we cannot control the wallet modal
} else {
switchChain?.({ chainId: networkId });
if (chainType === ChainType.SOLANA) {
handleSignOutAndSignInWithSolana();
} else {
switchChain?.({ chainId: networkId });
}
closeModal();
}
};
Expand All @@ -83,7 +87,9 @@ const SwitchNetwork: FC<ISwitchNetworkModal> = ({
{desc && <P>{desc}</P>}
{networks?.map(({ networkId, chainType }) => (
<NetworkItem
onClick={() => handleNetworkItemClick(networkId)}
onClick={() =>
handleNetworkItemClick(networkId, chainType)
}
$isSelected={networkId === chainId}
key={networkId}
$baseTheme={theme}
Expand Down

0 comments on commit dab8b04

Please sign in to comment.