Skip to content

Commit

Permalink
Merge pull request #4981 from Giveth/solana-connection-issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mateodaza authored Jan 29, 2025
2 parents a736774 + dab8b04 commit 7ddf900
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 7ddf900

Please sign in to comment.