feat: BIP-44 support for EarnController#6402
Merged
ameliejyc merged 20 commits intoSep 3, 2025
Merged
Conversation
aa8c429 to
8facad0
Compare
8facad0 to
e821953
Compare
50f93e3 to
e821953
Compare
ac78790 to
839f91f
Compare
839f91f to
a0f3b9c
Compare
…ontroller:getAccountsFromSelectedAccountGroup
… AccountsController:selectedAccountChange
747c1cb to
f06fad2
Compare
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
7 tasks
nickewansmith
previously approved these changes
Sep 3, 2025
nickewansmith
left a comment
Contributor
There was a problem hiding this comment.
LGTM on mobile side
cryptodev-2s
reviewed
Sep 3, 2025
…roller-for-earn-experiences
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
cryptodev-2s
reviewed
Sep 3, 2025
mcmire
reviewed
Sep 3, 2025
cryptodev-2s
reviewed
Sep 3, 2025
nickewansmith
approved these changes
Sep 3, 2025
…roller-for-earn-experiences
github-merge-queue Bot
pushed a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Sep 4, 2025
## **Description** This PR integrates the [EarnController core updates for BIP-44](MetaMask/core#6402) in version 7.0.0. It also bumps the account-tree-controller package to the latest patch we need 0.12.1 - the accounts team is fine for us to go ahead with this and will do a full alignment on their side later in the week. ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: the mobile repo side of [this](https://consensyssoftware.atlassian.net/browse/TAT-1315) Accompanies [this](MetaMask/core#6402) PR ## **Manual testing steps** Test the following scenarios that ensure that eligibility, pooled stakes, lending positions, and earn transactions work as expected. ```gherkin Feature: EarnController BIP-44 updates Scenario: user sees Earn feature on fresh app install Given a user downloads the MM app for the first time When user lands on the homescreen Then they see an Earn button next to Ethereum that takes them to the Earn feature Scenario: user sees Earn feature on account import with existing positions Given a user is on the MM app When user imports an account with existing positions Then they see Earn buttons next to all relevant stablecoins or ETH And they see earn data when they click on the token Scenario: user can conduct Earn transactions using the correct selected account Given a user has selected an account and pressed Earn on a lendable token When user makes a deposit or withdrawal Then the transaction successfully completes and the metadata shows the same selected account ``` ## Screenshots/Recordings N/A ## **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 - [ ] 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.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
To remove our dependency on AccountsController and use the new BIP-44 enabled AccountTreeController, this PR contains two main changes:
AccountsController:selectedAccountChangeforAccountTreeController:selectedAccountGroupChangeAccountsController:getSelectedAccountforAccountTreeController:getAccountsFromSelectedAccountGroupfrom which we derive the EVM-compatible accountThis relies on the latest 0.12.1 release of the account-tree-controller package.
Small things of note:
getSelectedEvmAccount()function I initially handled the case of no account being found (which shouldn't be possible) by failing early with a 'No EVM-compatible account address found' error. But on seeing how this case is handled by consuming functions (sometimes returning early, sometimes returning empty objects, sometimes throwing error) I opted to keep it consistent with the current codeReferences
Fixes the core side of this issue: https://consensyssoftware.atlassian.net/browse/TAT-1315?atlOrigin=eyJpIjoiMmQ2MDY1ZjQ4MDU5NDdiYmJhMjRhYzNiMThhMjEwYzIiLCJwIjoiaiJ9
And should be tested alongside the accompanying mobile repo update: MetaMask/metamask-mobile#19160
Checklist