1- import { getSmartAccountWalletClient } from '@/lib/smart-account ' ;
2- import { type GeoSmartAccount , Graph , type Op } from '@graphprotocol/grc-20 ' ;
3- import { publishOps , useHypergraphSpace } from '@graphprotocol/hypergraph-react' ;
1+ import { Graph , type Op } from '@graphprotocol/grc-20 ' ;
2+ import type { Connect } from '@graphprotocol/hypergraph ' ;
3+ import { publishOps , useHypergraphApp , useHypergraphSpace } from '@graphprotocol/hypergraph-react' ;
44import { useState } from 'react' ;
55import { Button } from './ui/button' ;
66import { Card , CardContent } from './ui/card' ;
77
88const createPropertiesAndTypesEvent = async ( {
9- smartAccountWalletClient ,
9+ smartSessionClient ,
1010 space,
11- } : { smartAccountWalletClient : GeoSmartAccount ; space : string } ) => {
11+ } : { smartSessionClient : Connect . SmartSessionClient ; space : string } ) => {
1212 const ops : Array < Op > = [ ] ;
1313 const { id : salaryPropertyId , ops : createSalaryPropertyOps } = Graph . createProperty ( {
1414 dataType : 'NUMBER' ,
@@ -50,7 +50,7 @@ const createPropertiesAndTypesEvent = async ({
5050
5151 const result = await publishOps ( {
5252 ops,
53- walletClient : smartAccountWalletClient ,
53+ walletClient : smartSessionClient ,
5454 space,
5555 name : 'Create properties and types' ,
5656 network : 'TESTNET' ,
@@ -69,6 +69,7 @@ const createPropertiesAndTypesEvent = async ({
6969export const CreatePropertiesAndTypesEvent = ( ) => {
7070 const [ mapping , setMapping ] = useState < string > ( '' ) ;
7171 const space = useHypergraphSpace ( ) ;
72+ const { getSmartSessionClient } = useHypergraphApp ( ) ;
7273
7374 return (
7475 < div >
@@ -81,9 +82,9 @@ export const CreatePropertiesAndTypesEvent = () => {
8182 ) }
8283 < Button
8384 onClick = { async ( ) => {
84- const smartAccountWalletClient = await getSmartAccountWalletClient ( ) ;
85- if ( ! smartAccountWalletClient ) {
86- throw new Error ( 'Missing smartAccountWalletClient ' ) ;
85+ const smartSessionClient = await getSmartSessionClient ( ) ;
86+ if ( ! smartSessionClient ) {
87+ throw new Error ( 'Missing smartSessionClient ' ) ;
8788 }
8889 const {
8990 eventTypeId,
@@ -93,8 +94,7 @@ export const CreatePropertiesAndTypesEvent = () => {
9394 jobOffersRelationTypeId,
9495 sponsorsRelationTypeId,
9596 } = await createPropertiesAndTypesEvent ( {
96- // @ts -expect-error TODO: in the future we probably only only use one smart account wallet client
97- smartAccountWalletClient,
97+ smartSessionClient,
9898 space,
9999 } ) ;
100100
0 commit comments