Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/connect/.env.development
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN="http://localhost:3030"
VITE_HYPERGRAPH_CHAIN="geo-testnet"
VITE_HYPERGRAPH_API_URL="https://hypergraph-v2-testnet.up.railway.app/graphql"
VITE_HYPERGRAPH_API_URL="https://v2-postgraphile.up.railway.app/graphql"
VITE_HYPERGRAPH_RPC_URL="https://rpc-geo-test-zc16z3tcvf.t.conduit.xyz"
VITE_PRIVY_APP_ID="cmbhnmo1x000bla0mxudtd8z9"
VITE_PRIVY_PROVIDERS="development"
Expand Down
2 changes: 1 addition & 1 deletion apps/connect/.env.production
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN="https://syncserver.hypergraph.thegraph.com"
VITE_HYPERGRAPH_SYNC_SERVER_ORIGIN="https://hypergraph.fly.dev"
VITE_HYPERGRAPH_CHAIN="geo-testnet"
VITE_HYPERGRAPH_API_URL="https://hypergraph-v2-testnet.up.railway.app/graphql"
VITE_HYPERGRAPH_API_URL="https://v2-postgraphile.up.railway.app/graphql"
VITE_HYPERGRAPH_RPC_URL="https://rpc-geo-test-zc16z3tcvf.t.conduit.xyz"
VITE_PRIVY_APP_ID="cmcccikza007bjy0niawgutl0"
VITE_PRIVY_PROVIDERS="production"
8 changes: 4 additions & 4 deletions apps/connect/src/hooks/use-public-spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { gql, request } from 'graphql-request';

