fix: snap account card use account group name#39488
Conversation
|
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. |
Builds ready [3a3e29d]
UI Startup Metrics (1345 ± 109 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (3 files, +42 -144)
|
Builds ready [d8b282e]
UI Startup Metrics (1295 ± 114 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [f7acf6a]
UI Startup Metrics (1250 ± 107 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [2821921]
UI Startup Metrics (1343 ± 109 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
| snapId="npm:@metamask/test-snap-bip44" | ||
| snapName="BIP-44" | ||
| publicAddress="0xde939393DDe455081fFb3Dfd027E189919F04BD0" | ||
| onCancel={() => {}} |
There was a problem hiding this comment.
Using an address that's part of the default state (on the account-tree)
| snapId="npm:@metamask/snap-simple-keyring" | ||
| snapName="Test name" | ||
| publicAddress="0x64a845a5b02460acf8a3d84503b0d68d028b4bb4" | ||
| snapId="npm:@metamask/test-snap-bip44" |
There was a problem hiding this comment.
Using a true Snap ID that's part of the default state.
| }, | ||
| }, | ||
| tokenList: {}, | ||
| tokenBalances: testData.metamask.tokenBalances, |
There was a problem hiding this comment.
This was missing and his now required to properly display the aggregated balance (part of the new multichain account model)
| }, | ||
| args: { | ||
| publicAddress: '0x64a845a5b02460acf8a3d84503b0d68d028b4bb4', | ||
| publicAddress: '0xde939393DDe455081fFb3Dfd027E189919F04BD0', |
There was a problem hiding this comment.
Using an address that's part of the default state (on the account-tree)
| jest.mock('../../selectors/assets', () => ({ | ||
| ...jest.requireActual('../../selectors/assets'), | ||
| selectBalanceForAllWallets: () => mockBalanceForAllWallets, | ||
| })); |
There was a problem hiding this comment.
Test mock targets wrong selector and won't work
Low Severity
The test mocks selectBalanceForAllWallets but the SnapAccountCard component actually uses selectBalanceByAccountGroup. Additionally, jest.mock calls inside test functions don't work as intended—they need to be at the module level to properly intercept imports. The test passes coincidentally because it only checks if the balance element exists, not its actual value, making this test misleading about what it verifies.
Builds ready [5cef461]
UI Startup Metrics (1423 ± 88 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [27da64b]
UI Startup Metrics (1450 ± 111 ms)
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|


Description
Remove the dependency to
MultichainAccountListItem(since this is a state 1 component) + Re-using the proper components/style for theSnapAccountCard(displayed in the 3rd party Snap account creations).Changelog
CHANGELOG entry: Snap account creation now use account group names instead of old account names
Related issues
N/A
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Refactors the Snap account removal/creation card rendering and selector usage, which could affect displayed account name/balance and crash if expected account-group data is missing. Scope is limited to UI and story/test data updates.
Overview
Updates
SnapAccountCardto stop usingAccountListItemand instead render its own layout, showing the account group name (not the internal account name), checksum/shortened address, network indicator, snap labels, and a formatted group-level balance with privacy-mode hiding and loading skeleton.Adds Storybook coverage (
SnapAccountCardstories and updatedRemoveSnapAccount/confirmation stories) plus a new unit test forSnapAccountCard; updates snapshots/console baselines and Storybook test state to include a representative Snap keyring/account and token balances.Written by Cursor Bugbot for commit 27da64b. This will update automatically on new commits. Configure here.