Skip to content
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

refactor: asset-list and token-list #29886

Merged
merged 26 commits into from
Feb 7, 2025

Conversation

gambinish
Copy link
Contributor

@gambinish gambinish commented Jan 23, 2025

Description

This is the first of a series of PRs that aim to address two things:

  1. Simplify/fix some technical debt accrued during PortfolioView sprints
  2. Prepare AssetList for chain agnostic tokens (removal of EVM specific conventions)

This PR aims to simplify asset-list and token-list components. The next PR will simplify token-cell and token-list-item

  • Refactor consolidateTokenBalances into a redux selector getTokenBalancesEvm. Eventually (soon) this will be wrapped in a more generic selector, that will understand how to select/calculate balances for tokens on different chains.

  • Add a app/assets/hooks directory to help clean up and extract business logic away from the body of asset-list and token-list components and improve readability

  • Adds two utility files: calculateTokenBalance and calculateTokenFiatAmount (these are called from the selector file)

  • Adds a app/assets/types.ts file to consolidate all the types related to assets.

Open in GitHub Codespaces

Related issues

Manual testing steps

This PR should not break anything. It also should not introduce anything.

Screenshots/Recordings

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.

Copy link
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.

@metamaskbot
Copy link
Collaborator

Builds ready [439b107]
Page Load Metrics (1945 ± 100 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint49824251895377181
domContentLoaded15732364191920096
load162924151945209100
domInteractive26141533115
backgroundConnect1075292210
firstReactRender1796412613
getState589292512
initialActions01000
loadScripts10961758138616981
setupStore990282412
uiStartup181329452265257123
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 1.3 KiB (0.02%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [cbfd264]
Page Load Metrics (1620 ± 115 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint139025821624240115
domContentLoaded138225691599238114
load139025821620240115
domInteractive238939199
backgroundConnect892232311
firstReactRender1597452914
getState44611126
initialActions01000
loadScripts9451608112513565
setupStore785202411
uiStartup160628491873304146
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 1.3 KiB (0.02%)
  • common: 0 Bytes (0.00%)

@gambinish gambinish changed the title chore: Create consolidateTokenBalances utility function refactor: Chain agnostic token-list Feb 6, 2025
@gambinish gambinish changed the title refactor: Chain agnostic token-list refactor: asset-list and token-list Feb 6, 2025
@gambinish gambinish requested review from a team, HowardBraham and dbrans as code owners February 6, 2025 22:31
@gambinish gambinish requested a review from darkwing February 6, 2025 22:42
@metamaskbot
Copy link
Collaborator

Builds ready [78b2643]
Page Load Metrics (1675 ± 75 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint41421181618319153
domContentLoaded14402058165815775
load14482074167515675
domInteractive239139209
backgroundConnect95620136
firstReactRender15106412713
getState461222010
initialActions01000
loadScripts10291580120314067
setupStore75113126
uiStartup16042489192120699
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 1.01 KiB (0.01%)
  • common: 6.29 KiB (0.07%)

Copy link
Contributor

@vinnyhoward vinnyhoward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are absolutely killer refactors. Mobile sorely needs this type of love. LGTM!

Copy link
Contributor

@davidmurdoch davidmurdoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

circular dep changes are 👍 !

@gambinish gambinish enabled auto-merge February 7, 2025 18:38
@gambinish gambinish added this pull request to the merge queue Feb 7, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [3df8360]
Page Load Metrics (1712 ± 79 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint38221251646328158
domContentLoaded14542101168615876
load14652125171216579
domInteractive24114442412
backgroundConnect10119252613
firstReactRender16179473919
getState56015189
initialActions00000
loadScripts10241541122512761
setupStore880242311
uiStartup165327481997265127
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 1.01 KiB (0.01%)
  • common: 6.29 KiB (0.07%)

@metamaskbot
Copy link
Collaborator

Builds ready [3df8360]
Page Load Metrics (1712 ± 79 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint38221251646328158
domContentLoaded14542101168615876
load14652125171216579
domInteractive24114442412
backgroundConnect10119252613
firstReactRender16179473919
getState56015189
initialActions00000
loadScripts10241541122512761
setupStore880242311
uiStartup165327481997265127
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 0 Bytes (0.00%)
  • ui: 1.01 KiB (0.01%)
  • common: 6.29 KiB (0.07%)

Merged via the queue into main with commit 43efd3f Feb 7, 2025
111 checks passed
@gambinish gambinish deleted the refactor/mmassets-492_chain-agnostic-asset-list branch February 7, 2025 19:22
@github-actions github-actions bot locked and limited conversation to collaborators Feb 7, 2025
@metamaskbot metamaskbot added the release-12.13.0 Issue or pull request that will be included in release 12.13.0 label Feb 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.13.0 Issue or pull request that will be included in release 12.13.0 team-assets
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

9 participants