@@ -39,19 +39,32 @@ export function PayBountyModal({ bounty, wallets, onClose, onSuccess }: PayBount
3939 const sats = Math . floor ( parseFloat ( amount ) * SATS ) ;
4040 const feeSats = Math . round ( fee * SATS ) ;
4141 if ( isNaN ( sats ) || sats <= 0 ) { setError ( 'Amount must be positive' ) ; return ; }
42- if ( ! isValidAddress ( hunterAddress . trim ( ) ) ) { setError ( 'Invalid hunter address' ) ; return ; }
42+
43+ const input = hunterAddress . trim ( ) . replace ( / ^ @ / , '' ) ;
44+ if ( ! input ) { setError ( 'Hunter address is required' ) ; return ; }
4345
4446 setLoading ( true ) ;
4547 try {
48+ // Resolve ULTRA ID or address via /balance/ endpoint (accepts names, hex, bech32)
49+ let resolvedAddr = input ;
50+ if ( ! isValidAddress ( input ) ) {
51+ const lookupRes = await fetch ( `${ getNodeUrl ( ) } /balance/${ encodeURIComponent ( input ) } ` , { signal : AbortSignal . timeout ( 5000 ) } ) ;
52+ if ( ! lookupRes . ok ) { setError ( `Could not resolve "${ input } " — not a valid ULTRA ID or address` ) ; setLoading ( false ) ; return ; }
53+ const lookupData = await lookupRes . json ( ) ;
54+ if ( ! lookupData . address ) { setError ( `ULTRA ID "${ input } " not found` ) ; setLoading ( false ) ; return ; }
55+ resolvedAddr = lookupData . address ;
56+ }
57+ const toAddr = normalizeAddress ( resolvedAddr ) ;
58+
4659 const passkey = getPasskeyInfo ( ) ;
4760 if ( passkey && wallet . address === passkey . address ) {
4861 const balRes = await fetch ( `${ getNodeUrl ( ) } /balance/${ wallet . address } ` , { signal : AbortSignal . timeout ( 5000 ) } ) ;
4962 const balData = await balRes . json ( ) ;
50- await signAndSubmitWithPasskey ( normalizeAddress ( hunterAddress . trim ( ) ) , sats , feeSats , balData . nonce ?? 0 , memo ) ;
63+ await signAndSubmitWithPasskey ( toAddr , sats , feeSats , balData . nonce ?? 0 , memo ) ;
5164 } else {
5265 await postTx ( {
5366 secret_key : wallet . secret_key ,
54- to : normalizeAddress ( hunterAddress . trim ( ) ) ,
67+ to : toAddr ,
5568 amount : sats , fee : feeSats , memo,
5669 } ) ;
5770 }
@@ -89,7 +102,7 @@ export function PayBountyModal({ bounty, wallets, onClose, onSuccess }: PayBount
89102 < div style = { { marginBottom : 12 } } >
90103 < label style = { { fontSize : 10 , color : 'var(--dag-text-faint)' , letterSpacing : 1 , display : 'block' , marginBottom : 4 } } > FROM WALLET</ label >
91104 < select value = { walletIdx } onChange = { e => setWalletIdx ( Number ( e . target . value ) ) } style = { { ...inputStyle , cursor : 'pointer' } } >
92- { wallets . map ( ( w , i ) => < option key = { i } value = { i } style = { { background : '#0B1120 ' } } > { w . name } </ option > ) }
105+ { wallets . map ( ( w , i ) => < option key = { i } value = { i } style = { { background : 'var(--dag-bg) ' } } > { w . name } </ option > ) }
93106 </ select >
94107 </ div >
95108 ) }
0 commit comments