c15743e2f4
* navigation bar conditional renders on connected and credit accounts * remove address requirement from allowed coins fetch * fix: credit accounts positions when no wallet connected * remove unnecessary comments
32 lines
666 B
TypeScript
32 lines
666 B
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
|
|
import useWalletStore from 'stores/useWalletStore'
|
|
import { contractAddresses } from 'config/contracts'
|
|
import { queryKeys } from 'types/query-keys-factory'
|
|
|
|
type Result = string[]
|
|
|
|
const queryMsg = {
|
|
allowed_coins: {},
|
|
}
|
|
|
|
const useAllowedCoins = () => {
|
|
const client = useWalletStore((s) => s.client)
|
|
|
|
const result = useQuery<Result>(
|
|
queryKeys.allowedCoins(),
|
|
async () => client?.queryContractSmart(contractAddresses.creditManager, queryMsg),
|
|
{
|
|
enabled: !!client,
|
|
staleTime: Infinity,
|
|
}
|
|
)
|
|
|
|
return {
|
|
...result,
|
|
data: result?.data,
|
|
}
|
|
}
|
|
|
|
export default useAllowedCoins
|