import { getConnectorIcon, useAccount, useWalletMenu, } from '@lifi/wallet-management' import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded' import OpenInNewRounded from '@mui/icons-material/OpenInNewRounded' import PowerSettingsNewRounded from '@mui/icons-material/PowerSettingsNewRounded' import { Avatar, Badge, Box, Button, IconButton, MenuItem } from '@mui/material' import { useTranslation } from 'react-i18next' import { useAvailableChains } from '../../hooks/useAvailableChains.js' import { useExplorer } from '../../hooks/useExplorer.js' import { shortenAddress } from '../../utils/wallet.js' import { AvatarMasked } from '../Avatar/Avatar.style.js' import { SmallAvatar } from '../Avatar/SmallAvatar.js' import { DisconnectIconButton } from './DisconnectIconButton.js' export const WalletMenu = ({ onClose }: { onClose: () => void }) => { const { t } = useTranslation() const { accounts } = useAccount() const { getChainById } = useAvailableChains() const { openWalletMenu } = useWalletMenu() const connect = async () => { openWalletMenu() onClose() } const { getAddressLink } = useExplorer() return ( <> {accounts.map((account) => { const chain = getChainById(account.chainId) const walletAddress = shortenAddress(account.address) const handleCopyAddress = async () => { await navigator.clipboard.writeText(account.address ?? '') onClose() } return ( {chain?.logoURI ? ( {chain?.name[0]} } sx={{ marginRight: 1.5 }} > {account.connector?.name[0]} ) : ( {account.connector?.name[0]} )} {walletAddress} ) })} ) }