Skip to content

Conversation

bergarces
Copy link
Contributor

@bergarces bergarces commented Oct 3, 2025

Description

Adds labels to BTC assets in the Tokens tab.

Open in GitHub Codespaces

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

  1. Open main wallet page with BTC enabled
  2. BTC native assets should have labels

Screenshots/Recordings

Before

image

After

image

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

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.

  • UI/Assets:
    • TokenCellTitle: Show account-type tag based on token.accountType (Legacy, Nested SegWit, Native SegWit, Taproot), keep StakeableLink when isStakeable.
    • Layout switched to design-system flex rows with gap; snapshots updated across token, asset, and DeFi views.
  • Types:
    • Add optional accountType: KeyringAccountType to TokenWithFiatAmount (ui/components/app/assets/types.ts).
  • Tests:
    • Add token-cell-title.test.tsx covering title, tags per BTC type, and StakeableLink visibility.
  • Dependencies:
    • Bump @metamask/assets-controllers to 79.0.0 (patch).

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

@bergarces bergarces requested a review from a team as a code owner October 3, 2025 16:25
@github-actions
Copy link
Contributor

github-actions bot commented Oct 3, 2025

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.

cursor[bot]

This comment was marked as outdated.

@github-actions github-actions bot added the size-M label Oct 3, 2025
cursor[bot]

This comment was marked as outdated.

<Box flexDirection={BoxFlexDirection.Row} gap={2}>
<AssetCellTitle title={token.title} />
{label && <Tag label={label} />}
</Box>
Copy link
Contributor Author

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.

@metamaskbot
Copy link
Collaborator

metamaskbot commented Oct 3, 2025

✨ Files requiring CODEOWNER review ✨

💎 @MetaMask/metamask-assets (4 files, +190 -10)
  • 📁 ui/
    • 📁 components/
      • 📁 app/
        • 📁 assets/
          • 📁 token-cell/
            • 📁 __snapshots__/
              • 📄 token-cell.test.tsx.snap +10 -6
            • 📁 cells/
              • 📄 token-cell-title.test.tsx +159 -0
              • 📄 token-cell-title.tsx +18 -4
            • 📄 types.ts +3 -0

Copy link
Contributor Author

@bergarces bergarces Oct 3, 2025

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.

