-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: Multichain account list balance #14278
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. |
55f44b0
to
63b88f3
Compare
82cb9be
to
add3081
Compare
## **Description** This PR provides a temporary fix for an issue where the Solana account balances appear as "0 ETH" in the account selector list. A proper fix that renders the correct Soalana fiat/token balance in this list is being worked on [here](#14278) but for the sake of speed and to unblock the RC 7.44.0, we are going to simply hide this incorrect value. This approach was disussed and confirmed with Rizivi this morning. The plan for this change to be cherry picked into rc 7.44.0 once it merges. ## **Related issues** Fixes: #14332 ## **Manual testing steps** 1. ensure you are building flask by verifying that your `.js.env` file contains `export METAMASK_BUILD_TYPE="flask"` 2. yarn setup && yarn start:ios 3. create or import a wallet 4. click on the account selector list 5. click on add account of hardware wallet 6. click on solana account 7. notice that there is no data at all in the right section of the account selector list 8. if you select the solana account, it should still render your balance in the main wallet page. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before**  ### **After** <image src="https://github.com/user-attachments/assets/e6214357-c1a0-4087-b051-ca7224b8d444" height="700" width="350" /> https://github.com/user-attachments/assets/513bd567-8473-47b3-9cdc-3f29ddd6d496 ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] 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.
8497609
to
06f9108
Compare
|
87f3d10
to
1cf5378
Compare
|
0d22750
to
232cf50
Compare
|
|
Description
This PR enables the account balances for non evm accounts (Solana) to be renders in the Account Selector List. This change was achieved by leveraging the existing logic in the
useMultichainBalances
hook which is already used in production to display both evm and non evm account balances for the selected account on the main wallet page. I had to expand this logic to not only derive the balance for the selected account on the selected chain but instead to derive the balances for all accounts. This way we can lookup theMultichainBalancesData
(defined in useMultichainBalances.types.ts) in a map where the key is the account ID. The key changes that enabled this change were the following...multichain.ts
selectMultichainNetworkAggregatedBalanceForAllAccounts
which, uses the same logic asselectSelectedAccountMultichainNetworkAggregatedBalance
except for all accounts and returns a map of account ids andMultichainNetworkAggregatedBalance
useMultichainBalances.ts
useAccounts.ts
getAccountBalances
util that I removed) in favour of the results from the useMultichainBalances hook.Engine.ts
getTotalFiatAccountBalance
togetTotalEvmFiatAccountBalance
getTotalEvmFiatAccountBalance
to take an optional InternalAccount param that allows this function to derive the evm balance for a specified account not just the currently selected accountgetTotalEvmFiatAccountBalance
to useTokenController.allTokens
instead ofTokenController.tokens
which is tied to the currently selected accountRelated issues
Fixes: https://github.com/MetaMask/accounts-planning/issues/697
Manual testing steps
Screenshots/Recordings
Before
ScreenRecording_04-02-2025.17-31-27_1.MP4
After
Pre-merge author checklist
Pre-merge reviewer checklist