import { Popover, Transition } from '@headlessui/react' import clsx from 'clsx' import { useWallet, useWalletStore } from 'contexts/wallet' import { Fragment } from 'react' import { FaCopy, FaPowerOff, FaRedo } from 'react-icons/fa' import { copy } from 'utils/clipboard' import { convertDenomToReadable } from 'utils/convertDenomToReadable' import { getShortAddress } from 'utils/getShortAddress' import { WalletButton } from './WalletButton' import { WalletPanelButton } from './WalletPanelButton' export const WalletLoader = () => { const { address, balance, connect, disconnect, initializing: isLoading, initialized: isReady } = useWallet() const displayName = useWalletStore((store) => store.name || getShortAddress(store.address)) return ( {({ close }) => ( <>
{!isReady && ( void connect()}> Connect Wallet )} {isReady && ( {displayName} )}
{getShortAddress(address)}
Your Balances
{balance.map((val) => ( {convertDenomToReadable(val.amount)} {val.denom.slice(1, val.denom.length)} ))}
void copy(address)}> Copy wallet address void connect()}> Reconnect [disconnect(), close()]}> Disconnect
)}
) }