@@ -3053,7 +3053,9 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
30533053 ! txParams ?. recipients &&
30543054 ! (
30553055 txParams . prebuildTx ?. consolidateId ||
3056- ( txParams . type && [ 'acceleration' , 'fillNonce' , 'transferToken' , 'tokenApproval' ] . includes ( txParams . type ) )
3056+ txPrebuild ?. consolidateId ||
3057+ ( txParams . type &&
3058+ [ 'acceleration' , 'fillNonce' , 'transferToken' , 'tokenApproval' , 'consolidate' ] . includes ( txParams . type ) )
30573059 )
30583060 ) {
30593061 throw new Error ( 'missing txParams' ) ;
@@ -3126,6 +3128,35 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
31263128 }
31273129 }
31283130
3131+ // Verify consolidation transactions send to base address
3132+ if ( params . verification ?. consolidationToBaseAddress ) {
3133+ const coinSpecific = wallet . coinSpecific ( ) ;
3134+ if ( ! coinSpecific || ! coinSpecific . baseAddress ) {
3135+ throw new Error ( 'Unable to determine base address for consolidation' ) ;
3136+ }
3137+ const baseAddress = coinSpecific . baseAddress ;
3138+
3139+ if ( ! txPrebuild . txHex ) {
3140+ throw new Error ( 'missing txHex in txPrebuild' ) ;
3141+ }
3142+
3143+ const txBuilder = this . getTransactionBuilder ( ) ;
3144+ txBuilder . from ( txPrebuild . txHex ) ;
3145+ const tx = await txBuilder . build ( ) ;
3146+ const txJson = tx . toJson ( ) ;
3147+
3148+ // Verify the transaction recipient matches the base address
3149+ if ( ! txJson . to ) {
3150+ throw new Error ( 'Consolidation transaction is missing recipient address' ) ;
3151+ }
3152+
3153+ if ( txJson . to . toLowerCase ( ) !== baseAddress . toLowerCase ( ) ) {
3154+ throwRecipientMismatch ( 'Consolidation transaction recipient does not match wallet base address' , [
3155+ { address : txJson . to , amount : txJson . value } ,
3156+ ] ) ;
3157+ }
3158+ }
3159+
31293160 return true ;
31303161 }
31313162
0 commit comments