11import { useState } from 'react' ;
2- import { postTxSubmit , getNodeUrl } from '../../lib/api' ;
3- import { getPasskeyWallet } from '../../lib/passkey-wallet' ;
42import { useToast } from '../../hooks/useToast' ;
53import type { Wallet } from '../../lib/keystore' ;
64
@@ -28,68 +26,25 @@ const labelStyle: React.CSSProperties = {
2826 display : 'block' , marginBottom : 4 , fontWeight : 600 ,
2927} ;
3028
31- export function EditProfileModal ( { name, wallet, currentBio, currentWebsite, currentGithub, currentTwitter, currentExternalAddresses, onClose, onSuccess } : EditProfileModalProps ) {
29+ export function EditProfileModal ( { name, wallet : _wallet , currentBio, currentWebsite, currentGithub, currentTwitter, currentExternalAddresses, onClose, onSuccess : _onSuccess } : EditProfileModalProps ) {
3230 const [ bio , setBio ] = useState ( currentBio ?? '' ) ;
3331 const [ website , setWebsite ] = useState ( currentWebsite ?? '' ) ;
3432 const [ github , setGithub ] = useState ( currentGithub ?? '' ) ;
3533 const [ twitter , setTwitter ] = useState ( currentTwitter ?? '' ) ;
3634 const [ ethAddr , setEthAddr ] = useState ( currentExternalAddresses . find ( ( [ k ] ) => k === 'eth' ) ?. [ 1 ] ?? '' ) ;
3735 const [ btcAddr , setBtcAddr ] = useState ( currentExternalAddresses . find ( ( [ k ] ) => k === 'btc' ) ?. [ 1 ] ?? '' ) ;
38- const [ loading , setLoading ] = useState ( false ) ;
36+ const [ loading ] = useState ( false ) ;
3937 const [ error , setError ] = useState ( '' ) ;
4038 const { toast } = useToast ( ) ;
4139
42- const isPasskey = ! ! getPasskeyWallet ( ) && ! wallet . secret_key ;
40+ // TODO: Profile editing requires either a testnet convenience endpoint for
41+ // UpdateProfileTx or client-side ed25519 signing. Neither is available yet.
42+ // For now, show the form as read-only preview of what will be saved.
43+ const canSave = false ;
4344
4445 const handleSave = async ( ) => {
45- if ( isPasskey ) {
46- setError ( 'SmartOp UpdateProfile not yet supported for passkey wallets. Use a legacy wallet.' ) ;
47- return ;
48- }
49- setError ( '' ) ;
50- setLoading ( true ) ;
51-
52- try {
53- // Build metadata entries
54- const metadata : Array < [ string , string ] > = [ ] ;
55- if ( bio . trim ( ) ) metadata . push ( [ 'bio' , bio . trim ( ) ] ) ;
56- if ( website . trim ( ) ) metadata . push ( [ 'website' , website . trim ( ) ] ) ;
57- if ( github . trim ( ) ) metadata . push ( [ 'github' , github . trim ( ) ] ) ;
58- if ( twitter . trim ( ) ) metadata . push ( [ 'twitter' , twitter . trim ( ) ] ) ;
59-
60- // Build external addresses
61- const externalAddresses : Array < [ string , string ] > = [ ] ;
62- if ( ethAddr . trim ( ) ) externalAddresses . push ( [ 'eth' , ethAddr . trim ( ) ] ) ;
63- if ( btcAddr . trim ( ) ) externalAddresses . push ( [ 'btc' , btcAddr . trim ( ) ] ) ;
64-
65- // Get nonce
66- const balRes = await fetch ( `${ getNodeUrl ( ) } /balance/${ wallet . address } ` , { signal : AbortSignal . timeout ( 5000 ) } ) ;
67- const balData = await balRes . json ( ) ;
68- const nonce = balData . nonce ?? 0 ;
69- const fee = 10000 ; // MIN_FEE
70-
71- // Build and sign UpdateProfileTx
72- // The /profile/update endpoint doesn't exist, so we use /tx with the update_profile type
73- const body = {
74- secret_key : wallet . secret_key ,
75- name,
76- external_addresses : externalAddresses ,
77- metadata,
78- fee,
79- nonce,
80- } ;
81-
82- await postTxSubmit ( { type : 'update_profile' , ...body } ) ;
83- toast ( 'Profile updated!' , 'success' ) ;
84- onSuccess ( ) ;
85- onClose ( ) ;
86- } catch ( e : unknown ) {
87- const msg = e instanceof Error ? e . message : 'Failed to update profile' ;
88- setError ( msg ) ;
89- toast ( msg , 'error' ) ;
90- } finally {
91- setLoading ( false ) ;
92- }
46+ setError ( 'Profile editing is coming soon. The UpdateProfile transaction endpoint is being added to the next release.' ) ;
47+ toast ( 'Profile editing coming soon' , 'info' ) ;
9348 } ;
9449
9550 return (
@@ -105,11 +60,9 @@ export function EditProfileModal({ name, wallet, currentBio, currentWebsite, cur
10560 < button onClick = { onClose } style = { { background : 'none' , border : 'none' , color : 'var(--dag-text-faint)' , fontSize : 18 , cursor : 'pointer' } } > ✕</ button >
10661 </ div >
10762
108- { isPasskey && (
109- < div style = { { marginBottom : 14 , padding : '10px 12px' , background : 'rgba(255,184,0,0.06)' , border : '1px solid rgba(255,184,0,0.15)' , borderRadius : 8 , fontSize : 11 , color : '#FFB800' } } >
110- Profile editing is not yet available for passkey wallets. SmartOp UpdateProfile support coming soon.
111- </ div >
112- ) }
63+ < div style = { { marginBottom : 14 , padding : '10px 12px' , background : 'rgba(0,224,196,0.06)' , border : '1px solid rgba(0,224,196,0.15)' , borderRadius : 8 , fontSize : 11 , color : '#00E0C4' } } >
64+ Preview your profile changes below. Saving will be enabled in the next release when the UpdateProfile endpoint is live.
65+ </ div >
11366
11467 < div style = { { display : 'flex' , flexDirection : 'column' , gap : 12 } } >
11568 < div >
@@ -162,13 +115,13 @@ export function EditProfileModal({ name, wallet, currentBio, currentWebsite, cur
162115 </ div >
163116 ) }
164117
165- < button onClick = { handleSave } disabled = { loading || isPasskey } style = { {
118+ < button onClick = { handleSave } disabled = { ! canSave || loading } style = { {
166119 width : '100%' , padding : '12px 0' , borderRadius : 10 , border : 'none' , marginTop : 16 ,
167- background : loading || isPasskey ? 'var(--dag-input-bg)' : 'linear-gradient(135deg, #00E0C4, #0066FF)' ,
168- color : loading || isPasskey ? 'var(--dag-text-faint)' : '#fff' ,
169- fontSize : 13 , fontWeight : 700 , cursor : loading || isPasskey ? 'default' : 'pointer' ,
120+ background : ! canSave || loading ? 'var(--dag-input-bg)' : 'linear-gradient(135deg, #00E0C4, #0066FF)' ,
121+ color : ! canSave || loading ? 'var(--dag-text-faint)' : '#fff' ,
122+ fontSize : 13 , fontWeight : 700 , cursor : ! canSave || loading ? 'default' : 'pointer' ,
170123 } } >
171- { loading ? 'Saving...' : 'Save Profile' }
124+ { loading ? 'Saving...' : 'Save Profile (Coming Soon) ' }
172125 </ button >
173126 </ div >
174127 </ div >
0 commit comments