diff --git a/modules/abstract-eth/src/abstractEthLikeNewCoins.ts b/modules/abstract-eth/src/abstractEthLikeNewCoins.ts index 89e3bd9482..612d9f9c84 100644 --- a/modules/abstract-eth/src/abstractEthLikeNewCoins.ts +++ b/modules/abstract-eth/src/abstractEthLikeNewCoins.ts @@ -3158,6 +3158,8 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin { 'consolidate', 'bridgeFunds', 'enabletoken', + 'defiApprove', + 'defiDeposit', ].includes(txParams.type)) ) ) { diff --git a/modules/sdk-coin-eth/test/unit/eth.ts b/modules/sdk-coin-eth/test/unit/eth.ts index 8534388aa4..6f8cba0844 100644 --- a/modules/sdk-coin-eth/test/unit/eth.ts +++ b/modules/sdk-coin-eth/test/unit/eth.ts @@ -867,6 +867,76 @@ describe('ETH:', function () { isTransactionVerified.should.equal(true); }); + it('should verify TSS transaction with defiApprove type', async function () { + const coin = bitgo.coin('hteth') as Hteth; + const baseAddress = '0x174cfd823af8ce27ed0afee3fcf3c3ba259116be'; + const wallet = new Wallet(bitgo, coin, { + coinSpecific: { + baseAddress: baseAddress, + }, + }); + + // DeFi deposit flow is intent-based: recipients/calldata are built server-side + // from defiParams, so txParams has no recipients (see CGD-1815). + const txParams = { + type: 'defiApprove', + defiParams: { vaultId: 'hteth-usdc-test', amount: '10' }, + wallet: wallet, + walletPassphrase: 'fakeWalletPassphrase', + }; + + const txPrebuild = { + txHex: '0x', + coin: 'hteth', + walletId: 'fakeWalletId', + }; + + const verification = {}; + + const isTransactionVerified = await coin.verifyTransaction({ + txParams: txParams as any, + txPrebuild: txPrebuild as any, + wallet, + verification, + walletType: 'tss', + }); + isTransactionVerified.should.equal(true); + }); + + it('should verify TSS transaction with defiDeposit type', async function () { + const coin = bitgo.coin('hteth') as Hteth; + const baseAddress = '0x174cfd823af8ce27ed0afee3fcf3c3ba259116be'; + const wallet = new Wallet(bitgo, coin, { + coinSpecific: { + baseAddress: baseAddress, + }, + }); + + const txParams = { + type: 'defiDeposit', + defiParams: { vaultId: 'hteth-usdc-test', amount: '10', operationId: 'fakeOperationId' }, + wallet: wallet, + walletPassphrase: 'fakeWalletPassphrase', + }; + + const txPrebuild = { + txHex: '0x', + coin: 'hteth', + walletId: 'fakeWalletId', + }; + + const verification = {}; + + const isTransactionVerified = await coin.verifyTransaction({ + txParams: txParams as any, + txPrebuild: txPrebuild as any, + wallet, + verification, + walletType: 'tss', + }); + isTransactionVerified.should.equal(true); + }); + describe('consolidationToBaseAddress verification', function () { it('should verify consolidation when recipient matches base address', async function () { const coin = bitgo.coin('hteth') as Hteth;