import { useWallet } from '@solana/wallet-adapter-react' import { Fragment, useState } from 'react' import Button, { LinkButton } from '../shared/Button' import DepositModal from '../modals/DepositModal' import WithdrawModal from '../modals/WithdrawModal' import mangoStore from '../../store/state' import { Popover, Transition } from '@headlessui/react' import { DotsHorizontalIcon, TrashIcon, XIcon } from '@heroicons/react/solid' import { useTranslation } from 'next-i18next' const AccountActions = () => { const { t } = useTranslation(['common', 'close-account']) const { connected } = useWallet() const [showDepositModal, setShowDepositModal] = useState(false) const [showWithdrawModal, setShowWithdrawModal] = useState(false) const handleCloseMangoAccount = async () => { const client = mangoStore.getState().client const mangoAccount = mangoStore.getState().mangoAccount const group = mangoStore.getState().group if (!mangoAccount || !group) return try { const tx = await client.closeMangoAccount(group, mangoAccount) console.log('success:', tx) } catch (e) { console.log(e) } } return ( <>
{({ open }) => (
{open ? ( ) : ( )} {t('close-account:close-account')}
)}
{showDepositModal ? ( setShowDepositModal(false)} /> ) : null} {showWithdrawModal ? ( setShowWithdrawModal(false)} /> ) : null} ) } export default AccountActions