Skip to content

Commit 96030dc

Browse files
committed
switch to the new api
1 parent 56e8851 commit 96030dc

File tree

12 files changed

+84
-87
lines changed

12 files changed

+84
-87
lines changed

apps/connect/.env.development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN="http://localhost:3030"
22
VITE_HYPERGRAPH_CHAIN="geo-testnet"
3-
VITE_HYPERGRAPH_API_URL="https://hypergraph-v2-testnet.up.railway.app/graphql"
3+
VITE_HYPERGRAPH_API_URL="https://v2-postgraphile.up.railway.app/graphql"
44
VITE_HYPERGRAPH_RPC_URL="https://rpc-geo-test-zc16z3tcvf.t.conduit.xyz"
55
VITE_PRIVY_APP_ID="cmbhnmo1x000bla0mxudtd8z9"
66
VITE_PRIVY_PROVIDERS="development"

apps/connect/.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN="https://syncserver.hypergraph.thegraph.com"
22
VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN="https://hypergraph.fly.dev"
33
VITE_HYPERGRAPH_CHAIN="geo-testnet"
4-
VITE_HYPERGRAPH_API_URL="https://hypergraph-v2-testnet.up.railway.app/graphql"
4+
VITE_HYPERGRAPH_API_URL="https://v2-postgraphile.up.railway.app/graphql"
55
VITE_HYPERGRAPH_RPC_URL="https://rpc-geo-test-zc16z3tcvf.t.conduit.xyz"
66
VITE_PRIVY_APP_ID="cmcccikza007bjy0niawgutl0"
77
VITE_PRIVY_PROVIDERS="production"

apps/connect/src/hooks/use-public-spaces.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { gql, request } from 'graphql-request';
44

