Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Bump `@metamask/network-enablement-controller` from `^5.2.0` to `^5.3.0` ([#9003](https://github.com/MetaMask/core/pull/9003))

### Deprecated

- Mark legacy assets controllers, their state types, and public methods as deprecated in favor of `AssetsController` from `@metamask/assets-controller`
- Affected controllers: `AccountTrackerController`, `CurrencyRateController`, `MultichainAssetsController`, `MultichainAssetsRatesController`, `MultichainBalancesController`, `RatesController`, `TokenBalancesController`, `TokenListController`, `TokenRatesController`, and `TokensController`.

## [108.5.0]

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type { AccountTrackerController } from './AccountTrackerController';

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Refreshes the balances of the accounts depending on the multi-account setting.
* If multi-account is disabled, only updates the selected account balance.
* If multi-account is enabled, updates balances for all accounts.
Expand All @@ -19,6 +20,7 @@ export type AccountTrackerControllerRefreshAction = {
};

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Sync accounts balances with some additional addresses.
*
* @param addresses - the additional addresses, may be hardware wallet addresses.
Expand All @@ -31,6 +33,7 @@ export type AccountTrackerControllerSyncBalanceWithAddressesAction = {
};

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Updates the balances of multiple native tokens in a single batch operation.
* This is more efficient than calling updateNativeToken multiple times as it
* triggers only one state update.
Expand All @@ -43,6 +46,7 @@ export type AccountTrackerControllerUpdateNativeBalancesAction = {
};

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Updates the staked balances of multiple accounts in a single batch operation.
* This is more efficient than updating staked balances individually as it
* triggers only one state update.
Expand Down
18 changes: 18 additions & 0 deletions packages/assets-controllers/src/AccountTrackerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
};

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* AccountTrackerControllerState
*
* Account tracker controller state
Expand All @@ -160,6 +161,7 @@
};

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* The action that can be performed to get the state of the {@link AccountTrackerController}.
*/
export type AccountTrackerControllerGetStateAction = ControllerGetStateAction<
Expand All @@ -168,13 +170,15 @@
>;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* The actions that can be performed using the {@link AccountTrackerController}.
*/
export type AccountTrackerControllerActions =
| AccountTrackerControllerGetStateAction
| AccountTrackerControllerMethodActions;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* The messenger of the {@link AccountTrackerController} for communication.
*/
export type AllowedActions =
Expand All @@ -191,6 +195,7 @@
| KeyringControllerGetStateAction;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* The event that {@link AccountTrackerController} can emit.
*/
export type AccountTrackerControllerStateChangeEvent =
Expand All @@ -200,12 +205,14 @@
>;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* The events that {@link AccountTrackerController} can emit.
*/
export type AccountTrackerControllerEvents =
AccountTrackerControllerStateChangeEvent;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* The external events available to the {@link AccountTrackerController}.
*/
export type AllowedEvents =
Expand All @@ -217,6 +224,7 @@
| KeyringControllerUnlockEvent;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* The messenger of the {@link AccountTrackerController}.
*/
export type AccountTrackerControllerMessenger = Messenger<
Expand All @@ -239,6 +247,7 @@
] as const;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Controller that tracks the network balances for all user accounts.
*/
export class AccountTrackerController extends StaticIntervalPollingController<AccountTrackerPollingInput>()<
Expand Down Expand Up @@ -422,6 +431,7 @@
}

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Whether the controller is active (keyring is unlocked and user is onboarded).
* When locked or not onboarded, balance updates should be skipped.
*
Expand Down Expand Up @@ -621,6 +631,7 @@
}

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Refreshes the balances of the accounts using the networkClientId
*
* @param input - The input for the poll.
Expand All @@ -637,6 +648,7 @@
}

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Refreshes the balances of the accounts depending on the multi-account setting.
* If multi-account is disabled, only updates the selected account balance.
* If multi-account is enabled, updates balances for all accounts.
Expand Down Expand Up @@ -666,6 +678,9 @@
});
}

