mango-ui-v3/hooks/useMangoAccount.tsx

20 lines
583 B
TypeScript

import useMangoStore from '../stores/useMangoStore'
import { MangoAccount } from '@blockworks-foundation/mango-client'
import shallow from 'zustand/shallow'
export default function useMangoAccount(): {
mangoAccount: MangoAccount | null
initialLoad: boolean
} {
const { mangoAccount, initialLoad } = useMangoStore(
(state) => ({
mangoAccount: state.selectedMangoAccount.current,
lastUpdatedAt: state.selectedMangoAccount.lastUpdatedAt,
initialLoad: state.selectedMangoAccount.initialLoad,
}),
shallow
)
return { mangoAccount, initialLoad }
}