Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions modules/abstract-eth/src/abstractEthLikeNewCoins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3158,6 +3158,8 @@ export abstract class AbstractEthLikeNewCoins extends AbstractEthLikeCoin {
'consolidate',
'bridgeFunds',
'enabletoken',
'defiApprove',
'defiDeposit',
].includes(txParams.type))
)
) {
Expand Down
70 changes: 70 additions & 0 deletions modules/sdk-coin-eth/test/unit/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading