Skip to content

Commit 586599c

Browse files
Merge pull request #7616 from BitGo/WIN-8040
fix: add support for seievm for tx acceleration
2 parents e95ce11 + 16be18e commit 586599c

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

modules/bitgo/test/v2/unit/wallet.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3357,6 +3357,48 @@ describe('V2 Wallet:', function () {
33573357
args[1]!.should.equal('full');
33583358
});
33593359

3360+
it('should call prebuildTxWithIntent with correct params for seievm acceleration (user stuck tx)', async function () {
3361+
const recipients = [
3362+
{
3363+
address: '0xde50d9bbdcd477c962bf1cebecef50e452565c53',
3364+
amount: '10000000000000000',
3365+
},
3366+
];
3367+
const feeOptions = {
3368+
maxFeePerGas: 30000000000,
3369+
maxPriorityFeePerGas: 20000000000,
3370+
};
3371+
3372+
const lowFeeTxid = '0x4d6deab136da1f3870de4eb6f8cf46ec1e08b9bf918b764578b7b1c7ab08d6b8';
3373+
const receiveAddress = '0x9bbb9a02e66e17636fd0637a0eee1e38f460b6ba';
3374+
3375+
const prebuildTxWithIntent = sandbox.stub(ECDSAUtils.EcdsaUtils.prototype, 'prebuildTxWithIntent');
3376+
prebuildTxWithIntent.resolves(txRequestFull);
3377+
3378+
// Create seievm wallet for testing
3379+
const seievmWallet = new Wallet(bitgo, bitgo.coin('seievm'), walletData);
3380+
3381+
await seievmWallet.prebuildTransaction({
3382+
reqId,
3383+
recipients,
3384+
type: 'acceleration',
3385+
feeOptions,
3386+
lowFeeTxid,
3387+
receiveAddress,
3388+
});
3389+
3390+
// Verify prebuildTxWithIntent was called with correct parameters
3391+
sinon.assert.calledOnce(prebuildTxWithIntent);
3392+
const args = prebuildTxWithIntent.args[0];
3393+
// Validate acceleration intent parameters
3394+
args[0]!.should.not.have.property('recipients');
3395+
args[0]!.feeOptions!.should.deepEqual(feeOptions);
3396+
args[0]!.lowFeeTxid!.should.equal(lowFeeTxid);
3397+
args[0]!.receiveAddress!.should.equal(receiveAddress);
3398+
args[0]!.intentType.should.equal('acceleration');
3399+
args[1]!.should.equal('full');
3400+
});
3401+
33603402
it('should call prebuildTxWithIntent with the correct params for eth fillNonce', async function () {
33613403
const feeOptions = {
33623404
maxFeePerGas: 3000000000,
@@ -3496,6 +3538,32 @@ describe('V2 Wallet:', function () {
34963538
intent.intentType.should.equal('acceleration');
34973539
});
34983540

3541+
it('populate intent should return valid seievm acceleration intent for stuck transaction', async function () {
3542+
const mpcUtils = new ECDSAUtils.EcdsaUtils(bitgo, bitgo.coin('seievm'));
3543+
3544+
const feeOptions = {
3545+
maxFeePerGas: 30000000000,
3546+
maxPriorityFeePerGas: 20000000000,
3547+
};
3548+
const lowFeeTxid = '0x4d6deab136da1f3870de4eb6f8cf46ec1e08b9bf918b764578b7b1c7ab08d6b8';
3549+
const receiveAddress = '0x9bbb9a02e66e17636fd0637a0eee1e38f460b6ba';
3550+
3551+
const intent = mpcUtils.populateIntent(bitgo.coin('seievm'), {
3552+
reqId,
3553+
intentType: 'acceleration',
3554+
lowFeeTxid,
3555+
receiveAddress,
3556+
feeOptions,
3557+
});
3558+
3559+
// Validate the acceleration intent structure
3560+
intent.should.have.property('recipients', undefined);
3561+
intent.feeOptions!.should.deepEqual(feeOptions);
3562+
intent.txid!.should.equal(lowFeeTxid);
3563+
intent.receiveAddress!.should.equal(receiveAddress);
3564+
intent.intentType.should.equal('acceleration');
3565+
});
3566+
34993567
it('populate intent should return valid eth acceleration intent for receive address', async function () {
35003568
const mpcUtils = new ECDSAUtils.EcdsaUtils(bitgo, bitgo.coin('hteth'));
35013569

modules/sdk-core/src/bitgo/utils/mpcUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export abstract class MpcUtils {
191191
isTestTransaction: params.isTestTransaction,
192192
};
193193

194-
if (['eth', 'polygon', 'bsc', 'coredao'].includes(baseCoin.getFamily())) {
194+
if (['eth', 'polygon', 'bsc', 'coredao', 'seievm'].includes(baseCoin.getFamily())) {
195195
switch (params.intentType) {
196196
case 'payment':
197197
case 'transferToken':

0 commit comments

Comments
 (0)