diff --git a/modules/abstract-eth/src/abstractEthLikeNewCoins.ts b/modules/abstract-eth/src/abstractEthLikeNewCoins.ts index be9a301d33..59d0422d82 100644 --- a/modules/abstract-eth/src/abstractEthLikeNewCoins.ts +++ b/modules/abstract-eth/src/abstractEthLikeNewCoins.ts @@ -2820,7 +2820,8 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin { !txParams?.recipients && !( txParams.prebuildTx?.consolidateId || - (txParams.type && ['acceleration', 'fillNonce', 'transferToken', 'tokenApproval'].includes(txParams.type)) + (txParams.type && + ['acceleration', 'fillNonce', 'transferToken', 'tokenApproval', 'consolidate'].includes(txParams.type)) ) ) { throw new Error('missing txParams'); @@ -2893,6 +2894,31 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin { } } + // Verify consolidation transactions send to base address + if (params.verification?.consolidationToBaseAddress) { + const coinSpecific = wallet.coinSpecific(); + if (!coinSpecific || !coinSpecific.baseAddress) { + throw new Error('Unable to determine base address for consolidation'); + } + const baseAddress = coinSpecific.baseAddress; + + const txBuilder = this.getTransactionBuilder(); + txBuilder.from(txPrebuild.txHex); + const tx = await txBuilder.build(); + const txJson = tx.toJson(); + + // Verify the transaction recipient matches the base address + if (!txJson.to) { + throw new Error('Consolidation transaction is missing recipient address'); + } + + if (txJson.to.toLowerCase() !== baseAddress.toLowerCase()) { + throwRecipientMismatch('Consolidation transaction recipient does not match wallet base address', [ + { address: txJson.to, amount: txJson.value }, + ]); + } + } + return true; }