@bergarces bergarces marked this pull request as draft October 7, 2025 14:13
@bergarces bergarces changed the title Add btc label tag feat: add btc label tag Oct 7, 2025
@bergarces bergarces changed the title feat: add btc label tag feat: add labels for btc assets Oct 7, 2025
@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: 0e863ab | Date: 10/8/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±70ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 734ms (±68ms) 🟢 | historical mean value: 735ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±11ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 70ms 1.01s 1.33s 1.25s 1.33s
domContentLoaded 734ms 68ms 699ms 1.01s 930ms 1.01s
firstPaint 77ms 11ms 60ms 168ms 88ms 168ms
firstContentfulPaint 77ms 11ms 60ms 168ms 88ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [0e863ab]
UI Startup Metrics (1230 ± 61 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1230108213486112841319
load106395311835611141151
domContentLoaded105794811755711081146
domInteractive1813138141740
firstPaint66876117943110661140
backgroundConnect2512382807255264
firstReactRender24184762537
getState1242961526
initialActions50355715
loadScripts81271393856863894
setupStore95254918
WebpackHomeuiStartup19001590232617320492235
load15601393185511116411793
domContentLoaded15451380183810916291768
domInteractive161272101446
firstPaint3066518244781941648
backgroundConnect341493154066
firstReactRender54192283160105
getState144148151422
initialActions30253310
loadScripts15411378183510816261756
setupStore145111121528
FirefoxBrowserifyHomeuiStartup13791208173011614531647
load1190105715039012551348
domContentLoaded1190105615029012551348
domInteractive1013329156105239
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect29197693344
firstReactRender28248772933
getState62939515
initialActions2032429
loadScripts1169103914788812311327
setupStore11413922663
WebpackHomeuiStartup15261344190811915851776
load1330119017349013841503
domContentLoaded1330118917349013831503
domInteractive973234852102178
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect3018118163346
firstReactRender332479123471
getState7211715514
initialActions4013014222
loadScripts1306116517168513511457
setupStore1148615757
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 362 Bytes (0.01%)
  • common: 10 Bytes (0%)

@bergarces bergarces marked this pull request as ready for review October 8, 2025 18:24
@socket-security
Copy link

socket-security bot commented Oct 8, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​assets-controllers@​78.0.0 ⏵ 79.0.09810091 +198 +1100

View full report

cursor[bot]

This comment was marked as outdated.

isStakeable?: boolean;
title: string;
// TODO BIP44: This will not need to be optional once BIP44 is enabled
accountType?: KeyringAccountType;
Copy link
Contributor Author

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.

@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: 27ea2a2 | Date: 10/8/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.08s (±78ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 757ms (±74ms) 🟢 | historical mean value: 736ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 81ms (±14ms) 🟢 | historical mean value: 79ms ⬆️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.08s 78ms 1.04s 1.39s 1.34s 1.39s
domContentLoaded 757ms 74ms 715ms 1.04s 1.02s 1.04s
firstPaint 81ms 14ms 64ms 212ms 92ms 212ms
firstContentfulPaint 81ms 14ms 64ms 212ms 92ms 212ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [27ea2a2]
UI Startup Metrics (1240 ± 72 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1240111514747212881383
load106995512556311131188
domContentLoaded106294912486410971182
domInteractive18135171738
firstPaint66783116142710811131
backgroundConnect25523728510258278
firstReactRender24164862638
getState1156281328
initialActions40385512
loadScripts81470299663852935
setupStore962441017
WebpackHomeuiStartup21231711254720022732445
load17201447207315518661999
domContentLoaded17031437206415718491992
domInteractive161191121447
firstPaint3865820205692071748
backgroundConnect47142734350192
firstReactRender73192745493221
getState2242633519111
initialActions40355310
loadScripts16991433206115718471990
setupStore205152202144
FirefoxBrowserifyHomeuiStartup14131197189512014731653
load1218104215639412821387
domContentLoaded1218104215639412821387
domInteractive101353455598237
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect3020167153445
firstReactRender29236762936
getState7317818613
initialActions30234213
loadScripts1197102615409312591363
setupStore946110740
WebpackHomeuiStartup15511335199512815981850
load13561191183710414001567
domContentLoaded13551189183710413991567
domInteractive100313716697328
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect331893143765
firstReactRender332578113569
getState9315918643
initialActions30607214
loadScripts13311175182110213781540
setupStore1039114744
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 15.95 KiB (0.35%)
  • ui: 376 Bytes (0.01%)
  • common: -16.06 KiB (-0.19%)

bergarces added a commit to MetaMask/core that referenced this pull request Oct 9, 2025
## 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 -->
@bergarces bergarces mentioned this pull request Oct 9, 2025
4 tasks
bergarces added a commit to MetaMask/core that referenced this pull request Oct 9, 2025
## 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 -->
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: ea0a2a4 | Date: 10/9/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.08s (±76ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 759ms (±86ms) 🟢 | historical mean value: 736ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 90ms (±128ms) 🟢 | historical mean value: 79ms ⬆️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.08s 76ms 1.03s 1.36s 1.32s 1.36s
domContentLoaded 759ms 86ms 717ms 1.30s 983ms 1.30s
firstPaint 90ms 128ms 60ms 1.36s 92ms 1.36s
firstContentfulPaint 90ms 128ms 60ms 1.36s 92ms 1.36s
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [ea0a2a4]
UI Startup Metrics (1230 ± 62 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1230110713896212771324
load106694911975911111162
domContentLoaded105791811906211011158
domInteractive17134771636
firstPaint68472119543310891160
backgroundConnect25724039921258275
firstReactRender23168982435
getState1152951322
initialActions40475411
loadScripts80966894260849905
setupStore85233916
WebpackHomeuiStartup18951584240317120182207
load15581397192711216101774
domContentLoaded15451389190811015971761
domInteractive1812102171456
firstPaint2095617513251921423
backgroundConnect3416134174064
firstReactRender5120211325999
getState144159161428
initialActions30294314
loadScripts15411387190511015931759
setupStore154141191532
FirefoxBrowserifyHomeuiStartup14341222195412114991656
load1233105914248112841381
domContentLoaded1232105814248112831380
domInteractive1063439358111255
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect3220110143459
firstReactRender29246253041
getState9318324512
initialActions30476210
loadScripts1208104114047912611350
setupStore10412317747
WebpackHomeuiStartup15161351197111015341748
load1329120117458313561494
domContentLoaded1329120117448313561494
domInteractive963235948101195
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect291970103454
firstReactRender322477113268
getState8211517639
initialActions409211212
loadScripts1306118517188013281468
setupStore944611743
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 376 Bytes (0.01%)
  • common: 38 Bytes (0%)

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a 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

},
(prevProps, nextProps) => prevProps.token.title === nextProps.token.title, // Only rerender if the title changes

Fix in Cursor Fix in Web


@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: e443a3f | Date: 10/9/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±70ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 730ms (±68ms) 🟢 | historical mean value: 734ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 75ms (±11ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 70ms 1.01s 1.31s 1.26s 1.31s
domContentLoaded 730ms 68ms 695ms 995ms 932ms 995ms
firstPaint 75ms 11ms 60ms 164ms 84ms 164ms
firstContentfulPaint 75ms 11ms 60ms 164ms 84ms 164ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [e443a3f]
UI Startup Metrics (1215 ± 57 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1215110713625712431338
load104995711885210771149
domContentLoaded104395211855210731144
domInteractive17145871739
firstPaint73485115440810691122
backgroundConnect2512382798255267
firstReactRender24166162535
getState1258181421
initialActions40325412
loadScripts79870594150827898
setupStore95264918
WebpackHomeuiStartup796684109166809924
load61756893564623765
domContentLoaded60956392763617756
domInteractive15116391343
firstPaint19853930201186594
backgroundConnect21125472431
firstReactRender24154772931
getState84193912
initialActions2013236
loadScripts60656191661615745
setupStore74132911
FirefoxBrowserifyHomeuiStartup14711281220114315211746
load1250111314578813151425
domContentLoaded1249111314578813141424
domInteractive993526654105251
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect302080103450
firstReactRender30256143236
getState10320425620
initialActions6013420222
loadScripts1227109614328612951398
setupStore12413618752
WebpackHomeuiStartup15661373206512716171825
load1363121317969813941513
domContentLoaded1362121217969813941513
domInteractive1023139668102341
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect301879113448
firstReactRender342682123675
getState8310713635
initialActions40619216
loadScripts1340119417619713761488
setupStore1045913747

@bergarces bergarces added this pull request to the merge queue Oct 9, 2025
Merged via the queue into main with commit c50627c Oct 9, 2025
170 checks passed
@bergarces bergarces deleted the add-btc-labels branch October 9, 2025 16:36
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2025
@metamaskbot metamaskbot added the release-13.6.0 Issue or pull request that will be included in release 13.6.0 label Oct 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.6.0 Issue or pull request that will be included in release 13.6.0 size-M team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants