-
Notifications
You must be signed in to change notification settings - Fork 5.4k
feat: add labels for btc assets #36574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
| <Box flexDirection={BoxFlexDirection.Row} gap={2}> | ||
| <AssetCellTitle title={token.title} /> | ||
| {label && <Tag label={label} />} | ||
| </Box> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrapping them in its own box because I don't want the stakeable link to look weird, as that one instead of a gap uses a character separator.
✨ Files requiring CODEOWNER review ✨💎 @MetaMask/metamask-assets (4 files, +190 -10)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I asked cursor to write the tests without a lot of hope, but I have to say I'm impressed with it suggesting to mock every single internal component that is a dependency whilst adding the fields passed as data. It makes it extremely easy to test whether they've been rendered without having to dig in their implementation.
I still had to make additional changes, but this was a huge win. A truly react component unit test.
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [0e863ab]
UI Startup Metrics (1230 ± 61 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
| isStakeable?: boolean; | ||
| title: string; | ||
| // TODO BIP44: This will not need to be optional once BIP44 is enabled | ||
| accountType?: KeyringAccountType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have tickets to do this.
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [27ea2a2]
UI Startup Metrics (1240 ± 72 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Change field name so that we can easily use the new selector result without doing a cumbersome mapping, as it currently clashes with a field on an interface that uses the same name. Preview PRs for [extension](MetaMask/metamask-extension#36574) and [mobile](MetaMask/metamask-mobile#20859). ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [X] I've updated the test suite for new or updated code as appropriate - [X] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [X] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [X] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Renames the token selector result field from `type` to `accountType` across selectors and tests, and documents it as a breaking change. > > - **Selectors (`src/selectors/token-selectors.ts`)**: > - Rename `Asset` field `type` → `accountType` and update all constructed asset objects accordingly (`EVM` and multichain paths). > - **Tests (`src/selectors/token-selectors.test.ts`)**: > - Update expectations to use `accountType` instead of `type`. > - **Changelog**: > - Add Unreleased entry marking the rename as **BREAKING**. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 44207a4. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> Assets controllers release. Preview PRs for extension MetaMask/metamask-extension#36574 and mobile MetaMask/metamask-mobile#20859. ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Releases assets-controllers v79 with a breaking token-selector rename, bumps bridge packages to v49 with updated peer deps and adds optional Client-Version header, and updates root/yarn versions. > > - **Packages**: > - **assets-controllers `v79.0.0` (BREAKING)**: > - Rename token-selector field `type` -> `accountType`. > - Update changelog links. > - **bridge-controller `v49.0.0`**: > - Bump peer/dev deps to `@metamask/assets-controllers@^79.0.0` (BREAKING peer update). > - Add optional `Client-Version` header to API requests. > - **bridge-status-controller `v49.0.0`**: > - Bump peer/dev deps to `@metamask/bridge-controller@^49.0.0` (BREAKING peer update). > - **Repo**: > - Bump root version to `608.0.0`; update `yarn.lock`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ca75c5f. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [ea0a2a4]
UI Startup Metrics (1230 ± 62 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
971228c to
7611d8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: TokenCellTitle Memoization Incomplete
The React.memo comparison for TokenCellTitle only checks token.title. The component's rendering, however, also depends on token.accountType for the BTC account type label, and token.isStakeable, token.chainId, token.symbol for the stakeable link. If these properties change without token.title updating, the component won't re-render, leading to stale UI.
ui/components/app/assets/token-cell/cells/token-cell-title.tsx#L36-L37
metamask-extension/ui/components/app/assets/token-cell/cells/token-cell-title.tsx
Lines 36 to 37 in e443a3f
| }, | |
| (prevProps, nextProps) => prevProps.token.title === nextProps.token.title, // Only rerender if the title changes |
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [e443a3f]
UI Startup Metrics (1215 ± 57 ms)
|
Description
Adds labels to BTC assets in the Tokens tab.
Changelog
CHANGELOG entry: Added new label to BTC assets in the Tokens tab
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1364
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Adds account-type tags (Legacy/Nested SegWit/Native SegWit/Taproot) to BTC assets and updates token title layout, with tests and a minor dependency bump.
TokenCellTitle: Show account-type tag based ontoken.accountType(Legacy,Nested SegWit,Native SegWit,Taproot), keepStakeableLinkwhenisStakeable.accountType: KeyringAccountTypetoTokenWithFiatAmount(ui/components/app/assets/types.ts).token-cell-title.test.tsxcovering title, tags per BTC type, andStakeableLinkvisibility.@metamask/assets-controllersto79.0.0(patch).Written by Cursor Bugbot for commit e443a3f. This will update automatically on new commits. Configure here.