@@ -30,6 +30,7 @@ import {
3030 MultisigType ,
3131 multisigTypes ,
3232 AuditDecryptedKeyParams ,
33+ TxIntentMismatchError ,
3334} from '@bitgo/sdk-core' ;
3435import stellar from 'stellar-sdk' ;
3536import BigNumber from 'bignumber.js' ;
@@ -580,7 +581,7 @@ export class Algo extends BaseCoin {
580581 }
581582
582583 async verifyTransaction ( params : VerifyTransactionOptions ) : Promise < boolean > {
583- const { txParams, txPrebuild } = params ;
584+ const { txParams, txPrebuild, wallet , verification } = params ;
584585
585586 if ( ! txParams ) {
586587 throw new Error ( 'missing txParams' ) ;
@@ -602,14 +603,40 @@ export class Algo extends BaseCoin {
602603 // Validate based on Algorand transaction type
603604 switch ( txJson . type ) {
604605 case 'pay' :
605- return this . validatePayTransaction ( txJson , txParams ) ;
606+ this . validatePayTransaction ( txJson , txParams ) ;
607+ break ;
606608 case 'axfer' :
607- return this . validateAssetTransferTransaction ( txJson , txParams ) ;
609+ this . validateAssetTransferTransaction ( txJson , txParams ) ;
610+ break ;
608611 default :
609612 // For other transaction types, perform basic validation
610613 this . validateBasicTransaction ( txJson ) ;
611- return true ;
614+ break ;
612615 }
616+
617+ // Verify consolidation transactions send to base address
618+ if ( verification ?. consolidationToBaseAddress ) {
619+ if ( ! wallet ?. coinSpecific ( ) ?. rootAddress ) {
620+ throw new Error ( 'Unable to determine base address for consolidation' ) ;
621+ }
622+ const rootAddress = wallet . coinSpecific ( ) ?. rootAddress as string ;
623+
624+ // Verify the transaction recipient matches the rootAddress
625+ if ( ! txJson . to ) {
626+ throw new Error ( 'Transaction is missing recipient address' ) ;
627+ }
628+
629+ if ( txJson . to !== rootAddress ) {
630+ throw new TxIntentMismatchError (
631+ 'Consolidation transaction recipient does not match wallet base address' ,
632+ txJson . to ,
633+ [ txParams ] ,
634+ txJson
635+ ) ;
636+ }
637+ }
638+
639+ return true ;
613640 }
614641
615642 /**
0 commit comments