Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion modules/abstract-eth/src/abstractEthLikeNewCoins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
}

Expand Down