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

feat: add rates controller #25314

Merged
merged 13 commits into from
Jun 20, 2024
Merged

feat: add rates controller #25314

merged 13 commits into from
Jun 20, 2024

Conversation

montelaidev
Copy link
Contributor

@montelaidev montelaidev commented Jun 14, 2024

Description

This PR adds the RatesController to query for multichain price conversion rates.

Related issues

Fixes https://github.com/MetaMask/accounts-planning/issues/483

Manual testing steps

This PR does not have any UI related changes, it adds new state instead by

  1. Start the extension.
  2. Wait 3 minutes
  3. Download the state log and see that state.metamask.rates is now populated with btc conversion rates.

Screenshots/Recordings

Not applicable

Pre-merge author checklist

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.

@montelaidev montelaidev self-assigned this Jun 14, 2024
Copy link
Contributor

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.

Copy link

codecov bot commented Jun 14, 2024

Codecov Report

Attention: Patch coverage is 69.56522% with 7 lines in your changes missing coverage. Please review.

Project coverage is 65.40%. Comparing base (da4b61c) to head (4c2aa8e).
Report is 10 commits behind head on develop.

Files Patch % Lines
app/scripts/metamask-controller.js 69.57% 7 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25314      +/-   ##
===========================================
+ Coverage    65.38%   65.40%   +0.01%     
===========================================
  Files         1382     1382              
  Lines        54767    54801      +34     
  Branches     14368    14378      +10     
===========================================
+ Hits         35809    35839      +30     
- Misses       18958    18962       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [d25cda2]
Page Load Metrics (168 ± 228 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint7014295189
domContentLoaded9251452
load412241168476228
domInteractive9251452
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 297 Bytes (0.01%)
  • ui: 0 Bytes (0.00%)
  • common: 63 Bytes (0.00%)

@montelaidev montelaidev marked this pull request as ready for review June 18, 2024 07:50
@montelaidev montelaidev requested a review from a team as a code owner June 18, 2024 07:50
ccharly
ccharly previously approved these changes Jun 18, 2024
Copy link
Contributor

@ccharly ccharly left a comment

Choose a reason for hiding this comment

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

LGTM.

NOTE: We do not start the controller polling on this PR, we talked about it together and we'll get this setup with incoming PR (like BalancesController one)

@metamaskbot
Copy link
Collaborator

Builds ready [bc9cc01]
Page Load Metrics (182 ± 249 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint73148101188
domContentLoaded10261452
load432444182519249
domInteractive10261452
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 297 Bytes (0.01%)
  • ui: 0 Bytes (0.00%)
  • common: 63 Bytes (0.00%)

k-g-j
k-g-j previously approved these changes Jun 18, 2024
Copy link
Contributor

@k-g-j k-g-j left a comment

Choose a reason for hiding this comment

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

The code looks good. I left two suggestions to clarify the test descriptions.

app/scripts/metamask-controller.test.js Outdated Show resolved Hide resolved
app/scripts/metamask-controller.test.js Outdated Show resolved Hide resolved
@metamaskbot
Copy link
Collaborator

Builds ready [99ee43c]
Page Load Metrics (162 ± 211 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint723641136833
domContentLoaded9221231
load422069162439211
domInteractive9221231
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 601 Bytes (0.02%)
  • ui: 0 Bytes (0.00%)
  • common: 63 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [a7e9c4c]
Page Load Metrics (52 ± 6 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6411882136
domContentLoaded9281252
load419052136
domInteractive9281252
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 601 Bytes (0.02%)
  • ui: 0 Bytes (0.00%)
  • common: 63 Bytes (0.00%)

@montelaidev montelaidev requested review from ccharly and k-g-j June 19, 2024 13:54
k-g-j
k-g-j previously approved these changes Jun 19, 2024
Copy link
Contributor

@k-g-j k-g-j 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 with the updates to the test descriptions!

app/scripts/metamask-controller.js Outdated Show resolved Hide resolved
app/scripts/metamask-controller.test.js Outdated Show resolved Hide resolved
app/scripts/metamask-controller.test.js Outdated Show resolved Hide resolved
app/scripts/metamask-controller.test.js Outdated Show resolved Hide resolved
app/scripts/metamask-controller.test.js Outdated Show resolved Hide resolved
@metamaskbot
Copy link
Collaborator

Builds ready [0ccb56c]
Page Load Metrics (53 ± 4 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint721078695
domContentLoaded9141111
load40755394
domInteractive9141111
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 681 Bytes (0.02%)
  • ui: 0 Bytes (0.00%)
  • common: 73 Bytes (0.00%)

gantunesr
gantunesr previously approved these changes Jun 20, 2024
app/scripts/metamask-controller.test.js Outdated Show resolved Hide resolved
app/scripts/metamask-controller.test.js Outdated Show resolved Hide resolved
app/scripts/metamask-controller.test.js Outdated Show resolved Hide resolved
app/scripts/metamask-controller.test.js Outdated Show resolved Hide resolved
@metamaskbot
Copy link
Collaborator

Builds ready [4c2aa8e]
Page Load Metrics (49 ± 4 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6810483105
domContentLoaded9191131
load40654984
domInteractive9191131
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 884 Bytes (0.02%)
  • ui: 0 Bytes (0.00%)
  • common: 73 Bytes (0.00%)

@ccharly ccharly merged commit b279386 into develop Jun 20, 2024
74 checks passed
@ccharly ccharly deleted the feat/add-rates-controller branch June 20, 2024 14:37
@github-actions github-actions bot locked and limited conversation to collaborators Jun 20, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-accounts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants