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

chore(runway): cherry-pick fix: add nativeAsset key to staked ETH asset multichain #12930

Open
wants to merge 1 commit into
base: release/7.38.0
Choose a base branch
from

Conversation

runway-github[bot]
Copy link
Contributor

@runway-github runway-github bot commented Jan 10, 2025

Description

  1. What is the reason for the change?

There was a crash when clicking on the Staked Ethereum asset due to it
missing a key nativeAsset which is required in some component. This
was a regression from code refactoring.

Separately, there was a currency switching bug that was introduced with
the use of a different fiat conversion method. I have switched to a
method that does not throw error for currency switching and this has
been tested with Vince

Separately, there were some issues with the Token list asset balances
being slightly off. This was noticed when the balance we use for the
Asset Detail staked Ethereum asset showed up differently than in the
Token List. Some of this has been addressed, but there are still issues
that I've noticed where we lose precision when getting the fiat total of
a token asset or native asset. I left a comment in the code about this,
and maybe it could be revisited it later.

  1. What is the improvement/solution?

We added the nativeAsset key back to the staked ethereum asset

We added the weiToFiat method to replace the Intl.NumberFormat method

We removed precision loss from multichain.ts asset fiatBalance
calculations, however there is another place(s) where fiat balances are
recalculated again i.e.
deriveBalanceFromAssetMarketDetails.ts

Related issues

Fixes: #12680
Fixes: #12856
Closes: https://consensyssoftware.atlassian.net/browse/STAKE-912

Manual testing steps

Screenshots/Recordings

Before

After

Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2025-01-09.at.08.42.08.mp4
Simulator.Screen.Recording.-.iPhone.SE.3rd.generation.-.2025-01-09.at.08.47.45.mp4

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. 40a999c

…et multichain (#12851)

## **Description**

1. What is the reason for the change?

There was a crash when clicking on the Staked Ethereum asset due to it
missing a key `nativeAsset` which is required in some component. This
was a regression from code refactoring.

Separately, there was a currency switching bug that was introduced with
the use of a different fiat conversion method. I have switched to a
method that does not throw error for currency switching and this has
been tested with Vince

Separately, there were some issues with the Token list asset balances
being slightly off. This was noticed when the balance we use for the
Asset Detail staked Ethereum asset showed up differently than in the
Token List. Some of this has been addressed, but there are still issues
that I've noticed where we lose precision when getting the fiat total of
a token asset or native asset. I left a comment in the code about this,
and maybe it could be revisited it later.

2. What is the improvement/solution?

We added the `nativeAsset` key back to the staked ethereum asset

We added the weiToFiat method to replace the Intl.NumberFormat method 

We removed precision loss from multichain.ts asset fiatBalance
calculations, however there is another place(s) where fiat balances are
recalculated again i.e.
[deriveBalanceFromAssetMarketDetails.ts](https://github.com/MetaMask/metamask-mobile/pull/12851/files#diff-283c109c8093bbb5d8e06be79bcbeac928b8353633e55dc7944594a0e6888b49)

## **Related issues**

Fixes: #12680
Fixes: #12856
Closes: https://consensyssoftware.atlassian.net/browse/STAKE-912

## **Manual testing steps**

- Import the staking test wallet in MM
- Click on the staked ethereum asset
- The link should not crash the application more info here on testing
this #12680
- Currency switching should not crash the application more info here on
testing this #12856

## **Screenshots/Recordings**

### **Before**

### **After**


https://github.com/user-attachments/assets/c2525b70-8d04-4606-861b-3206ebd557f4


https://github.com/user-attachments/assets/a8c4010e-3589-4171-803a-4d07a962e6a6

## **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
- [ ] 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**

- [ ] 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.
@runway-github runway-github bot requested review from a team as code owners January 10, 2025 16:55
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.

Copy link
Contributor

github-actions bot commented Jan 10, 2025

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 002e75a
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/dde10024-8c7a-4294-8b89-55463448581b

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@sahar-fehri sahar-fehri added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Jan 10, 2025
@nickewansmith nickewansmith added Run Smoke E2E Triggers smoke e2e on Bitrise and removed Run Smoke E2E Triggers smoke e2e on Bitrise labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants