Skip to content

Commit 51e299e

Browse files
committed
chore: resolve PR comments
1 parent 9cc92e6 commit 51e299e

File tree

3 files changed

+11
-32
lines changed

3 files changed

+11
-32
lines changed

packages/transaction-controller/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111

12-
- Preserve type of nested transactions in batch if specified in `TransactionBatchSingleRequest` ([#6056](https://github.com/MetaMask/core/pull/6056))
12+
- Preserve provided `type` in `transactions` when calling `addTransactionBatch` ([#6056](https://github.com/MetaMask/core/pull/6056))
1313

1414
## [58.1.0]
1515

packages/transaction-controller/src/utils/batch.test.ts

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -908,34 +908,12 @@ describe('Batch Utils', () => {
908908
await flushPromises();
909909

910910
expect(publishBatchHook).toHaveBeenCalledTimes(1);
911-
expect(publishBatchHook).toHaveBeenCalledWith({
912-
from: FROM_MOCK,
913-
networkClientId: NETWORK_CLIENT_ID_MOCK,
914-
transactions: [
915-
{
916-
id: TRANSACTION_ID_MOCK,
917-
params: {
918-
...TRANSACTION_BATCH_PARAMS_MOCK,
919-
gas: undefined,
920-
maxFeePerGas: undefined,
921-
maxPriorityFeePerGas: undefined,
922-
},
923-
signedTx: TRANSACTION_SIGNATURE_MOCK,
924-
type: TransactionType.swap,
925-
},
926-
{
927-
id: TRANSACTION_ID_2_MOCK,
928-
params: {
929-
...TRANSACTION_BATCH_PARAMS_MOCK,
930-
gas: undefined,
931-
maxFeePerGas: undefined,
932-
maxPriorityFeePerGas: undefined,
933-
},
934-
signedTx: TRANSACTION_SIGNATURE_2_MOCK,
935-
type: TransactionType.bridge,
936-
},
937-
],
938-
});
911+
expect(publishBatchHook.mock.calls[0][0].transactions[0]).toBe(
912+
TransactionType.swap,
913+
);
914+
expect(publishBatchHook.mock.calls[0][0].transactions[1]).toBe(
915+
TransactionType.bridge,
916+
);
939917
});
940918

941919
it('resolves individual publish hooks with transaction hashes from publish batch hook', async () => {

packages/transaction-controller/src/utils/batch.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,17 @@ async function getNestedTransactionMeta(
246246
ethQuery: EthQuery,
247247
): Promise<NestedTransactionMetadata> {
248248
const { from } = request;
249-
const { params, type: requestType } = singleRequest;
249+
const { params, type: requestedType } = singleRequest;
250250

251-
const { type } = await determineTransactionType(
251+
const { type: determinedType } = await determineTransactionType(
252252
{ from, ...params },
253253
ethQuery,
254254
);
255255

256+
const type = requestedType ?? determinedType;
256257
return {
257258
...params,
258-
type: requestType ?? type,
259+
type,
259260
};
260261
}
261262

0 commit comments

Comments
 (0)