2021-08-14 13:05:31 -07:00
|
|
|
import { useMemo } from 'react'
|
2021-06-16 22:37:35 -07:00
|
|
|
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
|
|
|
|
}
|