@@ -3089,7 +3089,9 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
30893089 ! txParams ?. recipients &&
30903090 ! (
30913091 txParams . prebuildTx ?. consolidateId ||
3092- ( txParams . type && [ 'acceleration' , 'fillNonce' , 'transferToken' , 'tokenApproval' ] . includes ( txParams . type ) )
3092+ txPrebuild ?. consolidateId ||
3093+ ( txParams . type &&
3094+ [ 'acceleration' , 'fillNonce' , 'transferToken' , 'tokenApproval' , 'consolidate' ] . includes ( txParams . type ) )
30933095 )
30943096 ) {
30953097 throw new Error ( 'missing txParams' ) ;
@@ -3164,6 +3166,35 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
31643166 }
31653167 }
31663168
3169+ // Verify consolidation transactions send to base address
3170+ if ( params . verification ?. consolidationToBaseAddress ) {
3171+ const coinSpecific = wallet . coinSpecific ( ) ;
3172+ if ( ! coinSpecific || ! coinSpecific . baseAddress ) {
3173+ throw new Error ( 'Unable to determine base address for consolidation' ) ;
3174+ }
3175+ const baseAddress = coinSpecific . baseAddress ;
3176+
3177+ if ( ! txPrebuild . txHex ) {
3178+ throw new Error ( 'missing txHex in txPrebuild' ) ;
3179+ }
3180+
3181+ const txBuilder = this . getTransactionBuilder ( ) ;
3182+ txBuilder . from ( txPrebuild . txHex ) ;
3183+ const tx = await txBuilder . build ( ) ;
3184+ const txJson = tx . toJson ( ) ;
3185+
3186+ // Verify the transaction recipient matches the base address
3187+ if ( ! txJson . to ) {
3188+ throw new Error ( 'Consolidation transaction is missing recipient address' ) ;
3189+ }
3190+
3191+ if ( txJson . to . toLowerCase ( ) !== baseAddress . toLowerCase ( ) ) {
3192+ throwRecipientMismatch ( 'Consolidation transaction recipient does not match wallet base address' , [
3193+ { address : txJson . to , amount : txJson . value } ,
3194+ ] ) ;
3195+ }
3196+ }
3197+
31673198 return true ;
31683199 }
31693200
0 commit comments