-
Notifications
You must be signed in to change notification settings - Fork 5.2k
feat: add setting to dismiss prompt to enable smart contract #31609
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
Conversation
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. |
Builds ready [2bed795]
UI Startup Metrics (1213 ± 58 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [bb98225]
UI Startup Metrics (1240 ± 66 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
|
||
if (!isUpgradeTransaction) { | ||
if (!isUpgradeTransaction || dismissSmartAccountSuggestionEnabled) { |
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.
Unfortunately we can't just hide the acknowledge checkbox as the transaction would still perform the upgrade once approved.
If we instead check this here:
Then the middleware would reject the request outright since the user has said they never want to upgrade.
Plus technically we should also check if the user is already upgraded and skip this check, but that can be done in a separate ticket as I have pending changes in the transaction controller to get that information.
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.
oh my bad, I fixed this
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.
Let me create task for
Plus technically we should also check if the user is already upgraded and skip this check, but that can be done in a separate ticket as I have pending changes in the transaction controller to get that information.
@@ -200,6 +201,7 @@ export const getDefaultPreferencesControllerState = | |||
showMultiRpcModal: false, | |||
privacyMode: false, | |||
shouldShowAggregatedBalancePopover: true, // by default user should see popover; | |||
dismissSmartAccountSuggestionEnabled: false, |
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.
We already have the accountUpgradeDisabledChains
also, should this be combined into that?
Do we also want to display those in the settings UI?
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.
yep I was also thinking about re-using this - and I think this will be more a user level thing and not account level, additionally it will reflect across the app
ui/selectors/selectors.js
Outdated
@@ -1998,6 +1998,11 @@ export function getShouldShowAggregatedBalancePopover(state) { | |||
return shouldShowAggregatedBalancePopover; | |||
} | |||
|
|||
export function getDismissSmartAccountSuggestionEnabled(state) { |
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.
Should we use ui/pages/confirmations/selectors/preferences.ts
instead of adding to this huge file?
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.
fixed
Builds ready [33a4883]
UI Startup Metrics (1272 ± 63 ms)
|
function validateUserPreference(dismissSmartAccountSuggestionEnabled: boolean) { | ||
if (dismissSmartAccountSuggestionEnabled) { | ||
throw rpcErrors.transactionRejected( | ||
'User does not want to update account to smart account.', |
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.
Could we combine this with the above to use the same error, as they're ultimately both preferences to not upgrade?
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.
Message for both will be bit different, as other will be address level now and this is more user level thing.
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.
Even so, from the perspective of the dApp, it's simply not supported for that chain and account. Plus I think we want to stick with methodNotSupported
for now since the user hasn't technically rejected the transaction, but the act of upgrading.
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.
👍 I will implement code changes in following PR.
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.
I made these changes in PR while updating it to resolve conflicts
Builds ready [79078c5]
UI Startup Metrics (1246 ± 65 ms)
|
Description
We should add a toggle within Settings > Advanced to not be asked to update an account to a Smart Account again.
Related issues
Fixes: https://github.com/MetaMask/MetaMask-planning/issues/4559
Manual testing steps
"Switch to Smart Account" suggestion
Screenshots/Recordings
Pre-merge author checklist
Pre-merge reviewer checklist