-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
Feat/preferences controller smart tx opt in #3815
Feat/preferences controller smart tx opt in #3815
Conversation
5f7c06e
to
df58f16
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of optional suggestions, but this looks good!
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR only covers a smaller subset of the files from #9565 for ease of reviewing. Please refer to that issue for videos. This PR is mostly for Engine and the views for Smart Transactions (STX). Merging this PR will cause changes to the functionality and behavior of the app, effectively making the feature "live". It covers the following areas: 1. `app/components` 2. `app/core` 3. `app/reducers` 4. `app/selectors` 5. `app/util/test` 6. `patches` - `PreferencesController` ([PR here](MetaMask/core#3815) to apply update to `main`) - `SwapsController` ([PR here](MetaMask/swaps-controller#229) to apply updates to `main`) Also fixed an issue for network onboarding where it would never set onboarded to `true`. This needed to be fixed so we could properly show the STX Opt In Modal. We only show the Opt In modal if the user has onboarded onto the network, to prevent multiple modals from showing up at the same time. See discussion #9448 (comment) ## **Related issues** Fixes: n/a - Targeting: #9442 - Broken out from: #9565 ## **Manual testing steps** Refer to #9565 ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> Refer to #9565 ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask 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. --------- Co-authored-by: tommasini <[email protected]> Co-authored-by: Vinicius Stevam <[email protected]>
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR only covers a smaller subset of the files from #9565 for ease of reviewing. Please refer to that issue for videos. This PR is mostly for Engine and the views for Smart Transactions (STX). Merging this PR will cause changes to the functionality and behavior of the app, effectively making the feature "live". It covers the following areas: 1. `app/components` 2. `app/core` 3. `app/reducers` 4. `app/selectors` 5. `app/util/test` 6. `patches` - `PreferencesController` ([PR here](MetaMask/core#3815) to apply update to `main`) - `SwapsController` ([PR here](MetaMask/swaps-controller#229) to apply updates to `main`) Also fixed an issue for network onboarding where it would never set onboarded to `true`. This needed to be fixed so we could properly show the STX Opt In Modal. We only show the Opt In modal if the user has onboarded onto the network, to prevent multiple modals from showing up at the same time. See discussion #9448 (comment) ## **Related issues** Fixes: n/a - Targeting: #9442 - Broken out from: #9565 ## **Manual testing steps** Refer to #9565 ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> Refer to #9565 ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask 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. --------- Co-authored-by: tommasini <[email protected]> Co-authored-by: Vinicius Stevam <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Explanation
This PR introduces a new state property
smartTransactionsOptInStatus
to thePreferencesController
. This property allows the user to opt in or opt out of smart transactions.This is to match changes introduced by the patch in Mobile MetaMask/metamask-mobile#9448
Changes:
smartTransactionsOptInStatus
to thePreferencesController
state.smartTransactionsOptInStatus
to update thesmartTransactionsOptInStatus
state.PreferencesController
tests to include tests forsmartTransactionsOptInStatus
and to check the default state ofsmartTransactionsOptInStatus
.Test Plan:
PreferencesController
using the commandyarn workspace @metamask/preferences-controller run test
.References
Related to MetaMask/metamask-mobile#8337
Changelog
@metamask/preferences-controller
Checklist