mango-ui-v3/hooks/useMangoGroupConfig.tsx

18 lines
609 B
TypeScript
Raw Normal View History

2021-08-14 13:05:31 -07:00
import { useMemo } from 'react'
import useConnection from './useConnection'
import useMangoStore from '../stores/useMangoStore'
import { Config } from '@blockworks-foundation/mango-client'
import { GroupConfig } from '@blockworks-foundation/mango-client/lib/src/config'
export default function useMangoGroupConfig(): GroupConfig {
const mangoGroupName = useMangoStore((state) => state.selectedMangoGroup.name)
const { cluster } = useConnection()
const mangoGroupConfig = useMemo(
() => Config.ids().getGroup(cluster, mangoGroupName),
[cluster, mangoGroupName]
)
2021-08-14 13:05:31 -07:00
return mangoGroupConfig
}