refactor(confirmations): migrate Badge and BadgeWrapper to MMDS - #34307
refactor(confirmations): migrate Badge and BadgeWrapper to MMDS#34307brianacnguyen wants to merge 26 commits into
Conversation
Replace component-library network badges with BadgeNetwork and BadgeWrapper, including AccountBase badgeProps. Co-authored-by: Cursor <cursoragent@cursor.com>
|
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. |
🧪 Flaky unit test detectionRun history flaky detectionHistorical failure rate is a hint, not proof — review each suggestion in context. See the flaky-test-detection skill for the full pattern reference and manual audit workflow. Failures / runs sampled per window:
AI-detected flaky patterns
|
…to refactor/confirmations-badge
…types Add AddressFrom and badge branch tests, tighten on-screen matchers, and cast network badge sources for BadgeNetwork. Co-authored-by: Cursor <cursoragent@cursor.com>
…con test Co-authored-by: Cursor <cursoragent@cursor.com>
BadgeNetwork is for BadgeWrapper overlays; use a sized network avatar to match sibling confirmation rows. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Pass network name to TokenIcon BadgeNetwork, gate badges on truthy image sources, and fix AddressFrom mock typing for missing images. Co-authored-by: Cursor <cursoragent@cursor.com>
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 e8de38a. Configure here.
Satisfy tsc TS2352 for the missing networkImage mock return value. Co-authored-by: Cursor <cursoragent@cursor.com>
…geSource Keep BadgeNetwork name from useNetworkName without gating the image on Redux EVM network config. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #34307 +/- ##
=======================================
Coverage 85.08% 85.09%
=======================================
Files 6332 6332
Lines 172506 172517 +11
Branches 42652 42660 +8
=======================================
+ Hits 146784 146795 +11
+ Misses 15691 15686 -5
- Partials 10031 10036 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: Affected areas:
Risk assessment: Medium — these are UI component swaps that change the rendering implementation. While the visual output should be similar, the component API changes (props renamed: Not selected: SmokeAccounts (account management flows not directly affected), SmokeNetworkAbstractions (network manager UI not changed), SmokeNetworkExpansion (Solana/multi-chain provider not changed), SmokeMoney (card/ramps not changed), SmokePerps (perps trading not changed), SmokeMultiChainAPI (CAIP-25 sessions not changed), SmokePredictions (prediction markets not changed), SmokeSeedlessOnboarding (social login not changed), SmokeBrowser (browser not changed), SmokeSnaps (snaps not changed), SmokeMMConnect (MM connect not changed). Performance Test Selection: |
|




Description
Component-library
Badge/BadgeWrapperare deprecated in favor of MMDS. Confirmation UIs still used the legacy network-badge pattern (BadgeVariant.Network+BadgePosition.BottomRight), which blocked cleanup and kept us on the old API.This PR migrates those call sites to
@metamask/design-system-react-nativeBadgeNetwork+BadgeWrapper(imageSource→src,badgeElement→badge,badgePosition→position). SharedAccountBase/AccountBalancebadgePropsnow take{ name?, src }instead of component-libraryBadgeProps, and callers (ApproveTransactionHeader,AddressFrom) are updated. Tests assert network badges viatestIDon real MMDS components (no Badge mocks).What changed:
AccountBasebadge rendering andbadgePropsshape; updatedApproveTransactionHeaderandAddressFromBadgeNetworkviatestIDBreaking change:
AccountBase/AccountBalancebadgePropsno longer accept component-libraryBadgeProps(variant,imageSource). Callers must pass{ name?: string; src?: ... }for MMDSBadgeNetwork.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/DSYS-985 https://consensyssoftware.atlassian.net/browse/DSYS-983
Manual testing steps
Unit tests:
Screenshots/Recordings
N/A — internal component migration; visual parity expected (network badge still bottom-right on the same avatars)
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Wide UI-only refactor across many confirmation entry points with a breaking AccountBase badgeProps API; behavior should stay visually the same but regressions are possible if network image gating differs from legacy Badge.
Overview
Replaces deprecated component-library Badge / BadgeWrapper network overlays in confirmation and account UI with
@metamask/design-system-react-nativeBadgeNetwork+BadgeWrapper(badgeElement→badge,badgePosition→position,imageSource→src).AccountBase/AccountBalancenow takebadgeProps: { name?, src }instead ofBadgeProps;AccountBaseonly renders the network badge whensrcis set. CallersAddressFrom,ApproveTransactionHeader, and related flows pass the new shape.Confirmation surfaces updated include hero token/NFT, send token/NFT rows, token icon, gas fee token icon, token conversion header, transaction details account row, legacy
AddressElement, andAddressFrom. Most sites gate the badge on a present network image (previously some could render with undefined sources). Staking network row swapsBadgeforAvatarNetworkwith layout tweaks.Tests assert MMDS badges via dedicated **
testID**s and add coverage for missing network image /showNetwork: falsewhere applicable.Reviewed by Cursor Bugbot for commit 1174f77. Bugbot is set up for automated code reviews on this repo. Configure here.