@@ -117,6 +117,12 @@ const useEOADetection = (
117117 }
118118
119119 const detectEOA = async ( ) => {
120+ const baseEventData = {
121+ chain_id : chainId ,
122+ address : userAddress ,
123+ wallet_type : wallet ?. vmType
124+ }
125+
120126 try {
121127 if ( ! wallet || ! wallet ?. isEOA ) {
122128 setDetectionState ( ( current ) =>
@@ -132,6 +138,8 @@ const useEOADetection = (
132138 abortController . abort ( )
133139 } , 1000 )
134140
141+ const startTime = performance . now ( )
142+
135143 try {
136144 const eoaResult = await Promise . race ( [
137145 wallet . isEOA ( chainId ! ) ,
@@ -153,14 +161,39 @@ const useEOADetection = (
153161 )
154162 } catch ( eoaError : any ) {
155163 clearTimeout ( timeoutId )
164+ const duration = performance . now ( ) - startTime
165+ const isTimeout = eoaError ?. message === 'EOA_DETECTION_TIMEOUT'
166+
167+ if ( isTimeout ) {
168+ console . error ( '[EOA Detection]' , {
169+ ...baseEventData ,
170+ error_type : 'timeout' ,
171+ duration_ms : Math . round ( duration )
172+ } )
173+ } else {
174+ console . error ( '[EOA Detection]' , {
175+ ...baseEventData ,
176+ error_type : 'error' ,
177+ duration_ms : Math . round ( duration ) ,
178+ error_message : eoaError ?. message || 'Unknown error' ,
179+ error_name : eoaError ?. name
180+ } )
181+ }
156182
157183 setDetectionState ( ( current ) =>
158184 current . conditionKey === conditionKey
159185 ? { value : true , conditionKey }
160186 : current
161187 )
162188 }
163- } catch ( error ) {
189+ } catch ( error : any ) {
190+ console . error ( '[EOA Detection]' , {
191+ ...baseEventData ,
192+ error_type : 'error' ,
193+ error_message : error ?. message || 'Unknown error' ,
194+ error_name : error ?. name
195+ } )
196+
164197 setDetectionState ( ( current ) =>
165198 current . conditionKey === conditionKey
166199 ? { value : true , conditionKey }
@@ -170,7 +203,7 @@ const useEOADetection = (
170203 }
171204
172205 detectEOA ( )
173- } , [ conditionKey , shouldDetect , wallet , chainId ] )
206+ } , [ conditionKey , shouldDetect , wallet , chainId , userAddress ] )
174207
175208 if ( ! shouldDetect && chainVmType === 'evm' ) {
176209 return explicitDeposit ?? true
0 commit comments