File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ const AccountSettings = () => {
57
57
const { t } = useTranslation ( [ 'common' , 'settings' , 'trade' ] )
58
58
const { mangoAccount, mangoAccountAddress } = useMangoAccount ( )
59
59
const { group } = useMangoGroup ( )
60
- const { isDelegatedAccount, isUnownedAccount } = useUnownedAccount ( )
60
+ const { isDelegatedAccount, isUnownedAccount, isOwnedAccount } =
61
+ useUnownedAccount ( )
61
62
const { connected } = useWallet ( )
62
63
const [ showAccountSizeModal , setShowAccountSizeModal ] = useState ( false )
63
64
const [ showEditAccountModal , setShowEditAccountModal ] = useState ( false )
@@ -737,7 +738,7 @@ const AccountSettings = () => {
737
738
< div className = "rounded-lg border border-th-bkg-3 p-4 md:p-6" >
738
739
< p className = "text-center" > { t ( 'settings:account-settings-unowned' ) } </ p >
739
740
</ div >
740
- ) : isDelegatedAccount ? (
741
+ ) : isDelegatedAccount && ! isOwnedAccount ? (
741
742
< div className = "rounded-lg border border-th-bkg-3 p-4 md:p-6" >
742
743
< p className = "text-center" > { t ( 'settings:account-settings-delegated' ) } </ p >
743
744
</ div >
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import useMangoAccount from './useMangoAccount'
5
5
const useUnownedAccount = ( ) : {
6
6
isUnownedAccount : boolean
7
7
isDelegatedAccount : boolean
8
+ isOwnedAccount : boolean
8
9
} => {
9
10
const { connected, publicKey } = useWallet ( )
10
11
const { mangoAccountAddress, mangoAccount } = useMangoAccount ( )
@@ -21,7 +22,14 @@ const useUnownedAccount = (): {
21
22
return false
22
23
} , [ publicKey , mangoAccount ] )
23
24
24
- return { isUnownedAccount, isDelegatedAccount }
25
+ const isOwnedAccount : boolean = useMemo ( ( ) => {
26
+ if ( publicKey && mangoAccount ) {
27
+ return mangoAccount ?. owner . equals ( publicKey )
28
+ }
29
+ return false
30
+ } , [ publicKey , mangoAccount ] )
31
+
32
+ return { isUnownedAccount, isDelegatedAccount, isOwnedAccount }
25
33
}
26
34
27
35
export default useUnownedAccount
You can’t perform that action at this time.
0 commit comments