Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ linkStyle default opacity:0.5
assets_controllers --> polling_controller;
assets_controllers --> preferences_controller;
assets_controllers --> profile_sync_controller;
assets_controllers --> remote_feature_flag_controller;
assets_controllers --> storage_service;
assets_controllers --> transaction_controller;
authenticated_user_storage --> base_data_service;
Expand Down
2 changes: 2 additions & 0 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **BREAKING:** `DeFiPositionsControllerV2.fetchDeFiPositions` now polls while any selected account has `processingDefiPositions: true`, updating state only when every account is ready, invalidating the balances cache between attempts, sharing one in-flight promise per selected-account + `vsCurrency` key (so fast switches can join an earlier matching poll), and stopping on request failure or the max attempt limit ([#9711](https://github.com/MetaMask/core/pull/9711))
- Clients must allow and delegate `RemoteFeatureFlagController:getState` on the `DeFiPositionsControllerV2` messenger.
- Bump `@metamask/transaction-controller` from `^69.4.0` to `^69.5.0` ([#9780](https://github.com/MetaMask/core/pull/9780))

## [110.1.1]
Expand Down
1 change: 1 addition & 0 deletions packages/assets-controllers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"@metamask/polling-controller": "^16.0.9",
"@metamask/preferences-controller": "^23.1.0",
"@metamask/profile-sync-controller": "^29.0.0",
"@metamask/remote-feature-flag-controller": "^5.0.0",
"@metamask/rpc-errors": "^7.0.2",
"@metamask/snaps-controllers": "^19.0.0",
"@metamask/snaps-sdk": "^11.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,30 @@
import type { DeFiPositionsControllerV2 } from './DeFiPositionsControllerV2.js';

/**
* Fetches DeFi positions for the selected account group. Each account key in
* a ready response replaces that account's state (other accounts stay).
* Accounts still indexing (`processingDefiPositions`) are skipped so prior
* state is kept for them. No-ops when disabled or when the group has no
* Fetches DeFi positions for the selected account group. State is updated only
* when every selected account in the response is ready (none report
* `processingDefiPositions`); each account key in that response replaces that
* account's state (other accounts stay). While any account is still indexing,
* prior state is kept and the method polls (invalidating the balances cache
* between attempts) until all selected accounts are ready, the attempt limit
* is reached, or a request fails. Concurrent calls for the same selected
* accounts and `vsCurrency` share one in-flight promise; calls for a different
* selection or fiat currency start a new fetch and leave prior polls running
* so a later switch back can join them. When a successful ready response
* required more than one attempt, or when polling hits the attempt limit
* while still processing, reports to Sentry via `messenger.captureException`
* (error names `DeFiPositionsV2FetchAttempts` /
* `DeFiPositionsV2ProcessingPollExhausted`) so poll limits can be tuned.
* No-ops when disabled or when the group has no
* supported accounts. Caching / spam prevention is handled by the apiClient
* TanStack Query cache (keyed by accounts + query options including
* `vsCurrency`). Pass `{ forceRefresh: true }` to bypass the cache (e.g.
* pull-to-refresh).
* `vsCurrency`). Pass `{ forceRefresh: true }` to bypass the cache on the
* first attempt (e.g. pull-to-refresh).
*
* @param options - Optional fetch modifiers.
* @param options.forceRefresh - When true, bypass the apiClient cache and
* fetch immediately.
* @param options.forceRefresh - When true, bypass the apiClient cache on the
* first attempt and fetch immediately.
* @returns Resolves when the fetch (and any processing polls) finish.
*/
export type DeFiPositionsControllerV2FetchDeFiPositionsAction = {
type: `DeFiPositionsControllerV2:fetchDeFiPositions`;
Expand Down
Loading