@@ -772,6 +772,24 @@ function extractDestCaller(messageHex) {
772772 }
773773}
774774
775+ // Extract the mintRecipient from the CCTP message body.
776+ // Body starts at header offset 116; mintRecipient is at body+4+32 = offset 152, 32 bytes.
777+ // For EVM the 20-byte address sits in the last 20 bytes; for Solana it is a full 32-byte pubkey.
778+ function extractMintRecipientFromMessage ( messageHex , isEvm ) {
779+ try {
780+ const bytes = hexToBytes ( messageHex ) ;
781+ if ( bytes . length < 184 ) return null ;
782+ const recipientBytes = bytes . slice ( 152 , 184 ) ;
783+ if ( isEvm ) {
784+ const addrBytes = recipientBytes . slice ( 12 , 32 ) ;
785+ return '0x' + Array . from ( addrBytes ) . map ( b => b . toString ( 16 ) . padStart ( 2 , '0' ) ) . join ( '' ) ;
786+ }
787+ return new PublicKey ( recipientBytes ) . toBase58 ( ) ;
788+ } catch ( e ) {
789+ return null ;
790+ }
791+ }
792+
775793function getApiBase ( ) {
776794 if ( ! elements . apiBase ) return '' ;
777795 const raw = elements . apiBase . value . trim ( ) ;
@@ -2053,8 +2071,9 @@ async function relayToSolana() {
20532071 // Show modal if not already showing (for manual relay)
20542072 const modalVisible = elements . progressModal && elements . progressModal . style . display === 'flex' ;
20552073 if ( ! modalVisible ) {
2056- // For manual relay, show a simplified modal starting at step 3
2057- const destAddress = elements . solanaDestAddress ?. value ?. trim ( ) || walletPublicKey . toBase58 ( ) ;
2074+ const destAddress = extractMintRecipientFromMessage ( messageHex , false )
2075+ || elements . solanaDestAddress ?. value ?. trim ( )
2076+ || walletPublicKey . toBase58 ( ) ;
20582077 showProgressModal ( destAddress , 0 ) ;
20592078 updateModalStep ( 1 , 'completed' , 'Completed' , 'Noble burn transaction (external)' ) ;
20602079 updateModalStep ( 2 , 'completed' , 'Completed' , 'Circle attestation verified' ) ;
@@ -2376,7 +2395,8 @@ async function relayToEvm() {
23762395
23772396 const modalVisible = elements . progressModal && elements . progressModal . style . display === 'flex' ;
23782397 if ( ! modalVisible ) {
2379- showProgressModal ( evmAddress , 0 ) ;
2398+ const receiver = extractMintRecipientFromMessage ( messageHex , true ) || evmAddress ;
2399+ showProgressModal ( receiver , 0 ) ;
23802400 updateModalStep ( 1 , 'completed' , 'Completed' , 'Noble burn transaction (external)' ) ;
23812401 updateModalStep ( 2 , 'completed' , 'Completed' , 'Circle attestation verified' ) ;
23822402 }
0 commit comments