Skip to content

Commit

Permalink
chore: Update assets and accounts packages (MetaMask#12984)
Browse files Browse the repository at this point in the history
# **Description**

The primary purpose of this PR is to update the accounts controller and
the assets-controller to the latest version. In doing that, there were
several other package updates that were needed. Here is a summary of the
updates...


# 🔴  Major updates 🔴 

### "@metamask/accounts-controller": "^20.0.1" -> ^21.0.0
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/accounts-controller/CHANGELOG.md#2100)
- Breaking changes
- BREAKING: Add scopes field to KeyringAccount
(MetaMask/core#5066),
(MetaMask/core#5136)
This field is now required and will be used to identify the supported
chains (using CAIP-2 chain IDs) for every accounts.
- Changes
- Bump @metamask/base-controller from ^7.0.0 to ^7.1.1
(MetaMask/core#5079),
(MetaMask/core#5135)
- Bump @metamask/utils to ^11.0.1
(MetaMask/core#5080)
- Bump @metamask/rpc-errors to ^7.0.2
(MetaMask/core#5080)
- Use new @metamask/keyring-internal-api@^1.0.0
(MetaMask/core#4695)
This package has been split out from the Keyring API.
- Bump @metamask/keyring-api from ^10.1.0 to ^12.0.0
(MetaMask/core#4695)
- Bump @metamask/eth-snap-keyring from ^5.0.1 to ^7.0.0
(MetaMask/core#4695)
ESM/CommonJS support.

### "@metamask/assets-controllers": "^45.1.1", ->  ^46.0.0",
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/assets-controllers/CHANGELOG.md#4600)
- Breaking changes
- BREAKING: Bump @metamask/accounts-controller peer dependency from
^20.0.0 to ^21.0.0 (MetaMask/core#5140)
- Changes
- Remove use of @metamask/keyring-api
(MetaMask/core#4695)
@metamask/providers and webextension-polyfill peer dependencies are no
longer required.
- Use new @metamask/keyring-internal-api@^1.0.0
(MetaMask/core#4695)
This package has been split out from the Keyring API. Its types are
compatible with the @metamask/keyring-api package used previously.
- Bump @metamask/base-controller from ^7.0.0 to ^7.1.1
(MetaMask/core#5079),
(MetaMask/core#5135)
- Bump @metamask/keyring-api from ^12.0.0 to ^13.0.0
(MetaMask/core#5066)
- Bump @metamask/utils to ^11.0.1
(MetaMask/core#5080)
- Bump @metamask/rpc-errors to ^7.0.2
(MetaMask/core#5080)
- Added
- Add new MultichainBalancesController
(MetaMask/core#4965)
This controller has been migrated from the MetaMask extension codebase.

### "@metamask/utils": "^10.0.1" -> ^11.0.1"
-
[changelog](https://github.com/MetaMask/utils/blob/main/CHANGELOG.md#1101)
- breaking changes
- BREAKING: generateRandomMnemonic now returns Promise<void> instead of
void (MetaMask/utils#222)

### Added "@metamask/keyring-internal-api": "^2.0.0",
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-internal-api/CHANGELOG.md#200)
- This package was a peer dep on the latest accounts controller and
assets controller. Given this I figured we should add it now anyway.
- Changes needed
- update imports from `@metamask/keyring-api` to
`@metamask/keyring-internal-api`
   - add support for scopes in the InternalAccount object
- added migration (066.ts) to backfill the scopes to existing accounts.
- This change is based off a [similar change made in the
extension](MetaMask/metamask-extension#29195)
made by @ccharly

### Added @metamask/keyring-snap-client: "^2.0.0"
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-snap-client/CHANGELOG.md#200)
- Added because KeyringClient is now exported from
`@metamask/keyring-snap-client` instead of `@metamask/keyring-api'`. See
`app/components/Views/AddAccountActions/AddAccountActions.tsx` for
changes.

### "@metamask/keyring-api": "^10.1.0", -> ^13.0.0"
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-api/CHANGELOG.md#1300)
- Breaking changes
- BREAKING: Add scopes field to KeyringAccount
(MetaMask/accounts#101)
- BREAKING: Split into several smaller packages
(MetaMask/accounts#24)
        - This should improve dependencies management.
- Internal related types (internal to both clients) have been moved to
keyring-internal-* packages.
- Keyring API clients (mainly used by dapps) have been moved to
keyring-snap-client package.
        - Common utils have been moevd to keyring-utils package.

### "@metamask/eth-snap-keyring": "^5.0.1" -> ^7.0.0"
-
[changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-eth-simple/CHANGELOG.md#700)
- breaking changes
- BREAKING: Increase minimum Node.js version to 16
(MetaMask/eth-simple-keyring#152)
- BREAKING: Bump @metamask/eth-sig-util from ^6.0.1 to ^7.0.0
(MetaMask/eth-simple-keyring#156)
- Bump @metamask/utils from ^5.0.0 to ^8.1.0
(MetaMask/eth-simple-keyring#153)
- Bump ethereum-cryptography from ^1.2.0 to ^2.1.2
(MetaMask/eth-simple-keyring#153)
- BREAKING: Bump @metamask/eth-sig-util dependency from ^7.0.3 to ^8.0.0
(MetaMask/accounts#79)
- signTypedData no longer support number for addresses, see
[here](https://github.com/MetaMask/eth-sig-util/blob/main/CHANGELOG.md#800).

## 🟡 Minor updates 🟡 

### "@metamask/base-controller": "^7.0.1", -> ^7.1.1
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/base-controller/CHANGELOG.md#711)
- Changes
    -  Bump @metamask/utils from ^10.0.0 to ^11.0.1
- Rename ControllerMessenger to Messenger
(MetaMask/core#5050)
        - ControllerMessenger has been renamed to Messenger
- RestrictedControllerMessengerConstraint has been renamed to
RestrictedMessengerConstraint
- RestrictedControllerMessenger has been renamed to RestrictedMessenger
- The RestrictedMessenger constructor parameter controllerMessenger has
been renamed to messenger, though the old name is still accepted
- The old names remain exported as deprecated aliases of the new names,
so this is not a breaking change.

### "@metamask/providers": "^18.1.0" -> ^18.3.1"
-
[changelog](https://github.com/MetaMask/providers/blob/main/CHANGELOG.md#1831)
- Changes
- Bump @metamask/json-rpc-engine from ^10.0.1 to ^10.0.2
(MetaMask/providers#397)
- Bump @metamask/json-rpc-middleware-stream from ^8.0.5 to ^8.0.6
(MetaMask/providers#397)
- Bump @metamask/rpc-errors from ^7.0.1 to ^7.0.2
(MetaMask/providers#397)
- Bump @metamask/utils from ^10.0.0 to ^11.0.1
(MetaMask/providers#397)


## 🟢  Patch updates 🟢 

### "@metamask/json-rpc-engine": "^10.0.0" -> ^10.0.2",
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/json-rpc-engine/CHANGELOG.md#1002)

### "@metamask/json-rpc-middleware-stream": "^8.0.2" -> 8.0.6"
-
[changelog](https://github.com/MetaMask/core/blob/main/packages/json-rpc-middleware-stream/CHANGELOG.md#806)
- changed
- Bump @metamask/json-rpc-engine from ^10.0.1 to ^10.0.2
(MetaMask/core#5082)
- Bump @metamask/utils from ^10.0.0 to ^11.0.1
(MetaMask/core#5080)

### "@metamask/rpc-errors": "^7.0.1" -> ^7.0.2"
-
[changelog](https://github.com/MetaMask/rpc-errors/blob/main/CHANGELOG.md#702)
- changes
- Bump @metamask/utils from ^10.0.0 to ^11.0.1
(MetaMask/rpc-errors#166)


## **Related issues**

Fixes: MetaMask#12967
Fixes: MetaMask#12966

Fixes: MetaMask/accounts-planning#758

Unblocks: MetaMask#12599

## **Manual testing steps**

#### Basic import account flow with tokens


https://github.com/user-attachments/assets/1a8d3e59-34e4-413e-a3e8-7dbdc5f7424a



## **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**

- [ ] 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).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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**

- [ ] 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.
  • Loading branch information
owencraston authored Jan 16, 2025
1 parent f62e266 commit 4c43298
Show file tree
Hide file tree
Showing 36 changed files with 874 additions and 290 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';

interface SelectedAsset {
isETH: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { selectInternalAccounts } from '../../../selectors/accountsController';
import Cell, {
CellVariant,
} from '../../../component-library/components/Cells/Cell';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { useStyles } from '../../../component-library/hooks';
import { TextColor } from '../../../component-library/components/Texts/Text';
import SensitiveText, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import {
TotalFiatBalancesCrossChains,
useGetTotalFiatBalanceCrossChains,
} from '../../../../hooks/useGetTotalFiatBalanceCrossChains';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { getChainIdsToPoll } from '../../../../../selectors/tokensController';
import AggregatedPercentageCrossChains from '../../../../../component-library/components-temp/Price/AggregatedPercentage/AggregatedPercentageCrossChains';

Expand Down
6 changes: 4 additions & 2 deletions app/components/Views/AccountActions/AccountActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { useDispatch, useSelector } from 'react-redux';
import Share from 'react-native-share';

// External dependencies
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import BottomSheet, {
BottomSheetRef,
} from '../../../component-library/components/BottomSheets/BottomSheet';
Expand Down Expand Up @@ -397,7 +397,9 @@ const AccountActions = () => {
actionTitle={strings('accounts.remove_hardware_account')}
iconName={IconName.Close}
onPress={showRemoveHWAlert}
testID={AccountActionsBottomSheetSelectorsIDs.REMOVE_HARDWARE_ACCOUNT}
testID={
AccountActionsBottomSheetSelectorsIDs.REMOVE_HARDWARE_ACCOUNT
}
/>
)}
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useMetrics } from '../../../components/hooks/useMetrics';

///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
import { CaipChainId } from '@metamask/utils';
import { KeyringClient } from '@metamask/keyring-api';
import { KeyringClient } from '@metamask/keyring-snap-client';
import { BitcoinWalletSnapSender } from '../../../core/SnapKeyring/BitcoinWalletSnap';
import { MultichainNetworks } from '../../../core/Multichain/constants';
import { useSelector } from 'react-redux';
Expand Down
2 changes: 1 addition & 1 deletion app/components/Views/EditAccountName/EditAccountName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useSelector } from 'react-redux';
import { SafeAreaView } from 'react-native';

// External dependencies
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import Text from '../../../component-library/components/Texts/Text/Text';
import { View } from 'react-native-animatable';
import { TextVariant } from '../../../component-library/components/Texts/Text';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from 'react-native';
import { useDispatch, useSelector } from 'react-redux';
import { wordlist } from '@metamask/scure-bip39/dist/wordlists/english';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import QRCode from 'react-native-qrcode-svg';
import { RouteProp, ParamListBase } from '@react-navigation/native';
import ScrollableTabView, {
Expand Down
18 changes: 11 additions & 7 deletions app/components/Views/RevealPrivateCredential/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react-native';
import configureMockStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { backgroundState } from '../../../util/test/initial-root-state';
import { RevealPrivateCredential } from './';
import { ThemeContext, mockTheme } from '../../../util/theme';
import { RevealSeedViewSelectorsIDs } from '../../../../e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors';
import { EthAccountType, EthMethod, EthScopes } from '@metamask/keyring-api';
import { KeyringTypes } from '@metamask/keyring-controller';

jest.mock('react-redux', () => ({
...jest.requireActual('react-redux'),
Expand Down Expand Up @@ -147,24 +149,26 @@ describe('RevealPrivateCredential', () => {

it('renders with a custom selectedAddress', async () => {
const mockInternalAccount: InternalAccount = {
type: 'eip155:eoa',
type: EthAccountType.Eoa,
id: 'unique-account-id-1',
address: '0x1234567890123456789012345678901234567890',
options: {
someOption: 'optionValue',
anotherOption: 42,
},
scopes: [EthScopes.Namespace],
methods: [
'personal_sign',
'eth_sign',
'eth_signTransaction',
'eth_sendTransaction',
EthMethod.PersonalSign,
EthMethod.SignTransaction,
EthMethod.SignTypedDataV1,
EthMethod.SignTypedDataV3,
EthMethod.SignTypedDataV4,
],
metadata: {
name: 'Test Account',
importTime: Date.now(),
keyring: {
type: 'HD Key Tree',
type: KeyringTypes.hd,
},
nameLastUpdatedAt: Date.now(),
snap: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import BottomSheet, {
import Text, {
TextVariant,
} from '../../../../component-library/components/Texts/Text';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import BannerAlert from '../../../../component-library/components/Banners/Banner/variants/BannerAlert';
import { BannerAlertSeverity } from '../../../../component-library/components/Banners/Banner';
import BottomSheetHeader from '../../../../component-library/components/BottomSheets/BottomSheetHeader';
Expand Down Expand Up @@ -170,56 +170,56 @@ export default function KeyringSnapRemovalWarning({
'app_settings.snaps.snap_settings.remove_account_snap_warning.banner_title',
)}
/>
{showConfirmation ? (
<>
<Text variant={TextVariant.BodyMD} style={styles.description}>
{`${strings(
'app_settings.snaps.snap_settings.remove_account_snap_warning.remove_account_snap_alert_description_1',
)} `}
<Text variant={TextVariant.BodyMDBold}>
{snap.manifest.proposedName}
</Text>
{` ${strings(
'app_settings.snaps.snap_settings.remove_account_snap_warning.remove_account_snap_alert_description_2',
)}`}
{showConfirmation ? (
<>
<Text variant={TextVariant.BodyMD} style={styles.description}>
{`${strings(
'app_settings.snaps.snap_settings.remove_account_snap_warning.remove_account_snap_alert_description_1',
)} `}
<Text variant={TextVariant.BodyMDBold}>
{snap.manifest.proposedName}
</Text>
<TextInput
style={styles.input}
value={confirmationInput}
onChangeText={handleConfirmationInputChange}
testID={KEYRING_SNAP_REMOVAL_WARNING_TEXT_INPUT}
/>
{error && (
<Text variant={TextVariant.BodySM} style={styles.errorText}>
{strings(
'app_settings.snaps.snap_settings.remove_account_snap_warning.remove_snap_error',
{
snapName: snap.manifest.proposedName,
},
)}
</Text>
)}
</>
) : (
<>
<Text variant={TextVariant.BodyMD} style={styles.description}>
{` ${strings(
'app_settings.snaps.snap_settings.remove_account_snap_warning.remove_account_snap_alert_description_2',
)}`}
</Text>
<TextInput
style={styles.input}
value={confirmationInput}
onChangeText={handleConfirmationInputChange}
testID={KEYRING_SNAP_REMOVAL_WARNING_TEXT_INPUT}
/>
{error && (
<Text variant={TextVariant.BodySM} style={styles.errorText}>
{strings(
'app_settings.snaps.snap_settings.remove_account_snap_warning.description',
'app_settings.snaps.snap_settings.remove_account_snap_warning.remove_snap_error',
{
snapName: snap.manifest.proposedName,
},
)}
</Text>
<NativeViewGestureHandler disallowInterruption>
)}
</>
) : (
<>
<Text variant={TextVariant.BodyMD} style={styles.description}>
{strings(
'app_settings.snaps.snap_settings.remove_account_snap_warning.description',
)}
</Text>
<NativeViewGestureHandler disallowInterruption>
<ScrollView style={styles.scrollView}>
{accountListItems}
</ScrollView>
</NativeViewGestureHandler>
</>
)}
</View>
<BottomSheetFooter
style={styles.buttonContainer}
buttonsAlignment={ButtonsAlignment.Horizontal}
buttonPropsArray={buttonPropsArray}
/>
{accountListItems}
</ScrollView>
</NativeViewGestureHandler>
</>
)}
</View>
<BottomSheetFooter
style={styles.buttonContainer}
buttonsAlignment={ButtonsAlignment.Horizontal}
buttonPropsArray={buttonPropsArray}
/>
</BottomSheet>
);
}
Expand Down
11 changes: 6 additions & 5 deletions app/components/Views/Snaps/SnapSettings/SnapSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { selectPermissionControllerState } from '../../../../selectors/snaps/per
import KeyringSnapRemovalWarning from '../KeyringSnapRemovalWarning/KeyringSnapRemovalWarning';
import { getAccountsBySnapId } from '../../../../core/SnapKeyring/utils/getAccountsBySnapId';
import { selectInternalAccounts } from '../../../../selectors/accountsController';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import Logger from '../../../../util/Logger';
interface SnapSettingsProps {
snap: Snap;
Expand Down Expand Up @@ -100,7 +100,6 @@ const SnapSettings = () => {
setIsShowingSnapKeyringRemoveWarning(false);
}, []);


const removeSnap = useCallback(async () => {
const { SnapController } = Engine.context;
await SnapController.removeSnap(snap.id);
Expand All @@ -110,8 +109,11 @@ const SnapSettings = () => {
for (const keyringAccount of keyringAccounts) {
await Engine.removeAccount(keyringAccount.address);
}
} catch(error) {
Logger.error(error as Error, 'SnapSettings: failed to remove snap accounts when calling Engine.removeAccount');
} catch (error) {
Logger.error(
error as Error,
'SnapSettings: failed to remove snap accounts when calling Engine.removeAccount',
);
}
}
navigation.goBack();
Expand All @@ -125,7 +127,6 @@ const SnapSettings = () => {
}
}, [isKeyringSnap, keyringAccounts.length, removeSnap]);


const handleRemoveSnapKeyring = useCallback(() => {
try {
setIsShowingSnapKeyringRemoveWarning(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
import React, { useCallback } from 'react';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { toChecksumHexAddress } from '@metamask/controller-utils';
import ButtonIcon, {
ButtonIconSizes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AddressBookControllerState } from '@metamask/address-book-controller';
import { NetworkType } from '@metamask/controller-utils';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import type { NetworkState } from '@metamask/network-controller';
import { Hex } from '@metamask/utils';

Expand Down
2 changes: 1 addition & 1 deletion app/components/hooks/useAccounts/useAccounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
UseAccounts,
UseAccountsParams,
} from './useAccounts.types';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { getChainIdsToPoll } from '../../../selectors/tokensController';
import { useGetFormattedTokensPerChain } from '../useGetFormattedTokensPerChain';
import { useGetTotalFiatBalanceCrossChains } from '../useGetTotalFiatBalanceCrossChains';
Expand Down
2 changes: 1 addition & 1 deletion app/components/hooks/useAccounts/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { getFormattedAddressFromInternalAccount } from '../../../core/Multichain/utils';
import { BigNumber } from 'ethers';
import {
Expand Down
2 changes: 1 addition & 1 deletion app/components/hooks/useGetFormattedTokensPerChain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
import { backgroundState } from '../../util/test/initial-root-state';
import { RootState } from '../../reducers';
import { useGetFormattedTokensPerChain } from './useGetFormattedTokensPerChain';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';

const mockInitialState: DeepPartial<RootState> = {
settings: {},
Expand Down
2 changes: 1 addition & 1 deletion app/components/hooks/useGetFormattedTokensPerChain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
selectCurrentCurrency,
} from '../../selectors/currencyRateController';
import { MarketDataDetails, Token } from '@metamask/assets-controllers';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { isTestNet } from '../../util/networks';
import { selectShowFiatInTestnets } from '../../selectors/settings';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
import { backgroundState } from '../../util/test/initial-root-state';
import { RootState } from '../../reducers';
import { useGetTotalFiatBalanceCrossChains } from './useGetTotalFiatBalanceCrossChains';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';

const mockInitialState: DeepPartial<RootState> = {
settings: {},
Expand Down
2 changes: 1 addition & 1 deletion app/components/hooks/useGetTotalFiatBalanceCrossChains.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
selectCurrencyRates,
selectCurrentCurrency,
} from '../../selectors/currencyRateController';
import { InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import { selectShowFiatInTestnets } from '../../selectors/settings';
import { isTestNet } from '../../util/networks';

Expand Down
7 changes: 6 additions & 1 deletion app/core/Multichain/test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import {
InternalAccount,
EthAccountType,
BtcAccountType,
EthMethod,
BtcMethod,
EthScopes,
BtcScopes,
} from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-internal-api';
import {
isEthAccount,
isBtcAccount,
Expand All @@ -28,6 +30,7 @@ const SOL_ADDRESSES = '7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV';
const mockEthEOAAccount: InternalAccount = {
address: MOCK_ETH_ADDRESS,
id: '1',
scopes: [EthScopes.Namespace],
metadata: {
name: 'Eth Account 1',
importTime: 1684232000456,
Expand All @@ -49,6 +52,7 @@ const mockEthEOAAccount: InternalAccount = {
const mockEthERC4337Account: InternalAccount = {
address: '0xC4966c0D659D99699BFD7EB54D8fafEE40e4a756',
id: '1',
scopes: [EthScopes.Namespace],
metadata: {
name: 'Eth Account ERC4337 1',
importTime: 1684232000456,
Expand All @@ -70,6 +74,7 @@ const mockEthERC4337Account: InternalAccount = {
const mockBTCAccount: InternalAccount = {
address: MOCK_BTC_MAINNET_ADDRESS,
id: '1',
scopes: [BtcScopes.Namespace],
metadata: {
name: 'Bitcoin Account',
importTime: 1684232000456,
Expand Down
2 changes: 1 addition & 1 deletion app/core/Multichain/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { toChecksumHexAddress } from '@metamask/controller-utils';
import { InternalAccount } from '@metamask/keyring-internal-api';
import {
InternalAccount,
EthAccountType,
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
BtcAccountType,
Expand Down
2 changes: 1 addition & 1 deletion app/core/SnapKeyring/BitcoinWalletSnap.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SnapId } from '@metamask/snaps-sdk';
import { Sender } from '@metamask/keyring-api';
import { Sender } from '@metamask/keyring-snap-client';
import { HandlerType } from '@metamask/snaps-utils';
import { Json, JsonRpcRequest } from '@metamask/utils';
// This dependency is still installed as part of the `package.json`, however
Expand Down
Loading

0 comments on commit 4c43298

Please sign in to comment.