Skip to content

feat: use the new onAssetsMarketData handler#6035

Merged
salimtb merged 17 commits intomainfrom
fix/use-onAssetsMarketData-handler
Jul 1, 2025
Merged

feat: use the new onAssetsMarketData handler#6035
salimtb merged 17 commits intomainfrom
fix/use-onAssetsMarketData-handler

Conversation

@salimtb
Copy link
Copy Markdown
Contributor

@salimtb salimtb commented Jun 25, 2025

feat: use the new onAssetsMarketData handler

Explanation

Current State and Problem

The MultichainAssetsRatesController currently uses the deprecated onAssetsConversion handler to fetch asset market data from Snaps. This handler interface is outdated and doesn't align with the current Snaps SDK architecture, which has evolved to provide better separation of concerns and more robust data handling.

Solution

This PR updates the MultichainAssetsRatesController to use the new onAssetsMarketData handler in addition of onAssetsConversion. This change:

  1. Improves handler interface: The new onAssetsMarketData handler provides a more standardized and reliable interface for fetching asset market data from Snaps
  2. Aligns with current SDK: Updates the controller to work with the latest Snaps SDK architecture
  3. Enhances maintainability: Uses the current best practices for Snaps integration

Dependency Updates

Alongside the main functional change, this PR also updates several Snaps-related dependencies across multiple packages to ensure compatibility and access to the latest features:

  • @metamask/snaps-sdk: ^7.1.0^9.0.0
  • @metamask/snaps-utils: ^9.4.0^11.0.0
  • @metamask/snaps-controllers: ^12.3.1^14.0.1

These updates are necessary because:

  • The new onAssetsMarketData handler is available in the updated SDK versions
  • The updated packages provide better performance and security improvements
  • Maintaining consistency across the codebase with the latest Snaps ecosystem

Package-Specific Changes

The changes affect multiple packages because they all depend on the Snaps ecosystem. Each package's changelog has been updated to reflect the specific dependency changes that apply to it, ensuring transparency for consumers.

References

  • Related to: Snaps SDK migration and handler interface improvements
  • Consumer impact: This change improves the reliability of asset market data fetching but maintains backward compatibility for the public API

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 communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note: All changelogs have been updated for the affected packages:

  • @metamask/assets-controllers
  • @metamask/account-tree-controller
  • @metamask/accounts-controller
  • @metamask/bridge-controller
  • @metamask/bridge-status-controller
  • @metamask/multichain-transactions-controller
  • @metamask/profile-sync-controller

@socket-security
Copy link
Copy Markdown

socket-security bot commented Jun 25, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​metamask/​snaps-utils@​11.0.0981007499100
Added@​metamask/​snaps-controllers@​14.0.1971007410050
Added@​metamask/​snaps-sdk@​9.0.09910076100100

View full report

@salimtb
Copy link
Copy Markdown
Contributor Author

salimtb commented Jun 25, 2025

@metamaskbot publish-preview

@github-actions
Copy link
Copy Markdown
Contributor

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

