diff --git a/packages/assets-controllers/CHANGELOG.md b/packages/assets-controllers/CHANGELOG.md index e8542e647e9..c6fa58e7327 100644 --- a/packages/assets-controllers/CHANGELOG.md +++ b/packages/assets-controllers/CHANGELOG.md @@ -7,8 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Add `AssetsByAccountGroup` to list of exported types ([#6983](https://github.com/MetaMask/core/pull/6983)) + ### Changed +- `isNative` is inferred as `true` for all non-evm assets with slip44 as its asset namespace ([#6983](https://github.com/MetaMask/core/pull/6983)) - **BREAKING:** Modify DeFi position fetching behaviour ([#6944](https://github.com/MetaMask/core/pull/6944)) - The fetch request to the API times out after 8 seconds and attempts a single retry - Refresh only updates the selected evm address diff --git a/packages/assets-controllers/src/index.ts b/packages/assets-controllers/src/index.ts index 22ed9936b6c..3b9cde2216f 100644 --- a/packages/assets-controllers/src/index.ts +++ b/packages/assets-controllers/src/index.ts @@ -224,6 +224,7 @@ export { calculateBalanceChangeForAccountGroup, } from './balances'; export type { + AssetsByAccountGroup, AccountGroupAssets, Asset, AssetListState, diff --git a/packages/assets-controllers/src/selectors/token-selectors.ts b/packages/assets-controllers/src/selectors/token-selectors.ts index f72959eabc4..123c26bb027 100644 --- a/packages/assets-controllers/src/selectors/token-selectors.ts +++ b/packages/assets-controllers/src/selectors/token-selectors.ts @@ -20,7 +20,7 @@ import type { TokenBalancesControllerState } from '../TokenBalancesController'; import type { Token, TokenRatesControllerState } from '../TokenRatesController'; import type { TokensControllerState } from '../TokensController'; -type AssetsByAccountGroup = { +export type AssetsByAccountGroup = { [accountGroupId: AccountGroupId]: AccountGroupAssets; }; @@ -28,12 +28,6 @@ export type AccountGroupAssets = { [network: string]: Asset[]; }; -// If this gets out of hand with other chains, we should probably have a permanent object that defines them -const MULTICHAIN_NATIVE_ASSET_IDS = [ - `bip122:000000000019d6689c085ae165831e93/slip44:0`, - `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501`, -]; - type EvmAccountType = Extract; type MultichainAccountType = Exclude< InternalAccount['type'], @@ -401,7 +395,7 @@ const selectAllMultichainAssets = createAssetListSelector( groupChainAssets.push({ accountType: type as MultichainAccountType, assetId, - isNative: MULTICHAIN_NATIVE_ASSET_IDS.includes(assetId), + isNative: caipAsset.assetNamespace === 'slip44', image: assetMetadata.iconUrl, name: assetMetadata.name ?? assetMetadata.symbol ?? asset, symbol: assetMetadata.symbol ?? asset,