1- import { getSmartAccountWalletClient } from '@/lib/smart-account' ;
21import { Id } from '@graphprotocol/grc-20' ;
32import { _generateDeleteOps , publishOps , useCreateEntity , useQuery , useSpace } from '@graphprotocol/hypergraph-react' ;
3+ import { useHypergraphApp } from '@graphprotocol/hypergraph-react' ;
44import { useGenerateCreateOps } from '@graphprotocol/hypergraph-react/internal/use-generate-create-ops' ;
55import { Todo2 } from '../../schema' ;
66import { Spinner } from '../spinner' ;
77import { Button } from '../ui/button' ;
88
99export const TodosPublic = ( ) => {
1010 const { id : spaceId } = useSpace ( { mode : 'public' } ) ;
11+ const { getSmartSessionClient } = useHypergraphApp ( ) ;
1112 const {
1213 data : dataPublic ,
1314 isLoading : isLoadingPublic ,
@@ -44,15 +45,14 @@ export const TodosPublic = () => {
4445
4546 < Button
4647 onClick = { async ( ) => {
47- const smartAccountWalletClient = await getSmartAccountWalletClient ( ) ;
48- if ( ! smartAccountWalletClient ) {
49- throw new Error ( 'Missing smartAccountWalletClient ' ) ;
48+ const smartSessionClient = await getSmartSessionClient ( ) ;
49+ if ( ! smartSessionClient ) {
50+ throw new Error ( 'Missing smartSessionClient ' ) ;
5051 }
5152 const ops = await _generateDeleteOps ( { id : todo . id , space : spaceId } ) ;
5253 const result = await publishOps ( {
5354 ops,
54- // @ts -expect-error - TODO: fix the types error
55- walletClient : smartAccountWalletClient ,
55+ walletClient : smartSessionClient ,
5656 space : spaceId ,
5757 name : 'Delete Todo' ,
5858 } ) ;
@@ -65,9 +65,9 @@ export const TodosPublic = () => {
6565 ) ) }
6666 < Button
6767 onClick = { async ( ) => {
68- const smartAccountWalletClient = await getSmartAccountWalletClient ( ) ;
69- if ( ! smartAccountWalletClient ) {
70- throw new Error ( 'Missing smartAccountWalletClient ' ) ;
68+ const smartSessionClient = await getSmartSessionClient ( ) ;
69+ if ( ! smartSessionClient ) {
70+ throw new Error ( 'Missing smartSessionClient ' ) ;
7171 }
7272 const userId = Id . Id ( '8zPJjTGLBDPtUcj6q2tghg' ) ;
7373 const todo = createTodo ( {
@@ -84,8 +84,7 @@ export const TodosPublic = () => {
8484 console . log ( 'ops' , ops ) ;
8585 const result = await publishOps ( {
8686 ops,
87- // @ts -expect-error - TODO: fix the types error
88- walletClient : smartAccountWalletClient ,
87+ walletClient : smartSessionClient ,
8988 space : spaceId ,
9089 name : 'Create Todo' ,
9190 } ) ;
0 commit comments