Skip to content

Commit

Permalink
chore(deps): bump accounts-controller to ^14.0.0 (#24130)
Browse files Browse the repository at this point in the history
## **Description**

This PR bumps the AccountsController to 14.0.0, @metamask/keyring-api to
^6.3.1, @metamask/eth-snap-keyring to ^4.2.1 and
@metamask/user-operation-controller to ^10.0.0

## **Related issues**

Fixes MetaMask/accounts-planning#465

## **Manual testing steps**

## **Screenshots/Recordings**

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.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-extension/blob/develop/.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.

---------

Co-authored-by: MetaMask Bot <[email protected]>
Co-authored-by: legobeat <[email protected]>
Co-authored-by: Michele Esposito <[email protected]>
Co-authored-by: Gustavo Antunes <[email protected]>
  • Loading branch information
5 people authored Jun 3, 2024
1 parent cf417bb commit 895d1f1
Show file tree
Hide file tree
Showing 60 changed files with 635 additions and 705 deletions.
29 changes: 16 additions & 13 deletions .storybook/test-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { draftTransactionInitialState } from '../ui/ducks/send';
import { KeyringType } from '../shared/constants/keyring';
import { NetworkType } from '@metamask/controller-utils';
import { NetworkStatus } from '@metamask/network-controller';
import { EthAccountType, EthMethod } from '@metamask/keyring-api';
import { EthAccountType } from '@metamask/keyring-api';
import { CHAIN_IDS } from '../shared/constants/network';
import { copyable, divider, heading, panel, text } from '@metamask/snaps-sdk';
import { getJsxElementFromComponent } from '@metamask/snaps-utils';
import { FirstTimeFlowType } from '../shared/constants/onboarding';
import { ETH_EOA_METHODS } from '../shared/constants/eth-methods';

const state = {
invalidCustomNetwork: {
Expand Down Expand Up @@ -282,13 +283,15 @@ const state = {
},
interfaces: {
'test-interface': {
content: getJsxElementFromComponent(panel([
heading('Foo bar'),
text('Description'),
divider(),
text('More text'),
copyable('Text you can copy'),
])),
content: getJsxElementFromComponent(
panel([
heading('Foo bar'),
text('Description'),
divider(),
text('More text'),
copyable('Text you can copy'),
]),
),
state: {},
snapId: 'local:http://localhost:8080/',
},
Expand Down Expand Up @@ -324,7 +327,7 @@ const state = {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
'07c2cfec-36c9-46c4-8115-3836d3ac9047': {
Expand All @@ -337,7 +340,7 @@ const state = {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
'15e69915-2a1a-4019-93b3-916e11fd432f': {
Expand All @@ -350,7 +353,7 @@ const state = {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
'784225f4-d30b-4e77-a900-c8bbce735b88': {
Expand All @@ -363,7 +366,7 @@ const state = {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
'b990b846-b384-4508-93d9-587461f1123e': {
Expand All @@ -376,7 +379,7 @@ const state = {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
},
Expand Down
15 changes: 10 additions & 5 deletions app/scripts/controllers/mmi-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SignatureController } from '@metamask/signature-controller';

import { NetworkController } from '@metamask/network-controller';
import { AccountsController } from '@metamask/accounts-controller';
import { EthAccountType, EthMethod } from '@metamask/keyring-api';
import { EthAccountType } from '@metamask/keyring-api';

import { CustodyController } from '@metamask-institutional/custody-controller';
import {
Expand All @@ -30,6 +30,7 @@ jest.mock('@metamask-institutional/portfolio-dashboard', () => ({
}));

import * as PortfolioDashboard from '@metamask-institutional/portfolio-dashboard';
import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods';

jest.mock('./permissions', () => ({
getPermissionBackgroundApiMethods: jest.fn().mockImplementation(() => {
Expand All @@ -49,7 +50,7 @@ const mockAccount = {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
};
const mockAccount2 = {
Expand All @@ -62,7 +63,7 @@ const mockAccount2 = {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
};

Expand Down Expand Up @@ -349,7 +350,7 @@ describe('MMIController', function () {
});

describe('getAllCustodianAccountsWithToken', () => {
it('should return custodian accounts with tokens', async () => { });
it('should return custodian accounts with tokens', async () => {});
});

describe('handleMmiDashboardData', () => {
Expand Down Expand Up @@ -438,7 +439,11 @@ describe('MMIController', function () {
getCustodianAccounts: mockCustodialKeyring,
});

await mmiController.getCustodianAccounts('token', 'neptune-custody', 'ECA3');
await mmiController.getCustodianAccounts(
'token',
'neptune-custody',
'ECA3',
);

expect(selectedAccountSpy).toHaveBeenCalledTimes(0);

Expand Down
23 changes: 12 additions & 11 deletions app/scripts/controllers/permissions/specifications.test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { EthMethod, EthAccountType } from '@metamask/keyring-api';
import { EthAccountType } from '@metamask/keyring-api';
import { SnapCaveatType } from '@metamask/snaps-rpc-methods';
import {
CaveatTypes,
RestrictedMethods,
} from '../../../../shared/constants/permissions';
import { ETH_EOA_METHODS } from '../../../../shared/constants/eth-methods';
import {
getCaveatSpecifications,
getPermissionSpecifications,
Expand Down Expand Up @@ -149,7 +150,7 @@ describe('PermissionController specifications', () => {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
{
Expand All @@ -163,7 +164,7 @@ describe('PermissionController specifications', () => {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
];
Expand Down Expand Up @@ -290,7 +291,7 @@ describe('PermissionController specifications', () => {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
{
Expand All @@ -303,7 +304,7 @@ describe('PermissionController specifications', () => {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
{
Expand All @@ -317,7 +318,7 @@ describe('PermissionController specifications', () => {
lastSelected: 3,
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
{
Expand All @@ -331,7 +332,7 @@ describe('PermissionController specifications', () => {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
];
Expand Down Expand Up @@ -367,7 +368,7 @@ describe('PermissionController specifications', () => {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
{
Expand All @@ -381,7 +382,7 @@ describe('PermissionController specifications', () => {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
];
Expand Down Expand Up @@ -415,7 +416,7 @@ describe('PermissionController specifications', () => {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
{
Expand All @@ -429,7 +430,7 @@ describe('PermissionController specifications', () => {
},
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
];
Expand Down
12 changes: 3 additions & 9 deletions app/scripts/lib/backup.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/**
* @jest-environment node
*/
import { EthAccountType, EthMethod } from '@metamask/keyring-api';
import { EthAccountType } from '@metamask/keyring-api';
import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods';
import Backup from './backup';

function getMockPreferencesController() {
Expand Down Expand Up @@ -185,14 +186,7 @@ const jsonData = JSON.stringify({
lastSelected: 1693289751176,
},
options: {},
methods: [
EthMethod.PersonalSign,
EthMethod.Sign,
EthMethod.SignTransaction,
EthMethod.SignTypedDataV1,
EthMethod.SignTypedDataV3,
EthMethod.SignTypedDataV4,
],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
},
},
Expand Down
5 changes: 3 additions & 2 deletions app/scripts/metamask-controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
METAMASK_STALELIST_FILE,
METAMASK_HOTLIST_DIFF_FILE,
} from '@metamask/phishing-controller';
import { EthMethod, EthAccountType } from '@metamask/keyring-api';
import { EthAccountType } from '@metamask/keyring-api';
import { NetworkType } from '@metamask/controller-utils';
import { ControllerMessenger } from '@metamask/base-controller';
import { LoggingController, LogType } from '@metamask/logging-controller';
Expand All @@ -28,6 +28,7 @@ import { LOG_EVENT } from '../../shared/constants/logs';
import mockEncryptor from '../../test/lib/mock-encryptor';
import * as tokenUtils from '../../shared/lib/token-util';
import { flushPromises } from '../../test/lib/timer-helpers';
import { ETH_EOA_METHODS } from '../../shared/constants/eth-methods';
import { deferredPromise } from './lib/util';
import MetaMaskController from './metamask-controller';

Expand Down Expand Up @@ -141,7 +142,7 @@ const TEST_INTERNAL_ACCOUNT = {
lastSelected: 0,
},
options: {},
methods: [...Object.values(EthMethod)],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
};

Expand Down
12 changes: 3 additions & 9 deletions app/scripts/migrations/105.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { v4 as uuid } from 'uuid';
import { sha256FromString } from 'ethereumjs-util';
import { EthMethod, InternalAccount } from '@metamask/keyring-api';
import { InternalAccount } from '@metamask/keyring-api';
import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods';
import { migrate } from './105';

const MOCK_ADDRESS = '0x0';
Expand Down Expand Up @@ -73,14 +74,7 @@ function expectedInternalAccount(
lastSelected: lastSelected ? expect.any(Number) : undefined,
},
options: {},
methods: [
EthMethod.Sign,
EthMethod.PersonalSign,
EthMethod.SignTransaction,
EthMethod.SignTypedDataV1,
EthMethod.SignTypedDataV3,
EthMethod.SignTypedDataV4,
],
methods: ETH_EOA_METHODS,
type: 'eip155:eoa',
};
}
Expand Down
16 changes: 3 additions & 13 deletions app/scripts/migrations/105.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import {
EthAccountType,
InternalAccount,
EthMethod,
} from '@metamask/keyring-api';
import { EthAccountType, InternalAccount } from '@metamask/keyring-api';
import { sha256FromString } from 'ethereumjs-util';
import { v4 as uuid } from 'uuid';
import { cloneDeep } from 'lodash';
import { ETH_EOA_METHODS } from '../../../shared/constants/eth-methods';

type VersionedData = {
meta: { version: number };
Expand Down Expand Up @@ -107,14 +104,7 @@ function createInternalAccountsForAccountsController(
type: 'HD Key Tree',
},
},
methods: [
EthMethod.Sign,
EthMethod.PersonalSign,
EthMethod.SignTransaction,
EthMethod.SignTypedDataV1,
EthMethod.SignTypedDataV3,
EthMethod.SignTypedDataV4,
],
methods: ETH_EOA_METHODS,
type: EthAccountType.Eoa,
};
});
Expand Down
Loading

0 comments on commit 895d1f1

Please sign in to comment.