import { ChainType } from '@lifi/sdk'; import { getWalletIcon } from '@collabland/lifi-wallet-management'; import ContentCopyIcon from '@mui/icons-material/ContentCopyRounded'; import OpenInNewIcon from '@mui/icons-material/OpenInNewRounded'; import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNewRounded'; import { Avatar, Badge, Box, Button, IconButton, MenuItem, } from '@mui/material'; import { useTranslation } from 'react-i18next'; import { useLocation, useNavigate } from 'react-router-dom'; import type { Connector } from 'wagmi'; import { useAccount, useAvailableChains } from '../../hooks'; import { navigationRoutes, shortenAddress } from '../../utils'; import { SmallAvatar } from '../SmallAvatar'; import { EVMDisconnectIconButton } from './EVMDisconnectIconButton'; import { SVMDisconnectIconButton } from './SVMDisconnectIconButton'; export const WalletMenu = ({ onClose }: { onClose: () => void }) => { const { t } = useTranslation(); const navigate = useNavigate(); const { pathname } = useLocation(); const { accounts } = useAccount(); const { getChainById } = useAvailableChains(); const connect = async () => { navigate(navigationRoutes.selectWallet); onClose(); }; return ( {accounts.map((account) => { const chain = getChainById(account.chainId); const walletAddress = shortenAddress(account.address); const handleCopyAddress = async () => { await navigator.clipboard.writeText(account.address ?? ''); onClose(); }; const avatar = ( {account.connector?.name[0]} ); return ( {chain?.logoURI ? ( {chain?.name[0]} } sx={{ marginRight: 1.5 }} > {avatar} ) : ( avatar )} {walletAddress} {account.chainType === ChainType.EVM ? ( ) : account.chainType === ChainType.SVM ? ( ) : null} ); })} {!pathname.includes(navigationRoutes.selectWallet) ? ( ) : null} ); };