Skip to content

Commit dc9cc6b

Browse files
committed
remove mapping and fix types
1 parent e965c6d commit dc9cc6b

File tree

13 files changed

+221
-299
lines changed

13 files changed

+221
-299
lines changed

apps/privy-login-example/src/Boot.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { HypergraphAppProvider } from '@graphprotocol/hypergraph-react';
22
import { PrivyProvider } from '@privy-io/react-auth';
33
import { createRouter, RouterProvider } from '@tanstack/react-router';
4-
import { mapping } from './mapping.js';
54
import { routeTree } from './routeTree.gen';
65

76
// Create a new router instance
@@ -29,11 +28,7 @@ export function Boot() {
2928
},
3029
}}
3130
>
32-
<HypergraphAppProvider
33-
syncServerUri="http://localhost:3030"
34-
mapping={mapping}
35-
appId="93bb8907-085a-4a0e-83dd-62b0dc98e793"
36-
>
31+
<HypergraphAppProvider syncServerUri="http://localhost:3030" appId="93bb8907-085a-4a0e-83dd-62b0dc98e793">
3732
<RouterProvider router={router} />
3833
</HypergraphAppProvider>
3934
</PrivyProvider>

apps/privy-login-example/src/mapping.ts

Lines changed: 0 additions & 61 deletions
This file was deleted.

apps/template-nextjs/app/Providers.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import { HypergraphAppProvider } from '@graphprotocol/hypergraph-react';
44

