Skip to content
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

Toggle option to enable/disable balance and Token rate checking for using third-party API #16772

Merged
merged 59 commits into from
Jan 17, 2023

Conversation

NiranjanaBinoy
Copy link
Contributor

@NiranjanaBinoy NiranjanaBinoy commented Dec 2, 2022

Fixes #16724

Explanation

We have added a new toggle to the Privacy and Security tab to control the use of third-party APIs like coinGecko and CryptoCompare for balance and Token rate checking.

Screenshots/Screencaps

Before

Screenshot 2022-12-07 at 6 00 34 PM

Screenshot 2022-12-07 at 6 00 57 PM

Screenshot 2022-12-07 at 6 01 47 PM

Screenshot 2022-12-07 at 6 02 09 PM

After

Screenshot 2022-12-07 at 5 59 02 PM

Screenshot 2022-12-07 at 5 58 28 PM

Screenshot 2022-12-07 at 5 59 31 PM

Screenshot 2022-12-07 at 5 59 52 PM

Manual Testing Steps

Onboard v1:

  1. Load the application and import a wallet.
  2. The fiat values should not be visible - in eth-overview, token overview, or in asset/token lists
  3. Try to send a token, and fiat values for gas or total should not be visible.
  4. Now go to settings, search for Show balance and token price checker in the security tab and toggle it ON.
  5. Now, come back to the overview page and make sure Fiat values are visible.
  6. Again, Toggle OFF and make sure the Fiat values disappear from everywhere.

Onboarding V2:

  1. Load the application and import a wallet.
  2. Enable the Show balance and token price checker from the Privacy settings.
  3. The app will display the fiat values.
  4. reload the application and import the wallet again.
  5. This time, without enabling Show balance and token price checker.
  6. the Fiat values should not e displayed.

Pre-merge author checklist

  • I've clearly explained:
    • What problem this PR is solving
    • How this problem was solved
    • How reviewers can test my changes
  • Sufficient automated test coverage has been added

Pre-merge reviewer checklist

  • Manual testing (e.g. pull and build branch, run in browser, test code being changed)
  • PR is linked to the appropriate GitHub issue
  • IF this PR fixes a bug in the release milestone, add this PR to the release milestone

If further QA is required (e.g. new feature, complex testing steps, large refactor), add the Extension QA Board label.

In this case, a QA Engineer approval will be be required.

@NiranjanaBinoy NiranjanaBinoy requested a review from a team as a code owner December 2, 2022 02:08
@NiranjanaBinoy NiranjanaBinoy self-assigned this Dec 2, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2022

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.

@danjm
Copy link
Contributor

danjm commented Dec 2, 2022

I think that with these modifications to this PR, we can greatly simplify the changes needed to controllers: https://github.com/MetaMask/metamask-extension/compare/optional-currency-conversion...optional-currency-conversion-alt?expand=1

I believe that with those changes, we will only need these changes to the controllers: https://github.com/MetaMask/controllers/compare/allow-disabled-config-tokenratescontroller?expand=1

@NiranjanaBinoy NiranjanaBinoy force-pushed the optional-currency-conversion branch from 5caf4c1 to 4ab6822 Compare December 2, 2022 18:32
@segun
Copy link
Contributor

segun commented Dec 4, 2022

Hi @NiranjanaBinoy I was also working on this issue as part of my PR that fixes this broader Security and Privacy settings page #16727 and this design

Can you confirm your PR is following this design as well

@danjm it seems there's some duplication of tasks here. For instance a PR already added this (merged to develop too recently).

Batch account balance requests
We batch accounts and query Infura to responsively show your balances. If you turn this off, only active accounts will be queried. Some dapps won't work unless you connect your wallet.

Which is part of the issue I'm working on as well.

Here's my PR that implemented the design.

As at the time I'm writing this, I have implemented everything according to that design except the last two. I hope to finish the designs today/tomorrow and then work on making sure the unit tests passed.

@NiranjanaBinoy
Copy link
Contributor Author

Hi @segun, Looks like we do have some overlapping. My PR will add the new toggle and the changes related to what the toggle will control. I think the work was broken down to add the new toggles as separate issues, and the purpose of this ticket was to reorganize the toggles based on the new design.

@danjm How should we proceed? For this PR, once we can merge and do a release on the asset-controller package, we can fix the errors and proceed with a detailed review.

