Skip to content

Commit

Permalink
feat: aggregated balance feature (#27097)
Browse files Browse the repository at this point in the history
## **Description**

- [x] Removes the primary currency from Settings => General

- [x] Removes usage of useNativeCurrencyAsPrimaryCurrency

- [x] Adds a new toggle in settings: "show native tokens as main
balance" which affects only the main coin overview.

- [x] When new setting is ON we will show to users the aggregated
balance of their tokens in Fiat, else we show the balance in crypto for
the native token.


## This final PR is the combination of the following PRs:

1- Removal of useNativeCurrencyAsPrimaryCurrency setting and adding the
new setting: #26870
2- Aggregated balance logic:
#27108
3- Aggregated balance UI:
#27161

[![Open in GitHub

Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/26870?quickstart=1)

## **Related issues**

Fixes:
https://github.com/orgs/MetaMask/projects/85/views/24?filterQuery=label%3A%22assets-aggregated%22
Figma:
https://www.figma.com/design/aMYisczaJyEsYl1TYdcPUL/Portfolio-View?node-id=4098-126568&node-type=instance&focus-id=4186-130770&m=dev

#27280

## **Manual testing steps**

1. Switch to Ethereum mainnet and go to home page
2. You should see the popover telling you about the new feature. You
should not be able to see the popover again once closed.
3. You should be able to see the aggregated balance in fiat of you
native token and imported ERC20 tokens
4. Go to settings; notice that there is no primary currency setting and
you should see the new setting.
5. Turn on "show native token as main balance" and go back to home page;
you should see your balance in crypto for the native token.
6. Switch to any testnet, exp (Sepolia), notice that you wont be able to
see aggregated balance unless you turn on the setting "Show conversion
on test networks" in settings => Advanced

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->


### **Before**


### **After**

https://github.com/user-attachments/assets/ddab8290-8f9f-4a27-8821-3f416ed35b53


## **Pre-merge author checklist**

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding

Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
  • Loading branch information
sahar-fehri authored Oct 2, 2024
1 parent eea557d commit d26968f
Show file tree
Hide file tree
Showing 189 changed files with 2,118 additions and 1,719 deletions.
2 changes: 1 addition & 1 deletion .storybook/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ const state = {
welcomeScreenSeen: false,
currentLocale: 'en',
preferences: {
useNativeCurrencyAsPrimaryCurrency: true,
showNativeTokenAsMainBalance: true,
},
incomingTransactionsPreferences: {
[CHAIN_IDS.MAINNET]: true,
Expand Down
13 changes: 0 additions & 13 deletions app/_locales/am/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/ar/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/bg/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions app/_locales/bn/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/ca/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions app/_locales/cs/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions app/_locales/da/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions app/_locales/de/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions app/_locales/el/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 11 additions & 17 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 0 additions & 16 deletions app/_locales/en_GB/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d26968f

Please sign in to comment.