@@ -15,7 +15,7 @@ import {
15
15
import { cn } from '@shinkai_network/shinkai-ui/utils' ;
16
16
import { ExternalLinkIcon } from 'lucide-react' ;
17
17
import { useEffect } from 'react' ;
18
- import { useForm } from 'react-hook-form' ;
18
+ import { useForm , useWatch } from 'react-hook-form' ;
19
19
import { Link } from 'react-router-dom' ;
20
20
import { toast } from 'sonner' ;
21
21
import { z } from 'zod' ;
@@ -25,6 +25,7 @@ import {
25
25
useGalxeRegisterShinkaiDesktopInstallationMutation ,
26
26
} from '../lib/galxe/galxe-client' ;
27
27
import { useAuth } from '../store/auth' ;
28
+ import { useSettings } from '../store/settings' ;
28
29
29
30
export const RegisterShinkaiDesktopInstallationFormSchema = z . object ( {
30
31
address : z . string ( ) . min ( 42 ) ,
@@ -40,6 +41,8 @@ const SUBSCRIPTION_PATH = '/My Subscriptions';
40
41
export const GalxeSusbcriptions = ( ) => {
41
42
const { t } = useTranslation ( ) ;
42
43
const auth = useAuth ( ( store ) => store . auth ) ;
44
+ const evmAddress = useSettings ( ( store ) => store . evmAddress ) ;
45
+ const setEvmAddress = useSettings ( ( store ) => store . setEvmAddress ) ;
43
46
44
47
const { inboxes } = useGetInboxes ( {
45
48
nodeAddress : auth ?. node_address ?? '' ,
@@ -103,7 +106,7 @@ export const GalxeSusbcriptions = () => {
103
106
const form = useForm < RegisterShinkaiDesktopInstallationForm > ( {
104
107
resolver : zodResolver ( RegisterShinkaiDesktopInstallationFormSchema ) ,
105
108
defaultValues : {
106
- address : '' ,
109
+ address : evmAddress ,
107
110
signature : subscriptionsProof ?. [ 0 ] ,
108
111
combined : subscriptionsProof ?. [ 1 ] ,
109
112
} ,
@@ -125,6 +128,17 @@ export const GalxeSusbcriptions = () => {
125
128
validateQuest ( { ...values } ) ;
126
129
} ;
127
130
131
+ const currentEvmAddress = useWatch ( {
132
+ control : form . control ,
133
+ name : 'address' ,
134
+ } ) ;
135
+
136
+ useEffect ( ( ) => {
137
+ if ( currentEvmAddress ) {
138
+ setEvmAddress ( currentEvmAddress ) ;
139
+ }
140
+ } , [ currentEvmAddress ] ) ;
141
+
128
142
useEffect ( ( ) => {
129
143
form . setValue ( 'signature' , subscriptionsProof ?. [ 0 ] ?? '' ) ;
130
144
form . setValue ( 'combined' , subscriptionsProof ?. [ 1 ] ?? '' ) ;
@@ -196,9 +210,7 @@ export const GalxeSusbcriptions = () => {
196
210
name = "address"
197
211
render = { ( { field } ) => (
198
212
< TextField
199
- classes = { {
200
- input : 'font-mono' ,
201
- } }
213
+ classes = { { input : 'font-mono' } }
202
214
endAdornment = {
203
215
< div className = "w-8" >
204
216
< CopyToClipboardIcon
0 commit comments