@NiranjanaBinoy NiranjanaBinoy force-pushed the optional-currency-conversion branch from f6edf66 to 1d926f2 Compare December 7, 2022 17:54
@NiranjanaBinoy NiranjanaBinoy marked this pull request as ready for review December 7, 2022 22:39
@PeterYinusa PeterYinusa added this to the v10.24.0 milestone Dec 8, 2022
@NiranjanaBinoy NiranjanaBinoy force-pushed the optional-currency-conversion branch 2 times, most recently from 31f748c to 2d32f79 Compare December 8, 2022 20:08
@metamaskbot
Copy link
Collaborator

Builds ready [dca5b08]
Page Load Metrics (2283 ± 150 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1061105181213102
domContentLoaded171532342265313151
load178532342283313150
domInteractive171532342265313151
Bundle size diffs [🚀 Bundle size reduced!]
  • background: -7057 bytes
  • ui: 3523 bytes
  • common: 1188 bytes

highlights:

storybook

@NiranjanaBinoy NiranjanaBinoy requested a review from jpuri December 13, 2022 22:46
@NiranjanaBinoy NiranjanaBinoy force-pushed the optional-currency-conversion branch from a837517 to f27e156 Compare December 13, 2022 22:51
@NiranjanaBinoy
Copy link
Contributor Author

@seaona Nice catch; I have updated the changes for swaps now; kindly verify it.

@metamaskbot
Copy link
Collaborator

Builds ready [f037623]
Page Load Metrics (1303 ± 206 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint881840195378181
domContentLoaded105931331286432208
load105931331303429206
domInteractive105931331286432208
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 812 bytes
  • ui: 3687 bytes
  • common: -66821 bytes

highlights:

storybook

danjm
danjm previously approved these changes Jan 16, 2023
Copy link
Contributor

@danjm danjm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@metamaskbot
Copy link
Collaborator

Builds ready [5127185]
Page Load Metrics (1495 ± 168 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint981740216350168
domContentLoaded110328591492352169
load110328591495350168
domInteractive110328591492352169
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 812 bytes
  • ui: 3933 bytes
  • common: -66821 bytes

highlights:

storybook

@metamaskbot
Copy link
Collaborator

Builds ready [8b96364]
Page Load Metrics (2715 ± 416 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1261821810718345
domContentLoaded145140722700861413
load145142232715867416
domInteractive145140722700861413
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 812 bytes
  • ui: 4180 bytes
  • common: -66821 bytes

highlights:

storybook

@codecov-commenter
Copy link

Codecov Report

Merging #16772 (8b96364) into develop (89ea31c) will increase coverage by 0.02%.
The diff coverage is 77.46%.

@@             Coverage Diff             @@
##           develop   #16772      +/-   ##
===========================================
+ Coverage    59.67%   59.69%   +0.02%     
===========================================
  Files          937      937              
  Lines        36013    36082      +69     
  Branches      9232     9254      +22     
===========================================
+ Hits         21489    21537      +48     
- Misses       14524    14545      +21     
Impacted Files Coverage Δ
app/scripts/controllers/detect-tokens.js 92.44% <ø> (-0.06%) ⬇️
...saction-base/confirm-transaction-base.component.js 0.00% <0.00%> (ø)
...saction-base/confirm-transaction-base.container.js 0.00% <ø> (ø)
...es/settings/security-tab/security-tab.container.js 31.58% <0.00%> (-1.75%) ⬇️
ui/helpers/constants/settings.js 32.47% <33.33%> (+0.02%) ⬆️
ui/pages/send/gas-display/gas-display.js 76.92% <60.00%> (-1.41%) ⬇️
ui/store/actions.js 39.13% <62.50%> (+0.10%) ⬆️
...ken/detected-token-values/detected-token-values.js 83.33% <66.67%> (-4.17%) ⬇️
ui/pages/swaps/fee-card/fee-card.js 78.26% <66.67%> (-5.07%) ⬇️
...es/settings/security-tab/security-tab.component.js 60.40% <80.00%> (+1.02%) ⬆️
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@NiranjanaBinoy NiranjanaBinoy merged commit a0bb4a6 into develop Jan 17, 2023
@NiranjanaBinoy NiranjanaBinoy deleted the optional-currency-conversion branch January 17, 2023 15:23
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2023
@gauthierpetetin gauthierpetetin added the team-extension-ux DEPRECATED: please use "team-wallet-ux" label instead label Feb 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-privacy area-settings rc-cherry-picked team-extension-ux DEPRECATED: please use "team-wallet-ux" label instead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make currency conversion features optional / toggleable