|
1 | 1 | import { getSmartAccountWalletClient } from '@/lib/smart-account'; |
2 | 2 | import { Id } from '@graphprotocol/grc-20'; |
3 | | -import { |
4 | | - _generateDeleteOps, |
5 | | - publishOps, |
6 | | - useCreateEntity, |
7 | | - useHypergraphSpace, |
8 | | - useQuery, |
9 | | -} from '@graphprotocol/hypergraph-react'; |
| 3 | +import { _generateDeleteOps, publishOps, useCreateEntity, useQuery, useSpace } from '@graphprotocol/hypergraph-react'; |
10 | 4 | import { useGenerateCreateOps } from '@graphprotocol/hypergraph-react/internal/use-generate-create-ops'; |
11 | 5 | import { Todo2 } from '../../schema'; |
12 | 6 | import { Spinner } from '../spinner'; |
13 | 7 | import { Button } from '../ui/button'; |
14 | 8 |
|
15 | 9 | export const TodosPublic = () => { |
16 | | - const space = useHypergraphSpace(); |
| 10 | + const { id: spaceId } = useSpace({ mode: 'public' }); |
17 | 11 | const { |
18 | 12 | data: dataPublic, |
19 | 13 | isLoading: isLoadingPublic, |
@@ -54,11 +48,12 @@ export const TodosPublic = () => { |
54 | 48 | if (!smartAccountWalletClient) { |
55 | 49 | throw new Error('Missing smartAccountWalletClient'); |
56 | 50 | } |
57 | | - const ops = await _generateDeleteOps({ id: todo.id, space }); |
| 51 | + const ops = await _generateDeleteOps({ id: todo.id, space: spaceId }); |
58 | 52 | const result = await publishOps({ |
59 | 53 | ops, |
| 54 | + // @ts-expect-error - TODO: fix the types error |
60 | 55 | walletClient: smartAccountWalletClient, |
61 | | - space, |
| 56 | + space: spaceId, |
62 | 57 | name: 'Delete Todo', |
63 | 58 | }); |
64 | 59 | console.log('result', result); |
@@ -89,8 +84,9 @@ export const TodosPublic = () => { |
89 | 84 | console.log('ops', ops); |
90 | 85 | const result = await publishOps({ |
91 | 86 | ops, |
| 87 | + // @ts-expect-error - TODO: fix the types error |
92 | 88 | walletClient: smartAccountWalletClient, |
93 | | - space, |
| 89 | + space: spaceId, |
94 | 90 | name: 'Create Todo', |
95 | 91 | }); |
96 | 92 | console.log('result', result); |
|
0 commit comments