Skip to content

Commit 42263b2

Browse files
authored
chore: Update accounts controller to v23 and related packages (transaction controller etc) (#13436)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR updates the [AccountsController](https://github.com/MetaMask/core/blob/main/packages/accounts-controller/CHANGELOG.md#2310) and the [TransactionController](https://github.com/MetaMask/core/blob/main/packages/transaction-controller/CHANGELOG.md#4510). These are the two major updates however there are a few smaller peer dep updates as well. Here is a description of the changes... ### "@metamask/accounts-controller": "^21.0.0" -> 23.1.0" - [changelog](https://github.com/MetaMask/core/blob/main/packages/accounts-controller/CHANGELOG.md#2310) - Breaking changes: - BREAKING: Now requires SnapKeyring:account{AssetList,Balances,Transactions}Updated events to be registered on the messenger (MetaMask/core#5190) - BREAKING: Bump @metamask/snaps-controllers peer dependency from ^9.7.0 to ^9.19.0 (MetaMask/core#5265) - Bump @metamask/base-controller from ^7.1.1 to ^8.0.0 - Non breaking changes: - Bump @metamask/keyring-api" from ^16.1.0 to ^17.0.0 (MetaMask/core#5280) - Bump @metamask/eth-snap-keyring from ^9.1.1 to ^10.0.0 (MetaMask/core#5280) - Bump @metamask/snaps-sdk from ^6.7.0 to ^6.17.1 (MetaMask/core#5220), (MetaMask/core#5265) - Bump @metamask/snaps-utils from ^8.9.0 to ^8.10.0 (MetaMask/core#5265) ### "@metamask/transaction-controller": "^43.0.0" -> 45.1.0 - [changelog](https://github.com/MetaMask/core/blob/main/packages/transaction-controller/CHANGELOG.md#4510) - Breaking changes: - BREAKING: Bump @metamask/accounts-controller peer dependency from ^22.0.0 to ^23.0.0 ### "@metamask/keyring-api": "^13.0.0" -> 17.0.0 - [changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-api/CHANGELOG.md#1700) - Breaking changes: - BREAKING: Make CaipAssetType type more restritive (MetaMask/accounts#150) It used to be a string but it has been restricted with a template literal type that matches CAIP-19 asset type. - BREAKING: Make specific *AccountStruct.scopes more strict (MetaMask/accounts#159) - BREAKING: Remove CAIP redefinitions (MetaMask/accounts#167) We now rely on CAIP definitions coming @metamask/utils. - BREAKING: Enforce that scopes contains CAIP-2 chain IDs (MetaMask/accounts#165) Initially scopes accepted CAIP-2 namespaces as well to address the EVM EOA accounts that supports all EVM chains. This has been dropped in favor of eip155:0 scope. - BREAKING: Rename *Scopes enums to *Scope (MetaMask/accounts#165) - BREAKING: Use CaipAccountId for ResolvedAccountAddress.address (MetaMask/accounts#186) This was missing from SIP-26, but we expect this address to be CAIP-10 compliant. ### "@metamask/keyring-internal-api": "^2.0.0" -> 4.0.2 - [changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-internal-api/CHANGELOG.md#402) - Breaking changes - BREAKING: Bump @metamask/keyring-api from ^14.0.0 to ^15.0.0 (MetaMask/accounts#160) The scopes from each *AccountStruct types is now more strict which impact all Internal*AccountStruct types. - BREAKING: Bump @metamask/keyring-api from ^15.0.0 to ^16.0.0 (MetaMask/accounts#172) The scopes from each *AccountStruct types is now more strict (remove support of CAIP-2 namespaces) which impact all Internal*AccountStruct types. - Bump @metamask/keyring-api from ^16.1.0 to ^17.0.0 (MetaMask/accounts#192) ### "@metamask/eth-snap-keyring": "^7.1.0" -> 10.0.0 - [changelog](https://github.com/MetaMask/accounts/blob/main/packages/keyring-snap-bridge/CHANGELOG.md) - Breaking changes: - BREAKING: Bump @metamask/keyring-api from ^12.0.0 to ^13.0.0 (MetaMask/accounts#101) This change was not properly reported as breaking on the 7.1.0. KeyringAccount and InternalAccount have a new required field (scopes) and are part of the public API. - BREAKING: Bump @metamask/keyring-internal-api from ^1.0.0 to ^2.0.0 (MetaMask/accounts#135) This change was not properly reported as breaking on the 7.1.0. InternalAccount extends KeyringAccount which has a new required field (scopes) and is part of the public API. - BREAKING: Bump @metamask/keyring-snap-internal-client from ^1.0.0 to ^2.0.0 (MetaMask/accounts#135) This change was not properly reported as breaking on the 7.1.0. KeyringAccount has a new required field (scopes) and is part of the public API. - BREAKING: Use Messenger instead of SnapsController (MetaMask/accounts#152) This allows to break the runtime dependency we had with some snaps-* pacakges. - BREAKING: Make scopes more strict (MetaMask/accounts#159) We now use specific *AccountStucts when checking created/updated accounts to make the scopes sent by the Snap are valid regarding their account type definition. - BREAKING: Use CaipAccountId for ResolvedAccountAddress.address (MetaMask/accounts#186) This was missing from SIP-26, but we expect this address to be CAIP-10 compliant. ### "@metamask/snaps-sdk": "^6.13.0" -> 6.17.1 - [changelog](https://github.com/MetaMask/snaps/blob/main/packages/snaps-sdk/CHANGELOG.md#6171) - no breaking changes ### "@metamask/snaps-utils": "^8.6.1" -> ^8.10.0 - [changelog](https://github.com/MetaMask/snaps/blob/main/packages/snaps-utils/CHANGELOG.md#8100) - no breaking changes ## **Related issues** Fixes: #13374 Fixes: #13377 ## **Manual testing steps** #### Testing snap accounts 1. ensure you are building metamask flask by setting the value of `METAMASK_BUILD_TYPE` to `flask` in your `.js.env` 2. source .js.env 3. yarn setup 4. yarn start:ios 5. create/import a wallet 6. click on the selected account at the top of the home page 7. click on the Add account button 8. then click the Add Solana account (Beta) button 9. a popup with a suggested name should appeaer 10. click OK, the account should now be added to your account list. if you have a balance on this address then it should show in the portfolio view. 11. repeat the above steps with the Bitcoin and Bitcoin testnet account #### Testing transactions 1. ensure you are NOT building flask by setting the value of `METAMASK_BUILD_TYPE` to `main` in your `.js.env` 2. source .js.env 3. yarn setup 4. yarn start:ios 5. import an account that has funds 6. click on the selected account at the top of the screen and the account list should open 7. then click on the add account button, then click add account 8. a new eth account should appear in your wallet 9. click on main bottom tab navigator icon which should open a list of actions, select Send. 10. the Send flow should open. 11. set your from account to the account that has funds and the to account to your newly created account. 12. type in a valid amount then go through the rest of the send flow 13. in the end the transaction should go through. 14. the account balances on the home page should be updated ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** On-boarding and Account Creation Flow https://github.com/user-attachments/assets/2ccd8fb4-4857-4a99-ab52-cdb071bd0447 Send flow https://github.com/user-attachments/assets/da81d49c-b472-49a7-83c4-1d1046521072 ## **Pre-merge author checklist** - [x] 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). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] 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.
1 parent 665035f commit 42263b2

File tree

24 files changed

+946
-316
lines changed

24 files changed

+946
-316
lines changed

app/components/Views/RevealPrivateCredential/index.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { backgroundState } from '../../../util/test/initial-root-state';
77
import { RevealPrivateCredential } from './';
88
import { ThemeContext, mockTheme } from '../../../util/theme';
99
import { RevealSeedViewSelectorsIDs } from '../../../../e2e/selectors/Settings/SecurityAndPrivacy/RevealSeedView.selectors';
10-
import { EthAccountType, EthMethod, EthScopes } from '@metamask/keyring-api';
10+
import { EthAccountType, EthMethod, EthScope } from '@metamask/keyring-api';
1111
import { KeyringTypes } from '@metamask/keyring-controller';
1212

1313
jest.mock('react-redux', () => ({
@@ -156,7 +156,7 @@ describe('RevealPrivateCredential', () => {
156156
someOption: 'optionValue',
157157
anotherOption: 42,
158158
},
159-
scopes: [EthScopes.Namespace],
159+
scopes: [EthScope.Eoa],
160160
methods: [
161161
EthMethod.PersonalSign,
162162
EthMethod.SignTransaction,

app/core/Engine/Engine.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,11 @@ import {
231231
SnapControllerStateChangeEvent,
232232
SnapControllerUpdateSnapStateAction,
233233
} from './controllers/SnapController/constants';
234+
import {
235+
SnapKeyringAccountAssetListUpdatedEvent,
236+
SnapKeyringAccountBalancesUpdatedEvent,
237+
SnapKeyringAccountTransactionsUpdatedEvent,
238+
} from '../SnapKeyring/constants';
234239

235240
const NON_EMPTY = 'NON_EMPTY';
236241

@@ -377,14 +382,16 @@ export class Engine {
377382
});
378383

379384
// Create AccountsController
380-
// @ts-expect-error TODO: Resolve mismatch between base-controller versions.
381385
const accountsControllerMessenger: AccountsControllerMessenger =
382386
this.controllerMessenger.getRestricted({
383387
name: 'AccountsController',
384388
allowedEvents: [
385389
SnapControllerStateChangeEvent,
386390
'KeyringController:accountRemoved',
387391
'KeyringController:stateChange',
392+
SnapKeyringAccountAssetListUpdatedEvent,
393+
SnapKeyringAccountBalancesUpdatedEvent,
394+
SnapKeyringAccountTransactionsUpdatedEvent,
388395
],
389396
allowedActions: [
390397
'KeyringController:getAccounts',
@@ -620,7 +627,7 @@ export class Engine {
620627

621628
///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps)
622629
const snapKeyringBuildMessenger = this.controllerMessenger.getRestricted({
623-
name: 'SnapKeyringBuilder',
630+
name: 'SnapKeyring',
624631
allowedActions: [
625632
'ApprovalController:addRequest',
626633
'ApprovalController:acceptRequest',
@@ -635,12 +642,12 @@ export class Engine {
635642
AccountsControllerSetSelectedAccountAction,
636643
AccountsControllerGetAccountByAddressAction,
637644
AccountsControllerSetAccountNameAction,
645+
SnapControllerHandleRequestAction,
646+
SnapControllerGetSnapAction,
638647
],
639648
allowedEvents: [],
640649
});
641650

642-
const getSnapController = () => this.snapController;
643-
644651
// Necessary to persist the keyrings and update the accounts both within the keyring controller and accounts controller
645652
const persistAndUpdateAccounts = async () => {
646653
await this.keyringController.persistAllKeyrings();
@@ -650,7 +657,6 @@ export class Engine {
650657
additionalKeyrings.push(
651658
snapKeyringBuilder(
652659
snapKeyringBuildMessenger,
653-
getSnapController,
654660
persistAndUpdateAccounts,
655661
(address) => this.removeAccount(address),
656662
),
@@ -1265,7 +1271,6 @@ export class Engine {
12651271
},
12661272
isSimulationEnabled: () =>
12671273
preferencesController.state.useTransactionSimulations,
1268-
// @ts-expect-error TODO: Resolve mismatch between base-controller versions.
12691274
messenger: this.controllerMessenger.getRestricted({
12701275
name: 'TransactionController',
12711276
allowedActions: [

app/core/Engine/controllers/AccountsController/utils.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ import { AGREED, METRICS_OPT_IN } from '../../../../constants/storage';
2020
import StorageWrapper from '../../../../store/storage-wrapper';
2121
import { logAccountsControllerCreation } from './logger';
2222
import { SnapControllerStateChangeEvent } from '../SnapController/constants';
23+
import { SnapKeyringEvents } from '@metamask/eth-snap-keyring';
24+
import {
25+
SnapKeyringAccountAssetListUpdatedEvent,
26+
SnapKeyringAccountBalancesUpdatedEvent,
27+
SnapKeyringAccountTransactionsUpdatedEvent,
28+
} from '../../../SnapKeyring/constants';
2329

2430
jest.mock('@sentry/react-native', () => ({
2531
withScope: jest.fn(),
@@ -45,14 +51,17 @@ describe('accountControllersUtils', () => {
4551
| SnapStateChange
4652
| KeyringControllerAccountRemovedEvent
4753
| KeyringControllerStateChangeEvent
54+
| SnapKeyringEvents
4855
>();
49-
// @ts-expect-error TODO: Resolve mismatch between base-controller versions.
5056
accountsControllerMessenger = globalMessenger.getRestricted({
5157
name: 'AccountsController',
5258
allowedEvents: [
5359
SnapControllerStateChangeEvent,
5460
'KeyringController:accountRemoved',
5561
'KeyringController:stateChange',
62+
SnapKeyringAccountAssetListUpdatedEvent,
63+
SnapKeyringAccountBalancesUpdatedEvent,
64+
SnapKeyringAccountTransactionsUpdatedEvent,
5665
],
5766
allowedActions: [
5867
'KeyringController:getAccounts',

app/core/Engine/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ import {
180180
RemoteFeatureFlagControllerActions,
181181
RemoteFeatureFlagControllerEvents,
182182
} from '@metamask/remote-feature-flag-controller/dist/remote-feature-flag-controller.cjs';
183+
import { SnapKeyringEvents } from '@metamask/eth-snap-keyring';
183184

184185
/**
185186
* Controllers that area always instantiated
@@ -291,7 +292,8 @@ type GlobalEvents =
291292
| SelectedNetworkControllerEvents
292293
| SmartTransactionsControllerEvents
293294
| AssetsContractControllerEvents
294-
| RemoteFeatureFlagControllerEvents;
295+
| RemoteFeatureFlagControllerEvents
296+
| SnapKeyringEvents;
295297

296298
// TODO: Abstract this into controller utils for TransactionController
297299
export interface TransactionEventPayload {

app/core/Multichain/test/utils.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import {
33
BtcAccountType,
44
EthMethod,
55
BtcMethod,
6-
EthScopes,
7-
BtcScopes,
8-
SolScopes,
6+
EthScope,
7+
BtcScope,
8+
SolScope,
99
SolAccountType,
1010
SolMethod,
1111
} from '@metamask/keyring-api';
@@ -34,7 +34,7 @@ const SOL_ADDRESS = '7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV';
3434
const mockEthEOAAccount: InternalAccount = {
3535
address: MOCK_ETH_ADDRESS,
3636
id: '1',
37-
scopes: [EthScopes.Namespace],
37+
scopes: [EthScope.Eoa],
3838
metadata: {
3939
name: 'Eth Account 1',
4040
importTime: 1684232000456,
@@ -56,7 +56,7 @@ const mockEthEOAAccount: InternalAccount = {
5656
const mockEthERC4337Account: InternalAccount = {
5757
address: '0xC4966c0D659D99699BFD7EB54D8fafEE40e4a756',
5858
id: '1',
59-
scopes: [EthScopes.Namespace],
59+
scopes: [EthScope.Eoa],
6060
metadata: {
6161
name: 'Eth Account ERC4337 1',
6262
importTime: 1684232000456,
@@ -78,7 +78,7 @@ const mockEthERC4337Account: InternalAccount = {
7878
const mockBTCAccount: InternalAccount = {
7979
address: MOCK_BTC_MAINNET_ADDRESS,
8080
id: '1',
81-
scopes: [BtcScopes.Namespace],
81+
scopes: [BtcScope.Mainnet],
8282
metadata: {
8383
name: 'Bitcoin Account',
8484
importTime: 1684232000456,
@@ -114,7 +114,7 @@ const mockSolAccount: InternalAccount = {
114114
enabled: true,
115115
},
116116
},
117-
scopes: [SolScopes.Mainnet, SolScopes.Testnet, SolScopes.Devnet],
117+
scopes: [SolScope.Mainnet, SolScope.Testnet, SolScope.Devnet],
118118
};
119119

120120
describe('MultiChain utils', () => {

app/core/SnapKeyring/SnapKeyring.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Messenger } from '@metamask/base-controller';
2-
import { EthAccountType, EthScopes, KeyringEvent } from '@metamask/keyring-api';
2+
import { EthAccountType, EthScope, KeyringEvent } from '@metamask/keyring-api';
33
import { InternalAccount } from '@metamask/keyring-internal-api';
44
import { snapKeyringBuilder } from './SnapKeyring';
55
import {
@@ -15,7 +15,6 @@ const mockEndFlow = jest.fn();
1515
const mockGetAccounts = jest.fn();
1616
const mockSnapId: SnapId = 'snapId' as SnapId;
1717
const mockSnapName = 'mock-snap';
18-
const mockSnapController = jest.fn();
1918
const mockPersisKeyringHelper = jest.fn();
2019
const mockSetSelectedAccount = jest.fn();
2120
const mockRemoveAccountHelper = jest.fn();
@@ -35,7 +34,7 @@ const mockAccount = {
3534
};
3635
const mockInternalAccount: InternalAccount = {
3736
...mockAccount,
38-
scopes: [EthScopes.Namespace],
37+
scopes: [EthScope.Eoa],
3938
metadata: {
4039
snap: {
4140
enabled: true,
@@ -109,7 +108,6 @@ const createControllerMessenger = ({
109108
const createSnapKeyringBuilder = () =>
110109
snapKeyringBuilder(
111110
createControllerMessenger(),
112-
mockSnapController,
113111
mockPersisKeyringHelper,
114112
mockRemoveAccountHelper,
115113
);

app/core/SnapKeyring/SnapKeyring.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import { SnapKeyring } from '@metamask/eth-snap-keyring';
2-
import type { SnapController } from '@metamask/snaps-controllers';
3-
import { SnapKeyringBuilderMessenger } from './types';
42
import Logger from '../../util/Logger';
53
import { showAccountNameSuggestionDialog } from './utils/showDialog';
4+
import { SnapKeyringBuilderMessenger } from './types';
65

76
/**
87
* Constructs a SnapKeyring builder with specified handlers for managing snap accounts.
98
* - Here is the equivalent function on the extension: https://github.com/MetaMask/metamask-extension/blob/develop/app/scripts/lib/snap-keyring/snap-keyring.ts#L111
109
*
1110
* @param controllerMessenger - The controller messenger instance.
12-
* @param getSnapController - A function that retrieves the Snap Controller instance.
1311
* @param persistKeyringHelper - A function that persists all keyrings in the vault.
1412
* @param removeAccountHelper - A function to help remove an account based on its address.
1513
* @returns The constructed SnapKeyring builder instance with the following methods:
@@ -21,13 +19,14 @@ import { showAccountNameSuggestionDialog } from './utils/showDialog';
2119
*/
2220
export const snapKeyringBuilder = (
2321
controllerMessenger: SnapKeyringBuilderMessenger,
24-
getSnapController: () => SnapController,
22+
2523
persistKeyringHelper: () => Promise<void>,
2624
removeAccountHelper: (address: string) => Promise<unknown>,
2725
): { (): SnapKeyring; type: string } => {
2826
const builder = () =>
29-
new SnapKeyring(getSnapController(), {
30-
addressExists: async (address) =>
27+
// @ts-expect-error TODO: Resolve mismatch between base-controller versions.
28+
new SnapKeyring(controllerMessenger, {
29+
addressExists: async (address: string) =>
3130
(
3231
await controllerMessenger.call('KeyringController:getAccounts')
3332
).includes(address.toLowerCase()),

app/core/SnapKeyring/constants.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {
2+
SnapKeyringAccountAssetListUpdatedEvent as SnapKeyringAccountAssetListUpdatedEventType,
3+
SnapKeyringAccountBalancesUpdatedEvent as SnapKeyringAccountBalancesUpdatedEventType,
4+
SnapKeyringAccountTransactionsUpdatedEvent as SnapKeyringAccountTransactionsUpdatedEventType,
5+
} from '@metamask/eth-snap-keyring';
6+
7+
// Events
8+
export const SnapKeyringAccountAssetListUpdatedEvent: SnapKeyringAccountAssetListUpdatedEventType['type'] =
9+
'SnapKeyring:accountAssetListUpdated';
10+
11+
export const SnapKeyringAccountBalancesUpdatedEvent: SnapKeyringAccountBalancesUpdatedEventType['type'] =
12+
'SnapKeyring:accountBalancesUpdated';
13+
14+
export const SnapKeyringAccountTransactionsUpdatedEvent: SnapKeyringAccountTransactionsUpdatedEventType['type'] =
15+
'SnapKeyring:accountTransactionsUpdated';

app/core/SnapKeyring/types.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import type {
1616
ShowSuccess,
1717
StartFlow,
1818
} from '@metamask/approval-controller';
19+
import {
20+
HandleSnapRequest as SnapControllerHandleRequestActionType,
21+
GetSnap as SnapControllerGetSnapActionType,
22+
} from '@metamask/snaps-controllers';
1923

2024
export type SnapKeyringBuilderAllowActions =
2125
| StartFlow
@@ -31,10 +35,12 @@ export type SnapKeyringBuilderAllowActions =
3135
| GetSubjectMetadata
3236
| AccountsControllerSetSelectedAccountAction
3337
| AccountsControllerGetAccountByAddressAction
34-
| AccountsControllerSetAccountNameAction;
38+
| AccountsControllerSetAccountNameAction
39+
| SnapControllerHandleRequestActionType
40+
| SnapControllerGetSnapActionType;
3541

3642
export type SnapKeyringBuilderMessenger = RestrictedMessenger<
37-
'SnapKeyringBuilder',
43+
'SnapKeyring',
3844
SnapKeyringBuilderAllowActions,
3945
never,
4046
SnapKeyringBuilderAllowActions['type'],

app/selectors/accountsController.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { AccountsControllerState } from '@metamask/accounts-controller';
22
import { captureException } from '@sentry/react-native';
33
import { Hex, isValidChecksumAddress } from '@metamask/utils';
4-
import { BtcAccountType } from '@metamask/keyring-api';
4+
import {
5+
BtcAccountType,
6+
EthAccountType,
7+
EthScope,
8+
} from '@metamask/keyring-api';
59
import { InternalAccount } from '@metamask/keyring-internal-api';
610
import StorageWrapper from '../store/storage-wrapper';
711
import {
@@ -85,7 +89,7 @@ describe('Accounts Controller Selectors', () => {
8589
address: '0xc4966c0d659d99699bfd7eb54d8fafee40e4a756',
8690
id: expectedUuid2,
8791
options: {},
88-
scopes: ['eip155'],
92+
scopes: [EthScope.Eoa],
8993
metadata: {
9094
name: 'Account 2',
9195
importTime: 1684232000456,
@@ -100,7 +104,7 @@ describe('Accounts Controller Selectors', () => {
100104
'eth_signTypedData_v3',
101105
'eth_signTypedData_v4',
102106
],
103-
type: 'eip155:eoa',
107+
type: EthAccountType.Eoa,
104108
});
105109
});
106110
it('throws an error if the selected account ID does not exist', () => {

app/store/migrations/036.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EthAccountType, EthMethod, EthScopes } from '@metamask/keyring-api';
1+
import { EthAccountType, EthMethod, EthScope } from '@metamask/keyring-api';
22
import { InternalAccount } from '@metamask/keyring-internal-api';
33
import migrate, { Identity } from './036';
44
import { captureException } from '@sentry/react-native';
@@ -50,7 +50,7 @@ function expectedInternalAccount(
5050
): InternalAccount {
5151
return {
5252
address,
53-
scopes: [EthScopes.Namespace],
53+
scopes: [EthScope.Eoa],
5454
id: getUUIDFromAddressOfNormalAccount(address),
5555
metadata: {
5656
name: nickname,

app/store/migrations/036.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EthAccountType, EthScopes } from '@metamask/keyring-api';
1+
import { EthAccountType, EthScope } from '@metamask/keyring-api';
22
import { InternalAccount } from '@metamask/keyring-internal-api';
33
import { isObject, hasProperty } from '@metamask/utils';
44
import { captureException } from '@sentry/react-native';
@@ -113,7 +113,7 @@ function createInternalAccountsForAccountsController(
113113

114114
accounts[expectedId] = {
115115
address: identity.address,
116-
scopes: [EthScopes.Namespace],
116+
scopes: [EthScope.Eoa],
117117
id: expectedId,
118118
options: {},
119119
metadata: {

0 commit comments

Comments
 (0)