/**

Check failure on line 681 in packages/assets-controllers/src/AccountTrackerController.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (lint:eslint)

Missing JSDoc @param "options0.addresses" declaration

Check failure on line 681 in packages/assets-controllers/src/AccountTrackerController.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (lint:eslint)

Missing JSDoc @param "options0.networkClientIds" declaration

Check failure on line 681 in packages/assets-controllers/src/AccountTrackerController.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test / Lint (lint:eslint)

Missing JSDoc @param "options0" declaration
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
*/
async refreshAddresses({
networkClientIds,
addresses,
Expand Down Expand Up @@ -869,6 +884,7 @@
}

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Sync accounts balances with some additional addresses.
*
* @param addresses - the additional addresses, may be hardware wallet addresses.
Expand Down Expand Up @@ -937,6 +953,7 @@
}

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Updates the balances of multiple native tokens in a single batch operation.
* This is more efficient than calling updateNativeToken multiple times as it
* triggers only one state update.
Expand Down Expand Up @@ -989,6 +1006,7 @@
}

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Updates the staked balances of multiple accounts in a single batch operation.
* This is more efficient than updating staked balances individually as it
* triggers only one state update.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type { CurrencyRateController } from './CurrencyRateController';

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Sets a currency to track.
*
* @param currentCurrency - ISO 4217 currency code.
Expand All @@ -16,6 +17,7 @@ export type CurrencyRateControllerSetCurrentCurrencyAction = {
};

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Updates the exchange rate for the current currency and native currency pairs.
*
* @param nativeCurrencies - The native currency symbols to fetch exchange rates for.
Expand Down
21 changes: 21 additions & 0 deletions packages/assets-controllers/src/CurrencyRateController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type { AbstractTokenPricesService } from './token-prices-service/abstract
import { getNativeTokenAddress } from './token-prices-service/codefi-v2';

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* currencyRates - Object keyed by native currency
*
* currencyRates.conversionDate - Timestamp of conversion rate expressed in ms since UNIX epoch
Expand Down Expand Up @@ -51,18 +52,30 @@ const MESSENGER_EXPOSED_METHODS = [
'updateExchangeRate',
] as const;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
*/
export type CurrencyRateStateChange = ControllerStateChangeEvent<
typeof name,
CurrencyRateState
>;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
*/
export type CurrencyRateControllerEvents = CurrencyRateStateChange;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
*/
export type CurrencyRateControllerGetStateAction = ControllerGetStateAction<
typeof name,
CurrencyRateState
>;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
*/
export type CurrencyRateControllerActions =
| CurrencyRateControllerGetStateAction
| CurrencyRateControllerMethodActions;
Expand All @@ -71,6 +84,9 @@ type AllowedActions =
| NetworkControllerGetNetworkClientByIdAction
| NetworkControllerGetStateAction;

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
*/
export type CurrencyRateMessenger = Messenger<
typeof name,
CurrencyRateControllerActions | AllowedActions,
Expand Down Expand Up @@ -124,6 +140,7 @@ type FetchRatesResult = {
};

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Controller that passively polls on a set interval for an exchange rate from the current network
* asset to the user's preferred currency.
*/
Expand Down Expand Up @@ -184,6 +201,7 @@ export class CurrencyRateController extends StaticIntervalPollingController<Curr
}

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Sets a currency to track.
*
* @param currentCurrency - ISO 4217 currency code.
Expand Down Expand Up @@ -425,6 +443,7 @@ export class CurrencyRateController extends StaticIntervalPollingController<Curr
}

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Updates the exchange rate for the current currency and native currency pairs.
*
* @param nativeCurrencies - The native currency symbols to fetch exchange rates for.
Expand Down Expand Up @@ -473,6 +492,7 @@ export class CurrencyRateController extends StaticIntervalPollingController<Curr
}

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Prepare to discard this controller.
*
* This stops any active polling.
Expand All @@ -483,6 +503,7 @@ export class CurrencyRateController extends StaticIntervalPollingController<Curr
}

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Updates exchange rate for the current currency.
*
* @param input - The input for the poll.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import type { MultichainAssetsController } from './MultichainAssetsController';

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Returns the metadata for the given asset
*
* @param asset - The asset to get metadata for
Expand All @@ -17,6 +18,7 @@ export type MultichainAssetsControllerGetAssetMetadataAction = {
};

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Ignores a batch of assets for a specific account.
*
* @param assetsToIgnore - Array of asset IDs to ignore.
Expand All @@ -28,6 +30,7 @@ export type MultichainAssetsControllerIgnoreAssetsAction = {
};

/**
* @deprecated This is deprecated and will be removed in a future version. Use `AssetsController` from `@metamask/assets-controller` instead.
* Adds multiple assets to the stored asset list for a specific account.
* All assets must belong to the same chain.
*
Expand Down
Loading
Loading