Skip to content

Commit fb2534d

Browse files
chore: fix kavaevm withdrawls not working
Ticket: WIN-7466
1 parent 3b25b96 commit fb2534d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

modules/sdk-coin-evm/src/evmCoin.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
recoveryBlockchainExplorerQuery,
1111
TransactionBuilder as EthLikeTransactionBuilder,
1212
UnsignedSweepTxMPCv2,
13+
VerifyEthTransactionOptions,
1314
} from '@bitgo/abstract-eth';
1415
import { TransactionBuilder } from './lib';
1516
import assert from 'assert';
@@ -69,4 +70,43 @@ export class EvmCoin extends AbstractEthLikeNewCoins {
6970
const explorerUrl = evmConfig[this.getFamily()].baseUrl;
7071
return await recoveryBlockchainExplorerQuery(query, explorerUrl as string, apiToken as string);
7172
}
73+
74+
/** @inheritDoc */
75+
async verifyTssTransaction(params: VerifyEthTransactionOptions): Promise<boolean> {
76+
const supportsEIP1559 = this.staticsCoin?.features?.includes(CoinFeature.EIP1559);
77+
if (supportsEIP1559) {
78+
return await super.verifyTssTransaction(params);
79+
} else {
80+
return await this.verifyLegacyTssTransaction(params);
81+
}
82+
}
83+
84+
/**
85+
* Verifies legacy (non-EIP-1559) TSS transactions with basic validation.
86+
*/
87+
private async verifyLegacyTssTransaction(params: VerifyEthTransactionOptions): Promise<boolean> {
88+
const { txParams, txPrebuild, wallet } = params;
89+
90+
// Basic validation for legacy transactions only
91+
if (
92+
!txParams?.recipients &&
93+
!(
94+
txParams.prebuildTx?.consolidateId ||
95+
(txParams.type && ['acceleration', 'fillNonce', 'transferToken', 'tokenApproval'].includes(txParams.type))
96+
)
97+
) {
98+
throw new Error(`missing txParams`);
99+
}
100+
101+
if (!wallet || !txPrebuild) {
102+
throw new Error(`missing params`);
103+
}
104+
105+
if (txParams.hop && txParams.recipients && txParams.recipients.length > 1) {
106+
throw new Error(`tx cannot be both a batch and hop transaction`);
107+
}
108+
109+
// If validation passes, consider it verified
110+
return true;
111+
}
72112
}

0 commit comments

Comments
 (0)