From 16be18e6edd9a201402ea4bc636251d9ec1f3c15 Mon Sep 17 00:00:00 2001 From: Abhishek Agrawal Date: Tue, 25 Nov 2025 15:33:27 +0530 Subject: [PATCH] fix: add support for seievm for tx acceleration TICKET: WIN-8040 --- modules/bitgo/test/v2/unit/wallet.ts | 68 ++++++++++++++++++++ modules/sdk-core/src/bitgo/utils/mpcUtils.ts | 2 +- 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/modules/bitgo/test/v2/unit/wallet.ts b/modules/bitgo/test/v2/unit/wallet.ts index f1d4ec3ed7..8761d161a0 100644 --- a/modules/bitgo/test/v2/unit/wallet.ts +++ b/modules/bitgo/test/v2/unit/wallet.ts @@ -3357,6 +3357,48 @@ describe('V2 Wallet:', function () { args[1]!.should.equal('full'); }); + it('should call prebuildTxWithIntent with correct params for seievm acceleration (user stuck tx)', async function () { + const recipients = [ + { + address: '0xde50d9bbdcd477c962bf1cebecef50e452565c53', + amount: '10000000000000000', + }, + ]; + const feeOptions = { + maxFeePerGas: 30000000000, + maxPriorityFeePerGas: 20000000000, + }; + + const lowFeeTxid = '0x4d6deab136da1f3870de4eb6f8cf46ec1e08b9bf918b764578b7b1c7ab08d6b8'; + const receiveAddress = '0x9bbb9a02e66e17636fd0637a0eee1e38f460b6ba'; + + const prebuildTxWithIntent = sandbox.stub(ECDSAUtils.EcdsaUtils.prototype, 'prebuildTxWithIntent'); + prebuildTxWithIntent.resolves(txRequestFull); + + // Create seievm wallet for testing + const seievmWallet = new Wallet(bitgo, bitgo.coin('seievm'), walletData); + + await seievmWallet.prebuildTransaction({ + reqId, + recipients, + type: 'acceleration', + feeOptions, + lowFeeTxid, + receiveAddress, + }); + + // Verify prebuildTxWithIntent was called with correct parameters + sinon.assert.calledOnce(prebuildTxWithIntent); + const args = prebuildTxWithIntent.args[0]; + // Validate acceleration intent parameters + args[0]!.should.not.have.property('recipients'); + args[0]!.feeOptions!.should.deepEqual(feeOptions); + args[0]!.lowFeeTxid!.should.equal(lowFeeTxid); + args[0]!.receiveAddress!.should.equal(receiveAddress); + args[0]!.intentType.should.equal('acceleration'); + args[1]!.should.equal('full'); + }); + it('should call prebuildTxWithIntent with the correct params for eth fillNonce', async function () { const feeOptions = { maxFeePerGas: 3000000000, @@ -3496,6 +3538,32 @@ describe('V2 Wallet:', function () { intent.intentType.should.equal('acceleration'); }); + it('populate intent should return valid seievm acceleration intent for stuck transaction', async function () { + const mpcUtils = new ECDSAUtils.EcdsaUtils(bitgo, bitgo.coin('seievm')); + + const feeOptions = { + maxFeePerGas: 30000000000, + maxPriorityFeePerGas: 20000000000, + }; + const lowFeeTxid = '0x4d6deab136da1f3870de4eb6f8cf46ec1e08b9bf918b764578b7b1c7ab08d6b8'; + const receiveAddress = '0x9bbb9a02e66e17636fd0637a0eee1e38f460b6ba'; + + const intent = mpcUtils.populateIntent(bitgo.coin('seievm'), { + reqId, + intentType: 'acceleration', + lowFeeTxid, + receiveAddress, + feeOptions, + }); + + // Validate the acceleration intent structure + intent.should.have.property('recipients', undefined); + intent.feeOptions!.should.deepEqual(feeOptions); + intent.txid!.should.equal(lowFeeTxid); + intent.receiveAddress!.should.equal(receiveAddress); + intent.intentType.should.equal('acceleration'); + }); + it('populate intent should return valid eth acceleration intent for receive address', async function () { const mpcUtils = new ECDSAUtils.EcdsaUtils(bitgo, bitgo.coin('hteth')); diff --git a/modules/sdk-core/src/bitgo/utils/mpcUtils.ts b/modules/sdk-core/src/bitgo/utils/mpcUtils.ts index 3b4c7c908d..d634de9afd 100644 --- a/modules/sdk-core/src/bitgo/utils/mpcUtils.ts +++ b/modules/sdk-core/src/bitgo/utils/mpcUtils.ts @@ -191,7 +191,7 @@ export abstract class MpcUtils { isTestTransaction: params.isTestTransaction, }; - if (['eth', 'polygon', 'bsc', 'coredao'].includes(baseCoin.getFamily())) { + if (['eth', 'polygon', 'bsc', 'coredao', 'seievm'].includes(baseCoin.getFamily())) { switch (params.intentType) { case 'payment': case 'transferToken':