feat(STX-331): migrate STX flags to smart-transactions-controller #550
+2,164
−67
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
Reads STX feature flags from RemoteFeatureFlagController, validates on state changes with Sentry reporting, adds selectors/utilities, and deprecates getFeatureFlags.
RemoteFeatureFlagController:getState;getFeatureFlagsconstructor option deprecated/ignored.RemoteFeatureFlagController:getState,ErrorReportingService:captureExceptionand eventRemoteFeatureFlagController:stateChange.src/SmartTransactionsController.ts):RemoteFeatureFlagController:stateChange, validates flags, reports errors viaErrorReportingService:captureException.getSmartTransactionsFeatureFlags/getSmartTransactionsFeatureFlagsForChainto drive behavior (e.g., marking regular tx failed).src/featureFlags/*):smartTransactionsNetworks; supports hex and CAIP-2 IDs.normalizeChainId, per-chain merge withdefault, and hardcoded disabled defaults for unknown chains.src/selectors.ts):selectSmartTransactionsFeatureFlagsandselectSmartTransactionsFeatureFlagsForChain.src/utils.ts):getReturnTxHashAsap/shouldMarkRegularTransactionAsFailedto use network config flags.@metamask/superstruct,@metamask/utils,reselect; peer deps@metamask/remote-feature-flag-controller,@metamask/error-reporting-service.Written by Cursor Bugbot for commit eb0e310. This will update automatically on new commits. Configure here.