Skip to content

refactor(card): sonarcloud maintainability issues#22221

Merged
Brunonascdev merged 6 commits into
mainfrom
refactor/mm-card-maintainability-issues
Nov 6, 2025
Merged

refactor(card): sonarcloud maintainability issues#22221
Brunonascdev merged 6 commits into
mainfrom
refactor/mm-card-maintainability-issues

Conversation

@Brunonascdev

@Brunonascdev Brunonascdev commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

Description

This PR addresses several maintainability issues reported by SonarCloud:
🔗 View related issues on SonarCloud

Additionally, it reverts a temporary workaround previously added for Android to prevent a crash occurring when users navigated through the KYC WebView.
The root cause of the WebView crash has been resolved in a separate PR, making the temporary fix unnecessary.

Changelog

CHANGELOG entry: Reverted temporary workaround for KYC WebView crash (issue resolved in upstream fix).

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Refactors Card features: rewrites asset selection and balance logic, unifies KYC verification navigation to WebView, tightens onboarding routing, improves SDK/logging, and adds extensive tests.

  • Card Home:
    • Add enableCardAction tests covering success/failure/loading paths; mock Logger.log.
    • Log errors in enableCardAction catch.
  • Asset Selection Bottom Sheet:
    • Major refactor with helper utilities (network filtering, token mapping/deduping, CAIP handling, sorting by priority/allowance).
    • Integrate balances via useAssetBalances; show allowance state text; improve list rendering and Solana footer.
    • Preserve existing navigation and priority update, and allow Limited tokens to update priority directly.
  • Balances (useAssetBalances):
    • Extract helpers; improve fiat calculation (market data, Solana rates, proportional fallback), normalization, and asset building.
    • Update tests with extensive scenarios (enabled/limited/not-enabled, fallbacks, edge cases).
  • Onboarding/KYC:
    • Verify Identity: always navigate to WebView; simplify tests; add screen view metric.
    • OnboardingNavigator: require firstName and countryOfNationality before address; update tests.
    • Types: add countryOfNationality to UserResponse.
  • SDK:
    • Improve error logging/handling (external wallet details, provision card); simplify network-to-CAIP mapping; minor cleanup.
  • Priority/External Wallet Hooks:
    • Extract determineAllowanceState; use nullish coalescing where applicable; add tests for warnings and fetching behaviors.

Written by Cursor Bugbot for commit 94c9b08. This will update automatically on new commits. Configure here.

@Brunonascdev Brunonascdev self-assigned this Nov 6, 2025
@Brunonascdev Brunonascdev added the team-card Card Team label Nov 6, 2025
@Brunonascdev Brunonascdev requested a review from a team as a code owner November 6, 2025 00:21
@github-actions

github-actions Bot commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2025

Copy link
Copy Markdown

@Brunonascdev Brunonascdev added this pull request to the merge queue Nov 6, 2025
Merged via the queue into main with commit a2bee21 Nov 6, 2025
84 of 85 checks passed
@Brunonascdev Brunonascdev deleted the refactor/mm-card-maintainability-issues branch November 6, 2025 15:59
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 6, 2025
@metamaskbot metamaskbot added the release-7.60.0 Issue or pull request that will be included in release 7.60.0 label Nov 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.60.0 Issue or pull request that will be included in release 7.60.0 size-XL team-card Card Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants