import { Popover } from '@headlessui/react' import Image from 'next/image' import React, { useState } from 'react' import { toast } from 'react-toastify' import useTokenBalance from 'hooks/useTokenBalance' import useWalletStore from 'stores/useWalletStore' import { chain } from 'utils/chains' import { formatWalletAddress } from 'utils/formatters' import Button from 'components/Button' import ConnectModal from 'components/ConnectModal' const WalletPopover = ({ children }: { children: React.ReactNode }) => { const address = useWalletStore((s) => s.address) const actions = useWalletStore((s) => s.actions) const { data } = useTokenBalance() return ( {children} {chain.stakeCurrency.coinDenom}{' '} {data?.toFixed(2)} actions.disconnect()}>Disconnect {address} { navigator.clipboard.writeText(address).then(() => { toast.success('Address copied to your clipboard') }) }} > Copy Address ) } const Wallet = () => { const [showConnectModal, setShowConnectModal] = useState(false) const address = useWalletStore((s) => s.address) return ( <> {address ? ( {formatWalletAddress(address)} ) : ( setShowConnectModal(true)}> Connect Wallet )} setShowConnectModal(false)} /> > ) } export default Wallet
{chain.stakeCurrency.coinDenom}{' '} {data?.toFixed(2)}
{address}