diff --git a/apps/server/src/index.ts b/apps/server/src/index.ts index ae099064..1e100b91 100755 --- a/apps/server/src/index.ts +++ b/apps/server/src/index.ts @@ -69,7 +69,7 @@ app.use(express.json({ limit: '2mb' })); app.use(cors()); app.get('/', (_req, res) => { - res.send('Server is running (v0.0.13)'); + res.send('Server is running (v0.0.14)'); }); app.get('/connect/spaces', async (req, res) => { diff --git a/packages/hypergraph-react/package.json b/packages/hypergraph-react/package.json index c0b16977..82303703 100644 --- a/packages/hypergraph-react/package.json +++ b/packages/hypergraph-react/package.json @@ -1,6 +1,6 @@ { "name": "@graphprotocol/hypergraph-react", - "version": "0.0.13", + "version": "0.0.14", "description": "React implementation and additional functionality, components, and hooks for the hypergraph SDK framework", "keywords": ["Web3", "Local-First", "Knowledge Graph", "Graph Protocol", "react"], "publishConfig": { diff --git a/packages/hypergraph-react/src/hooks/use-spaces.ts b/packages/hypergraph-react/src/hooks/use-spaces.ts index f7a2bbb6..80f83cb2 100644 --- a/packages/hypergraph-react/src/hooks/use-spaces.ts +++ b/packages/hypergraph-react/src/hooks/use-spaces.ts @@ -33,9 +33,13 @@ export const useSpaces = (params: { mode: 'public' | 'private' }) => { const publicResult = useQuery({ queryKey: ['hypergraph-spaces', params.mode], queryFn: async () => { - const result = await request(Graph.TESTNET_API_ORIGIN, publicSpacesQueryDocument, { - accountAddress, - }); + const result = await request( + `${Graph.TESTNET_API_ORIGIN}/graphql`, + publicSpacesQueryDocument, + { + accountAddress, + }, + ); return result?.spaces ? result.spaces.map((space) => ({ id: space.id, diff --git a/packages/hypergraph-react/src/internal/generate-delete-ops.tsx b/packages/hypergraph-react/src/internal/generate-delete-ops.tsx index d0a9be94..b5cbf72f 100644 --- a/packages/hypergraph-react/src/internal/generate-delete-ops.tsx +++ b/packages/hypergraph-react/src/internal/generate-delete-ops.tsx @@ -44,7 +44,7 @@ type DeleteEntityResult = { }; export const generateDeleteOps = async ({ id, space }: { id: string; space: string }) => { - const result = await request(Graph.TESTNET_API_ORIGIN, deleteEntityQueryDocument, { + const result = await request(`${Graph.TESTNET_API_ORIGIN}/graphql`, deleteEntityQueryDocument, { entityId: id, }); if (result.entity === null) { diff --git a/packages/hypergraph-react/src/internal/use-delete-entity-public.tsx b/packages/hypergraph-react/src/internal/use-delete-entity-public.tsx index 40fffed5..82fbce53 100644 --- a/packages/hypergraph-react/src/internal/use-delete-entity-public.tsx +++ b/packages/hypergraph-react/src/internal/use-delete-entity-public.tsx @@ -37,10 +37,14 @@ export const useDeleteEntityPublic = (type: S, { return async ({ id, walletClient }: { id: string; walletClient: Connect.SmartSessionClient }) => { try { - const result = await request(Graph.TESTNET_API_ORIGIN, deleteEntityQueryDocument, { - spaceId: space, - entityId: id, - }); + const result = await request( + `${Graph.TESTNET_API_ORIGIN}/graphql`, + deleteEntityQueryDocument, + { + spaceId: space, + entityId: id, + }, + ); if (!result) { return { success: false, error: 'Entity not found' }; } diff --git a/packages/hypergraph-react/src/internal/use-public-space.tsx b/packages/hypergraph-react/src/internal/use-public-space.tsx index c9be2356..ca7304cf 100644 --- a/packages/hypergraph-react/src/internal/use-public-space.tsx +++ b/packages/hypergraph-react/src/internal/use-public-space.tsx @@ -24,7 +24,7 @@ export const usePublicSpace = ({ spaceId, enabled }: { spaceId: string; enabled: const result = useQuery({ queryKey: ['hypergraph-public-space', spaceId], queryFn: async () => { - const result = await request(Graph.TESTNET_API_ORIGIN, spaceQueryDocument, { + const result = await request(`${Graph.TESTNET_API_ORIGIN}/graphql`, spaceQueryDocument, { spaceId, }); return result?.space?.page diff --git a/packages/hypergraph-react/src/internal/use-query-public.tsx b/packages/hypergraph-react/src/internal/use-query-public.tsx index cae53087..b34426a1 100644 --- a/packages/hypergraph-react/src/internal/use-query-public.tsx +++ b/packages/hypergraph-react/src/internal/use-query-public.tsx @@ -344,7 +344,7 @@ export const useQueryPublic = (type: S, params?: queryDocument = entitiesQueryDocumentLevel2; } - const result = await request(Graph.TESTNET_API_ORIGIN, queryDocument, { + const result = await request(`${Graph.TESTNET_API_ORIGIN}/graphql`, queryDocument, { spaceId: space, typeIds: mappingEntry?.typeIds || [], relationTypeIdsLevel1, diff --git a/packages/hypergraph-react/src/prepare-publish.ts b/packages/hypergraph-react/src/prepare-publish.ts index 6d3980d5..8eb71217 100644 --- a/packages/hypergraph-react/src/prepare-publish.ts +++ b/packages/hypergraph-react/src/prepare-publish.ts @@ -45,10 +45,14 @@ export const preparePublish = async ({ entity, publicSpace, }: PreparePublishParams) => { - const data = await request(Graph.TESTNET_API_ORIGIN, entityToPublishQueryDocument, { - entityId: entity.id, - spaceId: publicSpace, - }); + const data = await request( + `${Graph.TESTNET_API_ORIGIN}/graphql`, + entityToPublishQueryDocument, + { + entityId: entity.id, + spaceId: publicSpace, + }, + ); const mapping = store.getSnapshot().context.mapping; const typeName = entity.type; diff --git a/packages/hypergraph-react/src/publish-ops.ts b/packages/hypergraph-react/src/publish-ops.ts index bf3695fb..d84d88c0 100644 --- a/packages/hypergraph-react/src/publish-ops.ts +++ b/packages/hypergraph-react/src/publish-ops.ts @@ -1,5 +1,5 @@ import type { Op } from '@graphprotocol/grc-20'; -import { Ipfs } from '@graphprotocol/grc-20'; +import { Graph, Ipfs } from '@graphprotocol/grc-20'; import { Connect } from '@graphprotocol/hypergraph'; import type { Hash } from 'viem'; @@ -34,7 +34,7 @@ export const publishOps = async ({ name, ops, walletClient, space }: PublishPara const cid = publishResult.cid; // This returns the correct contract address and calldata depending on the space id - const result = await fetch(`https://api-testnet.geobrowser.io/space/${space}/edit/calldata`, { + const result = await fetch(`${Graph.TESTNET_API_ORIGIN}/space/${space}/edit/calldata`, { method: 'POST', body: JSON.stringify({ cid }), }); diff --git a/packages/hypergraph/package.json b/packages/hypergraph/package.json index 8bec8a91..22446eaa 100644 --- a/packages/hypergraph/package.json +++ b/packages/hypergraph/package.json @@ -1,6 +1,6 @@ { "name": "@graphprotocol/hypergraph", - "version": "0.0.13", + "version": "0.0.14", "description": "SDK for building performant, type-safe, local-first dapps on top of The Graph ecosystem knowledge graphs.", "publishConfig": { "access": "public",