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 new rates controller for non-EVM chains #4242

Merged
merged 78 commits into from May 22, 2024
Merged

Conversation

gantunesr
Copy link
Member

@gantunesr gantunesr commented May 1, 2024

Explanation

As part of the non-EVM initiative, there's a need to develop a new controller capable of fetching the rates for these blockchains. Currently, we can't rely on the CurrencyRatesController since it's dependent on the activity of the NetworkController, which is exclusively EVM oriented.

References

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

Changelog

@metamask/assets-controllers

  • ADDED: New RatesController to manage data related to rates for non-EVM blockchains
  • ADDED: New method to use the multi price endpoint from CryptoCompare

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@gantunesr
Copy link
Member Author

@metamaskbot publish-preview

Copy link
Contributor

github-actions bot commented May 1, 2024

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "14.0.0-preview-4a029d8",
  "@metamask-previews/address-book-controller": "4.0.1-preview-4a029d8",
  "@metamask-previews/announcement-controller": "6.1.0-preview-4a029d8",
  "@metamask-previews/approval-controller": "6.0.2-preview-4a029d8",
  "@metamask-previews/assets-controllers": "29.0.0-preview-4a029d8",
  "@metamask-previews/base-controller": "5.0.2-preview-4a029d8",
  "@metamask-previews/build-utils": "2.0.1-preview-4a029d8",
  "@metamask-previews/composable-controller": "6.0.1-preview-4a029d8",
  "@metamask-previews/controller-utils": "9.1.0-preview-4a029d8",
  "@metamask-previews/ens-controller": "10.0.1-preview-4a029d8",
  "@metamask-previews/eth-json-rpc-provider": "3.0.2-preview-4a029d8",
  "@metamask-previews/gas-fee-controller": "15.1.1-preview-4a029d8",
  "@metamask-previews/json-rpc-engine": "8.0.2-preview-4a029d8",
  "@metamask-previews/json-rpc-middleware-stream": "7.0.1-preview-4a029d8",
  "@metamask-previews/keyring-controller": "16.0.0-preview-4a029d8",
  "@metamask-previews/logging-controller": "3.0.1-preview-4a029d8",
  "@metamask-previews/message-manager": "8.0.2-preview-4a029d8",
  "@metamask-previews/name-controller": "6.0.1-preview-4a029d8",
  "@metamask-previews/network-controller": "18.1.0-preview-4a029d8",
  "@metamask-previews/notification-controller": "5.0.1-preview-4a029d8",
  "@metamask-previews/permission-controller": "9.0.2-preview-4a029d8",
  "@metamask-previews/permission-log-controller": "2.0.1-preview-4a029d8",
  "@metamask-previews/phishing-controller": "9.0.2-preview-4a029d8",
  "@metamask-previews/polling-controller": "6.0.2-preview-4a029d8",
  "@metamask-previews/preferences-controller": "11.0.0-preview-4a029d8",
  "@metamask-previews/queued-request-controller": "0.9.0-preview-4a029d8",
  "@metamask-previews/rate-limit-controller": "5.0.1-preview-4a029d8",
  "@metamask-previews/selected-network-controller": "12.0.1-preview-4a029d8",
  "@metamask-previews/signature-controller": "16.0.0-preview-4a029d8",
  "@metamask-previews/transaction-controller": "28.1.1-preview-4a029d8",
  "@metamask-previews/user-operation-controller": "9.0.0-preview-4a029d8"
}

@gantunesr
Copy link
Member Author

@metamaskbot publish-preview

@gantunesr gantunesr changed the title feat: rates [WIP] feat: Add new rates controller for non-EVM chains May 10, 2024
@gantunesr gantunesr self-assigned this May 10, 2024
@gantunesr gantunesr marked this pull request as ready for review May 10, 2024 12:58
@gantunesr gantunesr requested a review from a team as a code owner May 10, 2024 12:58
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Hello! I have done a single pass on this and made some suggestions on conventions. I will do another pass later thinking about tightening up the controller API and also diving more closely into JSDocs.

packages/assets-controllers/src/RatesController/types.ts Outdated Show resolved Hide resolved
packages/assets-controllers/src/RatesController/types.ts Outdated Show resolved Hide resolved
packages/assets-controllers/src/RatesController/types.ts Outdated Show resolved Hide resolved
packages/assets-controllers/src/RatesController/types.ts Outdated Show resolved Hide resolved
packages/assets-controllers/src/RatesController/types.ts Outdated Show resolved Hide resolved
gantunesr and others added 6 commits May 10, 2024 19:12
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
ccharly
ccharly previously approved these changes May 20, 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! (thanks for all those small changes)

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Just a few more suggestions, mostly more naming-related things. All comment are minor at this point, everything is looking a lot better now.

gantunesr and others added 3 commits May 22, 2024 11:26
Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
@gantunesr gantunesr merged commit 09b569b into main May 22, 2024
147 checks passed
@gantunesr gantunesr deleted the feat/nonevm-rates branch May 22, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants