-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Show Staked ETH position in mobile homepage along with other to…
…kens (#4879) ## Explanation **What is the current state of things and why does it need to change?** - Currently the `metamask-mobile` app using the `assets-controllers` to get information about account token balances. We need to be able to support getting a new type of asset on mainnet and holesky chains, _Staked Ethereum_, which is not a token but represents the amount of ETH staked using our products. **What is the solution your changes offer and how does it work?** - We update the `AssetContractController` with a new method, `getStakedBalanceForChain`, which gets staked ethereum balances per account from the Stakewise vault contract. We update the AccountTrackerController with options to `includeStakedAssets` and to add a `getStakedBalanceForChain` method. - We bind `AssetContractController.getStakedBalanceForChain` to `getStakedBalanceForChain` option property in `metamask-mobile` code and then set `includeStakingAssets` option to the boolean feature flag for ETH Staking on Mobile. - We use the AccountTrackerController state in mobile to update the account `balance` and now, if enabled the `stakedBalance` as well. **Are there any changes whose purpose might not obvious to those unfamiliar with the domain?** - We don't want to show `stakedBalance` if not on a supported network, and so return undefined vs defaulting to zero hex. If there is an error and we are on a supported network, we want to default to zero hex. **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?** - There is 1 package affected **If you had to upgrade a dependency, why did you do so?** - No need to update dependency ## References **Are there any issues that this pull request is tied to?** - Relates to https://consensyssoftware.atlassian.net/browse/STAKE-817 **Are there other links that reviewers should consult to understand these changes better?** - MetaMask/metamask-mobile#12146 PR to MM mobile with patched `[email protected]` **Are there client or consumer pull requests to adopt any breaking changes?** - No ## Changelog ### `@metamask/assets-controllers` **ADDED**: AssetsContractController.getStakedBalanceForChain method to get staked ethereum balance for an address **ADDED**: AccountTrackerController options `includeStakedEthereum` and `getStakedBalanceForChain` for turning on staked balance functionality and providing a method to do so ## 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 highlighted breaking changes using the "BREAKING" category above as appropriate - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
- Loading branch information
1 parent
951e026
commit f5ad522
Showing
6 changed files
with
686 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.