Skip to content

feat: update container types #6014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/transaction-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Support `containerTypes` property in `updateEditableParams` method ([#6014](https://github.com/MetaMask/core/pull/6014))
- Add specific transaction types to outgoing transactions retrieved from accounts API ([#5987](https://github.com/MetaMask/core/pull/5987))
- Add optional `amount` property to `transferInformation` object in `TransactionMeta` type.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import {
GasFeeEstimateType,
SimulationErrorCode,
SimulationTokenStandard,
TransactionContainerType,
TransactionEnvelopeType,
TransactionStatus,
TransactionType,
Expand Down Expand Up @@ -7157,6 +7158,29 @@ describe('TransactionController', () => {
);
});

it('updates container types', async () => {
const { controller } = setupController({
options: {
state: {
transactions: [transactionMeta],
},
},
updateToInitialState: true,
});

const updatedTransaction = await controller.updateEditableParams(
transactionId,
{
...params,
containerTypes: [TransactionContainerType.EnforcedSimulations],
},
);

expect(updatedTransaction?.containerTypes).toStrictEqual([
TransactionContainerType.EnforcedSimulations,
]);
});

it('throws an error if no transaction metadata is found', async () => {
const { controller } = setupController();
await expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ import type {
TransactionBatchMeta,
AfterSimulateHook,
BeforeSignHook,
TransactionContainerType,
} from './types';
import {
GasFeeEstimateLevel,
Expand Down Expand Up @@ -2027,6 +2028,7 @@ export class TransactionController extends BaseController<
*
* @param txId - The ID of the transaction to update.
* @param params - The editable parameters to update.
* @param params.containerTypes - Container types applied to the parameters.
* @param params.data - Data to pass with the transaction.
* @param params.from - Address to send the transaction from.
* @param params.gas - Maximum number of units of gas to use for the transaction.
Expand All @@ -2040,6 +2042,7 @@ export class TransactionController extends BaseController<
async updateEditableParams(
txId: string,
{
containerTypes,
data,
from,
gas,
Expand All @@ -2049,6 +2052,7 @@ export class TransactionController extends BaseController<
to,
value,
}: {
containerTypes?: TransactionContainerType[];
data?: string;
from?: string;
gas?: string;
Expand Down Expand Up @@ -2099,6 +2103,10 @@ export class TransactionController extends BaseController<

updatedTransaction.type = type;

if (containerTypes) {
updatedTransaction.containerTypes = containerTypes;
}

await updateTransactionLayer1GasFee({
layer1GasFeeFlows: this.#layer1GasFeeFlows,
messenger: this.messagingSystem,
Expand Down
Loading