5-
import { mapping } from './mapping';
6-
75
export default function Providers({ children }: Readonly<{ children: React.ReactNode }>) {
86
const _storage = typeof window !== 'undefined' ? window.localStorage : (undefined as unknown as Storage);
97

108
return (
11-
<HypergraphAppProvider mapping={mapping} storage={_storage} appId="93bb8907-085a-4a0e-83dd-62b0dc98e793">
9+
<HypergraphAppProvider storage={_storage} appId="93bb8907-085a-4a0e-83dd-62b0dc98e793">
1210
{children}
1311
</HypergraphAppProvider>
1412
);

apps/template-nextjs/app/mapping.ts

Lines changed: 0 additions & 66 deletions
This file was deleted.

apps/template-nextjs/app/schema.ts

Lines changed: 104 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,111 @@
1-
import { Entity, Type } from '@graphprotocol/hypergraph';
1+
import { EntitySchema, Id, Type } from '@graphprotocol/hypergraph';
22

3-
export class Image extends Entity.Class<Image>('Image')({
4-
url: Type.String,
5-
}) {}
3+
export const Image = EntitySchema(
4+
{
5+
url: Type.String,
6+
},
7+
{
8+
types: [Id('ba4e4146-0010-499d-a0a3-caaa7f579d0e')],
9+
properties: {
10+
url: Id('8a743832-c094-4a62-b665-0c3cc2f9c7bc'),
11+
},
12+
},
13+
);
614

7-
export class Project extends Entity.Class<Project>('Project')({
8-
name: Type.String,
9-
description: Type.optional(Type.String),
10-
xUrl: Type.optional(Type.String),
11-
avatar: Type.Relation(Image),
12-
}) {}
15+
export const Project = EntitySchema(
16+
{
17+
name: Type.String,
18+
description: Type.optional(Type.String),
19+
x: Type.optional(Type.String),
20+
avatar: Type.Relation(Image),
21+
},
22+
{
23+
types: [Id('484a18c5-030a-499c-b0f2-ef588ff16d50')],
24+
properties: {
25+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
26+
description: Id('9b1f76ff-9711-404c-861e-59dc3fa7d037'),
27+
x: Id('0d625978-4b3c-4b57-a86f-de45c997c73c'),
28+
avatar: Id('1155beff-fad5-49b7-a2e0-da4777b8792c'),
29+
},
30+
},
31+
);
1332

14-
export class Dapp extends Entity.Class<Dapp>('Dapp')({
15-
name: Type.String,
16-
description: Type.optional(Type.String),
17-
xUrl: Type.optional(Type.String),
18-
githubUrl: Type.optional(Type.String),
19-
avatar: Type.Relation(Image),
20-
}) {}
33+
export const Dapp = EntitySchema(
34+
{
35+
name: Type.String,
36+
description: Type.optional(Type.String),
37+
x: Type.optional(Type.String),
38+
github: Type.optional(Type.String),
39+
avatar: Type.Relation(Image),
40+
},
41+
{
42+
types: [Id('8ca136d0-698a-4bbf-a76b-8e2741b2dc8c')],
43+
properties: {
44+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
45+
description: Id('9b1f76ff-9711-404c-861e-59dc3fa7d037'),
46+
x: Id('0d625978-4b3c-4b57-a86f-de45c997c73c'),
47+
github: Id('9eedefa8-60ae-4ac1-9a04-805054a4b094'),
48+
avatar: Id('1155beff-fad5-49b7-a2e0-da4777b8792c'),
49+
},
50+
},
51+
);
2152

22-
export class Investor extends Entity.Class<Investor>('Investor')({
23-
name: Type.String,
24-
}) {}
53+
export const Investor = EntitySchema(
54+
{
55+
name: Type.String,
56+
},
57+
{
58+
types: [Id('331aea18-973c-4adc-8f53-614f598d262d')],
59+
properties: {
60+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
61+
},
62+
},
63+
);
2564

26-
export class FundingStage extends Entity.Class<FundingStage>('FundingStage')({
27-
name: Type.String,
28-
}) {}
65+
export const FundingStage = EntitySchema(
66+
{
67+
name: Type.String,
68+
},
69+
{
70+
types: [Id('8d35d217-3fa1-4686-b74f-fcb3e9438067')],
71+
properties: {
72+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
73+
},
74+
},
75+
);
2976

30-
export class InvestmentRound extends Entity.Class<InvestmentRound>('InvestmentRound')({
31-
name: Type.String,
32-
raisedAmount: Type.optional(Type.Number),
33-
investors: Type.Relation(Investor),
34-
fundingStages: Type.Relation(FundingStage),
35-
raisedBy: Type.Relation(Project),
36-
}) {}
77+
export const InvestmentRound = EntitySchema(
78+
{
79+
name: Type.String,
80+
raisedAmount: Type.optional(Type.Number),
81+
investors: Type.Relation(Investor),
82+
fundingStages: Type.Relation(FundingStage),
83+
raisedBy: Type.Relation(Project),
84+
},
85+
{
86+
types: [Id('8f03f4c9-59e4-44a8-a625-c0a40b1ff330')],
87+
properties: {
88+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
89+
raisedAmount: Id('16781706-dd9c-48bf-913e-cdf18b56034f'),
90+
investors: Id('9b8a610a-fa35-486e-a479-e253dbdabb4f'),
91+
fundingStages: Id('e278c3d4-78b9-4222-b272-5a39a8556bd2'),
92+
raisedBy: Id('b4878d1a-0609-488d-b8a6-e19862d6b62f'),
93+
},
94+
},
95+
);
3796

38-
export class Asset extends Entity.Class<Asset>('Asset')({
39-
name: Type.String,
40-
symbol: Type.optional(Type.String),
41-
blockchainAddress: Type.optional(Type.String),
42-
}) {}
97+
export const Asset = EntitySchema(
98+
{
99+
name: Type.String,
100+
symbol: Type.optional(Type.String),
101+
blockchainAddress: Type.optional(Type.String),
102+
},
103+
{
104+
types: [Id('f8780a80-c238-4a2a-96cb-567d88b1aa63')],
105+
properties: {
106+
name: Id('a126ca53-0c8e-48d5-b888-82c734c38935'),
107+
symbol: Id('ace1e96c-9b83-47b4-bd33-1d302ec0a0f5'),
108+
blockchainAddress: Id('56b5944f-f059-48d1-b0fa-34abe84219da'),
109+
},
110+
},
111+
);

apps/template-vite-react/src/main.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { HypergraphAppProvider } from '@graphprotocol/hypergraph-react';
2-
import { RouterProvider, createRouter } from '@tanstack/react-router';
2+
import { createRouter, RouterProvider } from '@tanstack/react-router';
33
import ReactDOM from 'react-dom/client';
44
import './index.css';
5-
import { mapping } from './mapping';
65

76
// Import the generated route tree
87
import { routeTree } from './routeTree.gen';
@@ -23,7 +22,7 @@ if (rootElement && !rootElement.innerHTML) {
2322
const root = ReactDOM.createRoot(rootElement);
2423
root.render(
2524
// <React.StrictMode>
26-
<HypergraphAppProvider mapping={mapping} appId="93bb8907-085a-4a0e-83dd-62b0dc98e793">
25+
<HypergraphAppProvider appId="93bb8907-085a-4a0e-83dd-62b0dc98e793">
2726
<RouterProvider router={router} />
2827
</HypergraphAppProvider>,
2928
// </React.StrictMode>,

apps/template-vite-react/src/mapping.ts

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)