Skip to content

Conversation

@bergarces
Copy link
Contributor

@bergarces bergarces commented Nov 18, 2025

Description

Upgrade assets-controllers to start using Price API v3 spot-prices endpoint.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1575

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

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.

Note

Upgrades assets-controllers to a preview build and updates code/tests to use TokenRatesController.updateExchangeRates, while narrowing the TokenRatesController messenger scope.

  • Core/Dependencies:
    • Upgrade @metamask/assets-controllers to preview version 89.0.1-preview-f83c2058 via npm alias in package.json and lockfile.
    • Token Rates messenger: restrict delegated actions to TokensController:getState, NetworkController:getState and events to TokensController:stateChange, NetworkController:stateChange in app/core/Engine/messengers/token-rates-controller-messenger.ts.
  • Token Rates API Migration:
    • Replace TokenRatesController.updateExchangeRatesByChainId with TokenRatesController.updateExchangeRates in tokenRefreshUtils.ts and related tests (Tokens, refreshEvmTokens, refreshTokens, tokenRefreshUtils, OnboardingSuccess).

Written by Cursor Bugbot for commit fd5a5c1. This will update automatically on new commits. Configure here.

@github-actions
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.

@bergarces bergarces changed the title upgrade preview package feat: price API v3 upgrade Nov 18, 2025
@bergarces bergarces requested review from a team as code owners November 18, 2025 17:07
@github-actions github-actions bot added size-S and removed size-XS labels Nov 18, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Test Mocks Out of Sync

The mock setup still defines updateExchangeRatesByChainId but the test expectations were changed to call updateExchangeRates. This mismatch causes tests to fail because the mock method name doesn't match what the implementation calls.

app/components/UI/Tokens/util/refreshEvmTokens.test.ts#L20-L21

TokenRatesController: {
updateExchangeRatesByChainId: jest.fn(),

Fix in Cursor Fix in Web


Bug: Mock method mismatch breaks tests.

The mock setup still defines updateExchangeRatesByChainId but the test expectations were changed to call updateExchangeRates. This mismatch causes tests to fail because the mock method name doesn't match what the implementation calls.

app/components/UI/Tokens/util/refreshTokens.test.ts#L20-L21

TokenRatesController: {
updateExchangeRatesByChainId: jest.fn(),

Fix in Cursor Fix in Web


Bug: Mock method mismatch breaks tests.

The mock setup still defines updateExchangeRatesByChainId but the test expectations were changed to call updateExchangeRates. This mismatch causes tests to fail because the mock method name doesn't match what the implementation calls.

app/components/UI/Tokens/util/tokenRefreshUtils.test.ts#L20-L21

TokenRatesController: {
updateExchangeRatesByChainId: jest.fn(() => Promise.resolve()),

Fix in Cursor Fix in Web


@bergarces bergarces requested a review from a team as a code owner November 19, 2025 20:17
@github-actions
Copy link
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAssets, SmokeWalletPlatform, SmokeCore, SmokeWalletUX
  • Risk Level: high
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

This PR involves significant changes to core wallet functionality around token rates and asset controllers:

  1. Critical Engine Changes: Modified token-rates-controller-messenger.ts (a critical Engine file) by removing AccountsController delegations. This simplifies the messenger but changes how the TokenRatesController interacts with the system.

  2. Preview Package Dependency: Upgraded @metamask/assets-controllers to a preview version, which typically contains new features or breaking changes that need thorough testing.

  3. API Rename: Changed updateExchangeRatesByChainId to updateExchangeRates across the codebase, suggesting a breaking change in the assets-controllers package.

  4. Wide Impact: Token rates affect multiple critical user flows:

    • Asset display and balances (SmokeAssets)
    • Token lists and portfolio views (SmokeWalletPlatform)
    • Onboarding success flows (SmokeWalletUX)
    • Core wallet infrastructure (SmokeCore)

Selected Tags:

  • SmokeAssets: Primary impact on asset management, token display, and pricing
  • SmokeWalletPlatform: Affects core wallet functionality and token display
  • SmokeCore: Engine messenger changes affect core infrastructure
  • SmokeWalletUX: Impacts user-facing elements like onboarding and token lists

Risk Level: HIGH because:

  • Changes to Engine core infrastructure (critical)
  • Preview package dependency (unstable)
  • Breaking API changes in a widely-used controller
  • Affects token pricing across the entire application

Confidence: 85% - I've thoroughly investigated the changes and their impact through code analysis. The changes are clearly related to asset management and token rates, but the preview package nature adds some uncertainty about what else might be affected.

View GitHub Actions results

@sonarqubecloud
Copy link

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.

3 participants