From 183e953390065359e412a6b278e849e50ae5eec4 Mon Sep 17 00:00:00 2001 From: httpjunkie Date: Mon, 24 Feb 2025 13:31:37 -0500 Subject: [PATCH 1/4] fix: exclude smart transaction status page from rate limiting This change adds 'smartTransaction:showSmartTransactionStatusPage' to the typesExcludedFromRateLimiting array when initializing the ApprovalController. This prevents the "Request of type 'smartTransaction:showSmartTransactionStatusPage' already pending" error that was occurring when users executed sequential transactions in quick succession. Fixes TXL-679 --- app/scripts/metamask-controller.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 29ea67419583..a0e4c9f71b2a 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -521,6 +521,8 @@ export default class MetamaskController extends EventEmitter { ApprovalType.WatchAsset, ApprovalType.EthGetEncryptionPublicKey, ApprovalType.EthDecrypt, + // Exclude Smart TX Status Page from rate limiting to allow sequential transactions + 'smartTransaction:showSmartTransactionStatusPage', ], }); From 202e49606d742512f0a43bad508a31eca4b2a07e Mon Sep 17 00:00:00 2001 From: httpjunkie Date: Tue, 25 Feb 2025 09:45:44 -0500 Subject: [PATCH 2/4] feat: add SMART_TRANSACTION_CONFIRMATION_TYPES rather than a string. --- app/scripts/metamask-controller.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 7485d37d54ac..26a560c03495 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -373,6 +373,7 @@ import { SnapInterfaceControllerInit, SnapsRegistryInit, } from './controller-init/snaps'; +import { SMART_TRANSACTION_CONFIRMATION_TYPES } from '../shared/constants/app'; const { TRIGGER_TYPES } = NotificationServicesController.Constants; export const METAMASK_CONTROLLER_EVENTS = { @@ -523,7 +524,7 @@ export default class MetamaskController extends EventEmitter { ApprovalType.EthGetEncryptionPublicKey, ApprovalType.EthDecrypt, // Exclude Smart TX Status Page from rate limiting to allow sequential transactions - 'smartTransaction:showSmartTransactionStatusPage', + SMART_TRANSACTION_CONFIRMATION_TYPES.showSmartTransactionStatusPage, ], }); From 56596a0ba8ac0fcc10c06ca59f38e9fd508fda4d Mon Sep 17 00:00:00 2001 From: httpjunkie Date: Tue, 25 Feb 2025 10:25:11 -0500 Subject: [PATCH 3/4] fix: import order --- app/scripts/metamask-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 26a560c03495..fa16e4332fea 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -239,6 +239,7 @@ import { BridgeBackgroundAction, } from '../../shared/types/bridge'; import { isProduction } from '../../shared/modules/environment'; +import { SMART_TRANSACTION_CONFIRMATION_TYPES } from '../shared/constants/app'; import { ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) handleMMITransactionUpdate, @@ -373,7 +374,6 @@ import { SnapInterfaceControllerInit, SnapsRegistryInit, } from './controller-init/snaps'; -import { SMART_TRANSACTION_CONFIRMATION_TYPES } from '../shared/constants/app'; const { TRIGGER_TYPES } = NotificationServicesController.Constants; export const METAMASK_CONTROLLER_EVENTS = { From aab8455b56a5dd2bd3cf1241d55f5687946e3647 Mon Sep 17 00:00:00 2001 From: httpjunkie Date: Tue, 25 Feb 2025 10:37:50 -0500 Subject: [PATCH 4/4] fix: remove extra import and consolidate into existing import --- app/scripts/metamask-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index fa16e4332fea..e3ab5127e1e2 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -196,6 +196,7 @@ import { MILLISECOND, MINUTE, SECOND } from '../../shared/constants/time'; import { ORIGIN_METAMASK, POLLING_TOKEN_ENVIRONMENT_TYPES, + SMART_TRANSACTION_CONFIRMATION_TYPES, } from '../../shared/constants/app'; import { MetaMetricsEventCategory, @@ -239,7 +240,6 @@ import { BridgeBackgroundAction, } from '../../shared/types/bridge'; import { isProduction } from '../../shared/modules/environment'; -import { SMART_TRANSACTION_CONFIRMATION_TYPES } from '../shared/constants/app'; import { ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) handleMMITransactionUpdate,