55
const publicSpacesQueryDocument = gql`
66
query Spaces($accountAddress: String!) {
7-
spaces(filter: { member: { is: $accountAddress } }) {
7+
spaces(filter: {members: {some: {address: {is: $accountAddress}}}}) {
88
id
99
type
1010
mainVotingAddress
1111
personalAddress
12-
entity {
12+
page {
1313
name
1414
}
1515
}
@@ -21,7 +21,7 @@ type SpaceQueryResult = {
2121
type: string;
2222
mainVotingAddress: string;
2323
personalAddress: string;
24-
entity: {
24+
page: {
2525
name: string;
2626
};
2727
};
@@ -50,7 +50,7 @@ export const usePublicSpaces = (url: string): UseQueryResult<PublicSpaceData[],
5050
return result?.spaces
5151
? result.spaces.map((space: SpaceQueryResult) => ({
5252
id: space.id,
53-
name: space.entity.name,
53+
name: space.page.name,
5454
type: space.type,
5555
mainVotingAddress: space.mainVotingAddress,
5656
personalAddress: space.personalAddress,

apps/events/src/components/create-events.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const createEvents = async ({
4747
});
4848
ops.push(...createCompanyTypeOps);
4949

50-
const { ops: createEventTypeOps } = Graph.createEntity({
50+
const { ops: createEventTypeOps, id: eventTypeId } = Graph.createEntity({
5151
name: 'My Test Event',
5252
types: mapping.Event.typeIds,
5353
relations: {
@@ -56,13 +56,15 @@ const createEvents = async ({
5656
});
5757
ops.push(...createEventTypeOps);
5858

59+
console.log('eventTypeId', eventTypeId);
60+
5961
const result = await publishOps({
6062
ops,
6163
walletClient: smartSessionClient,
6264
space,
6365
name: 'Create Job Offers, Companies and Events',
6466
});
65-
console.log('result', result);
67+
console.log('result', result, ops);
6668
alert('Events created');
6769
} catch (error) {
6870
console.error('error', error);

apps/events/src/routes/playground.lazy.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const Route = createLazyFileRoute('/playground')({
99
});
1010

1111
function RouteComponent() {
12-
const space = 'a57cd482-6dd3-4ba3-ac44-e2e8ea7a2862';
12+
const space = 'a393e509-ae56-4d99-987c-bed71d9db631';
1313
return (
1414
<HypergraphSpaceProvider space={space}>
1515
<div className="flex flex-col gap-4 max-w-(--breakpoint-sm) mx-auto py-8">

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ import { GEO_API_TESTNET_ENDPOINT } from '../internal/constants.js';
88

99
const publicSpacesQueryDocument = gql`
1010
query Spaces($accountAddress: String!) {
11-
spaces(filter: {
12-
member: { is: $accountAddress }
13-
}) {
11+
spaces(filter: {members: {some: {address: {is: $accountAddress}}}}) {
1412
id
1513
spaceAddress
16-
entity {
14+
page {
1715
name
1816
}
1917
}
@@ -24,7 +22,7 @@ type PublicSpacesQueryResult = {
2422
spaces: {
2523
id: string;
2624
spaceAddress: string;
27-
entity: {
25+
page: {
2826
name: string;
2927
};
3028
}[];
@@ -41,7 +39,7 @@ export const useSpaces = (params: { mode: 'public' | 'private' }) => {
4139
return result?.spaces
4240
? result.spaces.map((space) => ({
4341
id: space.id,
44-
name: space.entity.name,
42+
name: space.page.name,
4543
spaceAddress: space.spaceAddress,
4644
}))
4745
: [];
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
export const GEO_API_MAINNET_ENDPOINT = 'https://hypergraph-v2.up.railway.app/graphql';
2-
export const GEO_API_TESTNET_ENDPOINT = 'https://hypergraph-v2-testnet.up.railway.app/graphql';
2+
export const GEO_API_TESTNET_ENDPOINT = 'https://v2-postgraphile.up.railway.app/graphql';

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ type DeleteEntityPublicParams = {
1010
};
1111

1212
const deleteEntityQueryDocument = gql`
13-
query entityToDelete($entityId: String!, $spaceId: String!) {
14-
entity(id: $entityId, spaceId: $spaceId) {
15-
values {
13+
query entityToDelete($entityId: UUID!, $spaceId: UUID!) {
14+
entity(id: $entityId) {
15+
valuesList(filter: {spaceId: {is: $spaceId}}) {
1616
propertyId
1717
}
18-
relations {
18+
relationsList(filter: {spaceId: {is: $spaceId}}) {
1919
id
2020
}
2121
}
@@ -24,10 +24,10 @@ query entityToDelete($entityId: String!, $spaceId: String!) {
2424

2525
type EntityToDeleteQueryResult = {
2626
entity: {
27-
values: {
27+
valuesList: {
2828
propertyId: string;
2929
}[];
30-
relations: {
30+
relationsList: {
3131
id: string;
3232
}[];
3333
};
@@ -45,14 +45,14 @@ export const useDeleteEntityPublic = <S extends Entity.AnyNoContext>(type: S, {
4545
if (!result) {
4646
return { success: false, error: 'Entity not found' };
4747
}
48-
const { values, relations } = result.entity;
48+
const { valuesList, relationsList } = result.entity;
4949
const ops: Op[] = [];
5050
const { ops: unsetEntityValuesOps } = Graph.unsetEntityValues({
5151
id,
52-
properties: values.map(({ propertyId }) => propertyId),
52+
properties: valuesList.map(({ propertyId }) => propertyId),
5353
});
5454
ops.push(...unsetEntityValuesOps);
55-
for (const relation of relations) {
55+
for (const relation of relationsList) {
5656
const { ops: deleteRelationOps } = Graph.deleteRelation({ id: relation.id });
5757
ops.push(...deleteRelationOps);
5858
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { gql, request } from 'graphql-request';
33
import { GEO_API_TESTNET_ENDPOINT } from '../internal/constants.js';
44

55
const spaceQueryDocument = gql`
6-
query Space($spaceId: String!) {
6+
query Space($spaceId: UUID!) {
77
space(id: $spaceId) {
8-
entity {
8+
page {
99
name
1010
}
1111
}
@@ -14,7 +14,7 @@ query Space($spaceId: String!) {
1414

1515
type SpaceQueryResult = {
1616
space: {
17-
entity: {
17+
page: {
1818
name: string;
1919
};
2020
} | null;
@@ -27,9 +27,9 @@ export const usePublicSpace = ({ spaceId, enabled }: { spaceId: string; enabled:
2727
const result = await request<SpaceQueryResult>(GEO_API_TESTNET_ENDPOINT, spaceQueryDocument, {
2828
spaceId,
2929
});
30-
return result?.space?.entity
30+
return result?.space?.page
3131
? {
32-
name: result.space.entity.name,
32+
name: result.space.page.name,
3333
}
3434
: null;
3535
},

0 commit comments

Comments
 (0)