From 3dc5441f81a476247732c9986162c193d3678dc9 Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Tue, 1 Jul 2025 13:52:14 -0700 Subject: [PATCH 01/10] fix: preserve transaction type of batched transactions --- packages/transaction-controller/CHANGELOG.md | 4 + .../src/utils/batch.test.ts | 104 ++++++++++++++++++ .../transaction-controller/src/utils/batch.ts | 14 ++- 3 files changed, 118 insertions(+), 4 deletions(-) diff --git a/packages/transaction-controller/CHANGELOG.md b/packages/transaction-controller/CHANGELOG.md index 1e189e0e80d..faec546da35 100644 --- a/packages/transaction-controller/CHANGELOG.md +++ b/packages/transaction-controller/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Preserve type of nested transactions in batch if specified in `TransactionBatchSingleRequest` ([]()) + ## [58.1.0] ### Added diff --git a/packages/transaction-controller/src/utils/batch.test.ts b/packages/transaction-controller/src/utils/batch.test.ts index 0f484dd0f15..54f97c3e93d 100644 --- a/packages/transaction-controller/src/utils/batch.test.ts +++ b/packages/transaction-controller/src/utils/batch.test.ts @@ -834,6 +834,110 @@ describe('Batch Utils', () => { }); }); + it('calls publish batch hook with requested transaction type', async () => { + const publishBatchHook: jest.MockedFn = jest.fn(); + + addTransactionMock + .mockResolvedValueOnce({ + transactionMeta: { + ...TRANSACTION_META_MOCK, + id: TRANSACTION_ID_MOCK, + }, + result: Promise.resolve(''), + }) + .mockResolvedValueOnce({ + transactionMeta: { + ...TRANSACTION_META_MOCK, + id: TRANSACTION_ID_2_MOCK, + }, + result: Promise.resolve(''), + }); + + publishBatchHook.mockResolvedValue({ + results: [ + { + transactionHash: TRANSACTION_HASH_MOCK, + }, + { + transactionHash: TRANSACTION_HASH_2_MOCK, + }, + ], + }); + + addTransactionBatch({ + ...request, + publishBatchHook, + request: { + ...request.request, + transactions: [ + { + ...request.request.transactions[0], + type: TransactionType.swap, + }, + { + ...request.request.transactions[1], + type: TransactionType.bridge, + }, + ], + disable7702: true, + }, + }).catch(() => { + // Intentionally empty + }); + + await flushPromises(); + + const publishHooks = addTransactionMock.mock.calls.map( + ([, options]) => options.publishHook, + ); + + publishHooks[0]?.( + TRANSACTION_META_MOCK, + TRANSACTION_SIGNATURE_MOCK, + ).catch(() => { + // Intentionally empty + }); + + publishHooks[1]?.( + TRANSACTION_META_MOCK, + TRANSACTION_SIGNATURE_2_MOCK, + ).catch(() => { + // Intentionally empty + }); + + await flushPromises(); + + expect(publishBatchHook).toHaveBeenCalledTimes(1); + expect(publishBatchHook).toHaveBeenCalledWith({ + from: FROM_MOCK, + networkClientId: NETWORK_CLIENT_ID_MOCK, + transactions: [ + { + id: TRANSACTION_ID_MOCK, + params: { + ...TRANSACTION_BATCH_PARAMS_MOCK, + gas: undefined, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined, + }, + signedTx: TRANSACTION_SIGNATURE_MOCK, + type: TransactionType.swap, + }, + { + id: TRANSACTION_ID_2_MOCK, + params: { + ...TRANSACTION_BATCH_PARAMS_MOCK, + gas: undefined, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined, + }, + signedTx: TRANSACTION_SIGNATURE_2_MOCK, + type: TransactionType.bridge, + }, + ], + }); + }); + it('resolves individual publish hooks with transaction hashes from publish batch hook', async () => { const publishBatchHook: jest.MockedFn = jest.fn(); diff --git a/packages/transaction-controller/src/utils/batch.ts b/packages/transaction-controller/src/utils/batch.ts index 53d489662f5..84665ab34c5 100644 --- a/packages/transaction-controller/src/utils/batch.ts +++ b/packages/transaction-controller/src/utils/batch.ts @@ -246,7 +246,7 @@ async function getNestedTransactionMeta( ethQuery: EthQuery, ): Promise { const { from } = request; - const { params } = singleRequest; + const { params, type: requestType } = singleRequest; const { type } = await determineTransactionType( { from, ...params }, @@ -255,7 +255,7 @@ async function getNestedTransactionMeta( return { ...params, - type, + type: requestType ?? type, }; } @@ -544,7 +544,7 @@ async function processTransactionWithHook( request: AddTransactionBatchRequest, txBatchMeta?: TransactionBatchMeta, ) { - const { existingTransaction, params } = nestedTransaction; + const { existingTransaction, params, type } = nestedTransaction; const { addTransaction, @@ -595,6 +595,7 @@ async function processTransactionWithHook( const { transactionMeta } = await addTransaction( transactionMetaForGasEstimates.txParams, { + type, batchId, disableGasBuffer: true, networkClientId, @@ -620,11 +621,16 @@ async function processTransactionWithHook( value, }; - log('Processed new transaction with hook', { id, params: newParams }); + log('Processed new transaction with hook', { + id, + params: newParams, + type: nestedTransaction.type, + }); return { id, params: newParams, + type: nestedTransaction.type, }; } From 9cc92e6fabfbe7b0d7400179ea74a5379bf90031 Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Tue, 1 Jul 2025 13:54:10 -0700 Subject: [PATCH 02/10] chore: update changelog --- packages/transaction-controller/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/transaction-controller/CHANGELOG.md b/packages/transaction-controller/CHANGELOG.md index faec546da35..0d790ce892d 100644 --- a/packages/transaction-controller/CHANGELOG.md +++ b/packages/transaction-controller/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Preserve type of nested transactions in batch if specified in `TransactionBatchSingleRequest` ([]()) +- Preserve type of nested transactions in batch if specified in `TransactionBatchSingleRequest` ([#6056](https://github.com/MetaMask/core/pull/6056)) ## [58.1.0] From 51e299e1a738f9e8a3c1ba93c0e4f2669127ba89 Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Wed, 2 Jul 2025 07:19:26 -0700 Subject: [PATCH 03/10] chore: resolve PR comments --- packages/transaction-controller/CHANGELOG.md | 2 +- .../src/utils/batch.test.ts | 34 ++++--------------- .../transaction-controller/src/utils/batch.ts | 7 ++-- 3 files changed, 11 insertions(+), 32 deletions(-) diff --git a/packages/transaction-controller/CHANGELOG.md b/packages/transaction-controller/CHANGELOG.md index 0d790ce892d..b0eee00ad5f 100644 --- a/packages/transaction-controller/CHANGELOG.md +++ b/packages/transaction-controller/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Preserve type of nested transactions in batch if specified in `TransactionBatchSingleRequest` ([#6056](https://github.com/MetaMask/core/pull/6056)) +- Preserve provided `type` in `transactions` when calling `addTransactionBatch` ([#6056](https://github.com/MetaMask/core/pull/6056)) ## [58.1.0] diff --git a/packages/transaction-controller/src/utils/batch.test.ts b/packages/transaction-controller/src/utils/batch.test.ts index 54f97c3e93d..6649990fca2 100644 --- a/packages/transaction-controller/src/utils/batch.test.ts +++ b/packages/transaction-controller/src/utils/batch.test.ts @@ -908,34 +908,12 @@ describe('Batch Utils', () => { await flushPromises(); expect(publishBatchHook).toHaveBeenCalledTimes(1); - expect(publishBatchHook).toHaveBeenCalledWith({ - from: FROM_MOCK, - networkClientId: NETWORK_CLIENT_ID_MOCK, - transactions: [ - { - id: TRANSACTION_ID_MOCK, - params: { - ...TRANSACTION_BATCH_PARAMS_MOCK, - gas: undefined, - maxFeePerGas: undefined, - maxPriorityFeePerGas: undefined, - }, - signedTx: TRANSACTION_SIGNATURE_MOCK, - type: TransactionType.swap, - }, - { - id: TRANSACTION_ID_2_MOCK, - params: { - ...TRANSACTION_BATCH_PARAMS_MOCK, - gas: undefined, - maxFeePerGas: undefined, - maxPriorityFeePerGas: undefined, - }, - signedTx: TRANSACTION_SIGNATURE_2_MOCK, - type: TransactionType.bridge, - }, - ], - }); + expect(publishBatchHook.mock.calls[0][0].transactions[0]).toBe( + TransactionType.swap, + ); + expect(publishBatchHook.mock.calls[0][0].transactions[1]).toBe( + TransactionType.bridge, + ); }); it('resolves individual publish hooks with transaction hashes from publish batch hook', async () => { diff --git a/packages/transaction-controller/src/utils/batch.ts b/packages/transaction-controller/src/utils/batch.ts index 84665ab34c5..e91b2e041b4 100644 --- a/packages/transaction-controller/src/utils/batch.ts +++ b/packages/transaction-controller/src/utils/batch.ts @@ -246,16 +246,17 @@ async function getNestedTransactionMeta( ethQuery: EthQuery, ): Promise { const { from } = request; - const { params, type: requestType } = singleRequest; + const { params, type: requestedType } = singleRequest; - const { type } = await determineTransactionType( + const { type: determinedType } = await determineTransactionType( { from, ...params }, ethQuery, ); + const type = requestedType ?? determinedType; return { ...params, - type: requestType ?? type, + type, }; } From 242887c6d71e303ccc71db04faace21ee4da9af1 Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Thu, 3 Jul 2025 16:22:37 -0700 Subject: [PATCH 04/10] chore: rename type usages --- packages/transaction-controller/src/utils/batch.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/transaction-controller/src/utils/batch.ts b/packages/transaction-controller/src/utils/batch.ts index d9e19a4f734..7334718edb1 100644 --- a/packages/transaction-controller/src/utils/batch.ts +++ b/packages/transaction-controller/src/utils/batch.ts @@ -602,12 +602,12 @@ async function processTransactionWithHook( const { transactionMeta } = await addTransaction( transactionMetaForGasEstimates.txParams, { - type, batchId, disableGasBuffer: true, networkClientId, publishHook, requireApproval: false, + type, }, ); @@ -631,13 +631,13 @@ async function processTransactionWithHook( log('Processed new transaction with hook', { id, params: newParams, - type: nestedTransaction.type, + type, }); return { id, params: newParams, - type: nestedTransaction.type, + type, }; } From c466dfb7fb831757347434f1a33f5f5e72f53398 Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Wed, 9 Jul 2025 18:41:37 -0700 Subject: [PATCH 05/10] chore: add unit test for 7702-enabled batch transactions --- .../src/utils/batch.test.ts | 52 ++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/packages/transaction-controller/src/utils/batch.test.ts b/packages/transaction-controller/src/utils/batch.test.ts index 4fc6180d738..6a381abc1ca 100644 --- a/packages/transaction-controller/src/utils/batch.test.ts +++ b/packages/transaction-controller/src/utils/batch.test.ts @@ -368,6 +368,53 @@ describe('Batch Utils', () => { const result = await addTransactionBatch(request); expect(result.batchId).toMatch(/^0x[0-9a-f]{32}$/u); + expect(addTransactionMock.mock.calls).toStrictEqual({}); + }); + + it('preserves nested transaction types when disable7702 is false', async () => { + const publishBatchHook: jest.MockedFn = jest.fn(); + + isAccountUpgradedToEIP7702Mock.mockResolvedValueOnce({ + delegationAddress: undefined, + isSupported: true, + }); + + addTransactionMock.mockResolvedValueOnce({ + transactionMeta: TRANSACTION_META_MOCK, + result: Promise.resolve(''), + }); + + const result = await addTransactionBatch({ + ...request, + publishBatchHook, + request: { + ...request.request, + transactions: [ + { + ...request.request.transactions[0], + type: TransactionType.swapApproval, + }, + { + ...request.request.transactions[1], + type: TransactionType.bridgeApproval, + }, + ], + disable7702: false, + }, + }); + + expect(result.batchId).toMatch(/^0x[0-9a-f]{32}$/u); + expect(addTransactionMock).toHaveBeenCalledTimes(1); + expect(addTransactionMock.mock.calls[0][1].type).toStrictEqual( + TransactionType.batch, + ); + + expect( + addTransactionMock.mock.calls[0][1].nestedTransactions?.[0].type, + ).toBe(TransactionType.swapApproval); + expect( + addTransactionMock.mock.calls[0][1].nestedTransactions?.[1].type, + ).toBe(TransactionType.bridgeApproval); }); it('returns provided batch ID', async () => { @@ -889,6 +936,7 @@ describe('Batch Utils', () => { // Intentionally empty }); + expect(request.request.transactions).toHaveLength(2); await flushPromises(); const publishHooks = addTransactionMock.mock.calls.map( @@ -912,10 +960,10 @@ describe('Batch Utils', () => { await flushPromises(); expect(publishBatchHook).toHaveBeenCalledTimes(1); - expect(publishBatchHook.mock.calls[0][0].transactions[0]).toBe( + expect(publishBatchHook.mock.calls[0][0].transactions[0].type).toBe( TransactionType.swap, ); - expect(publishBatchHook.mock.calls[0][0].transactions[1]).toBe( + expect(publishBatchHook.mock.calls[0][0].transactions[1].type).toBe( TransactionType.bridge, ); }); From 34d659486df527940f925611d4dd324084b6230b Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Wed, 9 Jul 2025 18:42:13 -0700 Subject: [PATCH 06/10] chore: add type to PublishBatchHookTransaction and NestedTransactionMetadata --- packages/transaction-controller/src/TransactionController.ts | 3 ++- packages/transaction-controller/src/types.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/transaction-controller/src/TransactionController.ts b/packages/transaction-controller/src/TransactionController.ts index c04b13f5bee..eaff578f7a3 100644 --- a/packages/transaction-controller/src/TransactionController.ts +++ b/packages/transaction-controller/src/TransactionController.ts @@ -120,6 +120,7 @@ import type { AfterSimulateHook, BeforeSignHook, TransactionContainerType, + NestedTransactionMetadata, } from './types'; import { GasFeeEstimateLevel, @@ -1132,7 +1133,7 @@ export class TransactionController extends BaseController< deviceConfirmedOn?: WalletDevice; disableGasBuffer?: boolean; method?: string; - nestedTransactions?: BatchTransactionParams[]; + nestedTransactions?: NestedTransactionMetadata[]; networkClientId: NetworkClientId; origin?: string; publishHook?: PublishHook; diff --git a/packages/transaction-controller/src/types.ts b/packages/transaction-controller/src/types.ts index 1a9e7a36693..ea13968ec21 100644 --- a/packages/transaction-controller/src/types.ts +++ b/packages/transaction-controller/src/types.ts @@ -1722,6 +1722,9 @@ export type PublishBatchHookTransaction = { /** Signed transaction data to publish. */ signedTx: Hex; + + /** Type of the nested transaction. */ + type?: TransactionType; }; /** From e252d709d3dda1558a7a8e24dfa4e4b62c0db63c Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Wed, 9 Jul 2025 18:44:16 -0700 Subject: [PATCH 07/10] fix: unit test --- packages/transaction-controller/src/utils/batch.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/transaction-controller/src/utils/batch.test.ts b/packages/transaction-controller/src/utils/batch.test.ts index 6a381abc1ca..602b1aefed4 100644 --- a/packages/transaction-controller/src/utils/batch.test.ts +++ b/packages/transaction-controller/src/utils/batch.test.ts @@ -368,7 +368,6 @@ describe('Batch Utils', () => { const result = await addTransactionBatch(request); expect(result.batchId).toMatch(/^0x[0-9a-f]{32}$/u); - expect(addTransactionMock.mock.calls).toStrictEqual({}); }); it('preserves nested transaction types when disable7702 is false', async () => { From 958a0d21f3c8f8829ade19bbd48bd01d6c6dbe28 Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Wed, 9 Jul 2025 18:47:54 -0700 Subject: [PATCH 08/10] chore: update changelog --- packages/transaction-controller/CHANGELOG.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/transaction-controller/CHANGELOG.md b/packages/transaction-controller/CHANGELOG.md index 7be659071db..58d4758c07a 100644 --- a/packages/transaction-controller/CHANGELOG.md +++ b/packages/transaction-controller/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add fallback to the sequential hook when `publishBatchHook` returns empty ([#6063](https://github.com/MetaMask/core/pull/6063)) +### Fixed + +- Preserve provided `type` in `transactions` when calling `addTransactionBatch` ([#6056](https://github.com/MetaMask/core/pull/6056)) + ## [58.1.1] ### Changed @@ -19,10 +23,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - This upgrade includes performance improvements to checksum hex address normalization - Bump `@metamask/utils` from `^11.2.0` to `^11.4.2` ([#6054](https://github.com/MetaMask/core/pull/6054)) -### Fixed - -- Preserve provided `type` in `transactions` when calling `addTransactionBatch` ([#6056](https://github.com/MetaMask/core/pull/6056)) - ## [58.1.0] ### Added From b5ec8c5ca5230434f940d7004ec20aa4d6480537 Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Mon, 21 Jul 2025 12:30:46 -0700 Subject: [PATCH 09/10] fix: update batch tx unit test --- packages/transaction-controller/src/types.ts | 3 - .../src/utils/batch.test.ts | 176 +++++++++--------- 2 files changed, 93 insertions(+), 86 deletions(-) diff --git a/packages/transaction-controller/src/types.ts b/packages/transaction-controller/src/types.ts index ea13968ec21..1a9e7a36693 100644 --- a/packages/transaction-controller/src/types.ts +++ b/packages/transaction-controller/src/types.ts @@ -1722,9 +1722,6 @@ export type PublishBatchHookTransaction = { /** Signed transaction data to publish. */ signedTx: Hex; - - /** Type of the nested transaction. */ - type?: TransactionType; }; /** diff --git a/packages/transaction-controller/src/utils/batch.test.ts b/packages/transaction-controller/src/utils/batch.test.ts index 602b1aefed4..36554a395b5 100644 --- a/packages/transaction-controller/src/utils/batch.test.ts +++ b/packages/transaction-controller/src/utils/batch.test.ts @@ -370,6 +370,55 @@ describe('Batch Utils', () => { expect(result.batchId).toMatch(/^0x[0-9a-f]{32}$/u); }); + it('preserves nested transaction types when disable7702 is true', async () => { + const publishBatchHook: jest.MockedFn = jest.fn(); + mockRequestApproval(MESSENGER_MOCK, { + state: 'approved', + }); + + addTransactionMock + .mockResolvedValueOnce({ + transactionMeta: { + ...TRANSACTION_META_MOCK, + id: TRANSACTION_ID_MOCK, + }, + result: Promise.resolve(''), + }) + .mockResolvedValueOnce({ + transactionMeta: { + ...TRANSACTION_META_MOCK, + id: TRANSACTION_ID_2_MOCK, + }, + result: Promise.resolve(''), + }); + addTransactionBatch({ + ...request, + publishBatchHook, + request: { + ...request.request, + transactions: [ + { + ...request.request.transactions[0], + type: TransactionType.swap, + }, + { + ...request.request.transactions[1], + type: TransactionType.bridge, + }, + ], + disable7702: true, + }, + }).catch(() => { + // Intentionally empty + }); + + await flushPromises(); + + expect(addTransactionMock).toHaveBeenCalledTimes(2); + expect(addTransactionMock.mock.calls[0][1].type).toBe('swap'); + expect(addTransactionMock.mock.calls[1][1].type).toBe('bridge'); + }); + it('preserves nested transaction types when disable7702 is false', async () => { const publishBatchHook: jest.MockedFn = jest.fn(); @@ -883,89 +932,50 @@ describe('Batch Utils', () => { PUBLISH_BATCH_HOOK_PARAMS, ); }); - - it('calls publish batch hook with requested transaction type', async () => { - const publishBatchHook: jest.MockedFn = jest.fn(); - - addTransactionMock - .mockResolvedValueOnce({ - transactionMeta: { - ...TRANSACTION_META_MOCK, - id: TRANSACTION_ID_MOCK, - }, - result: Promise.resolve(''), - }) - .mockResolvedValueOnce({ - transactionMeta: { - ...TRANSACTION_META_MOCK, - id: TRANSACTION_ID_2_MOCK, - }, - result: Promise.resolve(''), - }); - - publishBatchHook.mockResolvedValue({ - results: [ - { - transactionHash: TRANSACTION_HASH_MOCK, - }, - { - transactionHash: TRANSACTION_HASH_2_MOCK, - }, - ], - }); - - addTransactionBatch({ - ...request, - publishBatchHook, - request: { - ...request.request, - transactions: [ - { - ...request.request.transactions[0], - type: TransactionType.swap, - }, - { - ...request.request.transactions[1], - type: TransactionType.bridge, - }, - ], - disable7702: true, - }, - }).catch(() => { - // Intentionally empty - }); - - expect(request.request.transactions).toHaveLength(2); - await flushPromises(); - - const publishHooks = addTransactionMock.mock.calls.map( - ([, options]) => options.publishHook, - ); - - publishHooks[0]?.( - TRANSACTION_META_MOCK, - TRANSACTION_SIGNATURE_MOCK, - ).catch(() => { - // Intentionally empty - }); - - publishHooks[1]?.( - TRANSACTION_META_MOCK, - TRANSACTION_SIGNATURE_2_MOCK, - ).catch(() => { - // Intentionally empty - }); - - await flushPromises(); - - expect(publishBatchHook).toHaveBeenCalledTimes(1); - expect(publishBatchHook.mock.calls[0][0].transactions[0].type).toBe( - TransactionType.swap, - ); - expect(publishBatchHook.mock.calls[0][0].transactions[1].type).toBe( - TransactionType.bridge, - ); - }); + // const publishBatchHook: jest.MockedFn = jest.fn(); + + // addTransactionMock + // .mockResolvedValueOnce({ + // transactionMeta: { + // ...TRANSACTION_META_MOCK, + // id: TRANSACTION_ID_MOCK, + // }, + // result: Promise.resolve(''), + // }) + // .mockResolvedValueOnce({ + // transactionMeta: { + // ...TRANSACTION_META_MOCK, + // id: TRANSACTION_ID_2_MOCK, + // }, + // result: Promise.resolve(''), + // }); + // addTransactionBatch({ + // ...request, + // publishBatchHook, + // request: { + // ...request.request, + // transactions: [ + // { + // ...request.request.transactions[0], + // type: TransactionType.swap, + // }, + // { + // ...request.request.transactions[1], + // type: TransactionType.bridge, + // }, + // ], + // disable7702: true, + // }, + // }).catch(() => { + // // Intentionally empty + // }); + + // await flushPromises(); + + // expect(addTransactionMock).toHaveBeenCalledTimes(2); + // expect(addTransactionMock.mock.calls[0][1].type).toBe('swap'); + // expect(addTransactionMock.mock.calls[1][1].type).toBe('bridge'); + // }); it('resolves individual publish hooks with transaction hashes from publish batch hook', async () => { const publishBatchHook: jest.MockedFn = jest.fn(); From 8652accde3932e7e4761049eac28e25e2d9561d8 Mon Sep 17 00:00:00 2001 From: Micaela Estabillo Date: Tue, 22 Jul 2025 08:53:04 -0700 Subject: [PATCH 10/10] fix: removed commented unit tests --- .../src/utils/batch.test.ts | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/packages/transaction-controller/src/utils/batch.test.ts b/packages/transaction-controller/src/utils/batch.test.ts index 36554a395b5..0e254fa0979 100644 --- a/packages/transaction-controller/src/utils/batch.test.ts +++ b/packages/transaction-controller/src/utils/batch.test.ts @@ -932,50 +932,6 @@ describe('Batch Utils', () => { PUBLISH_BATCH_HOOK_PARAMS, ); }); - // const publishBatchHook: jest.MockedFn = jest.fn(); - - // addTransactionMock - // .mockResolvedValueOnce({ - // transactionMeta: { - // ...TRANSACTION_META_MOCK, - // id: TRANSACTION_ID_MOCK, - // }, - // result: Promise.resolve(''), - // }) - // .mockResolvedValueOnce({ - // transactionMeta: { - // ...TRANSACTION_META_MOCK, - // id: TRANSACTION_ID_2_MOCK, - // }, - // result: Promise.resolve(''), - // }); - // addTransactionBatch({ - // ...request, - // publishBatchHook, - // request: { - // ...request.request, - // transactions: [ - // { - // ...request.request.transactions[0], - // type: TransactionType.swap, - // }, - // { - // ...request.request.transactions[1], - // type: TransactionType.bridge, - // }, - // ], - // disable7702: true, - // }, - // }).catch(() => { - // // Intentionally empty - // }); - - // await flushPromises(); - - // expect(addTransactionMock).toHaveBeenCalledTimes(2); - // expect(addTransactionMock.mock.calls[0][1].type).toBe('swap'); - // expect(addTransactionMock.mock.calls[1][1].type).toBe('bridge'); - // }); it('resolves individual publish hooks with transaction hashes from publish batch hook', async () => { const publishBatchHook: jest.MockedFn = jest.fn();