Skip to content

Commit 9e73753

Browse files
committed
fix endpoints
1 parent 53ba6b8 commit 9e73753

File tree

7 files changed

+28
-16
lines changed

7 files changed

+28
-16
lines changed

packages/hypergraph-react/src/hooks/use-spaces.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ export const useSpaces = (params: { mode: 'public' | 'private' }) => {
3333
const publicResult = useQuery({
3434
queryKey: ['hypergraph-spaces', params.mode],
3535
queryFn: async () => {
36-
const result = await request<PublicSpacesQueryResult>(Graph.TESTNET_API_ORIGIN, publicSpacesQueryDocument, {
37-
accountAddress,
38-
});
36+
const result = await request<PublicSpacesQueryResult>(
37+
`${Graph.TESTNET_API_ORIGIN}/graphql`,
38+
publicSpacesQueryDocument,
39+
{
40+
accountAddress,
41+
},
42+
);
3943
return result?.spaces
4044
? result.spaces.map((space) => ({
4145
id: space.id,

packages/hypergraph-react/src/internal/generate-delete-ops.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type DeleteEntityResult = {
4444
};
4545

4646
export const generateDeleteOps = async ({ id, space }: { id: string; space: string }) => {
47-
const result = await request<DeleteEntityResult>(Graph.TESTNET_API_ORIGIN, deleteEntityQueryDocument, {
47+
const result = await request<DeleteEntityResult>(`${Graph.TESTNET_API_ORIGIN}/graphql`, deleteEntityQueryDocument, {
4848
entityId: id,
4949
});
5050
if (result.entity === null) {

packages/hypergraph-react/src/internal/use-delete-entity-public.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ export const useDeleteEntityPublic = <S extends Entity.AnyNoContext>(type: S, {
3737

3838
return async ({ id, walletClient }: { id: string; walletClient: Connect.SmartSessionClient }) => {
3939
try {
40-
const result = await request<EntityToDeleteQueryResult>(Graph.TESTNET_API_ORIGIN, deleteEntityQueryDocument, {
41-
spaceId: space,
42-
entityId: id,
43-
});
40+
const result = await request<EntityToDeleteQueryResult>(
41+
`${Graph.TESTNET_API_ORIGIN}/graphql`,
42+
deleteEntityQueryDocument,
43+
{
44+
spaceId: space,
45+
entityId: id,
46+
},
47+
);
4448
if (!result) {
4549
return { success: false, error: 'Entity not found' };
4650
}

packages/hypergraph-react/src/internal/use-public-space.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const usePublicSpace = ({ spaceId, enabled }: { spaceId: string; enabled:
2424
const result = useQuery({
2525
queryKey: ['hypergraph-public-space', spaceId],
2626
queryFn: async () => {
27-
const result = await request<SpaceQueryResult>(Graph.TESTNET_API_ORIGIN, spaceQueryDocument, {
27+
const result = await request<SpaceQueryResult>(`${Graph.TESTNET_API_ORIGIN}/graphql`, spaceQueryDocument, {
2828
spaceId,
2929
});
3030
return result?.space?.page

packages/hypergraph-react/src/internal/use-query-public.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export const useQueryPublic = <S extends Entity.AnyNoContext>(type: S, params?:
344344
queryDocument = entitiesQueryDocumentLevel2;
345345
}
346346

347-
const result = await request<EntityQueryResult>(Graph.TESTNET_API_ORIGIN, queryDocument, {
347+
const result = await request<EntityQueryResult>(`${Graph.TESTNET_API_ORIGIN}/graphql`, queryDocument, {
348348
spaceId: space,
349349
typeIds: mappingEntry?.typeIds || [],
350350
relationTypeIdsLevel1,

packages/hypergraph-react/src/prepare-publish.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ export const preparePublish = async <S extends Entity.AnyNoContext>({
4545
entity,
4646
publicSpace,
4747
}: PreparePublishParams<S>) => {
48-
const data = await request<EntityToPublishQueryResult>(Graph.TESTNET_API_ORIGIN, entityToPublishQueryDocument, {
49-
entityId: entity.id,
50-
spaceId: publicSpace,
51-
});
48+
const data = await request<EntityToPublishQueryResult>(
49+
`${Graph.TESTNET_API_ORIGIN}/graphql`,
50+
entityToPublishQueryDocument,
51+
{
52+
entityId: entity.id,
53+
spaceId: publicSpace,
54+
},
55+
);
5256

5357
const mapping = store.getSnapshot().context.mapping;
5458
const typeName = entity.type;

packages/hypergraph-react/src/publish-ops.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Op } from '@graphprotocol/grc-20';
2-
import { Ipfs } from '@graphprotocol/grc-20';
2+
import { Graph, Ipfs } from '@graphprotocol/grc-20';
33
import { Connect } from '@graphprotocol/hypergraph';
44
import type { Hash } from 'viem';
55

@@ -34,7 +34,7 @@ export const publishOps = async ({ name, ops, walletClient, space }: PublishPara
3434
const cid = publishResult.cid;
3535

3636
// This returns the correct contract address and calldata depending on the space id
37-
const result = await fetch(`https://api-testnet.geobrowser.io/space/${space}/edit/calldata`, {
37+
const result = await fetch(`${Graph.TESTNET_API_ORIGIN}/space/${space}/edit/calldata`, {
3838
method: 'POST',
3939
body: JSON.stringify({ cid }),
4040
});

0 commit comments

Comments
 (0)