import { Graph } from '@graphprotocol/grc-20';
import { useQuery } from '@tanstack/react-query';
import { gql, request } from 'graphql-request';
const spaceQueryDocument = gql`
query Space($spaceId: UUID!) {
  space(id: $spaceId) {
    page {
      name
    }
  }
}
`;
export const usePublicSpace = ({
  spaceId,
  enabled
}) => {
  const result = useQuery({
    queryKey: ['hypergraph-public-space', spaceId],
    queryFn: async () => {
      const result = await request(`${Graph.TESTNET_API_ORIGIN}/graphql`, spaceQueryDocument, {
        spaceId
      });
      return result?.space?.page ? {
        name: result.space.page.name
      } : null;
    },
    enabled
  });
  return result.data;
};
//# sourceMappingURL=use-public-space.js.map