import ChainCard from '@/components/ChainCard' import SettingsStore from '@/store/SettingsStore' import { eip155Addresses } from '@/utils/EIP155WalletUtil' import { truncate } from '@/utils/HelperUtil' import { updateSignClientChainId } from '@/utils/WalletConnectUtil' import { Avatar, Button, Text, Tooltip } from '@nextui-org/react' import Image from 'next/image' import { useState } from 'react' import { useSnapshot } from 'valtio' interface Props { name: string logo: string rgb: string address: string chainId: string } export default function AccountCard({ name, logo, rgb, address = '', chainId }: Props) { const [copied, setCopied] = useState(false) const { activeChainId, account } = useSnapshot(SettingsStore.state) function onCopy() { navigator?.clipboard?.writeText(address) setCopied(true) setTimeout(() => setCopied(false), 1500) } async function onChainChanged(chainId: string, address: string) { SettingsStore.setActiveChainId(chainId) await updateSignClientChainId(chainId.toString(), address) } return (
{name} {address ? truncate(address, 19) : ''}
) }