const publicSpacesQueryDocument = gql`
query Spaces($accountAddress: String!) {
spaces(filter: { member: { is: $accountAddress } }) {
spaces(filter: {members: {some: {address: {is: $accountAddress}}}}) {
id
type
mainVotingAddress
personalAddress
entity {
page {
name
}
}
Expand All @@ -21,7 +21,7 @@ type SpaceQueryResult = {
type: string;
mainVotingAddress: string;
personalAddress: string;
entity: {
page: {
name: string;
};
};
Expand Down Expand Up @@ -50,7 +50,7 @@ export const usePublicSpaces = (url: string): UseQueryResult<PublicSpaceData[],
return result?.spaces
? result.spaces.map((space: SpaceQueryResult) => ({
id: space.id,
name: space.entity.name,
name: space.page.name,
type: space.type,
mainVotingAddress: space.mainVotingAddress,
personalAddress: space.personalAddress,
Expand Down
8 changes: 6 additions & 2 deletions apps/events/src/components/create-events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ const createEvents = async ({
});
ops.push(...createCompanyTypeOps);

const { ops: createEventTypeOps } = Graph.createEntity({
console.log('companyTypeId', companyTypeId);

const { ops: createEventTypeOps, id: eventTypeId } = Graph.createEntity({
name: 'My Test Event',
types: mapping.Event.typeIds,
relations: {
Expand All @@ -56,13 +58,15 @@ const createEvents = async ({
});
ops.push(...createEventTypeOps);

console.log('eventTypeId', eventTypeId);

const result = await publishOps({
ops,
walletClient: smartSessionClient,
space,
name: 'Create Job Offers, Companies and Events',
});
console.log('result', result);
console.log('result', result, ops);
alert('Events created');
} catch (error) {
console.error('error', error);
Expand Down
2 changes: 1 addition & 1 deletion apps/events/src/components/playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const Playground = () => {
const { success, cid, txResult } = await createEntity(
{
name: 'Test Event 42 by Nik',
sponsors: ['347676a1-7cef-47dc-b6a7-c94fc6237dcd'],
sponsors: [],
},
{ walletClient },
);
Expand Down
12 changes: 6 additions & 6 deletions apps/events/src/mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@ import type { Mapping } from '@graphprotocol/hypergraph';

export const mapping: Mapping = {
Event: {
typeIds: [Id.Id('407d9e8a-c703-4fb4-830d-98c758c8564e')],
typeIds: [Id.Id('7f9562d4-034d-4385-bf5c-f02cdebba47a')],
properties: {
name: Id.Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
},
relations: {
sponsors: Id.Id('a7ac80a6-d3d9-4b04-9b9f-ead1723af09f'),
sponsors: Id.Id('6860bfac-f703-4289-b789-972d0aaf3abe'),
},
},
Company: {
typeIds: [Id.Id('b0220a78-9205-4e5e-9bf1-c03ee0791e23')],
typeIds: [Id.Id('6c504df5-1a8f-43d1-bf2d-1ef9fa5b08b5')],
properties: {
name: Id.Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
},
relations: {
jobOffers: Id.Id('7ca8063c-3664-479b-912d-1b3b86af2bf4'),
jobOffers: Id.Id('1203064e-9741-4235-89d4-97f4b22eddfb'),
},
},
JobOffer: {
typeIds: [Id.Id('99e1733b-661d-4edb-a253-98ff4b7747d0')],
typeIds: [Id.Id('f60585af-71b6-4674-9a26-b74ca6c1cceb')],
properties: {
name: Id.Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
salary: Id.Id('5ecfb4e5-09eb-437d-9c3c-e9e7395d52aa'),
salary: Id.Id('baa36ac9-78ac-4cf7-8394-6b2d3006bebe'),
},
},

Expand Down
2 changes: 1 addition & 1 deletion apps/events/src/routes/playground.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const Route = createLazyFileRoute('/playground')({
});

function RouteComponent() {
const space = 'a57cd482-6dd3-4ba3-ac44-e2e8ea7a2862';
const space = 'a393e509-ae56-4d99-987c-bed71d9db631';
return (
<HypergraphSpaceProvider space={space}>
<div className="flex flex-col gap-4 max-w-(--breakpoint-sm) mx-auto py-8">
Expand Down
10 changes: 4 additions & 6 deletions packages/hypergraph-react/src/hooks/use-spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ import { GEO_API_TESTNET_ENDPOINT } from '../internal/constants.js';

const publicSpacesQueryDocument = gql`
query Spaces($accountAddress: String!) {
spaces(filter: {
member: { is: $accountAddress }
}) {
spaces(filter: {members: {some: {address: {is: $accountAddress}}}}) {
id
spaceAddress
entity {
page {
name
}
}
Expand All @@ -24,7 +22,7 @@ type PublicSpacesQueryResult = {
spaces: {
id: string;
spaceAddress: string;
entity: {
page: {
name: string;
};
}[];
Expand All @@ -41,7 +39,7 @@ export const useSpaces = (params: { mode: 'public' | 'private' }) => {
return result?.spaces
? result.spaces.map((space) => ({
id: space.id,
name: space.entity.name,
name: space.page.name,
spaceAddress: space.spaceAddress,
}))
: [];
Expand Down
2 changes: 1 addition & 1 deletion packages/hypergraph-react/src/internal/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const GEO_API_MAINNET_ENDPOINT = 'https://hypergraph-v2.up.railway.app/graphql';
export const GEO_API_TESTNET_ENDPOINT = 'https://hypergraph-v2-testnet.up.railway.app/graphql';
export const GEO_API_TESTNET_ENDPOINT = 'https://v2-postgraphile.up.railway.app/graphql';
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ type DeleteEntityPublicParams = {
};

const deleteEntityQueryDocument = gql`
query entityToDelete($entityId: String!, $spaceId: String!) {
entity(id: $entityId, spaceId: $spaceId) {
values {
query entityToDelete($entityId: UUID!, $spaceId: UUID!) {
entity(id: $entityId) {
valuesList(filter: {spaceId: {is: $spaceId}}) {
propertyId
}
relations {
relationsList(filter: {spaceId: {is: $spaceId}}) {
id
}
}
Expand All @@ -24,10 +24,10 @@ query entityToDelete($entityId: String!, $spaceId: String!) {

type EntityToDeleteQueryResult = {
entity: {
values: {
valuesList: {
propertyId: string;
}[];
relations: {
relationsList: {
id: string;
}[];
};
Expand All @@ -45,14 +45,14 @@ export const useDeleteEntityPublic = <S extends Entity.AnyNoContext>(type: S, {
if (!result) {
return { success: false, error: 'Entity not found' };
}
const { values, relations } = result.entity;
const { valuesList, relationsList } = result.entity;
const ops: Op[] = [];
const { ops: unsetEntityValuesOps } = Graph.unsetEntityValues({
id,
properties: values.map(({ propertyId }) => propertyId),
properties: valuesList.map(({ propertyId }) => propertyId),
});
ops.push(...unsetEntityValuesOps);
for (const relation of relations) {
for (const relation of relationsList) {
const { ops: deleteRelationOps } = Graph.deleteRelation({ id: relation.id });
ops.push(...deleteRelationOps);
}
Expand Down
10 changes: 5 additions & 5 deletions packages/hypergraph-react/src/internal/use-public-space.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { gql, request } from 'graphql-request';
import { GEO_API_TESTNET_ENDPOINT } from '../internal/constants.js';

const spaceQueryDocument = gql`
query Space($spaceId: String!) {
query Space($spaceId: UUID!) {
space(id: $spaceId) {
entity {
page {
name
}
}
Expand All @@ -14,7 +14,7 @@ query Space($spaceId: String!) {

type SpaceQueryResult = {
space: {
entity: {
page: {
name: string;
};
} | null;
Expand All @@ -27,9 +27,9 @@ export const usePublicSpace = ({ spaceId, enabled }: { spaceId: string; enabled:
const result = await request<SpaceQueryResult>(GEO_API_TESTNET_ENDPOINT, spaceQueryDocument, {
spaceId,
});
return result?.space?.entity
return result?.space?.page
? {
name: result.space.entity.name,
name: result.space.page.name,
}
: null;
},
Expand Down
Loading
Loading