diff --git a/components/settings/AccountSettings.tsx b/components/settings/AccountSettings.tsx index becbc06d..0032da1c 100644 --- a/components/settings/AccountSettings.tsx +++ b/components/settings/AccountSettings.tsx @@ -57,7 +57,8 @@ const AccountSettings = () => { const { t } = useTranslation(['common', 'settings', 'trade']) const { mangoAccount, mangoAccountAddress } = useMangoAccount() const { group } = useMangoGroup() - const { isDelegatedAccount, isUnownedAccount } = useUnownedAccount() + const { isDelegatedAccount, isUnownedAccount, isOwnedAccount } = + useUnownedAccount() const { connected } = useWallet() const [showAccountSizeModal, setShowAccountSizeModal] = useState(false) const [showEditAccountModal, setShowEditAccountModal] = useState(false) @@ -737,7 +738,7 @@ const AccountSettings = () => {

{t('settings:account-settings-unowned')}

- ) : isDelegatedAccount ? ( + ) : isDelegatedAccount && !isOwnedAccount ? (

{t('settings:account-settings-delegated')}

diff --git a/hooks/useUnownedAccount.ts b/hooks/useUnownedAccount.ts index d046094a..9cca56a7 100644 --- a/hooks/useUnownedAccount.ts +++ b/hooks/useUnownedAccount.ts @@ -5,6 +5,7 @@ import useMangoAccount from './useMangoAccount' const useUnownedAccount = (): { isUnownedAccount: boolean isDelegatedAccount: boolean + isOwnedAccount: boolean } => { const { connected, publicKey } = useWallet() const { mangoAccountAddress, mangoAccount } = useMangoAccount() @@ -21,7 +22,14 @@ const useUnownedAccount = (): { return false }, [publicKey, mangoAccount]) - return { isUnownedAccount, isDelegatedAccount } + const isOwnedAccount: boolean = useMemo(() => { + if (publicKey && mangoAccount) { + return mangoAccount?.owner.equals(publicKey) + } + return false + }, [publicKey, mangoAccount]) + + return { isUnownedAccount, isDelegatedAccount, isOwnedAccount } } export default useUnownedAccount