feat(STX-331): migrate STX flags to smart-transactions-controller #550
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RemoteFeatureFlagController Integration in SmartTransactionController
This PR refactors how Smart Transactions feature flags are validated and made available to clients. This will allow clients to move away from the smart transactions properties of the swaps feature flags which are deprecated.
Key Changes:
RemoteFeatureFlagController:getStateinstead of agetFeatureFlagscallback.RemoteFeatureFlagController:stateChangefiresErrorReportingService:captureExceptionfalse)RemoteFeatureFlagController:getState,ErrorReportingService:captureExceptionas allowed actions, andRemoteFeatureFlagController:stateChangeas allowed eventgetFeatureFlagsconstructor option is deprecated and ignored.Links to draft migration PRs:
Note
Migrates smart-transactions feature flags to RemoteFeatureFlagController with per-chain validation, Sentry error reporting, new selectors, and controller changes that deprecate the getFeatureFlags option.
RemoteFeatureFlagController:getStateand listens toRemoteFeatureFlagController:stateChange.RemoteFeatureFlagController:getState,ErrorReportingService:captureExceptionand eventRemoteFeatureFlagController:stateChangein the messenger.getFeatureFlagsconstructor option.featureFlagsmodule with validators (superstruct) and helpers to process flags, normalize chain IDs (hex/CAIP-2), and merge per-chain configs.DEFAULT_DISABLED_SMART_TRANSACTIONS_FEATURE_FLAGSfallback.selectSmartTransactionsFeatureFlagsandselectSmartTransactionsFeatureFlagsForChain.src/SmartTransactionsController.ts):ErrorReportingService:captureException.getFeatureFlags.SmartTransactionsNetworkConfig,SmartTransactionsFeatureFlagsConfig; update public index exports.@metamask/superstruct,@metamask/utils,reselect; add peer deps@metamask/remote-feature-flag-controller,@metamask/error-reporting-service.Written by Cursor Bugbot for commit f0ffe63. This will update automatically on new commits. Configure here.