-
Notifications
You must be signed in to change notification settings - Fork 10
Nik/switch to geo sdk #586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates the codebase from the older @graphprotocol/grc-20 SDK to the new @geoprotocol/geo-sdk, and adjusts GraphQL endpoints and configuration to match the new SDK and API setup.
Changes:
- Replace
@graphprotocol/grc-20with@geoprotocol/geo-sdkacross packages, apps, and tests (imports, re-exports, and package.json dependencies). - Update several GraphQL clients and tests to use the new
/graphqlendpoint and point to the non‑staging testnet API origin. - Refresh the
pnpm-lock.yamlto include@geoprotocol/geo-sdk, drop direct@graphprotocol/grc-20lock entries, and bump related build/transpile tooling (e.g.,rolldown,@oxc-project/types).
Reviewed changes
Copilot reviewed 46 out of 47 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Lockfile updated to swap in @geoprotocol/geo-sdk, remove direct @graphprotocol/grc-20@0.33.0, and bump various transitive dependencies (rolldown bindings, @oxc-project/types, etc.). |
| packages/typesync-studio/src/clients/Graphql.ts | GraphQL client now imports Graph from @geoprotocol/geo-sdk and targets ${Graph.TESTNET_API_ORIGIN}/graphql. |
| packages/typesync-studio/package.json | Dependency switched from @graphprotocol/grc-20 to @geoprotocol/geo-sdk. |
| packages/typesync-studio/graphql.codegen.ts | Codegen config now imports Graph from @geoprotocol/geo-sdk and uses ${Graph.TESTNET_API_ORIGIN}/graphql as the schema endpoint. |
| packages/hypergraph/test/utils/translate-filter-to-graphql.test.ts | Test updated to import Id from @geoprotocol/geo-sdk. |
| packages/hypergraph/test/utils/relation-config-overrides.test.ts | Test updated to import Id from @geoprotocol/geo-sdk. |
| packages/hypergraph/test/mapping/Mapping.test.ts | Test updated to import Id from @geoprotocol/geo-sdk. |
| packages/hypergraph/test/entity/space-ids-types.test.ts | Test updated to import Id from @geoprotocol/geo-sdk. |
| packages/hypergraph/test/entity/findMany.test.ts | Test updated to import Id from @geoprotocol/geo-sdk. |
| packages/hypergraph/test/entity/find-one-public.test.ts | Test updated to import Id from @geoprotocol/geo-sdk. |
| packages/hypergraph/test/entity/find-many-public.test.ts | Test updated to import Id from @geoprotocol/geo-sdk. |
| packages/hypergraph/test/entity/entity.test.ts | Test updated to import Id from @geoprotocol/geo-sdk. |
| packages/hypergraph/test/cli/services/Utils.test.ts | Test updated to import Id from @geoprotocol/geo-sdk. |
| packages/hypergraph/src/space/find-many-public.ts | Public space finder now imports ContentIds and SystemIds from @geoprotocol/geo-sdk (runtime behavior unchanged otherwise). |
| packages/hypergraph/src/mapping/Mapping.ts | Mapping logic now uses Graph, CreatePropertyParams, Op, and Id from @geoprotocol/geo-sdk, plus doc comment updated to show the new import path. |
| packages/hypergraph/src/index.ts | Library re-export of Id now comes from @geoprotocol/geo-sdk. |
| packages/hypergraph/src/connect/smart-account.ts | Smart-account connector now imports TESTNET contracts from @geoprotocol/geo-sdk/contracts and re-maps SPACE_FACTORY_ADDRESS; currently both chain IDs are mapped to the testnet DAO factory (commented as TODO). |
| packages/hypergraph/src/config.ts | Config now imports Graph from @geoprotocol/geo-sdk but otherwise still defaults getApiOrigin() to Graph.TESTNET_API_ORIGIN. |
| packages/hypergraph/package.json | Hypergraph package dependency switched from @graphprotocol/grc-20 to @geoprotocol/geo-sdk. |
| packages/hypergraph-react/test/space-ids-types.test.ts | React test now imports Id from @geoprotocol/geo-sdk. |
| packages/hypergraph-react/test/prepare-publish.test.ts | Test updated to use Id from @geoprotocol/geo-sdk and to expect preparePublish to hit ${Config.getApiOrigin()}/graphql instead of /v2/graphql. |
| packages/hypergraph-react/src/publish-ops.ts | Publish helper now sources Op and Ipfs from @geoprotocol/geo-sdk, but network is hard-coded to 'TESTNET' for all chains (with a TODO). |
| packages/hypergraph-react/src/prepare-publish.ts | preparePublish now uses Graph, Id, Op, and parameter types from @geoprotocol/geo-sdk; GraphQL endpoint is still ${Config.getApiOrigin()}/v2/graphql. |
| packages/hypergraph-react/src/internal/use-public-space.tsx | Hook now queries ${Config.getApiOrigin()}/graphql instead of /v2/graphql for space metadata. |
| packages/hypergraph-react/src/internal/use-delete-entity-public.tsx | Hook uses Graph from @geoprotocol/geo-sdk for delete-entity flows. |
| packages/hypergraph-react/src/internal/generate-delete-ops.tsx | Delete-op generator now imports Op from @geoprotocol/geo-sdk but continues to call ${Config.getApiOrigin()}/v2/graphql. |
| packages/hypergraph-react/src/hooks/use-privy-auth-create-public-space.ts | Hook now imports Graph from @geoprotocol/geo-sdk for Privy-based public space creation. |
| packages/hypergraph-react/src/HypergraphAppContext.tsx | App provider uses Graph from @geoprotocol/geo-sdk, and Graph.createSpace is now always called with network: 'TESTNET' (with a TODO to reintroduce mainnet). |
| packages/hypergraph-react/package.json | React package dependency switched from @graphprotocol/grc-20 to @geoprotocol/geo-sdk. |
| package.json | Root devDependency updated from @graphprotocol/grc-20 to @geoprotocol/geo-sdk. |
| docs/docs/key-features.md | Documentation updated to reference @geoprotocol/geo-sdk and its npm link instead of @graphprotocol/grc-20. |
| apps/privy-login-example/src/components/create-properties-and-types-todos.tsx | Example component now imports Graph and Op from @geoprotocol/geo-sdk. |
| apps/privy-login-example/src/components/create-properties-and-types-event.tsx | Example component now imports Graph and Op from @geoprotocol/geo-sdk. |
| apps/privy-login-example/src/components/create-events.tsx | Example events component now imports Graph and Op from @geoprotocol/geo-sdk. |
| apps/privy-login-example/package.json | Example app dependency switched to @geoprotocol/geo-sdk. |
| apps/next-example/package.json | Next.js example app dependency switched to @geoprotocol/geo-sdk. |
| apps/events/test-script.ts | Script now imports SystemIds from @geoprotocol/geo-sdk and points Config.setApiOrigin at the non‑staging testnet API origin. |
| apps/events/src/schema.ts | Events app schema now imports ContentIds and SystemIds from @geoprotocol/geo-sdk. |
| apps/events/src/components/create-properties-and-types-todos.tsx | Events component now imports Graph and Op from @geoprotocol/geo-sdk. |
| apps/events/src/components/create-properties-and-types-event.tsx | Events component now imports Graph and Op from @geoprotocol/geo-sdk. |
| apps/events/src/components/create-events.tsx | Events component now imports Graph and Op from @geoprotocol/geo-sdk. |
| apps/events/src/Boot.tsx | Hypergraph provider apiOrigin updated from the staging testnet API to the production testnet API host. |
| apps/events/package.json | Events app dependency switched to @geoprotocol/geo-sdk. |
| apps/connect/src/routes/index.tsx | Route now imports Graph from @geoprotocol/geo-sdk; still uses ${Graph.TESTNET_API_ORIGIN}/v2/graphql with usePublicSpaces. |
| apps/connect/src/routes/authenticate.tsx | Authenticate route now imports Graph from @geoprotocol/geo-sdk and defines API_URL using ${Graph.TESTNET_API_ORIGIN}/graphql for both geogenesis and testnet (with a TODO for mainnet). |
| apps/connect/src/components/CreateSpaceCard.tsx | Component now imports Graph from @geoprotocol/geo-sdk for space creation. |
| apps/connect/package.json | Connect app dependency switched to @geoprotocol/geo-sdk. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const result = await preparePublish(params); | ||
|
|
||
| expect(mockRequest).toHaveBeenCalledWith(`${Config.getApiOrigin()}/v2/graphql`, expect.any(String), { | ||
| expect(mockRequest).toHaveBeenCalledWith(`${Config.getApiOrigin()}/graphql`, expect.any(String), { |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test now expects preparePublish to call request with ${Config.getApiOrigin()}/graphql, but the implementation in src/prepare-publish.ts still calls ${Config.getApiOrigin()}/v2/graphql. As written, the test and implementation disagree and the test will fail; either the implementation should be updated to use the /graphql endpoint or this assertion should be reverted to match the current implementation URL.
| expect(mockRequest).toHaveBeenCalledWith(`${Config.getApiOrigin()}/graphql`, expect.any(String), { | |
| expect(mockRequest).toHaveBeenCalledWith(`${Config.getApiOrigin()}/v2/graphql`, expect.any(String), { |
| import { Graph } from '@geoprotocol/geo-sdk'; | ||
| import { useIdentityToken } from '@privy-io/react-auth'; | ||
| import { createFileRoute } from '@tanstack/react-router'; | ||
| import { CreateSpaceCard } from '@/components/CreateSpaceCard'; |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that this route imports Graph from the new SDK, note that further down in this file usePublicSpaces is still called with a hard-coded ${Graph.TESTNET_API_ORIGIN}/v2/graphql URL. To avoid subtle inconsistencies with authenticate.tsx (which uses the /graphql endpoint via API_URL) and to prevent duplicated endpoint configuration, consider aligning that call with the same /graphql path or shared constant.
| import.meta.env.VITE_HYPERGRAPH_CHAIN === 'geogenesis' | ||
| ? `${Graph.MAINNET_API_ORIGIN}/v2/graphql` | ||
| : `${Graph.TESTNET_API_ORIGIN}/v2/graphql`; | ||
| ? `${Graph.TESTNET_API_ORIGIN}/graphql` // TODO: switch to mainnet |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API_URL now always uses Graph.TESTNET_API_ORIGIN, even when VITE_HYPERGRAPH_CHAIN === 'geogenesis', which means the app will talk to the testnet GraphQL API while CHAIN is set to the geogenesis (mainnet) chain. This desynchronizes chain and API target compared to the previous behavior that used Graph.MAINNET_API_ORIGIN for geogenesis, and will cause geogenesis deployments to hit the wrong backend; please restore a mainnet-specific origin for the geogenesis branch or otherwise align API_URL with CHAIN.
| ? `${Graph.TESTNET_API_ORIGIN}/graphql` // TODO: switch to mainnet | |
| ? `${Graph.MAINNET_API_ORIGIN}/graphql` |
| const SPACE_FACTORY_ADDRESS: Record<string, Hex> = { | ||
| '80451': MAINNET.DAO_FACTORY_ADDRESS, | ||
| '80451': TESTNET.DAO_FACTORY_ADDRESS, // TODO: switch to mainnet | ||
| '19411': TESTNET.DAO_FACTORY_ADDRESS, | ||
| }; |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SPACE_FACTORY_ADDRESS now maps chain ID '80451' to TESTNET.DAO_FACTORY_ADDRESS, whereas this previously used the mainnet DAO factory address. For calls executed on the 80451 (mainnet) chain this will route space-creation transactions to the testnet factory, which is almost certainly incorrect and will break mainnet behavior; this entry should continue to use the mainnet factory address (or an equivalent mainnet constant) rather than the testnet one.
| } | ||
|
|
||
| const network = walletClient.chain.id === Connect.GEO_TESTNET.id ? 'TESTNET' : 'MAINNET'; | ||
| const network = walletClient.chain.id === Connect.GEO_TESTNET.id ? 'TESTNET' : 'TESTNET'; // TODO: switch to mainnet |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The network variable now resolves to 'TESTNET' for both GEO testnet and non-testnet chains, so Ipfs.publishEdit will always be invoked with the testnet network label. This is a regression from the previous behavior (which used 'MAINNET' for non-testnet chains) and will cause publishes on mainnet to be tagged for the wrong network; the conditional should preserve a distinct mainnet value for non-testnet chains.
| const network = walletClient.chain.id === Connect.GEO_TESTNET.id ? 'TESTNET' : 'TESTNET'; // TODO: switch to mainnet | |
| const network = walletClient.chain.id === Connect.GEO_TESTNET.id ? 'TESTNET' : 'MAINNET'; |
| editorAddress: smartSessionClient.account.address, | ||
| name, | ||
| network: smartSessionClient.chain.id === Connect.GEO_TESTNET.id ? 'TESTNET' : 'MAINNET', | ||
| network: smartSessionClient.chain.id === Connect.GEO_TESTNET.id ? 'TESTNET' : 'TESTNET', // TODO: switch to mainnet |
Copilot
AI
Jan 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Graph.createSpace is now always called with network: 'TESTNET' regardless of smartSessionClient.chain.id, so even non-testnet chains are treated as testnet. This breaks multi-network support compared to the previous TESTNET vs MAINNET split and will cause spaces created on mainnet to be mis-labeled; the network argument should conditionally select a mainnet value when the chain is not Connect.GEO_TESTNET.
| network: smartSessionClient.chain.id === Connect.GEO_TESTNET.id ? 'TESTNET' : 'TESTNET', // TODO: switch to mainnet | |
| network: smartSessionClient.chain.id === Connect.GEO_TESTNET.id ? 'TESTNET' : 'MAINNET', |
No description provided.