feat(card): migrate card on-chain checks to CardController#28291
feat(card): migrate card on-chain checks to CardController#28291Brunonascdev merged 52 commits intomainfrom
Conversation
…card-feature-flag-refactor
…card-feature-flag-refactor
…migrate-unauthenticated-state-card
…migrate-unauthenticated-state-card
…migrate-unauthenticated-state-card
…/metamask-mobile into feat/card-feature-flag-refactor
…card-feature-flag-refactor
…migrate-unauthenticated-state-card
…migrate-unauthenticated-state-card
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0d0b9b2. Configure here.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
SmokeCard is the primary tag - directly tests Card home screen, Add Funds, Advanced Card Management, Card navbar button, and card analytics. All of these are affected by the authentication state changes, cardholder detection refactoring, and selector migrations. SmokeTrade is required per SmokeCard tag description (Add Funds uses swaps). Also, the EarnRewardsPreview component (part of Rewards/Earn) uses the updated card selectors. SmokeConfirmations is required per SmokeCard tag description (Add Funds uses swaps which require transaction confirmations). The Performance Test Selection: |
|
✅ E2E Fixture Validation — Schema is up to date |
|
christopherferreira9
left a comment
There was a problem hiding this comment.
Looks good for QA



Description
Migrates Card authentication and region state from Redux and ad hoc hooks into
CardController, and wires the Card SDK and screens to controller-backed selectors (app/selectors/cardController.ts). This follows earlier Card work already onmain(feature-flag cleanup, waitlist modal, etc.) and focuses on unauthenticated/authenticated state living in the Engine controller instead of thecardRedux slice.Why: A single source of truth in
CardControlleravoids duplicated session/cardholder logic, keeps logout and location updates consistent with provider APIs, and simplifies the Card SDK surface (no globalCardVerificationside-effect component).What changed (vs
origin/main—git diff origin/main...HEAD):CardControllerisAuthenticated,selectedCountry,activeProviderId,cardholderAccounts, and per-providerproviderData(including user location for selectors).Engine.context.CardController(e.g.logout(),setUserLocation()) instead of Redux-only flows.CardController.test.ts; messenger wiring incard-controller-messenger.selectIsCardAuthenticated,selectCardUserLocation,selectCardholderAccounts,selectIsCardholder, etc., inapp/selectors/cardController.ts(+cardController.test.ts).cardslicehasViewedCardButton,isDaimoDemo); large trim inindex.test.ts.app/components/UI/Card/sdk/index.tsx)selectCardUserLocation(controller).CardController.logout(); clears queries/onboarding withoutresetAuthenticatedData.CardVerificationcomponent that mounteduseCardholderCheck+useCardAuthenticationVerification.useCardholderCheck,getCardholder,handleLocalAuthentication(and their tests).useCardAuthenticationVerificationremoved as a standalone flow aligned with the old pattern (files touched in diff).CardHome,CardWelcome,CardAuthentication, onboarding (SignUp,PhysicalAddress,SetPhoneNumber),CardButton,AssetSelectionBottomSheet, routes, and push provisioning hooks updated to use controller-backed auth/location and tests adjusted.EarnRewardsPreview: fix so UK users see the Card banner as intended (+ tests).handleCardHome,handleCardKycNotification,handleCardOnboardingsimplified/aligned with controller-driven state (tests updated).app/components/Nav/Main/index.jsadjusted for Card entry behavior.tests/framework/fixtures/json/default-fixture.jsonupdated for Card controller state.Changelog
CHANGELOG entry: Card authentication, user location, and cardholder membership are sourced from
CardControllerandselectIsCardAuthenticated/ related selectors instead of Redux Card auth fields; global Card verification helpers and legacy auth utilities are removed in favor of controller APIs.Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Medium risk because it re-routes card authentication, user location, logout, and route-guard logic away from Redux into
Engine.context.CardController, which can affect session state, navigation, and provisioning behavior if controller state is out of sync.Overview
Migrates Card auth/location and cardholder checks from the
cardRedux slice + side-effect hooks to controller-backed state. Screens, hooks, deeplink handlers, and route guards now readselectIsCardAuthenticated/selectCardUserLocation/cardholder selectors fromselectors/cardController.ts, and update location/auth viaEngine.context.CardControllerAPIs.Simplifies session lifecycle and cleanup flows.
CardSDKProviderlogout now callsCardController.logout()and clears queries/onboarding state withoutresetAuthenticatedData; login/onboarding steps andCardHomeauth-error handling now callCardController.validateAndRefreshSession()after token changes to sync controller auth state. Several legacy utilities/hooks (useCardholderCheck,useCardAuthenticationVerification,getCardholder,handleLocalAuthentication) and the globalCardVerificationcomponent are removed, with tests/snapshots updated accordingly.Reviewed by Cursor Bugbot for commit 0d0b9b2. Bugbot is set up for automated code reviews on this repo. Configure here.