-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add PooledStaking slice for managing staking state (#12363)
## **Description** This PR refactors the staking-related state management by introducing a staking redux slice. This change improves state management consistency, reduces duplicate state, and makes the data flow more predictable across the staking feature. - Created new `PooledStaking` slice to manage staking-related state - Refactored hooks to use Redux store instead of local state: - `usePooledStakes` - `useStakingEligibility` - `useVaultData` - `useStakingEarnings` - Moved `hasStakedPositions` from `usePooledStakes` to `useStakingEarnings` to avoid prop drilling - Updated tests to reflect new state management pattern ## **Related issues** Fixes: [STAKE-870](https://consensyssoftware.atlassian.net/browse/STAKE-870) ## **Manual testing steps** 1. Perform an unstake transaction 2. Navigate to Eth details page while the transaction is still processing 3. You will now see the unstaking banner pop up when transaction is completed without navigating away and coming back to the details page ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/cbdfad52-58ae-4396-a214-0c793eb49f7c ### **After** https://github.com/user-attachments/assets/d064012f-32c3-41a3-8537-4593b6e409af ## **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** - [ ] 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. + [STAKE-870]: https://consensyssoftware.atlassian.net/browse/STAKE-870?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
Showing
10 changed files
with
328 additions
and
142 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
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
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
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
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.