Skip to content

Commit 2ff1225

Browse files
committed
geo-sdk upgrades
1 parent 04ed530 commit 2ff1225

12 files changed

Lines changed: 28 additions & 72 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@graphprotocol/hypergraph": patch
3+
"@graphprotocol/hypergraph-react": patch
4+
---
5+
6+
Update geo-sdk type names: float64 to float, bool to boolean. Replace removed Graph.createSpace calls with no-op alerts.

apps/connect/src/components/CreateSpaceCard.tsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Graph } from '@geoprotocol/geo-sdk';
21
import { Key, type Messages, SpaceEvents, SpaceInfo, StoreConnect, Utils } from '@graphprotocol/hypergraph';
32
import { useIdentityToken } from '@privy-io/react-auth';
43
import { useQueryClient } from '@tanstack/react-query';
@@ -20,26 +19,8 @@ export function CreateSpaceCard({ className, ...props }: CreateSpaceCardProps) {
2019
const queryClient = useQueryClient();
2120

2221
const createPublicSpace = async () => {
23-
if (!accountAddress) {
24-
alert('Missing account address');
25-
return;
26-
}
27-
28-
setIsLoading(true);
29-
30-
try {
31-
await Graph.createSpace({
32-
editorAddress: accountAddress,
33-
name: spaceName,
34-
network: 'TESTNET',
35-
});
36-
} catch (error) {
37-
alert('Failed to create space');
38-
console.error(error);
39-
} finally {
40-
setIsLoading(false);
41-
queryClient.invalidateQueries({ queryKey: ['public-spaces'] });
42-
}
22+
alert('Graph.createSpace has been removed. Public space creation needs to be re-implemented.');
23+
return;
4324
};
4425

4526
const createPrivateSpace = async () => {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const createEvents = async ({
2020
values: [
2121
{
2222
property: mapping.JobOffer.properties?.salary as string,
23-
type: 'float64',
23+
type: 'float',
2424
value: 80000,
2525
},
2626
],
@@ -33,7 +33,7 @@ const createEvents = async ({
3333
values: [
3434
{
3535
property: mapping.JobOffer.properties?.salary as string,
36-
type: 'float64',
36+
type: 'float',
3737
value: 90000,
3838
},
3939
],

apps/events/src/components/create-properties-and-types-event.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const createPropertiesAndTypesEvent = async ({
1414
}) => {
1515
const ops: Array<Op> = [];
1616
const { id: salaryPropertyId, ops: createSalaryPropertyOps } = Graph.createProperty({
17-
dataType: 'FLOAT64',
17+
dataType: 'FLOAT',
1818
name: 'Salary',
1919
});
2020
ops.push(...createSalaryPropertyOps);

apps/events/src/components/create-properties-and-types-todos.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const createPropertiesAndTypesTodos = async ({
4444
ops.push(...createPointPropertyOps);
4545

4646
const { id: amountPropertyId, ops: createAmountPropertyOps } = Graph.createProperty({
47-
dataType: 'FLOAT64',
47+
dataType: 'FLOAT',
4848
name: 'Amount',
4949
});
5050
ops.push(...createAmountPropertyOps);

apps/privy-login-example/src/components/create-events.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const createEvents = async ({
2020
values: [
2121
{
2222
property: mapping.JobOffer.properties?.salary as string,
23-
type: 'float64',
23+
type: 'float',
2424
value: 80000,
2525
},
2626
],
@@ -33,7 +33,7 @@ const createEvents = async ({
3333
values: [
3434
{
3535
property: mapping.JobOffer.properties?.salary as string,
36-
type: 'float64',
36+
type: 'float',
3737
value: 90000,
3838
},
3939
],

apps/privy-login-example/src/components/create-properties-and-types-event.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const createPropertiesAndTypesEvent = async ({
1414
}) => {
1515
const ops: Array<Op> = [];
1616
const { id: salaryPropertyId, ops: createSalaryPropertyOps } = Graph.createProperty({
17-
dataType: 'FLOAT64',
17+
dataType: 'FLOAT',
1818
name: 'Salary',
1919
});
2020
ops.push(...createSalaryPropertyOps);

apps/privy-login-example/src/components/create-properties-and-types-todos.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const createPropertiesAndTypesTodos = async ({
4444
ops.push(...createPointPropertyOps);
4545

4646
const { id: amountPropertyId, ops: createAmountPropertyOps } = Graph.createProperty({
47-
dataType: 'FLOAT64',
47+
dataType: 'FLOAT',
4848
name: 'Amount',
4949
});
5050
ops.push(...createAmountPropertyOps);

packages/hypergraph-react/src/HypergraphAppContext.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import * as automerge from '@automerge/automerge/slim';
55
import type { DocHandle } from '@automerge/automerge-repo';
66
import { Repo } from '@automerge/automerge-repo/slim';
77
import { RepoContext } from '@automerge/automerge-repo-react-hooks';
8-
import { Graph } from '@geoprotocol/geo-sdk';
98
import {
109
Config,
1110
Connect,
@@ -963,18 +962,9 @@ export function HypergraphAppProvider({
963962

964963
let spaceId = Utils.generateId();
965964

966-
try {
967-
if (smartSessionClient?.account) {
968-
const result = await Graph.createSpace({
969-
editorAddress: smartSessionClient.account.address,
970-
name,
971-
network: smartSessionClient.chain.id === Connect.GEO_TESTNET.id ? 'TESTNET' : 'TESTNET', // TODO: switch to mainnet
972-
});
973-
spaceId = result.id;
974-
console.log('Created public space', spaceId);
975-
}
976-
} catch (error) {
977-
console.error('Error creating public space', error);
965+
if (smartSessionClient?.account) {
966+
// TODO: Graph.createSpace has been removed. Public space creation needs to be re-implemented.
967+
console.warn('Graph.createSpace has been removed. Public space creation needs to be re-implemented.');
978968
}
979969

980970
const spaceEvent = await Effect.runPromise(
Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,15 @@
1-
import { Graph } from '@geoprotocol/geo-sdk';
2-
import { useQueryClient } from '@tanstack/react-query';
31
import { useState } from 'react';
4-
import { useHypergraphAuth } from '../HypergraphAppContext.js';
52

63
type CreatePublicSpaceParams = {
74
name: string;
85
};
96

107
export const usePrivyAuthCreatePublicSpace = () => {
11-
const [isLoading, setIsLoading] = useState(false);
12-
const queryClient = useQueryClient();
13-
const { privyIdentity } = useHypergraphAuth();
8+
const [isLoading] = useState(false);
149

15-
const createPublicSpace = async ({ name }: CreatePublicSpaceParams) => {
16-
const accountAddress = privyIdentity?.accountAddress;
17-
if (!accountAddress) {
18-
throw new Error('No account address found');
19-
}
20-
try {
21-
setIsLoading(true);
22-
const { id } = await Graph.createSpace({
23-
editorAddress: accountAddress,
24-
name,
25-
network: 'TESTNET',
26-
});
27-
queryClient.invalidateQueries({ queryKey: ['hypergraph-public-spaces'] });
28-
setIsLoading(false);
29-
return id;
30-
} catch (error) {
31-
setIsLoading(false);
32-
throw error;
33-
}
10+
const createPublicSpace = async ({ name: _name }: CreatePublicSpaceParams) => {
11+
alert('Graph.createSpace has been removed. Public space creation needs to be re-implemented.');
12+
return undefined;
3413
};
3514
return { createPublicSpace, isLoading };
3615
};

0 commit comments

Comments
 (0)