hide action buttons for unowned accounts
This commit is contained in:
parent
0b4da01ee1
commit
6a05e60376
|
@ -34,6 +34,7 @@ import BankAmountWithValue from './shared/BankAmountWithValue'
|
|||
import useBanksWithBalances, {
|
||||
BankWithBalance,
|
||||
} from 'hooks/useBanksWithBalances'
|
||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||
|
||||
const TokenList = () => {
|
||||
const { t } = useTranslation(['common', 'token', 'trade'])
|
||||
|
@ -399,7 +400,7 @@ const ActionsMenu = ({
|
|||
const router = useRouter()
|
||||
const { mangoTokens } = useJupiterMints()
|
||||
const spotMarkets = mangoStore((s) => s.serumMarkets)
|
||||
const { connected } = useWallet()
|
||||
const isUnownedAccount = useUnownedAccount()
|
||||
|
||||
const spotMarket = useMemo(() => {
|
||||
return spotMarkets.find((m) => {
|
||||
|
@ -477,7 +478,7 @@ const ActionsMenu = ({
|
|||
|
||||
return (
|
||||
<>
|
||||
{mangoAccount && !connected ? null : (
|
||||
{isUnownedAccount ? null : (
|
||||
<IconDropMenu
|
||||
icon={<EllipsisHorizontalIcon className="h-5 w-5" />}
|
||||
postion="leftBottom"
|
||||
|
|
|
@ -24,6 +24,7 @@ import DepositWithdrawModal from './modals/DepositWithdrawModal'
|
|||
import { useViewport } from 'hooks/useViewport'
|
||||
import { breakpoints } from 'utils/theme'
|
||||
import AccountsButton from './AccountsButton'
|
||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||
// import ThemeSwitcher from './ThemeSwitcher'
|
||||
|
||||
const TopBar = () => {
|
||||
|
@ -41,6 +42,7 @@ const TopBar = () => {
|
|||
const { query } = router
|
||||
const { width } = useViewport()
|
||||
const isMobile = width ? width < breakpoints.sm : false
|
||||
const isUnownedAccount = useUnownedAccount()
|
||||
|
||||
const handleCloseSetup = useCallback(() => {
|
||||
setShowUserSetup(false)
|
||||
|
@ -112,7 +114,7 @@ const TopBar = () => {
|
|||
{/* <div className="px-3 md:px-4">
|
||||
<ThemeSwitcher />
|
||||
</div> */}
|
||||
{(mangoAccount && !connected) || (!connected && isMobile) ? null : (
|
||||
{isUnownedAccount || (!connected && isMobile) ? null : (
|
||||
<Button
|
||||
onClick={() => handleDepositWithdrawModal('deposit')}
|
||||
secondary
|
||||
|
|
|
@ -23,6 +23,7 @@ import { useWallet } from '@solana/wallet-adapter-react'
|
|||
import CreateAccountModal from '@components/modals/CreateAccountModal'
|
||||
import { Popover, Transition } from '@headlessui/react'
|
||||
import ActionsLinkButton from './ActionsLinkButton'
|
||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||
|
||||
export const handleCopyAddress = (
|
||||
mangoAccount: MangoAccount,
|
||||
|
@ -37,7 +38,7 @@ export const handleCopyAddress = (
|
|||
|
||||
const AccountActions = () => {
|
||||
const { t } = useTranslation(['common', 'close-account'])
|
||||
const { mangoAccount } = useMangoAccount()
|
||||
const { mangoAccount, mangoAccountAddress } = useMangoAccount()
|
||||
const [showCloseAccountModal, setShowCloseAccountModal] = useState(false)
|
||||
const [showEditAccountModal, setShowEditAccountModal] = useState(false)
|
||||
const [showBorrowModal, setShowBorrowModal] = useState(false)
|
||||
|
@ -45,9 +46,10 @@ const AccountActions = () => {
|
|||
const [showDelegateModal, setShowDelegateModal] = useState(false)
|
||||
const [showCreateAccountModal, setShowCreateAccountModal] = useState(false)
|
||||
const { connected } = useWallet()
|
||||
const isUnownedAccount = useUnownedAccount()
|
||||
|
||||
const handleBorrowModal = () => {
|
||||
if (!connected || mangoAccount) {
|
||||
if (mangoAccountAddress || !connected) {
|
||||
setShowBorrowModal(true)
|
||||
} else {
|
||||
setShowCreateAccountModal(true)
|
||||
|
@ -56,11 +58,11 @@ const AccountActions = () => {
|
|||
|
||||
return (
|
||||
<>
|
||||
{mangoAccount && !connected ? null : (
|
||||
{isUnownedAccount ? null : (
|
||||
<div className="flex items-center space-x-2">
|
||||
<Button
|
||||
className="flex w-1/3 items-center justify-center md:w-auto"
|
||||
disabled={!mangoAccount}
|
||||
disabled={!mangoAccountAddress}
|
||||
onClick={() => setShowRepayModal(true)}
|
||||
secondary
|
||||
>
|
||||
|
|
|
@ -26,6 +26,7 @@ import BankAmountWithValue from './BankAmountWithValue'
|
|||
import useBanksWithBalances, {
|
||||
BankWithBalance,
|
||||
} from 'hooks/useBanksWithBalances'
|
||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||
|
||||
const BalancesTable = () => {
|
||||
const { t } = useTranslation(['common', 'trade'])
|
||||
|
@ -195,6 +196,7 @@ export default BalancesTable
|
|||
const Balance = ({ bank }: { bank: BankWithBalance }) => {
|
||||
const { selectedMarket } = useSelectedMarket()
|
||||
const { asPath } = useRouter()
|
||||
const isUnownedAccount = useUnownedAccount()
|
||||
|
||||
const tokenBank = bank.bank
|
||||
|
||||
|
@ -293,32 +295,39 @@ const Balance = ({ bank }: { bank: BankWithBalance }) => {
|
|||
|
||||
return (
|
||||
<p className="flex justify-end">
|
||||
{asPath.includes('/trade') && isBaseOrQuote ? (
|
||||
<LinkButton
|
||||
className="font-normal underline-offset-4"
|
||||
onClick={() =>
|
||||
handleTradeFormBalanceClick(Math.abs(balance), isBaseOrQuote)
|
||||
}
|
||||
>
|
||||
{!isUnownedAccount ? (
|
||||
asPath.includes('/trade') && isBaseOrQuote ? (
|
||||
<LinkButton
|
||||
className="font-normal underline-offset-4"
|
||||
onClick={() =>
|
||||
handleTradeFormBalanceClick(Math.abs(balance), isBaseOrQuote)
|
||||
}
|
||||
>
|
||||
<FormatNumericValue
|
||||
value={balance}
|
||||
decimals={tokenBank.mintDecimals}
|
||||
/>
|
||||
</LinkButton>
|
||||
) : asPath.includes('/swap') ? (
|
||||
<LinkButton
|
||||
className="font-normal underline-offset-4"
|
||||
onClick={() =>
|
||||
handleSwapFormBalanceClick(
|
||||
Number(formatNumericValue(balance, tokenBank.mintDecimals))
|
||||
)
|
||||
}
|
||||
>
|
||||
<FormatNumericValue
|
||||
value={balance}
|
||||
decimals={tokenBank.mintDecimals}
|
||||
/>
|
||||
</LinkButton>
|
||||
) : (
|
||||
<FormatNumericValue
|
||||
value={balance}
|
||||
decimals={tokenBank.mintDecimals}
|
||||
/>
|
||||
</LinkButton>
|
||||
) : asPath.includes('/swap') ? (
|
||||
<LinkButton
|
||||
className="font-normal underline-offset-4"
|
||||
onClick={() =>
|
||||
handleSwapFormBalanceClick(
|
||||
Number(formatNumericValue(balance, tokenBank.mintDecimals))
|
||||
)
|
||||
}
|
||||
>
|
||||
<FormatNumericValue
|
||||
value={balance}
|
||||
decimals={tokenBank.mintDecimals}
|
||||
/>
|
||||
</LinkButton>
|
||||
)
|
||||
) : (
|
||||
<FormatNumericValue value={balance} decimals={tokenBank.mintDecimals} />
|
||||
)}
|
||||
|
|
|
@ -48,6 +48,7 @@ import useIpAddress from 'hooks/useIpAddress'
|
|||
import { useEnhancedWallet } from '@components/wallet/EnhancedWalletProvider'
|
||||
import SwapSettings from './SwapSettings'
|
||||
import InlineNotification from '@components/shared/InlineNotification'
|
||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||
|
||||
const MAX_DIGITS = 11
|
||||
export const withValueLimit = (values: NumberFormatValues): boolean => {
|
||||
|
@ -69,6 +70,7 @@ const SwapForm = () => {
|
|||
const { group } = useMangoGroup()
|
||||
const [swapFormSizeUi] = useLocalStorageState(SIZE_INPUT_UI_KEY, 'slider')
|
||||
const { ipAllowed, ipCountry } = useIpAddress()
|
||||
const isUnownedAccount = useUnownedAccount()
|
||||
|
||||
const {
|
||||
margin: useMargin,
|
||||
|
@ -327,10 +329,12 @@ const SwapForm = () => {
|
|||
</div>
|
||||
<div className="mb-2 flex items-end justify-between">
|
||||
<p className="text-th-fgd-2 lg:text-base">{t('swap:pay')}</p>
|
||||
<MaxSwapAmount
|
||||
useMargin={useMargin}
|
||||
setAmountIn={(v) => setAmountInFormValue(v, true)}
|
||||
/>
|
||||
{!isUnownedAccount ? (
|
||||
<MaxSwapAmount
|
||||
useMargin={useMargin}
|
||||
setAmountIn={(v) => setAmountInFormValue(v, true)}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="mb-3 grid grid-cols-2" id="swap-step-two">
|
||||
<div className="col-span-1 rounded-lg rounded-r-none border border-r-0 border-th-input-border bg-th-input-bkg">
|
||||
|
|
|
@ -4,6 +4,7 @@ import { FadeInFadeOut } from '@components/shared/Transitions'
|
|||
import mangoStore from '@store/mangoStore'
|
||||
import useMangoAccount from 'hooks/useMangoAccount'
|
||||
import useSelectedMarket from 'hooks/useSelectedMarket'
|
||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
import { useCallback, useMemo } from 'react'
|
||||
import { formatNumericValue } from 'utils/numbers'
|
||||
|
@ -28,6 +29,7 @@ const MaxSizeButton = ({
|
|||
side,
|
||||
useMargin
|
||||
)
|
||||
const isUnownedAccount = useUnownedAccount()
|
||||
|
||||
const perpMax = useMemo(() => {
|
||||
const group = mangoStore.getState().group
|
||||
|
@ -108,7 +110,7 @@ const MaxSizeButton = ({
|
|||
return (
|
||||
<div className="mb-2 mt-3 flex items-center justify-between">
|
||||
<p className="text-xs text-th-fgd-3">{t('trade:size')}</p>
|
||||
<FadeInFadeOut show={!!price}>
|
||||
<FadeInFadeOut show={!!price && !isUnownedAccount}>
|
||||
<MaxAmountButton
|
||||
className="text-xs"
|
||||
decimals={minOrderDecimals}
|
||||
|
|
|
@ -27,6 +27,7 @@ import { useWallet } from '@solana/wallet-adapter-react'
|
|||
import { PublicKey } from '@solana/web3.js'
|
||||
import mangoStore from '@store/mangoStore'
|
||||
import useMangoAccount from 'hooks/useMangoAccount'
|
||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||
import { useViewport } from 'hooks/useViewport'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
import { ChangeEvent, useCallback, useState } from 'react'
|
||||
|
@ -49,6 +50,7 @@ const OpenOrders = () => {
|
|||
const showTableView = width ? width > breakpoints.md : false
|
||||
const { mangoAccountAddress } = useMangoAccount()
|
||||
const { connected } = useWallet()
|
||||
const isUnownedAccount = useUnownedAccount()
|
||||
|
||||
const findSerum3MarketPkInOpenOrders = (o: Order): string | undefined => {
|
||||
const openOrders = mangoStore.getState().mangoAccount.openOrders
|
||||
|
@ -237,7 +239,9 @@ const OpenOrders = () => {
|
|||
<Th className="w-[16.67%] text-right">{t('trade:size')}</Th>
|
||||
<Th className="w-[16.67%] text-right">{t('price')}</Th>
|
||||
<Th className="w-[16.67%] text-right">{t('value')}</Th>
|
||||
<Th className="w-[16.67%] text-right"></Th>
|
||||
{!isUnownedAccount ? (
|
||||
<Th className="w-[16.67%] text-right" />
|
||||
) : null}
|
||||
</TrHead>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -332,56 +336,58 @@ const OpenOrders = () => {
|
|||
isUsd
|
||||
/>
|
||||
</Td>
|
||||
<Td className="w-[16.67%]">
|
||||
<div className="flex justify-end space-x-2">
|
||||
{modifyOrderId !== o.orderId.toString() ? (
|
||||
<>
|
||||
<IconButton
|
||||
onClick={() => showEditOrderForm(o, tickSize)}
|
||||
size="small"
|
||||
>
|
||||
<PencilIcon className="h-4 w-4" />
|
||||
</IconButton>
|
||||
<Tooltip content={t('cancel')}>
|
||||
{!isUnownedAccount ? (
|
||||
<Td className="w-[16.67%]">
|
||||
<div className="flex justify-end space-x-2">
|
||||
{modifyOrderId !== o.orderId.toString() ? (
|
||||
<>
|
||||
<IconButton
|
||||
disabled={cancelId === o.orderId.toString()}
|
||||
onClick={() =>
|
||||
o instanceof PerpOrder
|
||||
? handleCancelPerpOrder(o)
|
||||
: handleCancelSerumOrder(o)
|
||||
}
|
||||
onClick={() => showEditOrderForm(o, tickSize)}
|
||||
size="small"
|
||||
>
|
||||
{cancelId === o.orderId.toString() ? (
|
||||
<PencilIcon className="h-4 w-4" />
|
||||
</IconButton>
|
||||
<Tooltip content={t('cancel')}>
|
||||
<IconButton
|
||||
disabled={cancelId === o.orderId.toString()}
|
||||
onClick={() =>
|
||||
o instanceof PerpOrder
|
||||
? handleCancelPerpOrder(o)
|
||||
: handleCancelSerumOrder(o)
|
||||
}
|
||||
size="small"
|
||||
>
|
||||
{cancelId === o.orderId.toString() ? (
|
||||
<Loading className="h-4 w-4" />
|
||||
) : (
|
||||
<TrashIcon className="h-4 w-4" />
|
||||
)}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<IconButton
|
||||
onClick={() => modifyOrder(o)}
|
||||
size="small"
|
||||
>
|
||||
{loadingModifyOrder ? (
|
||||
<Loading className="h-4 w-4" />
|
||||
) : (
|
||||
<TrashIcon className="h-4 w-4" />
|
||||
<CheckIcon className="h-4 w-4" />
|
||||
)}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<IconButton
|
||||
onClick={() => modifyOrder(o)}
|
||||
size="small"
|
||||
>
|
||||
{loadingModifyOrder ? (
|
||||
<Loading className="h-4 w-4" />
|
||||
) : (
|
||||
<CheckIcon className="h-4 w-4" />
|
||||
)}
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={cancelEditOrderForm}
|
||||
size="small"
|
||||
>
|
||||
<XMarkIcon className="h-4 w-4" />
|
||||
</IconButton>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</Td>
|
||||
<IconButton
|
||||
onClick={cancelEditOrderForm}
|
||||
size="small"
|
||||
>
|
||||
<XMarkIcon className="h-4 w-4" />
|
||||
</IconButton>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</Td>
|
||||
) : null}
|
||||
</TrBody>
|
||||
)
|
||||
})
|
||||
|
@ -477,7 +483,7 @@ const OpenOrders = () => {
|
|||
</div>
|
||||
)}
|
||||
</div>
|
||||
{connected ? (
|
||||
{!isUnownedAccount ? (
|
||||
<div className="flex items-center space-x-3 pl-8">
|
||||
<div className="flex items-center space-x-2">
|
||||
{modifyOrderId !== o.orderId.toString() ? (
|
||||
|
|
|
@ -9,6 +9,7 @@ import mangoStore from '@store/mangoStore'
|
|||
import useMangoAccount from 'hooks/useMangoAccount'
|
||||
import useMangoGroup from 'hooks/useMangoGroup'
|
||||
import useSelectedMarket from 'hooks/useSelectedMarket'
|
||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||
import { useTranslation } from 'next-i18next'
|
||||
import { useCallback, useState } from 'react'
|
||||
import { floorToDecimal, getDecimalCount } from 'utils/numbers'
|
||||
|
@ -28,6 +29,7 @@ const PerpPositions = () => {
|
|||
const { selectedMarket } = useSelectedMarket()
|
||||
const { connected } = useWallet()
|
||||
const { mangoAccountAddress } = useMangoAccount()
|
||||
const isUnownedAccount = useUnownedAccount()
|
||||
|
||||
const handlePositionClick = (positionSize: number, market: PerpMarket) => {
|
||||
const tradeForm = mangoStore.getState().tradeForm
|
||||
|
@ -86,7 +88,7 @@ const PerpPositions = () => {
|
|||
'pnl'
|
||||
)}`}</Th>
|
||||
<Th className="text-right">{t('pnl')}</Th>
|
||||
<Th />
|
||||
{!isUnownedAccount ? <Th /> : null}
|
||||
</TrHead>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -164,16 +166,18 @@ const PerpPositions = () => {
|
|||
>
|
||||
<FormatNumericValue value={cummulativePnl} isUsd />
|
||||
</Td>
|
||||
<Td className={`text-right`}>
|
||||
<Button
|
||||
className="text-xs"
|
||||
secondary
|
||||
size="small"
|
||||
onClick={() => showClosePositionModal(position)}
|
||||
>
|
||||
Close
|
||||
</Button>
|
||||
</Td>
|
||||
{!isUnownedAccount ? (
|
||||
<Td className={`text-right`}>
|
||||
<Button
|
||||
className="text-xs"
|
||||
secondary
|
||||
size="small"
|
||||
onClick={() => showClosePositionModal(position)}
|
||||
>
|
||||
Close
|
||||
</Button>
|
||||
</Td>
|
||||
) : null}
|
||||
</TrBody>
|
||||
)
|
||||
})}
|
||||
|
|
|
@ -17,6 +17,7 @@ import useMangoAccount from 'hooks/useMangoAccount'
|
|||
import { useWallet } from '@solana/wallet-adapter-react'
|
||||
import ConnectEmptyState from '@components/shared/ConnectEmptyState'
|
||||
import FormatNumericValue from '@components/shared/FormatNumericValue'
|
||||
import useUnownedAccount from 'hooks/useUnownedAccount'
|
||||
|
||||
const UnsettledTrades = ({
|
||||
unsettledSpotBalances,
|
||||
|
@ -32,6 +33,7 @@ const UnsettledTrades = ({
|
|||
const showTableView = width ? width > breakpoints.md : false
|
||||
const { mangoAccountAddress } = useMangoAccount()
|
||||
const { connected } = useWallet()
|
||||
const isUnownedAccount = useUnownedAccount()
|
||||
|
||||
const handleSettleSerumFunds = useCallback(async (mktAddress: string) => {
|
||||
const client = mangoStore.getState().client
|
||||
|
@ -136,7 +138,9 @@ const UnsettledTrades = ({
|
|||
<TrHead>
|
||||
<Th className="bg-th-bkg-1 text-left">{t('market')}</Th>
|
||||
<Th className="bg-th-bkg-1 text-right">{t('trade:amount')}</Th>
|
||||
<Th className="bg-th-bkg-1 text-right" />
|
||||
{!isUnownedAccount ? (
|
||||
<Th className="bg-th-bkg-1 text-right" />
|
||||
) : null}
|
||||
</TrHead>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -168,22 +172,24 @@ const UnsettledTrades = ({
|
|||
) : null}
|
||||
</div>
|
||||
</Td>
|
||||
<Td>
|
||||
<div className="flex justify-end">
|
||||
<Tooltip content={t('trade:settle-funds')}>
|
||||
<IconButton
|
||||
onClick={() => handleSettleSerumFunds(mktAddress)}
|
||||
size="small"
|
||||
>
|
||||
{settleMktAddress === mktAddress ? (
|
||||
<Loading className="h-4 w-4" />
|
||||
) : (
|
||||
<CheckIcon className="h-4 w-4" />
|
||||
)}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</Td>
|
||||
{!isUnownedAccount ? (
|
||||
<Td>
|
||||
<div className="flex justify-end">
|
||||
<Tooltip content={t('trade:settle-funds')}>
|
||||
<IconButton
|
||||
onClick={() => handleSettleSerumFunds(mktAddress)}
|
||||
size="small"
|
||||
>
|
||||
{settleMktAddress === mktAddress ? (
|
||||
<Loading className="h-4 w-4" />
|
||||
) : (
|
||||
<CheckIcon className="h-4 w-4" />
|
||||
)}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</Td>
|
||||
) : null}
|
||||
</TrBody>
|
||||
)
|
||||
})}
|
||||
|
@ -203,22 +209,24 @@ const UnsettledTrades = ({
|
|||
/>{' '}
|
||||
<span className="font-body text-th-fgd-4">USDC</span>
|
||||
</Td>
|
||||
<Td>
|
||||
<div className="flex justify-end">
|
||||
<Tooltip content={t('trade:settle-funds')}>
|
||||
<IconButton
|
||||
onClick={() => handleSettlePerpFunds(market)}
|
||||
size="small"
|
||||
>
|
||||
{settleMktAddress === market.publicKey.toString() ? (
|
||||
<Loading className="h-4 w-4" />
|
||||
) : (
|
||||
<CheckIcon className="h-4 w-4" />
|
||||
)}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</Td>
|
||||
{!isUnownedAccount ? (
|
||||
<Td>
|
||||
<div className="flex justify-end">
|
||||
<Tooltip content={t('trade:settle-funds')}>
|
||||
<IconButton
|
||||
onClick={() => handleSettlePerpFunds(market)}
|
||||
size="small"
|
||||
>
|
||||
{settleMktAddress === market.publicKey.toString() ? (
|
||||
<Loading className="h-4 w-4" />
|
||||
) : (
|
||||
<CheckIcon className="h-4 w-4" />
|
||||
)}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</Td>
|
||||
) : null}
|
||||
</TrBody>
|
||||
)
|
||||
})}
|
||||
|
@ -252,16 +260,18 @@ const UnsettledTrades = ({
|
|||
<span className="font-body text-th-fgd-4">{quote}</span>
|
||||
</span>
|
||||
) : null}
|
||||
<IconButton
|
||||
onClick={() => handleSettleSerumFunds(mktAddress)}
|
||||
size="medium"
|
||||
>
|
||||
{settleMktAddress === mktAddress ? (
|
||||
<Loading className="h-4 w-4" />
|
||||
) : (
|
||||
<CheckIcon className="h-4 w-4" />
|
||||
)}
|
||||
</IconButton>
|
||||
{!isUnownedAccount ? (
|
||||
<IconButton
|
||||
onClick={() => handleSettleSerumFunds(mktAddress)}
|
||||
size="medium"
|
||||
>
|
||||
{settleMktAddress === mktAddress ? (
|
||||
<Loading className="h-4 w-4" />
|
||||
) : (
|
||||
<CheckIcon className="h-4 w-4" />
|
||||
)}
|
||||
</IconButton>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
import { useWallet } from '@solana/wallet-adapter-react'
|
||||
import { useMemo } from 'react'
|
||||
import useMangoAccount from './useMangoAccount'
|
||||
|
||||
const useUnownedAccount = () => {
|
||||
const { connected } = useWallet()
|
||||
const { mangoAccountAddress } = useMangoAccount()
|
||||
|
||||
const isUnownedAccount = useMemo(() => {
|
||||
if (connected) return false
|
||||
return mangoAccountAddress && !connected
|
||||
}, [connected, mangoAccountAddress])
|
||||
|
||||
return isUnownedAccount
|
||||
}
|
||||
|
||||
export default useUnownedAccount
|
Loading…
Reference in New Issue