Expand for full list of packages and versions.
{
  "@metamask-previews/account-tree-controller": "0.4.0-preview-ee33e55",
  "@metamask-previews/accounts-controller": "31.0.0-preview-ee33e55",
  "@metamask-previews/address-book-controller": "6.1.0-preview-ee33e55",
  "@metamask-previews/announcement-controller": "7.0.3-preview-ee33e55",
  "@metamask-previews/app-metadata-controller": "1.0.0-preview-ee33e55",
  "@metamask-previews/approval-controller": "7.1.3-preview-ee33e55",
  "@metamask-previews/assets-controllers": "69.0.0-preview-ee33e55",
  "@metamask-previews/base-controller": "8.0.1-preview-ee33e55",
  "@metamask-previews/bridge-controller": "33.0.1-preview-ee33e55",
  "@metamask-previews/bridge-status-controller": "32.0.0-preview-ee33e55",
  "@metamask-previews/build-utils": "3.0.3-preview-ee33e55",
  "@metamask-previews/chain-agnostic-permission": "1.0.0-preview-ee33e55",
  "@metamask-previews/composable-controller": "11.0.0-preview-ee33e55",
  "@metamask-previews/controller-utils": "11.10.0-preview-ee33e55",
  "@metamask-previews/delegation-controller": "0.5.0-preview-ee33e55",
  "@metamask-previews/earn-controller": "2.0.0-preview-ee33e55",
  "@metamask-previews/eip1193-permission-middleware": "1.0.0-preview-ee33e55",
  "@metamask-previews/ens-controller": "17.0.0-preview-ee33e55",
  "@metamask-previews/error-reporting-service": "2.0.0-preview-ee33e55",
  "@metamask-previews/eth-json-rpc-provider": "4.1.8-preview-ee33e55",
  "@metamask-previews/foundryup": "1.0.0-preview-ee33e55",
  "@metamask-previews/gas-fee-controller": "24.0.0-preview-ee33e55",
  "@metamask-previews/json-rpc-engine": "10.0.3-preview-ee33e55",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.7-preview-ee33e55",
  "@metamask-previews/keyring-controller": "22.0.2-preview-ee33e55",
  "@metamask-previews/logging-controller": "6.0.4-preview-ee33e55",
  "@metamask-previews/message-manager": "12.0.1-preview-ee33e55",
  "@metamask-previews/multichain-api-middleware": "1.0.0-preview-ee33e55",
  "@metamask-previews/multichain-network-controller": "0.9.0-preview-ee33e55",
  "@metamask-previews/multichain-transactions-controller": "3.0.0-preview-ee33e55",
  "@metamask-previews/name-controller": "8.0.3-preview-ee33e55",
  "@metamask-previews/network-controller": "24.0.0-preview-ee33e55",
  "@metamask-previews/notification-services-controller": "12.0.0-preview-ee33e55",
  "@metamask-previews/permission-controller": "11.0.6-preview-ee33e55",
  "@metamask-previews/permission-log-controller": "3.0.3-preview-ee33e55",
  "@metamask-previews/phishing-controller": "12.6.0-preview-ee33e55",
  "@metamask-previews/polling-controller": "14.0.0-preview-ee33e55",
  "@metamask-previews/preferences-controller": "18.2.0-preview-ee33e55",
  "@metamask-previews/profile-sync-controller": "19.0.0-preview-ee33e55",
  "@metamask-previews/rate-limit-controller": "6.0.3-preview-ee33e55",
  "@metamask-previews/remote-feature-flag-controller": "1.6.0-preview-ee33e55",
  "@metamask-previews/sample-controllers": "1.0.0-preview-ee33e55",
  "@metamask-previews/seedless-onboarding-controller": "1.0.0-preview-ee33e55",
  "@metamask-previews/selected-network-controller": "23.0.0-preview-ee33e55",
  "@metamask-previews/signature-controller": "31.0.0-preview-ee33e55",
  "@metamask-previews/token-search-discovery-controller": "3.3.0-preview-ee33e55",
  "@metamask-previews/transaction-controller": "58.1.0-preview-ee33e55",
  "@metamask-previews/user-operation-controller": "37.0.0-preview-ee33e55"
}

@salimtb salimtb marked this pull request as ready for review June 26, 2025 09:06
@salimtb salimtb requested review from a team as code owners June 26, 2025 09:06
@salimtb salimtb marked this pull request as draft June 26, 2025 10:41
@salimtb salimtb marked this pull request as draft June 26, 2025 10:41
@salimtb salimtb marked this pull request as draft June 26, 2025 10:41
@salimtb salimtb marked this pull request as draft June 26, 2025 10:41
@salimtb salimtb force-pushed the fix/use-onAssetsMarketData-handler branch from ef20063 to 58d06fd Compare June 26, 2025 12:17
@salimtb salimtb force-pushed the fix/use-onAssetsMarketData-handler branch from f1867b7 to ba933d9 Compare June 26, 2025 12:54
@salimtb salimtb marked this pull request as ready for review June 26, 2025 12:54
@salimtb salimtb requested a review from GuillaumeRx June 26, 2025 12:56
Copy link
Copy Markdown
Contributor

@GuillaumeRx GuillaumeRx left a comment

Choose a reason for hiding this comment

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

Some small NITS otherwise LGTM ! Let's wait for the Snaps Platform release to merge.

GuillaumeRx
GuillaumeRx previously approved these changes Jun 30, 2025
gambinish
gambinish previously approved these changes Jun 30, 2025
cryptodev-2s
cryptodev-2s previously approved these changes Jun 30, 2025
Copy link
Copy Markdown
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

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

LGTM!

@salimtb salimtb dismissed stale reviews from cryptodev-2s, gambinish, and GuillaumeRx via a01473b July 1, 2025 09:59
@salimtb salimtb requested review from cryptodev-2s and mcmire July 1, 2025 10:00
cursor[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

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

LGTM!

@salimtb salimtb requested a review from GuillaumeRx July 1, 2025 10:06
cursor[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
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 for accounts owned file (changelogs + package.jsons). I haven't review the code/logic.

Copy link
Copy Markdown
Contributor

@mathieuartu mathieuartu left a comment

Choose a reason for hiding this comment

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

Owned files LGTM!

@GuillaumeRx GuillaumeRx removed their request for review July 1, 2025 13:08
@salimtb salimtb requested a review from gambinish July 1, 2025 13:53
@salimtb salimtb merged commit 31dabf2 into main Jul 1, 2025
213 checks passed
@salimtb salimtb deleted the fix/use-onAssetsMarketData-handler branch July 1, 2025 14:47
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Jul 8, 2025
## **Description**

This PR bumps:
- `@metamask/profile-sync-controller` to `^20.0.0`

Updates from the package changelog since `^18.0.0`:

```md
## [20.0.0]

### Added

- Add new `AuthenticationController:getUserProfileMetaMetrics` method ([#6068](MetaMask/core#6068))
  - This method fetches data using the Authentication API, returning all MetaMetrics sessions related to the currently authenticated user, in the form of `typeof UserProfileMetaMetrics`

### Changed

- **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` from `^12.0.0` to `^14.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-sdk` from `^7.1.0` to `^9.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-utils` from `^9.4.0` to `^11.0.0` ([#6035](MetaMask/core#6035))

## [19.0.0]

### Changed

- **BREAKING:** Bump peer dependency `@metamask/accounts-controller` to `^31.0.0` ([#5999](MetaMask/core#5999))
- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^24.0.0` ([#5999](MetaMask/core#5999))
```

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/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-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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: MetaMask Bot <metamaskbot@users.noreply.github.com>
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Jul 8, 2025
## **Description**

This PR bumps:
- `@metamask/profile-sync-controller` to `^20.0.0`

Updates from the package changelog since `^18.0.0`:

```md
## [20.0.0]

### Added

- Add new `AuthenticationController:getUserProfileMetaMetrics` method ([#6068](MetaMask/core#6068))
  - This method fetches data using the Authentication API, returning all MetaMetrics sessions related to the currently authenticated user, in the form of `typeof UserProfileMetaMetrics`

### Changed

- **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` from `^12.0.0` to `^14.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-sdk` from `^7.1.0` to `^9.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-utils` from `^9.4.0` to `^11.0.0` ([#6035](MetaMask/core#6035))

## [19.0.0]

### Changed

- **BREAKING:** Bump peer dependency `@metamask/accounts-controller` to `^31.0.0` ([#5999](MetaMask/core#5999))
- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^24.0.0` ([#5999](MetaMask/core#5999))
```

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
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**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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.
github-merge-queue bot pushed a commit to MetaMask/metamask-extension that referenced this pull request Jul 8, 2025
## **Description**

This PR bumps:
- `@metamask/profile-sync-controller` to `^20.0.0`

Updates from the package changelog since `^18.0.0`:

```md
## [20.0.0]

### Added

- Add new `AuthenticationController:getUserProfileMetaMetrics` method ([#6068](MetaMask/core#6068))
  - This method fetches data using the Authentication API, returning all MetaMetrics sessions related to the currently authenticated user, in the form of `typeof UserProfileMetaMetrics`

### Changed

- **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` from `^12.0.0` to `^14.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-sdk` from `^7.1.0` to `^9.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-utils` from `^9.4.0` to `^11.0.0` ([#6035](MetaMask/core#6035))

## [19.0.0]

### Changed

- **BREAKING:** Bump peer dependency `@metamask/accounts-controller` to `^31.0.0` ([#5999](MetaMask/core#5999))
- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^24.0.0` ([#5999](MetaMask/core#5999))
```

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry:

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/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-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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: MetaMask Bot <metamaskbot@users.noreply.github.com>
github-merge-queue bot pushed a commit to MetaMask/metamask-mobile that referenced this pull request Jul 8, 2025
## **Description**

This PR bumps:
- `@metamask/profile-sync-controller` to `^20.0.0`

Updates from the package changelog since `^18.0.0`:

```md
## [20.0.0]

### Added

- Add new `AuthenticationController:getUserProfileMetaMetrics` method ([#6068](MetaMask/core#6068))
  - This method fetches data using the Authentication API, returning all MetaMetrics sessions related to the currently authenticated user, in the form of `typeof UserProfileMetaMetrics`

### Changed

- **BREAKING:** Bump peer dependency `@metamask/snaps-controllers` from `^12.0.0` to `^14.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-sdk` from `^7.1.0` to `^9.0.0` ([#6035](MetaMask/core#6035))
- Bump `@metamask/snaps-utils` from `^9.4.0` to `^11.0.0` ([#6035](MetaMask/core#6035))

## [19.0.0]

### Changed

- **BREAKING:** Bump peer dependency `@metamask/accounts-controller` to `^31.0.0` ([#5999](MetaMask/core#5999))
- **BREAKING:** Bump peer dependency `@metamask/network-controller` to `^24.0.0` ([#5999](MetaMask/core#5999))
```

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
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**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants